diff --git a/OpenMetaverse.StructuredData/StructuredData.cs b/OpenMetaverse.StructuredData/StructuredData.cs index 8b877bdb..8a894dda 100644 --- a/OpenMetaverse.StructuredData/StructuredData.cs +++ b/OpenMetaverse.StructuredData/StructuredData.cs @@ -920,6 +920,24 @@ namespace OpenMetaverse.StructuredData return binary; } + public override long AsLong() + { + OSDBinary binary = new OSDBinary(AsBinary()); + return binary.AsLong(); + } + + public override ulong AsULong() + { + OSDBinary binary = new OSDBinary(AsBinary()); + return binary.AsULong(); + } + + public override uint AsUInteger() + { + OSDBinary binary = new OSDBinary(AsBinary()); + return binary.AsUInteger(); + } + public override Vector2 AsVector2() { Vector2 vector = Vector2.Zero; diff --git a/OpenMetaverse/Messages/CableBeachAttributes.cs b/OpenMetaverse/Messages/CableBeachAttributes.cs index a6ceba3b..47f91c61 100644 --- a/OpenMetaverse/Messages/CableBeachAttributes.cs +++ b/OpenMetaverse/Messages/CableBeachAttributes.cs @@ -30,7 +30,8 @@ namespace OpenMetaverse.Messages.CableBeach { public static class AvatarServices { - public static readonly Uri INVENTORY_SERVER = new Uri("http://openmetaverse.org/services/inventoryServer"); + public static readonly Uri INVENTORY = new Uri("http://openmetaverse.org/services/inventory"); + public static readonly Uri MAP = new Uri("http://openmetaverse.org/services/map"); } public static class AvatarAttributes diff --git a/OpenMetaverse/Messages/CableBeachMessages.cs b/OpenMetaverse/Messages/CableBeachMessages.cs index 2c0e1983..f331d5b5 100644 --- a/OpenMetaverse/Messages/CableBeachMessages.cs +++ b/OpenMetaverse/Messages/CableBeachMessages.cs @@ -157,6 +157,49 @@ namespace OpenMetaverse.Messages.CableBeach } public class CreateRegionReplyMessage : IMessage + { + public bool Success; + public string Message; + public UUID SimulationKey; + + public OSDMap Serialize() + { + OSDMap map = new OSDMap(); + map["success"] = OSD.FromBoolean(Success); + map["message"] = OSD.FromString(Message); + map["simulation_key"] = OSD.FromUUID(SimulationKey); + return map; + } + + public void Deserialize(OSDMap map) + { + Success = map["success"].AsBoolean(); + Message = map["message"].AsString(); + SimulationKey = map["simulation_key"].AsUUID(); + } + } + + public class DeleteRegionMessage : IMessage + { + public UUID ID; + public UUID SimulationKey; + + public OSDMap Serialize() + { + OSDMap map = new OSDMap(); + map["id"] = OSD.FromUUID(ID); + map["simulation_key"] = OSD.FromUUID(SimulationKey); + return map; + } + + public void Deserialize(OSDMap map) + { + ID = map["id"].AsUUID(); + SimulationKey = map["simulation_key"].AsUUID(); + } + } + + public class DeleteRegionReplyMessage : IMessage { public bool Success; public string Message; @@ -176,24 +219,28 @@ namespace OpenMetaverse.Messages.CableBeach } } - public class DeleteRegionMessage : IMessage + public class RegionUpdateMessage : IMessage { - public UUID ID; + public RegionInfo Region; + public UUID SimulationKey; public OSDMap Serialize() { OSDMap map = new OSDMap(); - map["id"] = OSD.FromUUID(ID); + map["region"] = Region.Serialize(); + map["simulation_key"] = OSD.FromUUID(SimulationKey); return map; } public void Deserialize(OSDMap map) { - ID = map["id"].AsUUID(); + Region = new RegionInfo(); + Region.Deserialize((OSDMap)map["region"]); + SimulationKey = map["simulation_key"].AsUUID(); } } - public class DeleteRegionReplyMessage : IMessage + public class RegionUpdateReplyMessage : IMessage { public bool Success; public string Message; @@ -620,7 +667,7 @@ namespace OpenMetaverse.Messages.CableBeach #endregion Inventory Messages - #region Region Messages + #region Simulator Messages public class EnableClientMessage : IMessage { @@ -738,6 +785,50 @@ namespace OpenMetaverse.Messages.CableBeach } } + public class CloseAgentConnectionMessage : IMessage + { + public UUID AgentID; + + public OSDMap Serialize() + { + OSDMap map = new OSDMap(); + map["agent_id"] = OSD.FromUUID(AgentID); + return map; + } + + public void Deserialize(OSDMap map) + { + AgentID = map["agent_id"].AsUUID(); + } + } + + public class NeighborUpdateMessage : IMessage + { + public RegionInfo[] Neighbors; + + public OSDMap Serialize() + { + OSDMap map = new OSDMap(); + OSDArray array = new OSDArray(Neighbors.Length); + for (int i = 0; i < Neighbors.Length; i++) + array.Add(Neighbors[i].Serialize()); + map["neighbors"] = array; + return map; + } + + public void Deserialize(OSDMap map) + { + OSDArray array = (OSDArray)map["neighbors"]; + Neighbors = new RegionInfo[array.Count]; + for (int i = 0; i < Neighbors.Length; i++) + { + RegionInfo region = new RegionInfo(); + region.Deserialize((OSDMap)array[i]); + Neighbors[i] = region; + } + } + } + public class ChildAgentUpdateMessage : IMessage { public UUID AgentID; @@ -910,5 +1001,5 @@ namespace OpenMetaverse.Messages.CableBeach } } - #endregion Region Messages + #endregion Simulator Messages } diff --git a/OpenMetaverse/Types/DoubleDictionary.cs b/OpenMetaverse/Types/DoubleDictionary.cs index 907eeddf..ce861d27 100644 --- a/OpenMetaverse/Types/DoubleDictionary.cs +++ b/OpenMetaverse/Types/DoubleDictionary.cs @@ -165,6 +165,24 @@ namespace OpenMetaverse } } + public void ForEach(Action> action) + { + lock (syncObject) + { + foreach (KeyValuePair entry in Dictionary1) + action(entry); + } + } + + public void ForEach(Action> action) + { + lock (syncObject) + { + foreach (KeyValuePair entry in Dictionary2) + action(entry); + } + } + public TValue FindValue(Predicate predicate) { lock (syncObject) diff --git a/data/cablebeach_message_template.msg b/data/cablebeach_message_template.msg new file mode 100644 index 00000000..55c545ef --- /dev/null +++ b/data/cablebeach_message_template.msg @@ -0,0 +1,394 @@ +//////////////////////////////////////////////////////////////////////////////// +// World Server +//////////////////////////////////////////////////////////////////////////////// + +®ion_info = +{ + name: string, + id: uuid, + handle: binary, + online: boolean, + ip: binary, + port: integer, + address: uri, + map_texture_id: uuid, + owner: uri, + region_flags: integer, + agent_count: integer, + capabilities: { $: uri }, + water_height: real, + default_position: [ real, real, real ], + default_look_at: [ real, real, real ] +} + +%%create_region + +-> region_info + +<- +{ + success: boolean, + message: string, + simulation_key: uuid +} + +%%delete_region + +-> +{ + id: uuid, + simulation_key: uuid +} + +<- +{ + success: boolean, + message: string +} + +%%region_update + +-> +{ + region: region_info, + simulation_key: uuid +} + +<- +{ + success: boolean, + message: string +} + +%%fetch_region + +&fetch_region_query = { id: uuid } +&fetch_region_query = { x: integer, y: integer, nearest: boolean } +&fetch_region_query = { name: string } + +-> fetch_region_query + +<- region_info + +%%fetch_default_region + +<- region_info + +%%region_search + +-> +{ + query: string +} + +<- +{ + regions: [ region_info, ... ] +} + +%%get_region_count + +<- +{ + count: integer +} + +//////////////////////////////////////////////////////////////////////////////// +// Identity +//////////////////////////////////////////////////////////////////////////////// + +// This message should be ignored if it originates from anywhere other than the +// identity server for the given identity + +%%request_capabilities + +-> +{ + identity: uri, + capabilities: [ string, ... ] +} + +<- +{ + capabilities: { $: uri } +} + +//////////////////////////////////////////////////////////////////////////////// +// Assets +//////////////////////////////////////////////////////////////////////////////// + +%%get_asset_metadata + +&metadata = +{ + id: uuid, + name: string, + description: string, + creation_date: date, + content_type: string, + sha256: binary, + temporary: boolean, + methods: { $: uri } +} + +&metadata = +{ + id: uuid, + name: string, + description: string, + creation_date: date, + content_type: string, + sha256: binary, + temporary: boolean, + methods: { $: uri } + components: integer, + layer_ends: [ integer ] +} + +<- metadata + +%%create_asset + +&create = +{ + content_type: string, + temporary: boolean, + base64_data: string +} + +&create = +{ + id: uuid, + content_type: string, + temporary: boolean, + base64_data: string +} + +-> create + +<- +{ + id: uuid +} + +//////////////////////////////////////////////////////////////////////////////// +// Inventory +//////////////////////////////////////////////////////////////////////////////// + +%%create_inventory + +-> +{ + identity: uri, + name: string +} + +<- +{ + root_folder_id: uuid +} + +%%create_folder + +-> +{ + identity: uri, + folder_id: uuid, + parent_id: uuid, + name: string, + preferred_content_type: string +} + +%%purge_folder + +-> +{ + identity: uri, + folder_id: uuid +} + +%%create_item + +-> +{ + identity: uri, + name: string, + description: string, + content_type: string, + asset_id: uuid, + parent_id: uuid +} + +<- +{ + item_id: uuid +} + +%%move_item + +-> +{ + identity: uri, + item_id: uuid, + new_parent_id: uuid, + new_name: string +} + +<- +{ + item_id: uuid +} + +%%update_item + +-> +{ + identity: uri, + name: string, + description: string, + content_type: string, + asset_id: uuid +} + +%%get_inventory_skeleton + +-> +{ + identity: uri +} + +<- +{ + folders: + [ + { + name: string, + parent_id: uuid, + version: integer, + preferred_content_type: string, + folder_id: uuid + }, + ... + ] +} + +%%get_active_gestures + +-> +{ + identity: uri +} + +<- +{ + gestures: + [ + { + item_id: uuid, + asset_id: uuid + }, + ... + ] +} + +//////////////////////////////////////////////////////////////////////////////// +// Simulators +//////////////////////////////////////////////////////////////////////////////// + +%%enable_client + +-> +{ + agent_id: uuid, + session_id: uuid, + secure_session_id: uuid, + circuit_code: integer, + region_handle: binary, + child_agent: boolean, + ip: binary, + client_version: string, + attributes: { }, + services: { $: { $: uri } }, + callback_uri: uri +} + +<- +{ + success: boolean, + message: string, + seed_capability: uri, +} + +%%enable_client_complete + +-> +{ + agent_id: uuid +} + +%%close_agent_connection + +-> +{ + agent_id: uuid +} + +%%neighbor_update + +-> +{ + neighbors: [ region_info, ... ] +} + +%%child_agent_update + +-> +{ + agent_id: uuid, + session_id: uuid, + position: [ real, real, real ], + velocity: [ real, real, real ], + region_handle: binary, + cam_position: [ real, real, real ], + cam_at_axis: [ real, real, real ], + cam_left_axis: [ real, real, real ], + cam_up_axis: [ real, real, real ] +} + +%%pass_object + +-> +{ + id: uuid +} + +<- +{ + success: boolean, + message: string +} + +%%fetch_terrain + +-> +{ + blocks: + [ + { + x: integer, + y: integer + } + ] +} + +<- +{ + blocks: + [ + { + x: integer, + y: integer, + data: binary + } + ] +}