From bcffd0cbd6efca9d20a38e06c88a608f19cb2a78 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sat, 27 Jun 2009 23:02:49 +0000 Subject: [PATCH] Removed OpenMetaverse.Messages.CableBeach. These messages have been moved to a new library in the CableBeach repository called CableBeachMessages.dll git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2925 52acb1d6-8a22-11de-b505-999d5b087335 --- .../Messages/CableBeachAttributes.cs | 120 -- OpenMetaverse/Messages/CableBeachHelpers.cs | 304 ---- OpenMetaverse/Messages/CableBeachMessages.cs | 1472 ----------------- data/cablebeach_message_template.msg | 628 ------- 4 files changed, 2524 deletions(-) delete mode 100644 OpenMetaverse/Messages/CableBeachAttributes.cs delete mode 100644 OpenMetaverse/Messages/CableBeachHelpers.cs delete mode 100644 OpenMetaverse/Messages/CableBeachMessages.cs delete mode 100644 data/cablebeach_message_template.msg diff --git a/OpenMetaverse/Messages/CableBeachAttributes.cs b/OpenMetaverse/Messages/CableBeachAttributes.cs deleted file mode 100644 index 74928e0f..00000000 --- a/OpenMetaverse/Messages/CableBeachAttributes.cs +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2009, openmetaverse.org - * All rights reserved. - * - * - Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - Neither the name of the openmetaverse.org nor the names - * of its contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -using System; - -namespace OpenMetaverse.Messages.CableBeach -{ - public static class CableBeachServices - { - public const string ASSETS = "http://openmetaverse.org/services/assets"; - public const string ASSET_CREATE_ASSET = "http://openmetaverse.org/services/assets/create_asset"; - public const string ASSET_GET_ASSET = "http://openmetaverse.org/services/assets/get_asset"; - public const string ASSET_GET_ASSET_METADATA = "http://openmetaverse.org/services/assets/get_asset_metadata"; - - public const string FILESYSTEM = "http://openmetaverse.org/services/filesystem"; - public const string FILESYSTEM_CREATE_FILESYSTEM = "http://openmetaverse.org/services/filesystem/create_filesystem"; - public const string FILESYSTEM_CREATE_OBJECT = "http://openmetaverse.org/services/filesystem/create_object"; - public const string FILESYSTEM_FETCH_OBJECT = "http://openmetaverse.org/services/filesystem/fetch_object"; - public const string FILESYSTEM_GET_FILESYSTEM_SKELETON = "http://openmetaverse.org/services/filesystem/get_filesystem_skeleton"; - public const string FILESYSTEM_PURGE_FOLDER = "http://openmetaverse.org/services/filesystem/purge_folder"; - - public const string MAP = "http://openmetaverse.org/services/map"; - public const string MAP_CREATE_REGION = "http://openmetaverse.org/services/map/create_region"; - public const string MAP_REGION_INFO = "http://openmetaverse.org/services/map/region_info"; - public const string MAP_DELETE_REGION = "http://openmetaverse.org/services/map/delete_region"; - public const string MAP_FETCH_REGION = "http://openmetaverse.org/services/map/fetch_region"; - public const string MAP_FETCH_REGION_DEFAULT = "http://openmetaverse.org/services/map/fetch_region_default"; - public const string MAP_REGION_SEARCH = "http://openmetaverse.org/services/map/region_search"; - public const string MAP_GET_REGION_COUNT = "http://openmetaverse.org/services/map/get_region_count"; - public const string MAP_REGION_UPDATE = "http://openmetaverse.org/services/map/region_update"; - - public const string SIMULATOR = "http://openmetaverse.org/services/simulator"; - public const string SIMULATOR_ENABLE_CLIENT = "http://openmetaverse.org/services/simulator/enable_client"; - public const string SIMULATOR_CLOSE_AGENT_CONNECTION = "http://openmetaverse.org/services/simulator/close_agent_connection"; - public const string SIMULATOR_CHILD_AGENT_UPDATE = "http://openmetaverse.org/services/simulator/child_agent_update"; - public const string SIMULATOR_NEIGHBOR_UPDATE = "http://openmetaverse.org/services/simulator/neighbor_update"; - } - - public static class AvatarAttributes - { - // axschema.org attributes - public static readonly Uri EMAIL = new Uri("http://axschema.org/contact/email"); - public static readonly Uri BIRTH_DATE = new Uri("http://axschema.org/birthDate"); - public static readonly Uri LANGUAGE = new Uri("http://axschema.org/pref/language"); - public static readonly Uri TIMEZONE = new Uri("http://axschema.org/pref/timezone"); - public static readonly Uri FIRST_NAME = new Uri("http://axschema.org/namePerson/first"); - public static readonly Uri LAST_NAME = new Uri("http://axschema.org/namePerson/last"); - public static readonly Uri COMPANY = new Uri("http://axschema.org/company/name"); - public static readonly Uri WEBSITE = new Uri("http://axschema.org/contact/web/default"); - public static readonly Uri BIOGRAPHY = new Uri("http://axschema.org/media/biography"); - - // OpenSim attributes - public static readonly Uri AVATAR_ID = new Uri("http://opensimulator.org/attributes/avatarID"); - public static readonly Uri DEFAULT_INVENTORY = new Uri("http://opensimulator.org/attributes/defaultInventory"); - public static readonly Uri LIBRARY_INVENTORY = new Uri("http://opensimulator.org/attributes/libraryInventory"); - public static readonly Uri IMAGE_ID = new Uri("http://opensimulator.org/attributes/imageID"); - public static readonly Uri FIRST_LIFE_IMAGE_ID = new Uri("http://opensimulator.org/attributes/firstLifeImageID"); - public static readonly Uri FIRST_LIFE_BIOGRAPHY = new Uri("http://opensimulator.org/attributes/firstLifeBiography"); - public static readonly Uri CAN_DO = new Uri("http://opensimulator.org/attributes/canDo"); - public static readonly Uri WANT_DO = new Uri("http://opensimulator.org/attributes/wantDo"); - - public static readonly Uri HOME_REGION_X = new Uri("http://opensimulator.org/attributes/homeRegionX"); - public static readonly Uri HOME_REGION_Y = new Uri("http://opensimulator.org/attributes/homeRegionY"); - public static readonly Uri HOME_REGION_ID = new Uri("http://opensimulator.org/attributes/homeRegionId"); - public static readonly Uri HOME_POSITION = new Uri("http://opensimulator.org/attributes/homePosition"); - public static readonly Uri HOME_LOOKAT = new Uri("http://opensimulator.org/attributes/homeLookat"); - - public static readonly Uri LAST_REGION_X = new Uri("http://opensimulator.org/attributes/lastRegionX"); - public static readonly Uri LAST_REGION_Y = new Uri("http://opensimulator.org/attributes/lastRegionY"); - public static readonly Uri LAST_REGION_ID = new Uri("http://opensimulator.org/attributes/lastRegionID"); - public static readonly Uri LAST_POSITION = new Uri("http://opensimulator.org/attributes/lastPosition"); - public static readonly Uri LAST_LOOKAT = new Uri("http://opensimulator.org/attributes/lastLookAt"); - - public static readonly Uri LAST_LOGIN_DATE = new Uri("http://opensimulator.org/attributes/lastLoginDate"); - public static readonly Uri GOD_LEVEL = new Uri("http://opensimulator.org/attributes/godLevel"); - public static readonly Uri PARTNER_ID = new Uri("http://opensimulator.org/attributes/partnerId"); - public static readonly Uri USER_FLAGS = new Uri("http://opensimulator.org/attributes/userFlags"); - public static readonly Uri CUSTOM_TYPE = new Uri("http://opensimulator.org/attributes/customType"); - - public static readonly Uri SHAPE_ITEM = new Uri("http://opensimulator.org/attributes/shapeItem"); - public static readonly Uri SKIN_ITEM = new Uri("http://opensimulator.org/attributes/skinItem"); - public static readonly Uri HAIR_ITEM = new Uri("http://opensimulator.org/attributes/hairItem"); - public static readonly Uri EYES_ITEM = new Uri("http://opensimulator.org/attributes/eyesItem"); - public static readonly Uri SHIRT_ITEM = new Uri("http://opensimulator.org/attributes/shirtItem"); - public static readonly Uri PANTS_ITEM = new Uri("http://opensimulator.org/attributes/pantsItem"); - public static readonly Uri SHOES_ITEM = new Uri("http://opensimulator.org/attributes/shoesItem"); - public static readonly Uri SOCKS_ITEM = new Uri("http://opensimulator.org/attributes/socksItem"); - public static readonly Uri JACKET_ITEM = new Uri("http://opensimulator.org/attributes/jacketItem"); - public static readonly Uri GLOVES_ITEM = new Uri("http://opensimulator.org/attributes/glovesItem"); - public static readonly Uri UNDERSHIRT_ITEM = new Uri("http://opensimulator.org/attributes/undershirtItem"); - public static readonly Uri UNDERPANTS_ITEM = new Uri("http://opensimulator.org/attributes/underpantsItem"); - public static readonly Uri SKIRT_ITEM = new Uri("http://opensimulator.org/attributes/skirtItem"); - public static readonly Uri AVATAR_HEIGHT = new Uri("http://opensimulator.org/attributes/avatarHeight"); - public static readonly Uri VISUAL_PARAMS = new Uri("http://opensimulator.org/attributes/visualParams"); - public static readonly Uri TEXTURE_ENTRY = new Uri("http://opensimulator.org/attributes/textureEntry"); - } -} diff --git a/OpenMetaverse/Messages/CableBeachHelpers.cs b/OpenMetaverse/Messages/CableBeachHelpers.cs deleted file mode 100644 index 4f0e7dc8..00000000 --- a/OpenMetaverse/Messages/CableBeachHelpers.cs +++ /dev/null @@ -1,304 +0,0 @@ -using System; -using OpenMetaverse; - -namespace OpenMetaverse.Messages.CableBeach -{ - public static class CableBeachUtils - { - // The following section is based on the table at https://wiki.secondlife.com/wiki/Asset_System - - #region SL / file extension / content-type conversions - - public static string SLAssetTypeToContentType(AssetType assetType) - { - switch (assetType) - { - case AssetType.Texture: - return "image/x-j2c"; - case AssetType.Sound: - return "application/ogg"; - case AssetType.CallingCard: - return "application/vnd.ll.callingcard"; - case AssetType.Landmark: - return "application/vnd.ll.landmark"; - case AssetType.Clothing: - return "application/vnd.ll.clothing"; - case AssetType.Object: - return "application/vnd.ll.primitive"; - case AssetType.Notecard: - return "application/vnd.ll.notecard"; - case AssetType.Folder: - return "application/vnd.ll.folder"; - case AssetType.RootFolder: - return "application/vnd.ll.rootfolder"; - case AssetType.LSLText: - return "application/vnd.ll.lsltext"; - case AssetType.LSLBytecode: - return "application/vnd.ll.lslbyte"; - case AssetType.TextureTGA: - case AssetType.ImageTGA: - return "image/tga"; - case AssetType.Bodypart: - return "application/vnd.ll.bodypart"; - case AssetType.TrashFolder: - return "application/vnd.ll.trashfolder"; - case AssetType.SnapshotFolder: - return "application/vnd.ll.snapshotfolder"; - case AssetType.LostAndFoundFolder: - return "application/vnd.ll.lostandfoundfolder"; - case AssetType.SoundWAV: - return "audio/x-wav"; - case AssetType.ImageJPEG: - return "image/jpeg"; - case AssetType.Animation: - return "application/vnd.ll.animation"; - case AssetType.Gesture: - return "application/vnd.ll.gesture"; - case AssetType.Simstate: - case AssetType.Unknown: - default: - return "application/octet-stream"; - } - } - - public static AssetType ContentTypeToSLAssetType(string contentType) - { - switch (contentType) - { - case "image/x-j2c": - case "image/jp2": - return AssetType.Texture; - case "application/ogg": - return AssetType.Sound; - case "application/vnd.ll.callingcard": - case "application/x-metaverse-callingcard": - return AssetType.CallingCard; - case "application/vnd.ll.landmark": - case "application/x-metaverse-landmark": - return AssetType.Landmark; - case "application/vnd.ll.clothing": - case "application/x-metaverse-clothing": - return AssetType.Clothing; - case "application/vnd.ll.primitive": - case "application/x-metaverse-primitive": - return AssetType.Object; - case "application/vnd.ll.notecard": - case "application/x-metaverse-notecard": - return AssetType.Notecard; - case "application/vnd.ll.folder": - return AssetType.Folder; - case "application/vnd.ll.rootfolder": - return AssetType.RootFolder; - case "application/vnd.ll.lsltext": - case "application/x-metaverse-lsl": - return AssetType.LSLText; - case "application/vnd.ll.lslbyte": - case "application/x-metaverse-lso": - return AssetType.LSLBytecode; - case "image/tga": - // Note that AssetType.TextureTGA will be converted to AssetType.ImageTGA - return AssetType.ImageTGA; - case "application/vnd.ll.bodypart": - case "application/x-metaverse-bodypart": - return AssetType.Bodypart; - case "application/vnd.ll.trashfolder": - return AssetType.TrashFolder; - case "application/vnd.ll.snapshotfolder": - return AssetType.SnapshotFolder; - case "application/vnd.ll.lostandfoundfolder": - return AssetType.LostAndFoundFolder; - case "audio/x-wav": - return AssetType.SoundWAV; - case "image/jpeg": - return AssetType.ImageJPEG; - case "application/vnd.ll.animation": - case "application/x-metaverse-animation": - return AssetType.Animation; - case "application/vnd.ll.gesture": - case "application/x-metaverse-gesture": - return AssetType.Gesture; - case "application/x-metaverse-simstate": - return AssetType.Simstate; - case "application/octet-stream": - default: - return AssetType.Unknown; - } - } - - public static InventoryType ContentTypeToSLInvType(string contentType) - { - switch (contentType) - { - case "image/x-j2c": - case "image/jp2": - case "image/tga": - case "image/jpeg": - return InventoryType.Texture; - case "application/ogg": - case "audio/x-wav": - return InventoryType.Sound; - case "application/vnd.ll.callingcard": - case "application/x-metaverse-callingcard": - return InventoryType.CallingCard; - case "application/vnd.ll.landmark": - case "application/x-metaverse-landmark": - return InventoryType.Landmark; - case "application/vnd.ll.clothing": - case "application/x-metaverse-clothing": - case "application/vnd.ll.bodypart": - case "application/x-metaverse-bodypart": - return InventoryType.Wearable; - case "application/vnd.ll.primitive": - case "application/x-metaverse-primitive": - return InventoryType.Object; - case "application/vnd.ll.notecard": - case "application/x-metaverse-notecard": - return InventoryType.Notecard; - case "application/vnd.ll.folder": - return InventoryType.Folder; - case "application/vnd.ll.rootfolder": - return InventoryType.RootCategory; - case "application/vnd.ll.lsltext": - case "application/x-metaverse-lsl": - case "application/vnd.ll.lslbyte": - case "application/x-metaverse-lso": - return InventoryType.LSL; - case "application/vnd.ll.trashfolder": - case "application/vnd.ll.snapshotfolder": - case "application/vnd.ll.lostandfoundfolder": - return InventoryType.Folder; - case "application/vnd.ll.animation": - case "application/x-metaverse-animation": - return InventoryType.Animation; - case "application/vnd.ll.gesture": - case "application/x-metaverse-gesture": - return InventoryType.Gesture; - case "application/x-metaverse-simstate": - return InventoryType.Snapshot; - case "application/octet-stream": - default: - return InventoryType.Unknown; - } - } - - public static string ContentTypeToExtension(string contentType) - { - switch (contentType) - { - case "image/x-j2c": - case "image/jp2": - return "texture"; - case "application/ogg": - return "ogg"; - case "application/vnd.ll.callingcard": - case "application/x-metaverse-callingcard": - return "callingcard"; - case "application/vnd.ll.landmark": - case "application/x-metaverse-landmark": - return "landmark"; - case "application/vnd.ll.clothing": - case "application/x-metaverse-clothing": - return "clothing"; - case "application/vnd.ll.primitive": - case "application/x-metaverse-primitive": - return "primitive"; - case "application/vnd.ll.notecard": - case "application/x-metaverse-notecard": - return "notecard"; - case "application/vnd.ll.folder": - return "folder"; - case "application/vnd.ll.rootfolder": - return "rootfolder"; - case "application/vnd.ll.lsltext": - case "application/x-metaverse-lsl": - return "lsltext"; - case "application/vnd.ll.lslbyte": - case "application/x-metaverse-lso": - return "lslbyte"; - case "image/tga": - return "tga"; - case "application/vnd.ll.bodypart": - case "application/x-metaverse-bodypart": - return "bodypart"; - case "application/vnd.ll.trashfolder": - return "trashfolder"; - case "application/vnd.ll.snapshotfolder": - return "snapshotfolder"; - case "application/vnd.ll.lostandfoundfolder": - return "lostandfoundfolder"; - case "audio/x-wav": - return "wav"; - case "image/jpeg": - return "jpg"; - case "application/vnd.ll.animation": - case "application/x-metaverse-animation": - return "animatn"; - case "application/vnd.ll.gesture": - case "application/x-metaverse-gesture": - return "gesture"; - case "application/x-metaverse-simstate": - return "simstate"; - case "application/octet-stream": - default: - return "binary"; - } - } - - public static string ExtensionToContentType(string extension) - { - switch (extension) - { - case "texture": - return "image/x-j2c"; - case "ogg": - return "application/ogg"; - case "callingcard": - return "application/vnd.ll.callingcard"; - case "landmark": - return "application/vnd.ll.landmark"; - case "clothing": - return "application/vnd.ll.clothing"; - case "primitive": - return "application/vnd.ll.primitive"; - case "notecard": - return "application/vnd.ll.notecard"; - case "folder": - return "application/vnd.ll.folder"; - case "rootfolder": - return "application/vnd.ll.rootfolder"; - case "lsltext": - return "application/vnd.ll.lsltext"; - case "lslbyte": - return "application/vnd.ll.lslbyte"; - case "tga": - return "image/tga"; - case "bodypart": - return "application/vnd.ll.bodypart"; - case "trashfolder": - return "application/vnd.ll.trashfolder"; - case "snapshotfolder": - return "application/vnd.ll.snapshotfolder"; - case "lostandfoundfolder": - return "application/vnd.ll.lostandfoundfolder"; - case "wav": - return "audio/x-wav"; - case "jpg": - return "image/jpeg"; - case "animatn": - return "application/vnd.ll.animation"; - case "gesture": - return "application/vnd.ll.gesture"; - case "binary": - default: - return "application/octet-stream"; - } - } - - #endregion SL / file extension / content-type conversions - - public static UUID IdentityToUUID(Uri identity) - { - return new UUID((OpenMetaverse.Utils.MD5(System.Text.Encoding.UTF8.GetBytes(identity.ToString()))), 0); - } - } -} diff --git a/OpenMetaverse/Messages/CableBeachMessages.cs b/OpenMetaverse/Messages/CableBeachMessages.cs deleted file mode 100644 index 48d3980e..00000000 --- a/OpenMetaverse/Messages/CableBeachMessages.cs +++ /dev/null @@ -1,1472 +0,0 @@ -/* - * Copyright (c) 2009, openmetaverse.org - * All rights reserved. - * - * - Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - Neither the name of the openmetaverse.org nor the names - * of its contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Net; -using OpenMetaverse.StructuredData; -using OpenMetaverse.Interfaces; - -namespace OpenMetaverse.Messages.CableBeach -{ - /// - /// Holds information about a grid region - /// - public struct RegionInfo - { - public string Name; - public UUID ID; - public ulong Handle; - public bool Online; - public IPAddress IP; - public int Port; - public UUID MapTextureID; - public Uri Owner; - public RegionFlags Flags; - public int AgentCount; - public Dictionary Capabilities; - public float WaterHeight; - public Vector3 DefaultPosition; - public Vector3 DefaultLookAt; - - public uint X - { - get - { - uint x, y; - OpenMetaverse.Utils.LongToUInts(Handle, out x, out y); - return x / 256; - } - - set - { - uint x, y; - OpenMetaverse.Utils.LongToUInts(Handle, out x, out y); - Handle = OpenMetaverse.Utils.UIntsToLong(value, y); - } - } - - public uint Y - { - get - { - uint x, y; - OpenMetaverse.Utils.LongToUInts(Handle, out x, out y); - return y / 256; - } - - set - { - uint x, y; - OpenMetaverse.Utils.LongToUInts(Handle, out x, out y); - Handle = OpenMetaverse.Utils.UIntsToLong(x, value); - } - } - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["name"] = OSD.FromString(Name); - map["id"] = OSD.FromUUID(ID); - map["handle"] = OSD.FromULong(Handle); - map["online"] = OSD.FromBoolean(Online); - map["ip"] = MessageUtils.FromIP(IP); - map["port"] = OSD.FromInteger(Port); - map["map_texture_id"] = OSD.FromUUID(MapTextureID); - map["owner"] = OSD.FromUri(Owner); - map["region_flags"] = OSD.FromInteger((int)Flags); - map["agent_count"] = OSD.FromInteger(AgentCount); - map["capabilities"] = MessageUtils.FromDictionaryUri(Capabilities); - map["water_height"] = OSD.FromReal(WaterHeight); - map["default_position"] = OSD.FromVector3(DefaultPosition); - map["default_look_at"] = OSD.FromVector3(DefaultLookAt); - return map; - } - - public void Deserialize(OSDMap map) - { - Name = map["name"].AsString(); - ID = map["id"].AsUUID(); - Handle = map["handle"].AsULong(); - Online = map["online"].AsBoolean(); - IP = MessageUtils.ToIP(map["ip"]); - Port = map["port"].AsInteger(); - MapTextureID = map["map_texture_id"].AsUUID(); - Owner = map["owner"].AsUri(); - Flags = (RegionFlags)map["region_flags"].AsInteger(); - AgentCount = map["agent_count"].AsInteger(); - Capabilities = MessageUtils.ToDictionaryUri(map["capabilities"]); - WaterHeight = (float)map["water_height"].AsReal(); - DefaultPosition = map["default_position"].AsVector3(); - DefaultLookAt = map["default_look_at"].AsVector3(); - } - - public override string ToString() - { - string ret = String.Empty; - if (!String.IsNullOrEmpty(Name)) - ret += Name + " "; - - ret += Online ? "[Online]" : "[Offline]"; - return ret; - } - } - - #region World Messages - - public class CreateRegionMessage : IMessage - { - public RegionInfo Region; - - public OSDMap Serialize() - { - return Region.Serialize(); - } - - public void Deserialize(OSDMap map) - { - Region = new RegionInfo(); - Region.Deserialize(map); - } - } - - public class CreateRegionReplyMessage : IMessage - { - public bool Success; - public string Message; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["success"] = OSD.FromBoolean(Success); - map["message"] = OSD.FromString(Message); - return map; - } - - public void Deserialize(OSDMap map) - { - Success = map["success"].AsBoolean(); - Message = map["message"].AsString(); - } - } - - public class DeleteRegionMessage : IMessage - { - public UUID ID; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["id"] = OSD.FromUUID(ID); - return map; - } - - public void Deserialize(OSDMap map) - { - ID = map["id"].AsUUID(); - } - } - - public class DeleteRegionReplyMessage : IMessage - { - public bool Success; - public string Message; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["success"] = OSD.FromBoolean(Success); - map["message"] = OSD.FromString(Message); - return map; - } - - public void Deserialize(OSDMap map) - { - Success = map["success"].AsBoolean(); - Message = map["message"].AsString(); - } - } - - public class RegionUpdateMessage : IMessage - { - public RegionInfo Region; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["region"] = Region.Serialize(); - return map; - } - - public void Deserialize(OSDMap map) - { - Region = new RegionInfo(); - Region.Deserialize((OSDMap)map["region"]); - } - } - - public class RegionUpdateReplyMessage : IMessage - { - public bool Success; - public string Message; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["success"] = OSD.FromBoolean(Success); - map["message"] = OSD.FromString(Message); - return map; - } - - public void Deserialize(OSDMap map) - { - Success = map["success"].AsBoolean(); - Message = map["message"].AsString(); - } - } - - public interface FetchRegionQuery - { - OSDMap Serialize(); - void Deserialize(OSDMap map); - } - - public class FetchRegionQueryID : FetchRegionQuery - { - public UUID ID; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["id"] = OSD.FromUUID(ID); - return map; - } - - public void Deserialize(OSDMap map) - { - ID = map["id"].AsUUID(); - } - } - - public class FetchRegionQueryCoords : FetchRegionQuery - { - public int X; - public int Y; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["x"] = OSD.FromInteger(X); - map["y"] = OSD.FromInteger(Y); - return map; - } - - public void Deserialize(OSDMap map) - { - X = map["x"].AsInteger(); - Y = map["y"].AsInteger(); - } - } - - public class FetchRegionQueryName : FetchRegionQuery - { - public string Name; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["name"] = OSD.FromString(Name); - return map; - } - - public void Deserialize(OSDMap map) - { - Name = map["name"].AsString(); - } - } - - public class FetchRegionMessage : IMessage - { - public FetchRegionQuery Query; - - public OSDMap Serialize() - { - return Query.Serialize(); - } - - public void Deserialize(OSDMap map) - { - if (map.ContainsKey("id")) - Query = new FetchRegionQueryID(); - else if (map.ContainsKey("name")) - Query = new FetchRegionQueryName(); - else - Query = new FetchRegionQueryCoords(); - - Query.Deserialize(map); - } - } - - public class FetchRegionReplyMessage : IMessage - { - RegionInfo Region; - - public OSDMap Serialize() - { - return Region.Serialize(); - } - - public void Deserialize(OSDMap map) - { - Region = new RegionInfo(); - Region.Deserialize(map); - } - } - - public class FetchDefaultRegionReplyMessage : IMessage - { - public RegionInfo Region; - - public OSDMap Serialize() - { - return Region.Serialize(); - } - - public void Deserialize(OSDMap map) - { - Region = new RegionInfo(); - Region.Deserialize(map); - } - } - - public class RegionSearchMessage : IMessage - { - public string Query; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["query"] = OSD.FromString(Query); - return map; - } - - public void Deserialize(OSDMap map) - { - Query = map["query"].AsString(); - } - } - - public class RegionSearchReplyMessage : IMessage - { - public RegionInfo[] Regions; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - OSDArray array = new OSDArray(Regions.Length); - for (int i = 0; i < Regions.Length; i++) - array.Add(Regions[i].Serialize()); - map["regions"] = array; - return map; - } - - public void Deserialize(OSDMap map) - { - OSDArray array = (OSDArray)map["regions"]; - Regions = new RegionInfo[array.Count]; - for (int i = 0; i < array.Count; i++) - { - RegionInfo region = new RegionInfo(); - region.Deserialize((OSDMap)array[i]); - Regions[i] = region; - } - } - } - - public class GetRegionCountReplyMessage : IMessage - { - public int Count; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["count"] = OSD.FromInteger(Count); - return map; - } - - public void Deserialize(OSDMap map) - { - Count = map["count"].AsInteger(); - } - } - - #endregion World Messages - - #region Identity Messages - - public class RequestCapabilitiesMessage : IMessage - { - public Uri Identity; - public Uri[] Capabilities; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(1); - map["identity"] = OSD.FromUri(Identity); - - OSDArray array = new OSDArray(Capabilities.Length); - for (int i = 0; i < Capabilities.Length; i++) - array.Add(OSD.FromUri(Capabilities[i])); - map["capabilities"] = array; - - return map; - } - - public void Deserialize(OSDMap map) - { - Identity = map["identity"].AsUri(); - - OSDArray array = (OSDArray)map["capabilities"]; - Capabilities = new Uri[array.Count]; - for (int i = 0; i < array.Count; i++) - Capabilities[i] = array[i].AsUri(); - } - } - - public class RequestCapabilitiesReplyMessage : IMessage - { - public Dictionary Capabilities; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(1); - OSDMap caps = new OSDMap(Capabilities.Count); - foreach (KeyValuePair entry in Capabilities) - caps.Add(entry.Key.ToString(), OSD.FromUri(entry.Value)); - map["capabilities"] = caps; - return map; - } - - public void Deserialize(OSDMap map) - { - OSDMap caps = (OSDMap)map["capabilities"]; - Capabilities = new Dictionary(caps.Count); - foreach (KeyValuePair entry in caps) - Capabilities.Add(new Uri(entry.Key), entry.Value.AsUri()); - } - } - - #endregion Identity Messages - - #region Asset Messages - - public abstract class MetadataBlock - { - public UUID ID; - public string Name; - public string Description; - public DateTime CreationDate; - public string ContentType; - public byte[] SHA256; - public bool Temporary; - public Dictionary Methods; - - public abstract OSDMap Serialize(); - public abstract void Deserialize(OSDMap map); - } - - public class MetadataDefault : MetadataBlock - { - public override OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["id"] = OSD.FromUUID(ID); - map["name"] = OSD.FromString(Name); - map["description"] = OSD.FromString(Description); - map["creation_date"] = OSD.FromDate(CreationDate); - map["content_type"] = OSD.FromString(ContentType); - map["sha256"] = OSD.FromBinary(SHA256); - map["temporary"] = OSD.FromBoolean(Temporary); - OSDMap methodsMap = new OSDMap(Methods.Count); - foreach (KeyValuePair entry in Methods) - methodsMap.Add(entry.Key, OSD.FromUri(entry.Value)); - map["methods"] = methodsMap; - return map; - } - - public override void Deserialize(OSDMap map) - { - ID = map["id"].AsUUID(); - Name = map["name"].AsString(); - Description = map["description"].AsString(); - CreationDate = map["creation_date"].AsDate(); - ContentType = map["content_type"].AsString(); - SHA256 = map["sha256"].AsBinary(); - Temporary = map["temporary"].AsBoolean(); - OSDMap methodsMap = map["methods"] as OSDMap; - if (methodsMap != null) - { - Methods = new Dictionary(methodsMap.Count); - foreach (KeyValuePair entry in methodsMap) - Methods.Add(entry.Key, entry.Value.AsUri()); - } - else - { - Methods = new Dictionary(0); - } - } - } - - public class MetadataJPEG2000 : MetadataBlock - { - public int Components; - public int[] LayerEnds; - - public override OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["id"] = OSD.FromUUID(ID); - map["name"] = OSD.FromString(Name); - map["description"] = OSD.FromString(Description); - map["creation_date"] = OSD.FromDate(CreationDate); - map["content_type"] = OSD.FromString(ContentType); - map["sha256"] = OSD.FromBinary(SHA256); - map["temporary"] = OSD.FromBoolean(Temporary); - OSDMap methodsMap = new OSDMap(Methods.Count); - foreach (KeyValuePair entry in Methods) - methodsMap.Add(entry.Key, OSD.FromUri(entry.Value)); - map["methods"] = methodsMap; - map["components"] = OSD.FromInteger(Components); - OSDArray layerEndsArray = new OSDArray(LayerEnds.Length); - for (int i = 0; i < LayerEnds.Length; i++) - layerEndsArray.Add(OSD.FromInteger(LayerEnds[i])); - map["layer_ends"] = layerEndsArray; - return map; - } - - public override void Deserialize(OSDMap map) - { - ID = map["id"].AsUUID(); - Name = map["name"].AsString(); - Description = map["description"].AsString(); - CreationDate = map["creation_date"].AsDate(); - ContentType = map["content_type"].AsString(); - SHA256 = map["sha256"].AsBinary(); - Temporary = map["temporary"].AsBoolean(); - OSDMap methodsMap = map["methods"] as OSDMap; - if (methodsMap != null) - { - Methods = new Dictionary(methodsMap.Count); - foreach (KeyValuePair entry in methodsMap) - Methods.Add(entry.Key, entry.Value.AsUri()); - } - else - { - Methods = new Dictionary(0); - } - Components = map["components"].AsInteger(); - OSDArray layerEndsArray = map["layer_ends"] as OSDArray; - if (layerEndsArray != null) - { - LayerEnds = new int[layerEndsArray.Count]; - for (int i = 0; i < layerEndsArray.Count; i++) - LayerEnds[i] = layerEndsArray[i].AsInteger(); - } - else - { - LayerEnds = new int[0]; - } - } - } - - public class GetAssetMetadataMessage : IMessage - { - public MetadataBlock Metadata; - - public OSDMap Serialize() - { - return Metadata.Serialize(); - } - - public void Deserialize(OSDMap map) - { - if (map.ContainsKey("components")) - Metadata = new MetadataJPEG2000(); - else - Metadata = new MetadataDefault(); - - Metadata.Deserialize(map); - } - } - - public class CreateAssetMessage : IMessage - { - public MetadataBlock Metadata; - public string Base64Data; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["metadata"] = Metadata.Serialize(); - map["base64_data"] = OSD.FromString(Base64Data); - return map; - } - - public void Deserialize(OSDMap map) - { - OSDMap metadata = (OSDMap)map["metadata"]; - - if (metadata.ContainsKey("components")) - Metadata = new MetadataJPEG2000(); - else - Metadata = new MetadataDefault(); - - Metadata.Deserialize(metadata); - Base64Data = map["base64_data"].AsString(); - } - } - - public class CreateAssetReplyMessage : IMessage - { - public UUID AssetID; - public Uri AssetUri; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["asset_uri"] = OSD.FromUri(AssetUri); - map["asset_id"] = OSD.FromUUID(AssetID); - return map; - } - - public void Deserialize(OSDMap map) - { - AssetUri = map["asset_uri"].AsUri(); - AssetID = map["asset_id"].AsUUID(); - } - } - - #endregion Asset Messages - - #region Inventory Messages - - public abstract class InventoryBlock - { - public UUID ID; - public UUID ParentID; - public string Name; - public UUID OwnerID; - - public abstract OSDMap Serialize(); - public abstract void Deserialize(OSDMap map); - } - - public class InventoryBlockItem : InventoryBlock - { - public UUID AssetID; - public string ContentType; - public UUID CreatorID; - public UUID GroupID; - public string Description; - public bool GroupOwned; - public uint PermsBase; - public uint PermsEveryone; - public uint PermsGroup; - public uint PermsNext; - public uint PermsOwner; - public int SalePrice; - public SaleType SaleType; - public uint Flags; - public DateTime CreationDate; - - public override OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["id"] = OSD.FromUUID(ID); - map["parent_id"] = OSD.FromUUID(ParentID); - map["name"] = OSD.FromString(Name); - map["owner_id"] = OSD.FromUUID(OwnerID); - map["asset_id"] = OSD.FromUUID(AssetID); - map["content_type"] = OSD.FromString(ContentType); - map["creator_id"] = OSD.FromUUID(CreatorID); - map["group_id"] = OSD.FromUUID(GroupID); - map["description"] = OSD.FromString(Description); - map["group_owned"] = OSD.FromBoolean(GroupOwned); - map["perms_base"] = OSD.FromUInteger(PermsBase); - map["perms_everyone"] = OSD.FromUInteger(PermsEveryone); - map["perms_group"] = OSD.FromUInteger(PermsGroup); - map["perms_next"] = OSD.FromUInteger(PermsNext); - map["perms_owner"] = OSD.FromUInteger(PermsOwner); - map["sale_price"] = OSD.FromInteger(SalePrice); - map["sale_type"] = OSD.FromInteger((byte)SaleType); - map["flags"] = OSD.FromInteger((int)Flags); - map["creation_date"] = OSD.FromInteger((int)Utils.DateTimeToUnixTime(CreationDate)); - return map; - } - - public override void Deserialize(OSDMap map) - { - ID = map["id"].AsUUID(); - ParentID = map["parent_id"].AsUUID(); - Name = map["name"].AsString(); - OwnerID = map["owner_id"].AsUUID(); - AssetID = map["asset_id"].AsUUID(); - ContentType = map["content_type"].AsString(); - CreatorID = map["creator_id"].AsUUID(); - GroupID = map["group_id"].AsUUID(); - Description = map["description"].AsString(); - GroupOwned = map["group_owned"].AsBoolean(); - PermsBase = map["perms_base"].AsUInteger(); - PermsEveryone = map["perms_everyone"].AsUInteger(); - PermsGroup = map["perms_group"].AsUInteger(); - PermsNext = map["perms_next"].AsUInteger(); - PermsOwner = map["perms_owner"].AsUInteger(); - } - } - - public class InventoryBlockFolder : InventoryBlock - { - public string PreferredContentType; - public int Version; - public InventoryBlock[] Children; - - public override OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["id"] = OSD.FromUUID(ID); - map["parent_id"] = OSD.FromUUID(ParentID); - map["name"] = OSD.FromString(Name); - map["owner_id"] = OSD.FromUUID(OwnerID); - map["preferred_content_type"] = OSD.FromString(PreferredContentType); - map["version"] = OSD.FromInteger(Version); - if (Children != null) - { - OSDArray array = new OSDArray(Children.Length); - for (int i = 0; i < Children.Length; i++) - array.Add(Children[i].Serialize()); - map["children"] = array; - } - else - { - map["children"] = new OSDArray(0); - } - return map; - } - - public override void Deserialize(OSDMap map) - { - ID = map["id"].AsUUID(); - ParentID = map["parent_id"].AsUUID(); - Name = map["name"].AsString(); - OwnerID = map["owner_id"].AsUUID(); - PreferredContentType = map["preferred_content_type"].AsString(); - Version = map["version"].AsInteger(); - OSDArray array = (OSDArray)map["children"]; - Children = new InventoryBlock[array.Count]; - for (int i = 0; i < array.Count; i++) - { - OSDMap childMap = (OSDMap)array[i]; - InventoryBlock obj; - if (childMap.ContainsKey("asset_id")) - obj = new InventoryBlockItem(); - else - obj = new InventoryBlockFolder(); - obj.Deserialize(childMap); - Children[i] = obj; - } - } - } - - public class CreateInventoryMessage : IMessage - { - public Uri Identity; - public string Name; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["identity"] = OSD.FromUri(Identity); - map["name"] = OSD.FromString(Name); - return map; - } - - public void Deserialize(OSDMap map) - { - Identity = map["identity"].AsUri(); - Name = map["name"].AsString(); - } - } - - public class CreateInventoryReplyMessage : IMessage - { - public UUID RootFolderID; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(1); - map["root_folder_id"] = OSD.FromUUID(RootFolderID); - return map; - } - - public void Deserialize(OSDMap map) - { - RootFolderID = map["root_folder_id"].AsUUID(); - } - } - - public class CreateObjectMessage : IMessage - { - public Uri Identity; - public InventoryBlock Object; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["identity"] = OSD.FromUri(Identity); - map["object"] = Object.Serialize(); - return map; - } - - public void Deserialize(OSDMap map) - { - Identity = map["identity"].AsUri(); - OSDMap objMap = (OSDMap)map["object"]; - if (objMap.ContainsKey("asset_id")) - Object = new InventoryBlockItem(); - else - Object = new InventoryBlockFolder(); - Object.Deserialize(objMap); - } - } - - public class CreateObjectReplyMessage : IMessage - { - public bool Success; - public string Message; - public InventoryBlock Object; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["success"] = OSD.FromBoolean(Success); - map["message"] = OSD.FromString(Message); - if (Object != null) - map["object"] = Object.Serialize(); - return map; - } - - public void Deserialize(OSDMap map) - { - Success = map["success"].AsBoolean(); - Message = map["message"].AsString(); - OSDMap objMap = map["object"] as OSDMap; - if (objMap != null) - { - if (objMap.ContainsKey("asset_id")) - Object = new InventoryBlockItem(); - else - Object = new InventoryBlockFolder(); - - Object.Deserialize(objMap); - } - else - { - Object = null; - } - } - } - - public class FetchObjectMessage : IMessage - { - public Uri Identity; - public UUID ObjectID; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["identity"] = OSD.FromUri(Identity); - map["object_id"] = OSD.FromUUID(ObjectID); - return map; - } - - public void Deserialize(OSDMap map) - { - Identity = map["identity"].AsUri(); - ObjectID = map["object_id"].AsUUID(); - } - } - - public class FetchObjectReplyMessage : IMessage - { - public bool Success; - public string Message; - public InventoryBlock Object; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["success"] = OSD.FromBoolean(Success); - map["message"] = OSD.FromString(Message); - if (Object != null) - map["object"] = Object.Serialize(); - return map; - } - - public void Deserialize(OSDMap map) - { - Success = map["success"].AsBoolean(); - Message = map["message"].AsString(); - OSDMap objMap = map["object"] as OSDMap; - if (objMap != null) - { - if (objMap.ContainsKey("asset_id")) - Object = new InventoryBlockItem(); - else - Object = new InventoryBlockFolder(); - - Object.Deserialize(objMap); - } - else - { - Object = null; - } - } - } - - public class PurgeFolderMessage : IMessage - { - public Uri Identity; - public UUID FolderID; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["identity"] = OSD.FromUri(Identity); - map["folder_id"] = OSD.FromUUID(FolderID); - return map; - } - - public void Deserialize(OSDMap map) - { - Identity = map["identity"].AsUri(); - FolderID = map["folder_id"].AsUUID(); - } - } - - public class PurgeFolderReplyMessage : IMessage - { - public bool Success; - public string Message; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["success"] = OSD.FromBoolean(Success); - map["message"] = OSD.FromString(Message); - return map; - } - - public void Deserialize(OSDMap map) - { - Success = map["success"].AsBoolean(); - Message = map["message"].AsString(); - } - } - - public class GetInventorySkeletonMessage : IMessage - { - public Uri Identity; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["identity"] = OSD.FromUri(Identity); - return map; - } - - public void Deserialize(OSDMap map) - { - Identity = map["identity"].AsUri(); - } - } - - public class GetInventorySkeletonReplyMessage : IMessage - { - public class Folder - { - public string Name; - public UUID ParentID; - public int Version; - public string PreferredContentType; - public UUID FolderID; - } - - public Folder[] Folders; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - - OSDArray folders = new OSDArray(Folders.Length); - for (int i = 0; i < Folders.Length; i++) - { - Folder folder = Folders[i]; - - OSDMap folderMap = new OSDMap(); - folderMap["name"] = OSD.FromString(folder.Name); - folderMap["parent_id"] = OSD.FromUUID(folder.ParentID); - folderMap["version"] = OSD.FromInteger(folder.Version); - folderMap["preferred_content_type"] = OSD.FromString(folder.PreferredContentType); - folderMap["folder_id"] = OSD.FromUUID(folder.FolderID); - - folders.Add(folderMap); - } - - map["folders"] = folders; - return map; - } - - public void Deserialize(OSDMap map) - { - OSDArray folders = (OSDArray)map["folders"]; - Folders = new Folder[folders.Count]; - for (int i = 0; i < folders.Count; i++) - { - OSDMap folderMap = (OSDMap)folders[i]; - - Folder folder = new Folder(); - folder.Name = folderMap["name"].AsString(); - folder.ParentID = folderMap["parent_id"].AsUUID(); - folder.Version = folderMap["version"].AsInteger(); - folder.PreferredContentType = folderMap["preferred_content_type"].AsString(); - folder.FolderID = folderMap["folder_id"].AsUUID(); - - Folders[i] = folder; - } - } - } - - public class GetActiveGesturesMessage : IMessage - { - public Uri Identity; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["identity"] = OSD.FromUri(Identity); - return map; - } - - public void Deserialize(OSDMap map) - { - Identity = map["identity"].AsUri(); - } - } - - public class GetActiveGesturesReplyMessage : IMessage - { - public class Gesture - { - public UUID ItemID; - public UUID AssetID; - } - - public Gesture[] Gestures; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - - OSDArray gestures = new OSDArray(); - for (int i = 0; i < Gestures.Length; i++) - { - Gesture gesture = Gestures[i]; - OSDMap gestureMap = new OSDMap(); - gestureMap["item_id"] = OSD.FromUUID(gesture.ItemID); - gestureMap["asset_id"] = OSD.FromUUID(gesture.AssetID); - gestures.Add(gestureMap); - } - - map["gestures"] = gestures; - return map; - } - - public void Deserialize(OSDMap map) - { - OSDArray gestures = (OSDArray)map["gestures"]; - Gestures = new Gesture[gestures.Count]; - for (int i = 0; i < gestures.Count; i++) - { - OSDMap gestureMap = (OSDMap)gestures[i]; - Gesture gesture = new Gesture(); - gesture.ItemID = gestureMap["item_id"].AsUUID(); - gesture.AssetID = gestureMap["asset_id"].AsUUID(); - Gestures[i] = gesture; - } - } - } - - #endregion Inventory Messages - - #region Simulator Messages - - public class EnableClientMessage : IMessage - { - public Uri Identity; - public UUID AgentID; - public UUID SessionID; - public UUID SecureSessionID; - public int CircuitCode; - public ulong RegionHandle; - public bool ChildAgent; - public IPAddress IP; - public string ClientVersion; - public Dictionary Attributes; - public Dictionary> Services; - public Uri CallbackUri; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["identity"] = OSD.FromUri(Identity); - map["agent_id"] = OSD.FromUUID(AgentID); - map["session_id"] = OSD.FromUUID(SessionID); - map["secure_session_id"] = OSD.FromUUID(SecureSessionID); - map["circuit_code"] = OSD.FromInteger(CircuitCode); - map["region_handle"] = OSD.FromULong(RegionHandle); - map["child_agent"] = OSD.FromBoolean(ChildAgent); - map["ip"] = OSD.FromBinary(IP.GetAddressBytes()); - map["client_version"] = OSD.FromString(ClientVersion); - - OSDMap attributes = new OSDMap(Attributes.Count); - foreach (KeyValuePair entry in Attributes) - attributes.Add(entry.Key.ToString(), entry.Value); - map["attributes"] = attributes; - - OSDMap services = new OSDMap(Services.Count); - foreach (KeyValuePair> serviceEntry in Services) - { - OSDMap service = new OSDMap(); - foreach (KeyValuePair entry in serviceEntry.Value) - service.Add(entry.Key.ToString(), OSD.FromUri(entry.Value)); - services.Add(serviceEntry.Key.ToString(), service); - } - map["services"] = services; - - map["callback_uri"] = OSD.FromUri(CallbackUri); - return map; - } - - public void Deserialize(OSDMap map) - { - Identity = map["identity"].AsUri(); - AgentID = map["agent_id"].AsUUID(); - SessionID = map["session_id"].AsUUID(); - SecureSessionID = map["secure_session_id"].AsUUID(); - CircuitCode = map["circuit_code"].AsInteger(); - RegionHandle = map["region_handle"].AsULong(); - ChildAgent = map["child_agent"].AsBoolean(); - IP = new IPAddress(map["ip"].AsBinary()); - ClientVersion = map["client_version"].AsString(); - - OSDMap attributesMap = (OSDMap)map["attributes"]; - Attributes = new Dictionary(attributesMap.Count); - foreach (KeyValuePair entry in attributesMap) - Attributes.Add(new Uri(entry.Key), entry.Value); - - OSDMap servicesMap = (OSDMap)map["services"]; - Services = new Dictionary>(servicesMap.Count); - foreach (KeyValuePair serviceEntry in servicesMap) - { - OSDMap serviceMap = (OSDMap)serviceEntry.Value; - Dictionary service = new Dictionary(serviceMap.Count); - foreach (KeyValuePair entry in serviceMap) - service.Add(new Uri(entry.Key), entry.Value.AsUri()); - Services.Add(new Uri(serviceEntry.Key), service); - } - - CallbackUri = map["callback_uri"].AsUri(); - } - } - - public class EnableClientReplyMessage : IMessage - { - public bool Success; - public string Message; - public Uri SeedCapability; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(); - map["success"] = OSD.FromBoolean(Success); - map["message"] = OSD.FromString(Message); - map["seed_capability"] = OSD.FromUri(SeedCapability); - return map; - } - - public void Deserialize(OSDMap map) - { - Success = map["success"].AsBoolean(); - Message = map["message"].AsString(); - SeedCapability = map["seed_capability"].AsUri(); - } - } - - public class EnableClientCompleteMessage : IMessage - { - public UUID AgentID; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(1); - map["agent_id"] = OSD.FromUUID(AgentID); - return map; - } - - public void Deserialize(OSDMap map) - { - AgentID = map["agent_id"].AsUUID(); - } - } - - 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; - public UUID SessionID; - public Vector3 Position; - public Vector3 Velocity; - public ulong RegionHandle; - public Vector3 CameraPosition; - public Vector3 CameraAtAxis; - public Vector3 CameraLeftAxis; - public Vector3 CameraUpAxis; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(8); - map["agent_id"] = OSD.FromUUID(AgentID); - map["session_id"] = OSD.FromUUID(SessionID); - map["position"] = OSD.FromVector3(Position); - map["velocity"] = OSD.FromVector3(Velocity); - map["region_handle"] = OSD.FromULong(RegionHandle); - map["cam_position"] = OSD.FromVector3(CameraPosition); - map["cam_at_axis"] = OSD.FromVector3(CameraAtAxis); - map["cam_left_axis"] = OSD.FromVector3(CameraLeftAxis); - map["cam_up_axis"] = OSD.FromVector3(CameraUpAxis); - return map; - } - - public void Deserialize(OSDMap map) - { - AgentID = map["agent_id"].AsUUID(); - SessionID = map["session_id"].AsUUID(); - Position = map["position"].AsVector3(); - Velocity = map["velocity"].AsVector3(); - RegionHandle = map["region_handle"].AsULong(); - CameraPosition = map["cam_position"].AsVector3(); - CameraAtAxis = map["cam_at_axis"].AsVector3(); - CameraLeftAxis = map["cam_left_axis"].AsVector3(); - CameraUpAxis = map["cam_up_axis"].AsVector3(); - } - } - - public class PassObjectMessage : IMessage - { - public UUID ID; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(1); - map["id"] = OSD.FromUUID(ID); - return map; - } - - public void Deserialize(OSDMap map) - { - ID = map["id"].AsUUID(); - } - } - - public class PassObjectReplyMessage : IMessage - { - public bool Success; - public string Message; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(2); - map["success"] = OSD.FromBoolean(Success); - map["message"] = OSD.FromString(Message); - return map; - } - - public void Deserialize(OSDMap map) - { - Success = map["success"].AsBoolean(); - Message = map["message"].AsString(); - } - } - - public class FetchTerrainMessage : IMessage - { - public class FetchTerrainBlock - { - public int X; - public int Y; - } - - public FetchTerrainBlock[] Blocks; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(1); - - OSDArray array = new OSDArray(Blocks.Length); - for (int i = 0; i < Blocks.Length; i++) - { - OSDMap blockMap = new OSDMap(2); - blockMap["x"] = OSD.FromInteger(Blocks[i].X); - blockMap["y"] = OSD.FromInteger(Blocks[i].Y); - array.Add(blockMap); - } - - map["blocks"] = array; - - return map; - } - - public void Deserialize(OSDMap map) - { - OSDArray array = (OSDArray)map["blocks"]; - - Blocks = new FetchTerrainBlock[array.Count]; - - for (int i = 0; i < array.Count; i++) - { - OSDMap blockMap = (OSDMap)array[i]; - - FetchTerrainBlock block = new FetchTerrainBlock(); - block.X = blockMap["x"].AsInteger(); - block.Y = blockMap["y"].AsInteger(); - Blocks[i] = block; - } - } - } - - public class FetchTerrainReplyMessage : IMessage - { - public class FetchTerrainReplyBlock - { - public int X; - public int Y; - public byte[] Data; - } - - public FetchTerrainReplyBlock[] Blocks; - - public OSDMap Serialize() - { - OSDMap map = new OSDMap(1); - - OSDArray array = new OSDArray(Blocks.Length); - for (int i = 0; i < Blocks.Length; i++) - { - OSDMap blockMap = new OSDMap(2); - blockMap["x"] = OSD.FromInteger(Blocks[i].X); - blockMap["y"] = OSD.FromInteger(Blocks[i].Y); - blockMap["data"] = OSD.FromBinary(Blocks[i].Data); - array.Add(blockMap); - } - - map["blocks"] = array; - - return map; - } - - public void Deserialize(OSDMap map) - { - OSDArray array = (OSDArray)map["blocks"]; - Blocks = new FetchTerrainReplyBlock[array.Count]; - - for (int i = 0; i < array.Count; i++) - { - OSDMap blockMap = (OSDMap)array[i]; - - FetchTerrainReplyBlock block = new FetchTerrainReplyBlock(); - block.X = blockMap["x"].AsInteger(); - block.Y = blockMap["y"].AsInteger(); - block.Data = blockMap["data"].AsBinary(); - Blocks[i] = block; - } - } - } - - #endregion Simulator Messages -} diff --git a/data/cablebeach_message_template.msg b/data/cablebeach_message_template.msg deleted file mode 100644 index 8875a426..00000000 --- a/data/cablebeach_message_template.msg +++ /dev/null @@ -1,628 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// World Server -//////////////////////////////////////////////////////////////////////////////// - -®ion_info = -{ - name: string, - id: uuid, - handle: binary, - online: boolean, - ip: binary, - port: integer, - 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 -} - -%%delete_region - --> -{ - id: uuid -} - -<- -{ - success: boolean, - message: string -} - -%%region_update - --> -{ - region: region_info -} - -<- -{ - 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 - -&identity_attribute = string -&identity_attribute = integer -&identity_attribute = date -&identity_attribute = uuid -&identity_attribute = uri -&identity_attribute = [ real, real, real ] - -%%request_capabilities - --> -{ - identity: uri, - capabilities: [ uri, ... ] -} - -<- -{ - capabilities: { $: uri } -} - -%%authenticate_ll - --> -{ - first: string, - last: string, - md5_pass: string, - services: { $: [ string, ... ] } -} - -<- -{ - success: boolean, - message: string, - identity: uri, - attributes: { $: identity_attribute }, - services: { $: { $: uri } } -} - -%%authenticate_openid - --> -{ - identity: uri, - # FIXME: Need whatever piece of data OpenID uses to confirm auth - services: { $: [ string, ... ] } -} - -<- -{ - success: boolean, - message: string, - identity: uri, - attributes: { $: identity_attribute }, - services: { $: { $: uri } } -} - -//////////////////////////////////////////////////////////////////////////////// -// Assets -//////////////////////////////////////////////////////////////////////////////// - -&primitive = -{ - attachment_position: [ real, real, real ], - attachment_rotation: [ real, real, real, real ], - before_attachment_rotation: [ real, real, real, real ], - name: string, - perms_base: integer, - perms_owner: integer, - perms_group: integer, - perms_everyone: integer, - perms_next_owner: integer, - creator_identity: string, - owner_identity: string, - last_owner_identity: string, - group_identity: string, - last_attachment_point: integer, - link_number: integer, - local_id: integer, - position: [ real, real, real ], - rotation: [ real, real, real, real ], - velocity: [ real, real, real ], - angular_velocity: [ real, real, real ], - scale: [ real, real, real ], - sit_offset: [ real, real, real ], - sit_rotation: [ real, real, real, real ], - camera_eye_offset: [ real, real, real ], - camera_at_offset: [ real, real, real ], - state: integer, - material: integer, - sound_id: uuid, - sound_gain: real, - sound_radius: real, - sound_flags: integer, - text_color: [ real, real, real, real ], - selected: boolean, - selector_id: uuid, - use_physics: boolean, - phantom: boolean, - remote_script_access_pin: integer, - volume_detect: boolean, - die_at_edge: boolean, - return_at_edge: boolean, - temporary: boolean, - sandbox: boolean, - rez_time: date, - sale_price: integer, - sale_type: integer, - flexible: - { - softness: integer, - gravity: real, - drag: real, - wind: real, - tension: real, - force: [ real, real, real ] - }, - light: - { - color: [ real, real, real, real ], - intensity: real, - radius: real, - cutoff: real, - falloff: real - }, - sculpt: - { - sculpt_texture: uuid, - sculpt_type: integer - }, - particles: - { - flags: integer, - pattern: integer, - max_age: real, - start_age: real, - inner_angle: real, - outer_angle: real, - burst_rate: real, - burst_radius: real, - burst_speed_min: real, - burst_speed_max: real, - burst_particle_count: integer, - angular_velocity: [ real, real, real ], - acceleration: [ real, real, real ], - texture_id: uuid, - target_id: uuid, - data_flags: integer, - particle_max_age: real, - particle_start_color: [ real, real, real, real ], - particle_end_color: [ real, real, real, real ], - particle_start_scale_x: real, - particle_start_scale_y: real, - particle_end_scale_x: real, - particle_end_scale_y: real - }, - shape: - { - path_curve: integer, - path_begin: real, - path_end: real, - path_scale_x: real, - path_scale_y: real, - path_shear_x: real, - path_shear_y: real, - path_twist: real, - path_twist_begin: real, - path_radius_offset: real, - path_taper_x: real, - path_taper_y: real, - path_revolutions: real, - path_skew: real, - profile_curve: integer, - profile_begin: real, - profile_end: real, - profile_hollow: real - } - faces: - [ - { - face_index: integer, - image_id: uuid, - color: [ real, real, real, real ], - scale_s: real, - scale_t: real, - offset_s: real, - offset_t: real, - imagerot: real, - bump: integer, - fullbright: boolean, - media_flags: integer - }, - ... - ], - inventory: - { - serial: integer, - items: - [ - { - id: uuid, - parent_id: uuid, - name: string, - owner_identity: string, - creator_identity: string, - group_identity: string, - asset_id: uuid, - content_type: string, - description: string, - group_owned: boolean, - perms_base: binary, - perms_everyone: binary, - perms_group: binary, - perms_next: binary, - perms_owner: binary, - sale_price: integer, - sale_type: integer, - flags: integer, - creation_date: integer, - permission_granter: uuid, - granted_permissions: integer - }, - ... - ] - } -} - -%%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 = -{ - metadata: metadata, - base64_data: string -} - -&create = -{ - metadata: metadata, - base64_data: string -} - --> create - -<- -{ - asset_uri: uri, - asset_id: uuid -} - -%%delete_asset - --> -{ - id: uuid -} - -<- -{ - success: boolean, - message: string -} - -//////////////////////////////////////////////////////////////////////////////// -// Inventory -//////////////////////////////////////////////////////////////////////////////// - -&inventory_object = -{ - id: uuid, - parent_id: uuid, - name: string, - owner_id: uuid, - asset_id: uuid, - content_type: string, - creator_id: uuid, - group_id: uuid, - description: string, - group_owned: boolean, - perms_base: binary, - perms_everyone: binary, - perms_group: binary, - perms_next: binary, - perms_owner: binary, - sale_price: integer, - sale_type: integer, - flags: integer, - creation_date: integer -} - -&inventory_object = -{ - id: uuid, - parent_id: uuid, - name: string, - owner_id: uuid, - preferred_content_type: string, - version: integer, - children: [ inventory_object, ... ] -} - -%%create_inventory - --> -{ - identity: uri, - name: string -} - -<- -{ - root_folder_id: uuid -} - -%%create_object - --> -{ - identity: uri, - object: inventory_object -} - -<- -{ - success: boolean, - message: string, - object: inventory_object -} - -%%fetch_object - --> -{ - identity: uri, - object_id: uuid -} - -<- -{ - success: boolean, - message: string, - object: inventory_object -} - -%%purge_folder - --> -{ - identity: uri, - folder_id: uuid -} - -<- -{ - success: boolean, - message: string -} - -%%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 - --> -{ - identity: uri, - 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 - } - ] -}