From 064404ab409ddd0a3b25027a98582696295c46fd Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 31 Oct 2007 07:28:23 +0000 Subject: * Moved OpenSim/Framework/General to OpenSim/Framework for great justice. --- OpenSim/Framework/ACL.cs | 263 ++++++++ OpenSim/Framework/AgentCircuitManager.cs | 127 ++++ OpenSim/Framework/AgentCiruitData.cs | 52 ++ OpenSim/Framework/AgentInventory.cs | 258 ++++++++ OpenSim/Framework/AgentWearable.cs | 71 +++ OpenSim/Framework/AssemblyInfo.cs | 36 ++ OpenSim/Framework/AssetBase.cs | 55 ++ OpenSim/Framework/AssetConfig.cs | 83 +++ OpenSim/Framework/AssetLandmark.cs | 59 ++ OpenSim/Framework/AssetStorage.cs | 48 ++ OpenSim/Framework/AuthenticateResponse.cs | 39 ++ OpenSim/Framework/BlockingQueue.cs | 58 ++ OpenSim/Framework/ClientManager.cs | 135 ++++ OpenSim/Framework/ConfigurationMember.cs | 440 +++++++++++++ OpenSim/Framework/ConfigurationOption.cs | 60 ++ OpenSim/Framework/Culture.cs | 54 ++ OpenSim/Framework/EstateSettings.cs | 707 +++++++++++++++++++++ OpenSim/Framework/General/ACL.cs | 263 -------- OpenSim/Framework/General/AgentCircuitManager.cs | 127 ---- OpenSim/Framework/General/AgentCiruitData.cs | 52 -- OpenSim/Framework/General/AgentInventory.cs | 258 -------- OpenSim/Framework/General/AgentWearable.cs | 71 --- OpenSim/Framework/General/AssetBase.cs | 55 -- OpenSim/Framework/General/AssetConfig.cs | 83 --- OpenSim/Framework/General/AssetLandmark.cs | 59 -- OpenSim/Framework/General/AssetStorage.cs | 48 -- OpenSim/Framework/General/AuthenticateResponse.cs | 39 -- OpenSim/Framework/General/BlockingQueue.cs | 58 -- OpenSim/Framework/General/ClientManager.cs | 135 ---- OpenSim/Framework/General/ConfigurationMember.cs | 440 ------------- OpenSim/Framework/General/ConfigurationOption.cs | 60 -- OpenSim/Framework/General/Culture.cs | 54 -- OpenSim/Framework/General/EstateSettings.cs | 707 --------------------- OpenSim/Framework/General/GridConfig.cs | 136 ---- OpenSim/Framework/General/IAssetProvider.cs | 41 -- OpenSim/Framework/General/IAssetServer.cs | 69 -- OpenSim/Framework/General/IClientAPI.cs | 447 ------------- OpenSim/Framework/General/IGenericConfig.cs | 40 -- OpenSim/Framework/General/IPlugin.cs | 53 -- OpenSim/Framework/General/IRegionCommsListener.cs | 49 -- OpenSim/Framework/General/IScene.cs | 43 -- OpenSim/Framework/General/IUserData.cs | 134 ---- OpenSim/Framework/General/IUserService.cs | 48 -- OpenSim/Framework/General/InventoryConfig.cs | 67 -- OpenSim/Framework/General/InventoryItemBase.cs | 273 -------- OpenSim/Framework/General/LandData.cs | 123 ---- OpenSim/Framework/General/Login.cs | 50 -- OpenSim/Framework/General/MapBlockData.cs | 50 -- OpenSim/Framework/General/NeighbourInfo.cs | 42 -- OpenSim/Framework/General/NetworkServersInfo.cs | 100 --- OpenSim/Framework/General/PrimitiveBaseShape.cs | 214 ------- .../Framework/General/Properties/AssemblyInfo.cs | 36 -- OpenSim/Framework/General/RegionCommsListener.cs | 112 ---- OpenSim/Framework/General/RegionHandle.cs | 150 ----- OpenSim/Framework/General/RegionInfo.cs | 328 ---------- OpenSim/Framework/General/Remoting.cs | 134 ---- OpenSim/Framework/General/UUID.cs | 155 ----- OpenSim/Framework/General/UserConfig.cs | 103 --- OpenSim/Framework/General/UserProfileData.cs | 214 ------- OpenSim/Framework/General/Util.cs | 371 ----------- OpenSim/Framework/GridConfig.cs | 136 ++++ OpenSim/Framework/IAssetProvider.cs | 41 ++ OpenSim/Framework/IAssetServer.cs | 69 ++ OpenSim/Framework/IClientAPI.cs | 447 +++++++++++++ OpenSim/Framework/IGenericConfig.cs | 40 ++ OpenSim/Framework/IPlugin.cs | 53 ++ OpenSim/Framework/IRegionCommsListener.cs | 49 ++ OpenSim/Framework/IScene.cs | 43 ++ OpenSim/Framework/IUserData.cs | 134 ++++ OpenSim/Framework/IUserService.cs | 48 ++ OpenSim/Framework/InventoryConfig.cs | 67 ++ OpenSim/Framework/InventoryItemBase.cs | 273 ++++++++ OpenSim/Framework/LandData.cs | 123 ++++ OpenSim/Framework/Login.cs | 50 ++ OpenSim/Framework/MapBlockData.cs | 50 ++ OpenSim/Framework/NeighbourInfo.cs | 42 ++ OpenSim/Framework/NetworkServersInfo.cs | 100 +++ OpenSim/Framework/PrimitiveBaseShape.cs | 214 +++++++ OpenSim/Framework/RegionCommsListener.cs | 112 ++++ OpenSim/Framework/RegionHandle.cs | 150 +++++ OpenSim/Framework/RegionInfo.cs | 328 ++++++++++ OpenSim/Framework/Remoting.cs | 134 ++++ OpenSim/Framework/UUID.cs | 155 +++++ OpenSim/Framework/UserConfig.cs | 103 +++ OpenSim/Framework/UserProfileData.cs | 214 +++++++ OpenSim/Framework/Util.cs | 371 +++++++++++ 86 files changed, 6091 insertions(+), 6091 deletions(-) create mode 100644 OpenSim/Framework/ACL.cs create mode 100644 OpenSim/Framework/AgentCircuitManager.cs create mode 100644 OpenSim/Framework/AgentCiruitData.cs create mode 100644 OpenSim/Framework/AgentInventory.cs create mode 100644 OpenSim/Framework/AgentWearable.cs create mode 100644 OpenSim/Framework/AssemblyInfo.cs create mode 100644 OpenSim/Framework/AssetBase.cs create mode 100644 OpenSim/Framework/AssetConfig.cs create mode 100644 OpenSim/Framework/AssetLandmark.cs create mode 100644 OpenSim/Framework/AssetStorage.cs create mode 100644 OpenSim/Framework/AuthenticateResponse.cs create mode 100644 OpenSim/Framework/BlockingQueue.cs create mode 100644 OpenSim/Framework/ClientManager.cs create mode 100644 OpenSim/Framework/ConfigurationMember.cs create mode 100644 OpenSim/Framework/ConfigurationOption.cs create mode 100644 OpenSim/Framework/Culture.cs create mode 100644 OpenSim/Framework/EstateSettings.cs delete mode 100644 OpenSim/Framework/General/ACL.cs delete mode 100644 OpenSim/Framework/General/AgentCircuitManager.cs delete mode 100644 OpenSim/Framework/General/AgentCiruitData.cs delete mode 100644 OpenSim/Framework/General/AgentInventory.cs delete mode 100644 OpenSim/Framework/General/AgentWearable.cs delete mode 100644 OpenSim/Framework/General/AssetBase.cs delete mode 100644 OpenSim/Framework/General/AssetConfig.cs delete mode 100644 OpenSim/Framework/General/AssetLandmark.cs delete mode 100644 OpenSim/Framework/General/AssetStorage.cs delete mode 100644 OpenSim/Framework/General/AuthenticateResponse.cs delete mode 100644 OpenSim/Framework/General/BlockingQueue.cs delete mode 100644 OpenSim/Framework/General/ClientManager.cs delete mode 100644 OpenSim/Framework/General/ConfigurationMember.cs delete mode 100644 OpenSim/Framework/General/ConfigurationOption.cs delete mode 100644 OpenSim/Framework/General/Culture.cs delete mode 100644 OpenSim/Framework/General/EstateSettings.cs delete mode 100644 OpenSim/Framework/General/GridConfig.cs delete mode 100644 OpenSim/Framework/General/IAssetProvider.cs delete mode 100644 OpenSim/Framework/General/IAssetServer.cs delete mode 100644 OpenSim/Framework/General/IClientAPI.cs delete mode 100644 OpenSim/Framework/General/IGenericConfig.cs delete mode 100644 OpenSim/Framework/General/IPlugin.cs delete mode 100644 OpenSim/Framework/General/IRegionCommsListener.cs delete mode 100644 OpenSim/Framework/General/IScene.cs delete mode 100644 OpenSim/Framework/General/IUserData.cs delete mode 100644 OpenSim/Framework/General/IUserService.cs delete mode 100644 OpenSim/Framework/General/InventoryConfig.cs delete mode 100644 OpenSim/Framework/General/InventoryItemBase.cs delete mode 100644 OpenSim/Framework/General/LandData.cs delete mode 100644 OpenSim/Framework/General/Login.cs delete mode 100644 OpenSim/Framework/General/MapBlockData.cs delete mode 100644 OpenSim/Framework/General/NeighbourInfo.cs delete mode 100644 OpenSim/Framework/General/NetworkServersInfo.cs delete mode 100644 OpenSim/Framework/General/PrimitiveBaseShape.cs delete mode 100644 OpenSim/Framework/General/Properties/AssemblyInfo.cs delete mode 100644 OpenSim/Framework/General/RegionCommsListener.cs delete mode 100644 OpenSim/Framework/General/RegionHandle.cs delete mode 100644 OpenSim/Framework/General/RegionInfo.cs delete mode 100644 OpenSim/Framework/General/Remoting.cs delete mode 100644 OpenSim/Framework/General/UUID.cs delete mode 100644 OpenSim/Framework/General/UserConfig.cs delete mode 100644 OpenSim/Framework/General/UserProfileData.cs delete mode 100644 OpenSim/Framework/General/Util.cs create mode 100644 OpenSim/Framework/GridConfig.cs create mode 100644 OpenSim/Framework/IAssetProvider.cs create mode 100644 OpenSim/Framework/IAssetServer.cs create mode 100644 OpenSim/Framework/IClientAPI.cs create mode 100644 OpenSim/Framework/IGenericConfig.cs create mode 100644 OpenSim/Framework/IPlugin.cs create mode 100644 OpenSim/Framework/IRegionCommsListener.cs create mode 100644 OpenSim/Framework/IScene.cs create mode 100644 OpenSim/Framework/IUserData.cs create mode 100644 OpenSim/Framework/IUserService.cs create mode 100644 OpenSim/Framework/InventoryConfig.cs create mode 100644 OpenSim/Framework/InventoryItemBase.cs create mode 100644 OpenSim/Framework/LandData.cs create mode 100644 OpenSim/Framework/Login.cs create mode 100644 OpenSim/Framework/MapBlockData.cs create mode 100644 OpenSim/Framework/NeighbourInfo.cs create mode 100644 OpenSim/Framework/NetworkServersInfo.cs create mode 100644 OpenSim/Framework/PrimitiveBaseShape.cs create mode 100644 OpenSim/Framework/RegionCommsListener.cs create mode 100644 OpenSim/Framework/RegionHandle.cs create mode 100644 OpenSim/Framework/RegionInfo.cs create mode 100644 OpenSim/Framework/Remoting.cs create mode 100644 OpenSim/Framework/UUID.cs create mode 100644 OpenSim/Framework/UserConfig.cs create mode 100644 OpenSim/Framework/UserProfileData.cs create mode 100644 OpenSim/Framework/Util.cs (limited to 'OpenSim') diff --git a/OpenSim/Framework/ACL.cs b/OpenSim/Framework/ACL.cs new file mode 100644 index 0000000..8f9c6e7 --- /dev/null +++ b/OpenSim/Framework/ACL.cs @@ -0,0 +1,263 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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; + +namespace OpenSim.Framework +{ + // ACL Class + // Modelled after the structure of the Zend ACL Framework Library + // with one key difference - the tree will search for all matching + // permissions rather than just the first. Deny permissions will + // override all others. + + #region ACL Core Class + + /// + /// Access Control List Engine + /// + public class ACL + { + private Dictionary Roles = new Dictionary(); + private Dictionary Resources = new Dictionary(); + + public ACL AddRole(Role role) + { + if (Roles.ContainsKey(role.Name)) + throw new AlreadyContainsRoleException(role); + + Roles.Add(role.Name, role); + + return this; + } + + public ACL AddResource(Resource resource) + { + Resources.Add(resource.Name, resource); + + return this; + } + + public Permission HasPermission(string role, string resource) + { + if (!Roles.ContainsKey(role)) + throw new KeyNotFoundException(); + + if (!Resources.ContainsKey(resource)) + throw new KeyNotFoundException(); + + return Roles[role].RequestPermission(resource); + } + + public ACL GrantPermission(string role, string resource) + { + if (!Roles.ContainsKey(role)) + throw new KeyNotFoundException(); + + if (!Resources.ContainsKey(resource)) + throw new KeyNotFoundException(); + + Roles[role].GivePermission(resource, Permission.Allow); + + return this; + } + + public ACL DenyPermission(string role, string resource) + { + if (!Roles.ContainsKey(role)) + throw new KeyNotFoundException(); + + if (!Resources.ContainsKey(resource)) + throw new KeyNotFoundException(); + + Roles[role].GivePermission(resource, Permission.Deny); + + return this; + } + + public ACL ResetPermission(string role, string resource) + { + if (!Roles.ContainsKey(role)) + throw new KeyNotFoundException(); + + if (!Resources.ContainsKey(resource)) + throw new KeyNotFoundException(); + + Roles[role].GivePermission(resource, Permission.None); + + return this; + } + } + + #endregion + + #region Exceptions + + /// + /// Thrown when an ACL attempts to add a duplicate role. + /// + public class AlreadyContainsRoleException : Exception + { + protected Role m_role; + + public Role ErrorRole + { + get { return m_role; } + } + + public AlreadyContainsRoleException(Role role) + { + m_role = role; + } + + public override string ToString() + { + return "This ACL already contains a role called '" + m_role.Name + "'."; + } + } + + #endregion + + #region Roles and Resources + + /// + /// Does this Role have permission to access a specified Resource? + /// + public enum Permission + { + Deny, + None, + Allow + } ; + + /// + /// A role class, for use with Users or Groups + /// + public class Role + { + private string m_name; + private Role[] m_parents; + private Dictionary m_resources = new Dictionary(); + + public string Name + { + get { return m_name; } + } + + public Permission RequestPermission(string resource) + { + return RequestPermission(resource, Permission.None); + } + + public Permission RequestPermission(string resource, Permission current) + { + // Deny permissions always override any others + if (current == Permission.Deny) + return current; + + Permission temp = Permission.None; + + // Pickup non-None permissions + if (m_resources.ContainsKey(resource) && m_resources[resource] != Permission.None) + temp = m_resources[resource]; + + if (m_parents != null) + { + foreach (Role parent in m_parents) + { + temp = parent.RequestPermission(resource, temp); + } + } + + return temp; + } + + public void GivePermission(string resource, Permission perm) + { + m_resources[resource] = perm; + } + + public Role(string name) + { + m_name = name; + m_parents = null; + } + + public Role(string name, Role[] parents) + { + m_name = name; + m_parents = parents; + } + } + + public class Resource + { + private string m_name; + + public string Name + { + get { return m_name; } + } + + public Resource(string name) + { + m_name = name; + } + } + + #endregion + + #region Tests + + internal class ACLTester + { + public ACLTester() + { + ACL acl = new ACL(); + + Role Guests = new Role("Guests"); + acl.AddRole(Guests); + + Role[] parents = new Role[0]; + parents[0] = Guests; + + Role JoeGuest = new Role("JoeGuest", parents); + acl.AddRole(JoeGuest); + + Resource CanBuild = new Resource("CanBuild"); + acl.AddResource(CanBuild); + + + acl.GrantPermission("Guests", "CanBuild"); + + acl.HasPermission("JoeGuest", "CanBuild"); + } + } + + #endregion +} \ No newline at end of file diff --git a/OpenSim/Framework/AgentCircuitManager.cs b/OpenSim/Framework/AgentCircuitManager.cs new file mode 100644 index 0000000..3658feb --- /dev/null +++ b/OpenSim/Framework/AgentCircuitManager.cs @@ -0,0 +1,127 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Collections.Generic; +using libsecondlife; + +namespace OpenSim.Framework +{ + public class AgentCircuitManager + { + public Dictionary AgentCircuits = new Dictionary(); + + public AgentCircuitManager() + { + } + + public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) + { + AgentCircuitData validcircuit = null; + if (AgentCircuits.ContainsKey(circuitcode)) + { + validcircuit = AgentCircuits[circuitcode]; + } + AuthenticateResponse user = new AuthenticateResponse(); + if (validcircuit == null) + { + //don't have this circuit code in our list + user.Authorised = false; + return (user); + } + + if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID)) + { + user.Authorised = true; + user.LoginInfo = new Login(); + user.LoginInfo.Agent = agentID; + user.LoginInfo.Session = sessionID; + user.LoginInfo.SecureSession = validcircuit.SecureSessionID; + user.LoginInfo.First = validcircuit.firstname; + user.LoginInfo.Last = validcircuit.lastname; + user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder; + user.LoginInfo.BaseFolder = validcircuit.BaseFolder; + } + else + { + // Invalid + user.Authorised = false; + } + + return (user); + } + + public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) + { + if (AgentCircuits.ContainsKey(circuitCode)) + { + AgentCircuits[circuitCode] = agentData; + } + else + { + AgentCircuits.Add(circuitCode, agentData); + } + } + + public LLVector3 GetPosition(uint circuitCode) + { + LLVector3 vec = new LLVector3(); + if (AgentCircuits.ContainsKey(circuitCode)) + { + vec = AgentCircuits[circuitCode].startpos; + } + return vec; + } + + public void UpdateAgentData(AgentCircuitData agentData) + { + if (AgentCircuits.ContainsKey((uint) agentData.circuitcode)) + { + AgentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname; + AgentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname; + AgentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos; + // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); + } + } + + public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) + { + if (AgentCircuits.ContainsKey(circuitcode)) + { + AgentCircuits[circuitcode].child = childstatus; + } + } + + public bool GetAgentChildStatus(uint circuitcode) + { + if (AgentCircuits.ContainsKey(circuitcode)) + { + return AgentCircuits[circuitcode].child; + } + return false; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/AgentCiruitData.cs b/OpenSim/Framework/AgentCiruitData.cs new file mode 100644 index 0000000..3f17ca8 --- /dev/null +++ b/OpenSim/Framework/AgentCiruitData.cs @@ -0,0 +1,52 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; + +namespace OpenSim.Framework +{ + [Serializable] + public class AgentCircuitData + { + public AgentCircuitData() + { + } + + public LLUUID AgentID; + public LLUUID SessionID; + public LLUUID SecureSessionID; + public LLVector3 startpos; + public string firstname; + public string lastname; + public uint circuitcode; + public bool child; + public LLUUID InventoryFolder; + public LLUUID BaseFolder; + public string CapsPath = ""; + } +} \ No newline at end of file diff --git a/OpenSim/Framework/AgentInventory.cs b/OpenSim/Framework/AgentInventory.cs new file mode 100644 index 0000000..7a1174a --- /dev/null +++ b/OpenSim/Framework/AgentInventory.cs @@ -0,0 +1,258 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; + +namespace OpenSim.Framework +{ + public class AgentInventory + { + //Holds the local copy of Inventory info for a agent + public Dictionary InventoryFolders; + public Dictionary InventoryItems; + public InventoryFolder InventoryRoot; + public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server + public LLUUID AgentID; + public AvatarWearable[] Wearables; + + public AgentInventory() + { + InventoryFolders = new Dictionary(); + InventoryItems = new Dictionary(); + Initialise(); + } + + public virtual void Initialise() + { + Wearables = new AvatarWearable[13]; + for (int i = 0; i < 13; i++) + { + Wearables[i] = new AvatarWearable(); + } + } + + public bool CreateNewFolder(LLUUID folderID, ushort type) + { + InventoryFolder Folder = new InventoryFolder(); + Folder.FolderID = folderID; + Folder.OwnerID = AgentID; + Folder.DefaultType = type; + InventoryFolders.Add(Folder.FolderID, Folder); + return (true); + } + + public void CreateRootFolder(LLUUID newAgentID, bool createTextures) + { + AgentID = newAgentID; + InventoryRoot = new InventoryFolder(); + InventoryRoot.FolderID = LLUUID.Random(); + InventoryRoot.ParentID = new LLUUID(); + InventoryRoot.Version = 1; + InventoryRoot.DefaultType = 8; + InventoryRoot.OwnerID = AgentID; + InventoryRoot.FolderName = "My Inventory"; + InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); + InventoryRoot.OwnerID = AgentID; + if (createTextures) + { + CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID); + } + } + + public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName) + { + InventoryFolder Folder = new InventoryFolder(); + Folder.FolderID = folderID; + Folder.OwnerID = AgentID; + Folder.DefaultType = type; + Folder.FolderName = folderName; + InventoryFolders.Add(Folder.FolderID, Folder); + return (true); + } + + public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID) + { + if (!InventoryFolders.ContainsKey(folderID)) + { + System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory"); + InventoryFolder Folder = new InventoryFolder(); + Folder.FolderID = folderID; + Folder.OwnerID = AgentID; + Folder.DefaultType = type; + Folder.FolderName = folderName; + Folder.ParentID = parentID; + InventoryFolders.Add(Folder.FolderID, Folder); + } + return (true); + } + + public bool HasFolder(LLUUID folderID) + { + if (InventoryFolders.ContainsKey(folderID)) + { + return true; + } + return false; + } + + public LLUUID GetFolderID(string folderName) + { + foreach (InventoryFolder inv in InventoryFolders.Values) + { + if (inv.FolderName == folderName) + { + return inv.FolderID; + } + } + return LLUUID.Zero; + } + + public bool UpdateItemAsset(LLUUID itemID, AssetBase asset) + { + if (InventoryItems.ContainsKey(itemID)) + { + InventoryItem Item = InventoryItems[itemID]; + Item.AssetID = asset.FullID; + System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + + " so it now is set to asset " + asset.FullID.ToStringHyphenated()); + //TODO need to update the rest of the info + } + return true; + } + + public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) + { + System.Console.WriteLine("updating inventory item details"); + if (InventoryItems.ContainsKey(itemID)) + { + System.Console.WriteLine("changing name to " + Util.FieldToString(packet.Name)); + InventoryItem Item = InventoryItems[itemID]; + Item.Name = Util.FieldToString(packet.Name); + System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated()); + //TODO need to update the rest of the info + } + return true; + } + + public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) + { + if (InventoryFolders.ContainsKey(folderID)) + { + LLUUID NewItemID = LLUUID.Random(); + + InventoryItem Item = new InventoryItem(); + Item.FolderID = folderID; + Item.OwnerID = AgentID; + Item.AssetID = asset.FullID; + Item.ItemID = NewItemID; + Item.Type = asset.Type; + Item.Name = asset.Name; + Item.Description = asset.Description; + Item.InvType = asset.InvType; + InventoryItems.Add(Item.ItemID, Item); + InventoryFolder Folder = InventoryFolders[Item.FolderID]; + Folder.Items.Add(Item); + return (Item.ItemID); + } + else + { + return (null); + } + } + + public bool DeleteFromInventory(LLUUID itemID) + { + bool res = false; + if (InventoryItems.ContainsKey(itemID)) + { + InventoryItem item = InventoryItems[itemID]; + InventoryItems.Remove(itemID); + foreach (InventoryFolder fold in InventoryFolders.Values) + { + if (fold.Items.Contains(item)) + { + fold.Items.Remove(item); + break; + } + } + res = true; + } + return res; + } + } + + public class InventoryFolder + { + public List Items; + //public List Subfolders; + public LLUUID FolderID; + public LLUUID OwnerID; + public LLUUID ParentID = LLUUID.Zero; + public string FolderName; + public ushort DefaultType; + public ushort Version; + + public InventoryFolder() + { + Items = new List(); + //Subfolders = new List(); + } + } + + public class InventoryItem + { + public LLUUID FolderID; + public LLUUID OwnerID; + public LLUUID ItemID; + public LLUUID AssetID; + public LLUUID CreatorID; + public sbyte InvType; + public sbyte Type; + public string Name = ""; + public string Description; + + public InventoryItem() + { + CreatorID = LLUUID.Zero; + } + + public string ExportString() + { + string typ = "notecard"; + string result = ""; + result += "\tinv_object\t0\n\t{\n"; + result += "\t\tobj_id\t%s\n"; + result += "\t\tparent_id\t" + ItemID.ToString() + "\n"; + result += "\t\ttype\t" + typ + "\n"; + result += "\t\tname\t" + Name + "|\n"; + result += "\t}\n"; + return result; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/AgentWearable.cs b/OpenSim/Framework/AgentWearable.cs new file mode 100644 index 0000000..a324cb3 --- /dev/null +++ b/OpenSim/Framework/AgentWearable.cs @@ -0,0 +1,71 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; + +namespace OpenSim.Framework +{ + public class AvatarWearable + { + public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); + public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); + + public AvatarWearable() + { + } + + public AvatarWearable(LLUUID itemId, LLUUID assetId) + { + AssetID = assetId; + ItemID = itemId; + } + + public static AvatarWearable[] DefaultWearables + { + get + { + AvatarWearable[] defaultWearables = new AvatarWearable[13]; //should be 13 of these + for (int i = 0; i < 13; i++) + { + defaultWearables[i] = new AvatarWearable(); + } + defaultWearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); + defaultWearables[0].ItemID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"); + + defaultWearables[1].ItemID = new LLUUID("77c41e39-38f9-f75a-024e-585989bfabc9"); + defaultWearables[1].AssetID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); + + defaultWearables[4].ItemID = new LLUUID("77c41e39-38f9-f75a-0000-585989bf0000"); + defaultWearables[4].AssetID = new LLUUID("00000000-38f9-1111-024e-222222111110"); + + defaultWearables[5].ItemID = new LLUUID("77c41e39-38f9-f75a-0000-5859892f1111"); + defaultWearables[5].AssetID = new LLUUID("00000000-38f9-1111-024e-222222111120"); + return defaultWearables; + } + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/AssemblyInfo.cs b/OpenSim/Framework/AssemblyInfo.cs new file mode 100644 index 0000000..b3206a7 --- /dev/null +++ b/OpenSim/Framework/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly : AssemblyTitle("OpenSim.FrameWork")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenSim.FrameWork")] +[assembly : AssemblyCopyright("Copyright © 2007")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly : ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly : Guid("a08e20c7-f191-4137-b1f0-9291408fa521")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// + +[assembly : AssemblyVersion("1.0.0.0")] +[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs new file mode 100644 index 0000000..ef1ee71 --- /dev/null +++ b/OpenSim/Framework/AssetBase.cs @@ -0,0 +1,55 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; + +namespace OpenSim.Framework +{ + [Serializable] + public class AssetBase + { + public byte[] Data; + public LLUUID FullID; + public sbyte Type; + public sbyte InvType; + public string Name = ""; + public string Description = ""; + public bool Local = false; + public bool Temporary = false; + + public AssetBase() + { + } + + public AssetBase(LLUUID assetId, string name) + { + FullID = assetId; + Name = name; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/AssetConfig.cs b/OpenSim/Framework/AssetConfig.cs new file mode 100644 index 0000000..fe77ab8 --- /dev/null +++ b/OpenSim/Framework/AssetConfig.cs @@ -0,0 +1,83 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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. +* +*/ + +namespace OpenSim.Framework +{ + /// + /// UserConfig -- For User Server Configuration + /// + public class AssetConfig + { + public string DefaultStartupMsg = ""; + + public string DatabaseProvider = ""; + + public static uint DefaultHttpPort = 8003; + public uint HttpPort = DefaultHttpPort; + + private ConfigurationMember configMember; + + public AssetConfig(string description, string filename) + { + configMember = + new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); + configMember.performConfigurationRetrieve(); + } + + public void loadConfigurationOptions() + { + configMember.addConfigurationOption("default_startup_message", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Default Startup Message", "Welcome to OGS", false); + + configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); + + configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, + "Http Listener port", DefaultHttpPort.ToString(), false); + } + + public bool handleIncomingConfiguration(string configuration_key, object configuration_result) + { + switch (configuration_key) + { + case "default_startup_message": + DefaultStartupMsg = (string) configuration_result; + break; + case "database_provider": + DatabaseProvider = (string) configuration_result; + break; + case "http_port": + HttpPort = (uint) configuration_result; + break; + } + + return true; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs new file mode 100644 index 0000000..4422331 --- /dev/null +++ b/OpenSim/Framework/AssetLandmark.cs @@ -0,0 +1,59 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Text; +using libsecondlife; + +namespace OpenSim.Framework +{ + public class AssetLandmark : AssetBase + { + public int Version; + public LLVector3 Position; + public LLUUID RegionID; + + public AssetLandmark(AssetBase a) + { + Data = a.Data; + FullID = a.FullID; + Type = a.Type; + InvType = a.InvType; + Name = a.Name; + Description = a.Description; + InternData(); + } + + private void InternData() + { + string temp = Encoding.UTF8.GetString(Data).Trim(); + string[] parts = temp.Split('\n'); + int.TryParse(parts[0].Substring(17, 1), out Version); + LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID); + LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position); + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/AssetStorage.cs b/OpenSim/Framework/AssetStorage.cs new file mode 100644 index 0000000..9d3de5b --- /dev/null +++ b/OpenSim/Framework/AssetStorage.cs @@ -0,0 +1,48 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; + +namespace OpenSim.Framework +{ + public class AssetStorage + { + public AssetStorage() + { + } + + public AssetStorage(LLUUID assetUUID) + { + UUID = assetUUID; + } + + public byte[] Data; + public sbyte Type; + public string Name; + public LLUUID UUID; + } +} \ No newline at end of file diff --git a/OpenSim/Framework/AuthenticateResponse.cs b/OpenSim/Framework/AuthenticateResponse.cs new file mode 100644 index 0000000..88a8713 --- /dev/null +++ b/OpenSim/Framework/AuthenticateResponse.cs @@ -0,0 +1,39 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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. +* +*/ +namespace OpenSim.Framework +{ + public class AuthenticateResponse + { + public bool Authorised; + public Login LoginInfo; + + public AuthenticateResponse() + { + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs new file mode 100644 index 0000000..006fbc8 --- /dev/null +++ b/OpenSim/Framework/BlockingQueue.cs @@ -0,0 +1,58 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Collections.Generic; +using System.Threading; + +namespace OpenSim.Framework +{ + public class BlockingQueue + { + private Queue _queue = new Queue(); + private object _queueSync = new object(); + + public void Enqueue(T value) + { + lock (_queueSync) + { + _queue.Enqueue(value); + Monitor.Pulse(_queueSync); + } + } + + public T Dequeue() + { + lock (_queueSync) + { + if (_queue.Count < 1) + Monitor.Wait(_queueSync); + + return _queue.Dequeue(); + } + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs new file mode 100644 index 0000000..e34c051 --- /dev/null +++ b/OpenSim/Framework/ClientManager.cs @@ -0,0 +1,135 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; + +namespace OpenSim.Framework +{ + public delegate void ForEachClientDelegate(IClientAPI client); + + public class ClientManager + { + private Dictionary m_clients; + + public void ForEachClient(ForEachClientDelegate whatToDo) + { + foreach (IClientAPI client in m_clients.Values) + { + whatToDo(client); + } + } + + public ClientManager() + { + m_clients = new Dictionary(); + } + + private void Remove(uint id) + { + m_clients.Remove(id); + } + + public void Add(uint id, IClientAPI client) + { + m_clients.Add(id, client); + } + + public void InPacket(uint circuitCode, Packet packet) + { + IClientAPI client; + + if (m_clients.TryGetValue(circuitCode, out client)) + { + client.InPacket(packet); + } + } + + public void CloseAllAgents(uint circuitCode) + { + IClientAPI client; + + if (m_clients.TryGetValue(circuitCode, out client)) + { + CloseAllCircuits(client.AgentId); + } + } + + public void CloseAllCircuits(LLUUID agentId) + { + uint[] circuits = GetAllCircuits(agentId); + foreach (uint circuit in circuits) + { + IClientAPI client; + if (m_clients.TryGetValue(circuit, out client)) + { + Remove(circuit); + client.Close(); + } + } + } + + private uint[] GetAllCircuits(LLUUID agentId) + { + List circuits = new List(); + + foreach (KeyValuePair pair in m_clients) + { + if (pair.Value.AgentId == agentId) + { + circuits.Add(pair.Key); + } + } + + return circuits.ToArray(); + } + + + public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) + { + ViewerEffectPacket packet = new ViewerEffectPacket(); + packet.Effect = effectBlock; + + foreach (IClientAPI client in m_clients.Values) + { + if (client.AgentId != sender.AgentId) + { + packet.AgentData.AgentID = client.AgentId; + packet.AgentData.SessionID = client.SessionId; + client.OutPacket(packet); + } + } + } + + public bool TryGetClient(uint circuitId, out IClientAPI user) + { + return m_clients.TryGetValue(circuitId, out user); + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs new file mode 100644 index 0000000..b68896c --- /dev/null +++ b/OpenSim/Framework/ConfigurationMember.cs @@ -0,0 +1,440 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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.Globalization; +using System.Net; +using System.Reflection; +using libsecondlife; +using OpenSim.Framework.Console; + +namespace OpenSim.Framework +{ + public class ConfigurationMember + { + public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); + + public delegate void ConfigurationOptionsLoad(); + + private List configurationOptions = new List(); + private string configurationFilename = ""; + private string configurationDescription = ""; + + private ConfigurationOptionsLoad loadFunction; + private ConfigurationOptionResult resultFunction; + + private IGenericConfig configurationPlugin = null; + + /// + /// This is the default configuration DLL loaded + /// + private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll"; + + public ConfigurationMember(string configuration_filename, string configuration_description, + ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) + { + configurationFilename = configuration_filename; + configurationDescription = configuration_description; + loadFunction = load_function; + resultFunction = result_function; + } + + public void setConfigurationFilename(string filename) + { + configurationFilename = filename; + } + + public void setConfigurationDescription(string desc) + { + configurationDescription = desc; + } + + public void setConfigurationResultFunction(ConfigurationOptionResult result) + { + resultFunction = result; + } + + public void forceConfigurationPluginLibrary(string dll_filename) + { + configurationPluginFilename = dll_filename; + } + + public void addConfigurationOption(string configuration_key, + ConfigurationOption.ConfigurationTypes configuration_type, + string configuration_question, string configuration_default, + bool use_default_no_prompt) + { + ConfigurationOption configOption = new ConfigurationOption(); + configOption.configurationKey = configuration_key; + configOption.configurationQuestion = configuration_question; + configOption.configurationDefault = configuration_default; + configOption.configurationType = configuration_type; + configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; + + if ((configuration_key != "" && configuration_question != "") || + (configuration_key != "" && use_default_no_prompt)) + { + if (!configurationOptions.Contains(configOption)) + { + configurationOptions.Add(configOption); + } + } + else + { + MainLog.Instance.Notice( + "Required fields for adding a configuration option is invalid. Will not add this option (" + + configuration_key + ")"); + } + } + + public void performConfigurationRetrieve() + { + configurationPlugin = LoadConfigDll(configurationPluginFilename); + configurationOptions.Clear(); + if (loadFunction == null) + { + MainLog.Instance.Error("Load Function for '" + configurationDescription + + "' is null. Refusing to run configuration."); + return; + } + + if (resultFunction == null) + { + MainLog.Instance.Error("Result Function for '" + configurationDescription + + "' is null. Refusing to run configuration."); + return; + } + + MainLog.Instance.Verbose("Calling Configuration Load Function..."); + loadFunction(); + + if (configurationOptions.Count <= 0) + { + MainLog.Instance.Error("No configuration options were specified for '" + configurationOptions + + "'. Refusing to continue configuration."); + return; + } + + bool useFile = true; + if (configurationPlugin == null) + { + MainLog.Instance.Error("Configuration Plugin NOT LOADED!"); + return; + } + + if (configurationFilename.Trim() != "") + { + configurationPlugin.SetFileName(configurationFilename); + configurationPlugin.LoadData(); + useFile = true; + } + else + { + MainLog.Instance.Notice("XML Configuration Filename is not valid; will not save to the file."); + useFile = false; + } + + foreach (ConfigurationOption configOption in configurationOptions) + { + bool convertSuccess = false; + object return_result = null; + string errorMessage = ""; + bool ignoreNextFromConfig = false; + while (convertSuccess == false) + { + string console_result = ""; + string attribute = null; + if (useFile) + { + if (!ignoreNextFromConfig) + { + attribute = configurationPlugin.GetAttribute(configOption.configurationKey); + } + else + { + ignoreNextFromConfig = false; + } + } + + if (attribute == null) + { + if (configOption.configurationUseDefaultNoPrompt) + { + console_result = configOption.configurationDefault; + } + else + { + if (configurationDescription.Trim() != "") + { + console_result = + MainLog.Instance.CmdPrompt( + configurationDescription + ": " + configOption.configurationQuestion, + configOption.configurationDefault); + } + else + { + console_result = + MainLog.Instance.CmdPrompt(configOption.configurationQuestion, + configOption.configurationDefault); + } + } + } + else + { + console_result = attribute; + } + + switch (configOption.configurationType) + { + case ConfigurationOption.ConfigurationTypes.TYPE_STRING: + return_result = console_result; + convertSuccess = true; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY: + if (console_result.Length > 0) + { + return_result = console_result; + convertSuccess = true; + } + errorMessage = "a string that is not empty"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN: + bool boolResult; + if (Boolean.TryParse(console_result, out boolResult)) + { + convertSuccess = true; + return_result = boolResult; + } + errorMessage = "'true' or 'false' (Boolean)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_BYTE: + byte byteResult; + if (Byte.TryParse(console_result, out byteResult)) + { + convertSuccess = true; + return_result = byteResult; + } + errorMessage = "a byte (Byte)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_CHARACTER: + char charResult; + if (Char.TryParse(console_result, out charResult)) + { + convertSuccess = true; + return_result = charResult; + } + errorMessage = "a character (Char)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_INT16: + short shortResult; + if (Int16.TryParse(console_result, out shortResult)) + { + convertSuccess = true; + return_result = shortResult; + } + errorMessage = "a signed 32 bit integer (short)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_INT32: + int intResult; + if (Int32.TryParse(console_result, out intResult)) + { + convertSuccess = true; + return_result = intResult; + } + errorMessage = "a signed 32 bit integer (int)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_INT64: + long longResult; + if (Int64.TryParse(console_result, out longResult)) + { + convertSuccess = true; + return_result = longResult; + } + errorMessage = "a signed 32 bit integer (long)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS: + IPAddress ipAddressResult; + if (IPAddress.TryParse(console_result, out ipAddressResult)) + { + convertSuccess = true; + return_result = ipAddressResult; + } + errorMessage = "an IP Address (IPAddress)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_LLUUID: + LLUUID uuidResult; + if (LLUUID.TryParse(console_result, out uuidResult)) + { + convertSuccess = true; + return_result = uuidResult; + } + errorMessage = "a UUID (LLUUID)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_LLVECTOR3: + LLVector3 vectorResult; + if (LLVector3.TryParse(console_result, out vectorResult)) + { + convertSuccess = true; + return_result = vectorResult; + } + errorMessage = "a vector (LLVector3)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_UINT16: + ushort ushortResult; + if (UInt16.TryParse(console_result, out ushortResult)) + { + convertSuccess = true; + return_result = ushortResult; + } + errorMessage = "an unsigned 16 bit integer (ushort)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_UINT32: + uint uintResult; + if (UInt32.TryParse(console_result, out uintResult)) + { + convertSuccess = true; + return_result = uintResult; + } + errorMessage = "an unsigned 32 bit integer (uint)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_UINT64: + ulong ulongResult; + if (UInt64.TryParse(console_result, out ulongResult)) + { + convertSuccess = true; + return_result = ulongResult; + } + errorMessage = "an unsigned 64 bit integer (ulong)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: + float floatResult; + if ( + float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, + out floatResult)) + { + convertSuccess = true; + return_result = floatResult; + } + errorMessage = "a single-precision floating point number (float)"; + break; + case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: + double doubleResult; + if ( + Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, + out doubleResult)) + { + convertSuccess = true; + return_result = doubleResult; + } + errorMessage = "an double-precision floating point number (double)"; + break; + } + + if (convertSuccess) + { + if (useFile) + { + configurationPlugin.SetAttribute(configOption.configurationKey, console_result); + } + + + if (!resultFunction(configOption.configurationKey, return_result)) + { + MainLog.Instance.Notice( + "The handler for the last configuration option denied that input, please try again."); + convertSuccess = false; + ignoreNextFromConfig = true; + } + } + else + { + if (configOption.configurationUseDefaultNoPrompt) + { + MainLog.Instance.Error("CONFIG", + string.Format( + "[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", + configOption.configurationKey, console_result, errorMessage, + configurationFilename)); + convertSuccess = true; + } + else + { + MainLog.Instance.Warn("CONFIG", + string.Format( + "[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", + configOption.configurationKey, console_result, errorMessage, + configurationFilename)); + ignoreNextFromConfig = true; + } + } + } + } + + if (useFile) + { + configurationPlugin.Commit(); + configurationPlugin.Close(); + } + } + + private IGenericConfig LoadConfigDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + IGenericConfig plug = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IGenericConfig", true); + + if (typeInterface != null) + { + plug = + (IGenericConfig) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + } + } + } + } + + pluginAssembly = null; + return plug; + } + + public void forceSetConfigurationOption(string configuration_key, string configuration_value) + { + configurationPlugin.LoadData(); + configurationPlugin.SetAttribute(configuration_key, configuration_value); + configurationPlugin.Commit(); + configurationPlugin.Close(); + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/ConfigurationOption.cs b/OpenSim/Framework/ConfigurationOption.cs new file mode 100644 index 0000000..ec39d3d --- /dev/null +++ b/OpenSim/Framework/ConfigurationOption.cs @@ -0,0 +1,60 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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. +* +*/ + +namespace OpenSim.Framework +{ + public class ConfigurationOption + { + public enum ConfigurationTypes + { + TYPE_STRING, + TYPE_STRING_NOT_EMPTY, + TYPE_UINT16, + TYPE_UINT32, + TYPE_UINT64, + TYPE_INT16, + TYPE_INT32, + TYPE_INT64, + TYPE_IP_ADDRESS, + TYPE_CHARACTER, + TYPE_BOOLEAN, + TYPE_BYTE, + TYPE_LLUUID, + TYPE_LLVECTOR3, + TYPE_FLOAT, + TYPE_DOUBLE + } ; + + public string configurationKey = ""; + public string configurationQuestion = ""; + public string configurationDefault = ""; + + public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING; + public bool configurationUseDefaultNoPrompt = false; + } +} \ No newline at end of file diff --git a/OpenSim/Framework/Culture.cs b/OpenSim/Framework/Culture.cs new file mode 100644 index 0000000..f8cadfe --- /dev/null +++ b/OpenSim/Framework/Culture.cs @@ -0,0 +1,54 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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.Globalization; +using System.Threading; + +namespace OpenSim.Framework +{ + public class Culture + { + private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", true); + + public static NumberFormatInfo NumberFormatInfo + { + get { return m_cultureInfo.NumberFormat; } + } + + public static IFormatProvider FormatProvider + { + get { return m_cultureInfo; } + } + + public static void SetCurrentCulture() + { + Thread.CurrentThread.CurrentCulture = m_cultureInfo; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs new file mode 100644 index 0000000..63b62c6 --- /dev/null +++ b/OpenSim/Framework/EstateSettings.cs @@ -0,0 +1,707 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.IO; +using libsecondlife; + +namespace OpenSim.Framework +{ + public class EstateSettings + { + //Settings to this island + private float m_billableFactor; + + public float billableFactor + { + get { return m_billableFactor; } + set + { + m_billableFactor = value; + configMember.forceSetConfigurationOption("billable_factor", m_billableFactor.ToString()); + } + } + + + private uint m_estateID; + + public uint estateID + { + get { return m_estateID; } + set + { + m_estateID = value; + configMember.forceSetConfigurationOption("estate_id", m_estateID.ToString()); + } + } + + + private uint m_parentEstateID; + + public uint parentEstateID + { + get { return m_parentEstateID; } + set + { + m_parentEstateID = value; + configMember.forceSetConfigurationOption("parent_estate_id", m_parentEstateID.ToString()); + } + } + + private byte m_maxAgents; + + public byte maxAgents + { + get { return m_maxAgents; } + set + { + m_maxAgents = value; + configMember.forceSetConfigurationOption("max_agents", m_maxAgents.ToString()); + } + } + + private float m_objectBonusFactor; + + public float objectBonusFactor + { + get { return m_objectBonusFactor; } + set + { + m_objectBonusFactor = value; + configMember.forceSetConfigurationOption("object_bonus_factor", m_objectBonusFactor.ToString()); + } + } + + private int m_redirectGridX; + + public int redirectGridX + { + get { return m_redirectGridX; } + set + { + m_redirectGridX = value; + configMember.forceSetConfigurationOption("redirect_grid_x", m_redirectGridX.ToString()); + } + } + + private int m_redirectGridY; + + public int redirectGridY + { + get { return m_redirectGridY; } + set + { + m_redirectGridY = value; + configMember.forceSetConfigurationOption("redirect_grid_y", m_redirectGridY.ToString()); + } + } + + private Simulator.RegionFlags m_regionFlags; + + public Simulator.RegionFlags regionFlags + { + get { return m_regionFlags; } + set + { + m_regionFlags = value; + configMember.forceSetConfigurationOption("region_flags", m_regionFlags.ToString()); + } + } + + + private Simulator.SimAccess m_simAccess; + + public Simulator.SimAccess simAccess + { + get { return m_simAccess; } + set + { + m_simAccess = value; + configMember.forceSetConfigurationOption("sim_access", m_simAccess.ToString()); + } + } + + private float m_sunHour; + + public float sunHour + { + get { return m_sunHour; } + set + { + m_sunHour = value; + configMember.forceSetConfigurationOption("sun_hour", m_sunHour.ToString()); + } + } + + private float m_terrainRaiseLimit; + + public float terrainRaiseLimit + { + get { return m_terrainRaiseLimit; } + set + { + m_terrainRaiseLimit = value; + configMember.forceSetConfigurationOption("terrain_raise_limit", m_terrainRaiseLimit.ToString()); + } + } + + private float m_terrainLowerLimit; + + public float terrainLowerLimit + { + get { return m_terrainLowerLimit; } + set + { + m_terrainLowerLimit = value; + configMember.forceSetConfigurationOption("terrain_lower_limit", m_terrainLowerLimit.ToString()); + } + } + + private bool m_useFixedSun; + + public bool useFixedSun + { + get { return m_useFixedSun; } + set + { + m_useFixedSun = value; + configMember.forceSetConfigurationOption("use_fixed_sun", m_useFixedSun.ToString()); + } + } + + + private int m_pricePerMeter; + + public int pricePerMeter + { + get { return m_pricePerMeter; } + set + { + m_pricePerMeter = value; + configMember.forceSetConfigurationOption("price_per_meter", m_pricePerMeter.ToString()); + } + } + + + private ushort m_regionWaterHeight; + + public ushort regionWaterHeight + { + get { return m_regionWaterHeight; } + set + { + m_regionWaterHeight = value; + configMember.forceSetConfigurationOption("region_water_height", m_regionWaterHeight.ToString()); + } + } + + + private bool m_regionAllowTerraform; + + public bool regionAllowTerraform + { + get { return m_regionAllowTerraform; } + set + { + m_regionAllowTerraform = value; + configMember.forceSetConfigurationOption("region_allow_terraform", m_regionAllowTerraform.ToString()); + } + } + + + // Region Information + // Low resolution 'base' textures. No longer used. + private LLUUID m_terrainBase0; + + public LLUUID terrainBase0 + { + get { return m_terrainBase0; } + set + { + m_terrainBase0 = value; + configMember.forceSetConfigurationOption("terrain_base_0", m_terrainBase0.ToString()); + } + } + + private LLUUID m_terrainBase1; + + public LLUUID terrainBase1 + { + get { return m_terrainBase1; } + set + { + m_terrainBase1 = value; + configMember.forceSetConfigurationOption("terrain_base_1", m_terrainBase1.ToString()); + } + } + + private LLUUID m_terrainBase2; + + public LLUUID terrainBase2 + { + get { return m_terrainBase2; } + set + { + m_terrainBase2 = value; + configMember.forceSetConfigurationOption("terrain_base_2", m_terrainBase2.ToString()); + } + } + + private LLUUID m_terrainBase3; + + public LLUUID terrainBase3 + { + get { return m_terrainBase3; } + set + { + m_terrainBase3 = value; + configMember.forceSetConfigurationOption("terrain_base_3", m_terrainBase3.ToString()); + } + } + + + // Higher resolution terrain textures + private LLUUID m_terrainDetail0; + + public LLUUID terrainDetail0 + { + get { return m_terrainDetail0; } + set + { + m_terrainDetail0 = value; + configMember.forceSetConfigurationOption("terrain_detail_0", m_terrainDetail0.ToString()); + } + } + + private LLUUID m_terrainDetail1; + + public LLUUID terrainDetail1 + { + get { return m_terrainDetail1; } + set + { + m_terrainDetail1 = value; + configMember.forceSetConfigurationOption("terrain_detail_1", m_terrainDetail1.ToString()); + } + } + + private LLUUID m_terrainDetail2; + + public LLUUID terrainDetail2 + { + get { return m_terrainDetail2; } + set + { + m_terrainDetail2 = value; + configMember.forceSetConfigurationOption("terrain_detail_2", m_terrainDetail2.ToString()); + } + } + + private LLUUID m_terrainDetail3; + + public LLUUID terrainDetail3 + { + get { return m_terrainDetail3; } + set + { + m_terrainDetail3 = value; + configMember.forceSetConfigurationOption("terrain_detail_3", m_terrainDetail3.ToString()); + } + } + + // First quad - each point is bilinearly interpolated at each meter of terrain + private float m_terrainStartHeight0; + + public float terrainStartHeight0 + { + get { return m_terrainStartHeight0; } + set + { + m_terrainStartHeight0 = value; + configMember.forceSetConfigurationOption("terrain_start_height_0", m_terrainStartHeight0.ToString()); + } + } + + + private float m_terrainStartHeight1; + + public float terrainStartHeight1 + { + get { return m_terrainStartHeight1; } + set + { + m_terrainStartHeight1 = value; + configMember.forceSetConfigurationOption("terrain_start_height_1", m_terrainStartHeight1.ToString()); + } + } + + private float m_terrainStartHeight2; + + public float terrainStartHeight2 + { + get { return m_terrainStartHeight2; } + set + { + m_terrainStartHeight2 = value; + configMember.forceSetConfigurationOption("terrain_start_height_2", m_terrainStartHeight2.ToString()); + } + } + + private float m_terrainStartHeight3; + + public float terrainStartHeight3 + { + get { return m_terrainStartHeight3; } + set + { + m_terrainStartHeight3 = value; + configMember.forceSetConfigurationOption("terrain_start_height_3", m_terrainStartHeight3.ToString()); + } + } + + // Second quad - also bilinearly interpolated. + // Terrain texturing is done that: + // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y] + private float m_terrainHeightRange0; + + public float terrainHeightRange0 + { + get { return m_terrainHeightRange0; } + set + { + m_terrainHeightRange0 = value; + configMember.forceSetConfigurationOption("terrain_height_range_0", m_terrainHeightRange0.ToString()); + } + } + + private float m_terrainHeightRange1; + + public float terrainHeightRange1 + { + get { return m_terrainHeightRange1; } + set + { + m_terrainHeightRange1 = value; + configMember.forceSetConfigurationOption("terrain_height_range_1", m_terrainHeightRange1.ToString()); + } + } + + private float m_terrainHeightRange2; + + public float terrainHeightRange2 + { + get { return m_terrainHeightRange2; } + set + { + m_terrainHeightRange2 = value; + configMember.forceSetConfigurationOption("terrain_height_range_2", m_terrainHeightRange2.ToString()); + } + } + + private float m_terrainHeightRange3; + + public float terrainHeightRange3 + { + get { return m_terrainHeightRange3; } + set + { + m_terrainHeightRange3 = value; + configMember.forceSetConfigurationOption("terrain_height_range_3", m_terrainHeightRange3.ToString()); + } + } + + // Terrain Default (Must be in F32 Format!) + private string m_terrainFile; + + public string terrainFile + { + get { return m_terrainFile; } + set + { + m_terrainFile = value; + configMember.forceSetConfigurationOption("terrain_file", m_terrainFile.ToString()); + } + } + + private double m_terrainMultiplier; + + public double terrainMultiplier + { + get { return m_terrainMultiplier; } + set + { + m_terrainMultiplier = value; + configMember.forceSetConfigurationOption("terrain_multiplier", m_terrainMultiplier.ToString()); + } + } + + private float m_waterHeight; + + public float waterHeight + { + get { return m_waterHeight; } + set + { + m_waterHeight = value; + configMember.forceSetConfigurationOption("water_height", m_waterHeight.ToString()); + } + } + + private LLUUID m_terrainImageID; + + public LLUUID terrainImageID + { + get { return m_terrainImageID; } + set + { + m_terrainImageID = value; + configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString()); + } + } + + private ConfigurationMember configMember; + + public EstateSettings() + { + // Temporary hack to prevent multiple loadings. + if (configMember == null) + { + configMember = + new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", + loadConfigurationOptions, handleIncomingConfiguration); + configMember.performConfigurationRetrieve(); + } + } + + public void loadConfigurationOptions() + { + configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", + "0.0", true); + configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", + true); + configMember.addConfigurationOption("parent_estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, + "", "0", true); + configMember.addConfigurationOption("max_agents", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "40", + true); + + configMember.addConfigurationOption("object_bonus_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, + "", "1.0", true); + configMember.addConfigurationOption("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", + "0", true); + configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", + "0", true); + configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", + "0", true); + configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "21", + true); + configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", + true); + configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, + "", "0", true); + configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, + "", "0", true); + configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", + "false", true); + configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, + "", "1", true); + configMember.addConfigurationOption("region_water_height", + ConfigurationOption.ConfigurationTypes.TYPE_UINT16, "", "20", true); + configMember.addConfigurationOption("region_allow_terraform", + ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "true", true); + + configMember.addConfigurationOption("terrain_base_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", + "b8d3965a-ad78-bf43-699b-bff8eca6c975", true); + configMember.addConfigurationOption("terrain_base_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", + "abb783e6-3e93-26c0-248a-247666855da3", true); + configMember.addConfigurationOption("terrain_base_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", + "179cdabd-398a-9b6b-1391-4dc333ba321f", true); + configMember.addConfigurationOption("terrain_base_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", + "beb169c7-11ea-fff2-efe5-0f24dc881df2", true); + + configMember.addConfigurationOption("terrain_detail_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, + "", "00000000-0000-0000-0000-000000000000", true); + configMember.addConfigurationOption("terrain_detail_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, + "", "00000000-0000-0000-0000-000000000000", true); + configMember.addConfigurationOption("terrain_detail_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, + "", "00000000-0000-0000-0000-000000000000", true); + configMember.addConfigurationOption("terrain_detail_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, + "", "00000000-0000-0000-0000-000000000000", true); + + configMember.addConfigurationOption("terrain_start_height_0", + ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); + configMember.addConfigurationOption("terrain_start_height_1", + ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); + configMember.addConfigurationOption("terrain_start_height_2", + ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); + configMember.addConfigurationOption("terrain_start_height_3", + ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); + + configMember.addConfigurationOption("terrain_height_range_0", + ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); + configMember.addConfigurationOption("terrain_height_range_1", + ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); + configMember.addConfigurationOption("terrain_height_range_2", + ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); + configMember.addConfigurationOption("terrain_height_range_3", + ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); + + configMember.addConfigurationOption("terrain_file", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "", + "default.r32", true); + configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, + "", "60.0", true); + configMember.addConfigurationOption("water_height", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, "", + "20.0", true); + configMember.addConfigurationOption("terrain_image_id", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, + "", "00000000-0000-0000-0000-000000000000", true); + } + + public bool handleIncomingConfiguration(string configuration_key, object configuration_result) + { + switch (configuration_key) + { + case "billable_factor": + m_billableFactor = (float) configuration_result; + break; + case "estate_id": + m_estateID = (uint) configuration_result; + break; + case "parent_estate_id": + m_parentEstateID = (uint) configuration_result; + break; + case "max_agents": + m_maxAgents = (byte) configuration_result; + break; + + case "object_bonus_factor": + m_objectBonusFactor = (float) configuration_result; + break; + case "redirect_grid_x": + m_redirectGridX = (int) configuration_result; + break; + case "redirect_grid_y": + m_redirectGridY = (int) configuration_result; + break; + case "region_flags": + m_regionFlags = (Simulator.RegionFlags) ((uint) configuration_result); + break; + case "sim_access": + m_simAccess = (Simulator.SimAccess) ((byte) configuration_result); + break; + case "sun_hour": + m_sunHour = (float) configuration_result; + break; + case "terrain_raise_limit": + m_terrainRaiseLimit = (float) configuration_result; + break; + case "terrain_lower_limit": + m_terrainLowerLimit = (float) configuration_result; + break; + case "use_fixed_sun": + m_useFixedSun = (bool) configuration_result; + break; + case "price_per_meter": + m_pricePerMeter = Convert.ToInt32(configuration_result); + break; + case "region_water_height": + m_regionWaterHeight = (ushort) configuration_result; + break; + case "region_allow_terraform": + m_regionAllowTerraform = (bool) configuration_result; + break; + + case "terrain_base_0": + m_terrainBase0 = (LLUUID) configuration_result; + break; + case "terrain_base_1": + m_terrainBase1 = (LLUUID) configuration_result; + break; + case "terrain_base_2": + m_terrainBase2 = (LLUUID) configuration_result; + break; + case "terrain_base_3": + m_terrainBase3 = (LLUUID) configuration_result; + break; + + case "terrain_detail_0": + m_terrainDetail0 = (LLUUID) configuration_result; + break; + case "terrain_detail_1": + m_terrainDetail1 = (LLUUID) configuration_result; + break; + case "terrain_detail_2": + m_terrainDetail2 = (LLUUID) configuration_result; + break; + case "terrain_detail_3": + m_terrainDetail3 = (LLUUID) configuration_result; + break; + + case "terrain_start_height_0": + m_terrainStartHeight0 = (float) configuration_result; + break; + case "terrain_start_height_1": + m_terrainStartHeight1 = (float) configuration_result; + break; + case "terrain_start_height_2": + m_terrainStartHeight2 = (float) configuration_result; + break; + case "terrain_start_height_3": + m_terrainStartHeight3 = (float) configuration_result; + break; + + case "terrain_height_range_0": + m_terrainHeightRange0 = (float) configuration_result; + break; + case "terrain_height_range_1": + m_terrainHeightRange1 = (float) configuration_result; + break; + case "terrain_height_range_2": + m_terrainHeightRange2 = (float) configuration_result; + break; + case "terrain_height_range_3": + m_terrainHeightRange3 = (float) configuration_result; + break; + + case "terrain_file": + m_terrainFile = (string) configuration_result; + break; + case "terrain_multiplier": + m_terrainMultiplier = Convert.ToDouble(configuration_result); + break; + case "water_height": + double tmpVal = (double) configuration_result; + m_waterHeight = (float) tmpVal; + break; + case "terrain_image_id": + m_terrainImageID = (LLUUID) configuration_result; + break; + } + + return true; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/General/ACL.cs b/OpenSim/Framework/General/ACL.cs deleted file mode 100644 index 8f9c6e7..0000000 --- a/OpenSim/Framework/General/ACL.cs +++ /dev/null @@ -1,263 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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; - -namespace OpenSim.Framework -{ - // ACL Class - // Modelled after the structure of the Zend ACL Framework Library - // with one key difference - the tree will search for all matching - // permissions rather than just the first. Deny permissions will - // override all others. - - #region ACL Core Class - - /// - /// Access Control List Engine - /// - public class ACL - { - private Dictionary Roles = new Dictionary(); - private Dictionary Resources = new Dictionary(); - - public ACL AddRole(Role role) - { - if (Roles.ContainsKey(role.Name)) - throw new AlreadyContainsRoleException(role); - - Roles.Add(role.Name, role); - - return this; - } - - public ACL AddResource(Resource resource) - { - Resources.Add(resource.Name, resource); - - return this; - } - - public Permission HasPermission(string role, string resource) - { - if (!Roles.ContainsKey(role)) - throw new KeyNotFoundException(); - - if (!Resources.ContainsKey(resource)) - throw new KeyNotFoundException(); - - return Roles[role].RequestPermission(resource); - } - - public ACL GrantPermission(string role, string resource) - { - if (!Roles.ContainsKey(role)) - throw new KeyNotFoundException(); - - if (!Resources.ContainsKey(resource)) - throw new KeyNotFoundException(); - - Roles[role].GivePermission(resource, Permission.Allow); - - return this; - } - - public ACL DenyPermission(string role, string resource) - { - if (!Roles.ContainsKey(role)) - throw new KeyNotFoundException(); - - if (!Resources.ContainsKey(resource)) - throw new KeyNotFoundException(); - - Roles[role].GivePermission(resource, Permission.Deny); - - return this; - } - - public ACL ResetPermission(string role, string resource) - { - if (!Roles.ContainsKey(role)) - throw new KeyNotFoundException(); - - if (!Resources.ContainsKey(resource)) - throw new KeyNotFoundException(); - - Roles[role].GivePermission(resource, Permission.None); - - return this; - } - } - - #endregion - - #region Exceptions - - /// - /// Thrown when an ACL attempts to add a duplicate role. - /// - public class AlreadyContainsRoleException : Exception - { - protected Role m_role; - - public Role ErrorRole - { - get { return m_role; } - } - - public AlreadyContainsRoleException(Role role) - { - m_role = role; - } - - public override string ToString() - { - return "This ACL already contains a role called '" + m_role.Name + "'."; - } - } - - #endregion - - #region Roles and Resources - - /// - /// Does this Role have permission to access a specified Resource? - /// - public enum Permission - { - Deny, - None, - Allow - } ; - - /// - /// A role class, for use with Users or Groups - /// - public class Role - { - private string m_name; - private Role[] m_parents; - private Dictionary m_resources = new Dictionary(); - - public string Name - { - get { return m_name; } - } - - public Permission RequestPermission(string resource) - { - return RequestPermission(resource, Permission.None); - } - - public Permission RequestPermission(string resource, Permission current) - { - // Deny permissions always override any others - if (current == Permission.Deny) - return current; - - Permission temp = Permission.None; - - // Pickup non-None permissions - if (m_resources.ContainsKey(resource) && m_resources[resource] != Permission.None) - temp = m_resources[resource]; - - if (m_parents != null) - { - foreach (Role parent in m_parents) - { - temp = parent.RequestPermission(resource, temp); - } - } - - return temp; - } - - public void GivePermission(string resource, Permission perm) - { - m_resources[resource] = perm; - } - - public Role(string name) - { - m_name = name; - m_parents = null; - } - - public Role(string name, Role[] parents) - { - m_name = name; - m_parents = parents; - } - } - - public class Resource - { - private string m_name; - - public string Name - { - get { return m_name; } - } - - public Resource(string name) - { - m_name = name; - } - } - - #endregion - - #region Tests - - internal class ACLTester - { - public ACLTester() - { - ACL acl = new ACL(); - - Role Guests = new Role("Guests"); - acl.AddRole(Guests); - - Role[] parents = new Role[0]; - parents[0] = Guests; - - Role JoeGuest = new Role("JoeGuest", parents); - acl.AddRole(JoeGuest); - - Resource CanBuild = new Resource("CanBuild"); - acl.AddResource(CanBuild); - - - acl.GrantPermission("Guests", "CanBuild"); - - acl.HasPermission("JoeGuest", "CanBuild"); - } - } - - #endregion -} \ No newline at end of file diff --git a/OpenSim/Framework/General/AgentCircuitManager.cs b/OpenSim/Framework/General/AgentCircuitManager.cs deleted file mode 100644 index 3658feb..0000000 --- a/OpenSim/Framework/General/AgentCircuitManager.cs +++ /dev/null @@ -1,127 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Collections.Generic; -using libsecondlife; - -namespace OpenSim.Framework -{ - public class AgentCircuitManager - { - public Dictionary AgentCircuits = new Dictionary(); - - public AgentCircuitManager() - { - } - - public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) - { - AgentCircuitData validcircuit = null; - if (AgentCircuits.ContainsKey(circuitcode)) - { - validcircuit = AgentCircuits[circuitcode]; - } - AuthenticateResponse user = new AuthenticateResponse(); - if (validcircuit == null) - { - //don't have this circuit code in our list - user.Authorised = false; - return (user); - } - - if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID)) - { - user.Authorised = true; - user.LoginInfo = new Login(); - user.LoginInfo.Agent = agentID; - user.LoginInfo.Session = sessionID; - user.LoginInfo.SecureSession = validcircuit.SecureSessionID; - user.LoginInfo.First = validcircuit.firstname; - user.LoginInfo.Last = validcircuit.lastname; - user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder; - user.LoginInfo.BaseFolder = validcircuit.BaseFolder; - } - else - { - // Invalid - user.Authorised = false; - } - - return (user); - } - - public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) - { - if (AgentCircuits.ContainsKey(circuitCode)) - { - AgentCircuits[circuitCode] = agentData; - } - else - { - AgentCircuits.Add(circuitCode, agentData); - } - } - - public LLVector3 GetPosition(uint circuitCode) - { - LLVector3 vec = new LLVector3(); - if (AgentCircuits.ContainsKey(circuitCode)) - { - vec = AgentCircuits[circuitCode].startpos; - } - return vec; - } - - public void UpdateAgentData(AgentCircuitData agentData) - { - if (AgentCircuits.ContainsKey((uint) agentData.circuitcode)) - { - AgentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname; - AgentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname; - AgentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos; - // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); - } - } - - public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) - { - if (AgentCircuits.ContainsKey(circuitcode)) - { - AgentCircuits[circuitcode].child = childstatus; - } - } - - public bool GetAgentChildStatus(uint circuitcode) - { - if (AgentCircuits.ContainsKey(circuitcode)) - { - return AgentCircuits[circuitcode].child; - } - return false; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/AgentCiruitData.cs b/OpenSim/Framework/General/AgentCiruitData.cs deleted file mode 100644 index 3f17ca8..0000000 --- a/OpenSim/Framework/General/AgentCiruitData.cs +++ /dev/null @@ -1,52 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; - -namespace OpenSim.Framework -{ - [Serializable] - public class AgentCircuitData - { - public AgentCircuitData() - { - } - - public LLUUID AgentID; - public LLUUID SessionID; - public LLUUID SecureSessionID; - public LLVector3 startpos; - public string firstname; - public string lastname; - public uint circuitcode; - public bool child; - public LLUUID InventoryFolder; - public LLUUID BaseFolder; - public string CapsPath = ""; - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/AgentInventory.cs b/OpenSim/Framework/General/AgentInventory.cs deleted file mode 100644 index 7a1174a..0000000 --- a/OpenSim/Framework/General/AgentInventory.cs +++ /dev/null @@ -1,258 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Collections.Generic; -using libsecondlife; -using libsecondlife.Packets; - -namespace OpenSim.Framework -{ - public class AgentInventory - { - //Holds the local copy of Inventory info for a agent - public Dictionary InventoryFolders; - public Dictionary InventoryItems; - public InventoryFolder InventoryRoot; - public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server - public LLUUID AgentID; - public AvatarWearable[] Wearables; - - public AgentInventory() - { - InventoryFolders = new Dictionary(); - InventoryItems = new Dictionary(); - Initialise(); - } - - public virtual void Initialise() - { - Wearables = new AvatarWearable[13]; - for (int i = 0; i < 13; i++) - { - Wearables[i] = new AvatarWearable(); - } - } - - public bool CreateNewFolder(LLUUID folderID, ushort type) - { - InventoryFolder Folder = new InventoryFolder(); - Folder.FolderID = folderID; - Folder.OwnerID = AgentID; - Folder.DefaultType = type; - InventoryFolders.Add(Folder.FolderID, Folder); - return (true); - } - - public void CreateRootFolder(LLUUID newAgentID, bool createTextures) - { - AgentID = newAgentID; - InventoryRoot = new InventoryFolder(); - InventoryRoot.FolderID = LLUUID.Random(); - InventoryRoot.ParentID = new LLUUID(); - InventoryRoot.Version = 1; - InventoryRoot.DefaultType = 8; - InventoryRoot.OwnerID = AgentID; - InventoryRoot.FolderName = "My Inventory"; - InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); - InventoryRoot.OwnerID = AgentID; - if (createTextures) - { - CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID); - } - } - - public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName) - { - InventoryFolder Folder = new InventoryFolder(); - Folder.FolderID = folderID; - Folder.OwnerID = AgentID; - Folder.DefaultType = type; - Folder.FolderName = folderName; - InventoryFolders.Add(Folder.FolderID, Folder); - return (true); - } - - public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID) - { - if (!InventoryFolders.ContainsKey(folderID)) - { - System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory"); - InventoryFolder Folder = new InventoryFolder(); - Folder.FolderID = folderID; - Folder.OwnerID = AgentID; - Folder.DefaultType = type; - Folder.FolderName = folderName; - Folder.ParentID = parentID; - InventoryFolders.Add(Folder.FolderID, Folder); - } - return (true); - } - - public bool HasFolder(LLUUID folderID) - { - if (InventoryFolders.ContainsKey(folderID)) - { - return true; - } - return false; - } - - public LLUUID GetFolderID(string folderName) - { - foreach (InventoryFolder inv in InventoryFolders.Values) - { - if (inv.FolderName == folderName) - { - return inv.FolderID; - } - } - return LLUUID.Zero; - } - - public bool UpdateItemAsset(LLUUID itemID, AssetBase asset) - { - if (InventoryItems.ContainsKey(itemID)) - { - InventoryItem Item = InventoryItems[itemID]; - Item.AssetID = asset.FullID; - System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + - " so it now is set to asset " + asset.FullID.ToStringHyphenated()); - //TODO need to update the rest of the info - } - return true; - } - - public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) - { - System.Console.WriteLine("updating inventory item details"); - if (InventoryItems.ContainsKey(itemID)) - { - System.Console.WriteLine("changing name to " + Util.FieldToString(packet.Name)); - InventoryItem Item = InventoryItems[itemID]; - Item.Name = Util.FieldToString(packet.Name); - System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated()); - //TODO need to update the rest of the info - } - return true; - } - - public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) - { - if (InventoryFolders.ContainsKey(folderID)) - { - LLUUID NewItemID = LLUUID.Random(); - - InventoryItem Item = new InventoryItem(); - Item.FolderID = folderID; - Item.OwnerID = AgentID; - Item.AssetID = asset.FullID; - Item.ItemID = NewItemID; - Item.Type = asset.Type; - Item.Name = asset.Name; - Item.Description = asset.Description; - Item.InvType = asset.InvType; - InventoryItems.Add(Item.ItemID, Item); - InventoryFolder Folder = InventoryFolders[Item.FolderID]; - Folder.Items.Add(Item); - return (Item.ItemID); - } - else - { - return (null); - } - } - - public bool DeleteFromInventory(LLUUID itemID) - { - bool res = false; - if (InventoryItems.ContainsKey(itemID)) - { - InventoryItem item = InventoryItems[itemID]; - InventoryItems.Remove(itemID); - foreach (InventoryFolder fold in InventoryFolders.Values) - { - if (fold.Items.Contains(item)) - { - fold.Items.Remove(item); - break; - } - } - res = true; - } - return res; - } - } - - public class InventoryFolder - { - public List Items; - //public List Subfolders; - public LLUUID FolderID; - public LLUUID OwnerID; - public LLUUID ParentID = LLUUID.Zero; - public string FolderName; - public ushort DefaultType; - public ushort Version; - - public InventoryFolder() - { - Items = new List(); - //Subfolders = new List(); - } - } - - public class InventoryItem - { - public LLUUID FolderID; - public LLUUID OwnerID; - public LLUUID ItemID; - public LLUUID AssetID; - public LLUUID CreatorID; - public sbyte InvType; - public sbyte Type; - public string Name = ""; - public string Description; - - public InventoryItem() - { - CreatorID = LLUUID.Zero; - } - - public string ExportString() - { - string typ = "notecard"; - string result = ""; - result += "\tinv_object\t0\n\t{\n"; - result += "\t\tobj_id\t%s\n"; - result += "\t\tparent_id\t" + ItemID.ToString() + "\n"; - result += "\t\ttype\t" + typ + "\n"; - result += "\t\tname\t" + Name + "|\n"; - result += "\t}\n"; - return result; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/AgentWearable.cs b/OpenSim/Framework/General/AgentWearable.cs deleted file mode 100644 index a324cb3..0000000 --- a/OpenSim/Framework/General/AgentWearable.cs +++ /dev/null @@ -1,71 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; - -namespace OpenSim.Framework -{ - public class AvatarWearable - { - public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); - public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); - - public AvatarWearable() - { - } - - public AvatarWearable(LLUUID itemId, LLUUID assetId) - { - AssetID = assetId; - ItemID = itemId; - } - - public static AvatarWearable[] DefaultWearables - { - get - { - AvatarWearable[] defaultWearables = new AvatarWearable[13]; //should be 13 of these - for (int i = 0; i < 13; i++) - { - defaultWearables[i] = new AvatarWearable(); - } - defaultWearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); - defaultWearables[0].ItemID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"); - - defaultWearables[1].ItemID = new LLUUID("77c41e39-38f9-f75a-024e-585989bfabc9"); - defaultWearables[1].AssetID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); - - defaultWearables[4].ItemID = new LLUUID("77c41e39-38f9-f75a-0000-585989bf0000"); - defaultWearables[4].AssetID = new LLUUID("00000000-38f9-1111-024e-222222111110"); - - defaultWearables[5].ItemID = new LLUUID("77c41e39-38f9-f75a-0000-5859892f1111"); - defaultWearables[5].AssetID = new LLUUID("00000000-38f9-1111-024e-222222111120"); - return defaultWearables; - } - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/AssetBase.cs b/OpenSim/Framework/General/AssetBase.cs deleted file mode 100644 index ef1ee71..0000000 --- a/OpenSim/Framework/General/AssetBase.cs +++ /dev/null @@ -1,55 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; - -namespace OpenSim.Framework -{ - [Serializable] - public class AssetBase - { - public byte[] Data; - public LLUUID FullID; - public sbyte Type; - public sbyte InvType; - public string Name = ""; - public string Description = ""; - public bool Local = false; - public bool Temporary = false; - - public AssetBase() - { - } - - public AssetBase(LLUUID assetId, string name) - { - FullID = assetId; - Name = name; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/AssetConfig.cs b/OpenSim/Framework/General/AssetConfig.cs deleted file mode 100644 index fe77ab8..0000000 --- a/OpenSim/Framework/General/AssetConfig.cs +++ /dev/null @@ -1,83 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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. -* -*/ - -namespace OpenSim.Framework -{ - /// - /// UserConfig -- For User Server Configuration - /// - public class AssetConfig - { - public string DefaultStartupMsg = ""; - - public string DatabaseProvider = ""; - - public static uint DefaultHttpPort = 8003; - public uint HttpPort = DefaultHttpPort; - - private ConfigurationMember configMember; - - public AssetConfig(string description, string filename) - { - configMember = - new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); - configMember.performConfigurationRetrieve(); - } - - public void loadConfigurationOptions() - { - configMember.addConfigurationOption("default_startup_message", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "Default Startup Message", "Welcome to OGS", false); - - configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); - - configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, - "Http Listener port", DefaultHttpPort.ToString(), false); - } - - public bool handleIncomingConfiguration(string configuration_key, object configuration_result) - { - switch (configuration_key) - { - case "default_startup_message": - DefaultStartupMsg = (string) configuration_result; - break; - case "database_provider": - DatabaseProvider = (string) configuration_result; - break; - case "http_port": - HttpPort = (uint) configuration_result; - break; - } - - return true; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/AssetLandmark.cs b/OpenSim/Framework/General/AssetLandmark.cs deleted file mode 100644 index 4422331..0000000 --- a/OpenSim/Framework/General/AssetLandmark.cs +++ /dev/null @@ -1,59 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Text; -using libsecondlife; - -namespace OpenSim.Framework -{ - public class AssetLandmark : AssetBase - { - public int Version; - public LLVector3 Position; - public LLUUID RegionID; - - public AssetLandmark(AssetBase a) - { - Data = a.Data; - FullID = a.FullID; - Type = a.Type; - InvType = a.InvType; - Name = a.Name; - Description = a.Description; - InternData(); - } - - private void InternData() - { - string temp = Encoding.UTF8.GetString(Data).Trim(); - string[] parts = temp.Split('\n'); - int.TryParse(parts[0].Substring(17, 1), out Version); - LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID); - LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position); - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/AssetStorage.cs b/OpenSim/Framework/General/AssetStorage.cs deleted file mode 100644 index 9d3de5b..0000000 --- a/OpenSim/Framework/General/AssetStorage.cs +++ /dev/null @@ -1,48 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; - -namespace OpenSim.Framework -{ - public class AssetStorage - { - public AssetStorage() - { - } - - public AssetStorage(LLUUID assetUUID) - { - UUID = assetUUID; - } - - public byte[] Data; - public sbyte Type; - public string Name; - public LLUUID UUID; - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/AuthenticateResponse.cs b/OpenSim/Framework/General/AuthenticateResponse.cs deleted file mode 100644 index 88a8713..0000000 --- a/OpenSim/Framework/General/AuthenticateResponse.cs +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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. -* -*/ -namespace OpenSim.Framework -{ - public class AuthenticateResponse - { - public bool Authorised; - public Login LoginInfo; - - public AuthenticateResponse() - { - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/BlockingQueue.cs b/OpenSim/Framework/General/BlockingQueue.cs deleted file mode 100644 index 006fbc8..0000000 --- a/OpenSim/Framework/General/BlockingQueue.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Collections.Generic; -using System.Threading; - -namespace OpenSim.Framework -{ - public class BlockingQueue - { - private Queue _queue = new Queue(); - private object _queueSync = new object(); - - public void Enqueue(T value) - { - lock (_queueSync) - { - _queue.Enqueue(value); - Monitor.Pulse(_queueSync); - } - } - - public T Dequeue() - { - lock (_queueSync) - { - if (_queue.Count < 1) - Monitor.Wait(_queueSync); - - return _queue.Dequeue(); - } - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/ClientManager.cs b/OpenSim/Framework/General/ClientManager.cs deleted file mode 100644 index e34c051..0000000 --- a/OpenSim/Framework/General/ClientManager.cs +++ /dev/null @@ -1,135 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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.Collections.Generic; -using libsecondlife; -using libsecondlife.Packets; - -namespace OpenSim.Framework -{ - public delegate void ForEachClientDelegate(IClientAPI client); - - public class ClientManager - { - private Dictionary m_clients; - - public void ForEachClient(ForEachClientDelegate whatToDo) - { - foreach (IClientAPI client in m_clients.Values) - { - whatToDo(client); - } - } - - public ClientManager() - { - m_clients = new Dictionary(); - } - - private void Remove(uint id) - { - m_clients.Remove(id); - } - - public void Add(uint id, IClientAPI client) - { - m_clients.Add(id, client); - } - - public void InPacket(uint circuitCode, Packet packet) - { - IClientAPI client; - - if (m_clients.TryGetValue(circuitCode, out client)) - { - client.InPacket(packet); - } - } - - public void CloseAllAgents(uint circuitCode) - { - IClientAPI client; - - if (m_clients.TryGetValue(circuitCode, out client)) - { - CloseAllCircuits(client.AgentId); - } - } - - public void CloseAllCircuits(LLUUID agentId) - { - uint[] circuits = GetAllCircuits(agentId); - foreach (uint circuit in circuits) - { - IClientAPI client; - if (m_clients.TryGetValue(circuit, out client)) - { - Remove(circuit); - client.Close(); - } - } - } - - private uint[] GetAllCircuits(LLUUID agentId) - { - List circuits = new List(); - - foreach (KeyValuePair pair in m_clients) - { - if (pair.Value.AgentId == agentId) - { - circuits.Add(pair.Key); - } - } - - return circuits.ToArray(); - } - - - public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) - { - ViewerEffectPacket packet = new ViewerEffectPacket(); - packet.Effect = effectBlock; - - foreach (IClientAPI client in m_clients.Values) - { - if (client.AgentId != sender.AgentId) - { - packet.AgentData.AgentID = client.AgentId; - packet.AgentData.SessionID = client.SessionId; - client.OutPacket(packet); - } - } - } - - public bool TryGetClient(uint circuitId, out IClientAPI user) - { - return m_clients.TryGetValue(circuitId, out user); - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/ConfigurationMember.cs b/OpenSim/Framework/General/ConfigurationMember.cs deleted file mode 100644 index b68896c..0000000 --- a/OpenSim/Framework/General/ConfigurationMember.cs +++ /dev/null @@ -1,440 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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.Globalization; -using System.Net; -using System.Reflection; -using libsecondlife; -using OpenSim.Framework.Console; - -namespace OpenSim.Framework -{ - public class ConfigurationMember - { - public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); - - public delegate void ConfigurationOptionsLoad(); - - private List configurationOptions = new List(); - private string configurationFilename = ""; - private string configurationDescription = ""; - - private ConfigurationOptionsLoad loadFunction; - private ConfigurationOptionResult resultFunction; - - private IGenericConfig configurationPlugin = null; - - /// - /// This is the default configuration DLL loaded - /// - private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll"; - - public ConfigurationMember(string configuration_filename, string configuration_description, - ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) - { - configurationFilename = configuration_filename; - configurationDescription = configuration_description; - loadFunction = load_function; - resultFunction = result_function; - } - - public void setConfigurationFilename(string filename) - { - configurationFilename = filename; - } - - public void setConfigurationDescription(string desc) - { - configurationDescription = desc; - } - - public void setConfigurationResultFunction(ConfigurationOptionResult result) - { - resultFunction = result; - } - - public void forceConfigurationPluginLibrary(string dll_filename) - { - configurationPluginFilename = dll_filename; - } - - public void addConfigurationOption(string configuration_key, - ConfigurationOption.ConfigurationTypes configuration_type, - string configuration_question, string configuration_default, - bool use_default_no_prompt) - { - ConfigurationOption configOption = new ConfigurationOption(); - configOption.configurationKey = configuration_key; - configOption.configurationQuestion = configuration_question; - configOption.configurationDefault = configuration_default; - configOption.configurationType = configuration_type; - configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; - - if ((configuration_key != "" && configuration_question != "") || - (configuration_key != "" && use_default_no_prompt)) - { - if (!configurationOptions.Contains(configOption)) - { - configurationOptions.Add(configOption); - } - } - else - { - MainLog.Instance.Notice( - "Required fields for adding a configuration option is invalid. Will not add this option (" + - configuration_key + ")"); - } - } - - public void performConfigurationRetrieve() - { - configurationPlugin = LoadConfigDll(configurationPluginFilename); - configurationOptions.Clear(); - if (loadFunction == null) - { - MainLog.Instance.Error("Load Function for '" + configurationDescription + - "' is null. Refusing to run configuration."); - return; - } - - if (resultFunction == null) - { - MainLog.Instance.Error("Result Function for '" + configurationDescription + - "' is null. Refusing to run configuration."); - return; - } - - MainLog.Instance.Verbose("Calling Configuration Load Function..."); - loadFunction(); - - if (configurationOptions.Count <= 0) - { - MainLog.Instance.Error("No configuration options were specified for '" + configurationOptions + - "'. Refusing to continue configuration."); - return; - } - - bool useFile = true; - if (configurationPlugin == null) - { - MainLog.Instance.Error("Configuration Plugin NOT LOADED!"); - return; - } - - if (configurationFilename.Trim() != "") - { - configurationPlugin.SetFileName(configurationFilename); - configurationPlugin.LoadData(); - useFile = true; - } - else - { - MainLog.Instance.Notice("XML Configuration Filename is not valid; will not save to the file."); - useFile = false; - } - - foreach (ConfigurationOption configOption in configurationOptions) - { - bool convertSuccess = false; - object return_result = null; - string errorMessage = ""; - bool ignoreNextFromConfig = false; - while (convertSuccess == false) - { - string console_result = ""; - string attribute = null; - if (useFile) - { - if (!ignoreNextFromConfig) - { - attribute = configurationPlugin.GetAttribute(configOption.configurationKey); - } - else - { - ignoreNextFromConfig = false; - } - } - - if (attribute == null) - { - if (configOption.configurationUseDefaultNoPrompt) - { - console_result = configOption.configurationDefault; - } - else - { - if (configurationDescription.Trim() != "") - { - console_result = - MainLog.Instance.CmdPrompt( - configurationDescription + ": " + configOption.configurationQuestion, - configOption.configurationDefault); - } - else - { - console_result = - MainLog.Instance.CmdPrompt(configOption.configurationQuestion, - configOption.configurationDefault); - } - } - } - else - { - console_result = attribute; - } - - switch (configOption.configurationType) - { - case ConfigurationOption.ConfigurationTypes.TYPE_STRING: - return_result = console_result; - convertSuccess = true; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY: - if (console_result.Length > 0) - { - return_result = console_result; - convertSuccess = true; - } - errorMessage = "a string that is not empty"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN: - bool boolResult; - if (Boolean.TryParse(console_result, out boolResult)) - { - convertSuccess = true; - return_result = boolResult; - } - errorMessage = "'true' or 'false' (Boolean)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_BYTE: - byte byteResult; - if (Byte.TryParse(console_result, out byteResult)) - { - convertSuccess = true; - return_result = byteResult; - } - errorMessage = "a byte (Byte)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_CHARACTER: - char charResult; - if (Char.TryParse(console_result, out charResult)) - { - convertSuccess = true; - return_result = charResult; - } - errorMessage = "a character (Char)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_INT16: - short shortResult; - if (Int16.TryParse(console_result, out shortResult)) - { - convertSuccess = true; - return_result = shortResult; - } - errorMessage = "a signed 32 bit integer (short)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_INT32: - int intResult; - if (Int32.TryParse(console_result, out intResult)) - { - convertSuccess = true; - return_result = intResult; - } - errorMessage = "a signed 32 bit integer (int)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_INT64: - long longResult; - if (Int64.TryParse(console_result, out longResult)) - { - convertSuccess = true; - return_result = longResult; - } - errorMessage = "a signed 32 bit integer (long)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS: - IPAddress ipAddressResult; - if (IPAddress.TryParse(console_result, out ipAddressResult)) - { - convertSuccess = true; - return_result = ipAddressResult; - } - errorMessage = "an IP Address (IPAddress)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_LLUUID: - LLUUID uuidResult; - if (LLUUID.TryParse(console_result, out uuidResult)) - { - convertSuccess = true; - return_result = uuidResult; - } - errorMessage = "a UUID (LLUUID)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_LLVECTOR3: - LLVector3 vectorResult; - if (LLVector3.TryParse(console_result, out vectorResult)) - { - convertSuccess = true; - return_result = vectorResult; - } - errorMessage = "a vector (LLVector3)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_UINT16: - ushort ushortResult; - if (UInt16.TryParse(console_result, out ushortResult)) - { - convertSuccess = true; - return_result = ushortResult; - } - errorMessage = "an unsigned 16 bit integer (ushort)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_UINT32: - uint uintResult; - if (UInt32.TryParse(console_result, out uintResult)) - { - convertSuccess = true; - return_result = uintResult; - } - errorMessage = "an unsigned 32 bit integer (uint)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_UINT64: - ulong ulongResult; - if (UInt64.TryParse(console_result, out ulongResult)) - { - convertSuccess = true; - return_result = ulongResult; - } - errorMessage = "an unsigned 64 bit integer (ulong)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: - float floatResult; - if ( - float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, - out floatResult)) - { - convertSuccess = true; - return_result = floatResult; - } - errorMessage = "a single-precision floating point number (float)"; - break; - case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: - double doubleResult; - if ( - Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, - out doubleResult)) - { - convertSuccess = true; - return_result = doubleResult; - } - errorMessage = "an double-precision floating point number (double)"; - break; - } - - if (convertSuccess) - { - if (useFile) - { - configurationPlugin.SetAttribute(configOption.configurationKey, console_result); - } - - - if (!resultFunction(configOption.configurationKey, return_result)) - { - MainLog.Instance.Notice( - "The handler for the last configuration option denied that input, please try again."); - convertSuccess = false; - ignoreNextFromConfig = true; - } - } - else - { - if (configOption.configurationUseDefaultNoPrompt) - { - MainLog.Instance.Error("CONFIG", - string.Format( - "[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", - configOption.configurationKey, console_result, errorMessage, - configurationFilename)); - convertSuccess = true; - } - else - { - MainLog.Instance.Warn("CONFIG", - string.Format( - "[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", - configOption.configurationKey, console_result, errorMessage, - configurationFilename)); - ignoreNextFromConfig = true; - } - } - } - } - - if (useFile) - { - configurationPlugin.Commit(); - configurationPlugin.Close(); - } - } - - private IGenericConfig LoadConfigDll(string dllName) - { - Assembly pluginAssembly = Assembly.LoadFrom(dllName); - IGenericConfig plug = null; - - foreach (Type pluginType in pluginAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type typeInterface = pluginType.GetInterface("IGenericConfig", true); - - if (typeInterface != null) - { - plug = - (IGenericConfig) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - } - } - } - } - - pluginAssembly = null; - return plug; - } - - public void forceSetConfigurationOption(string configuration_key, string configuration_value) - { - configurationPlugin.LoadData(); - configurationPlugin.SetAttribute(configuration_key, configuration_value); - configurationPlugin.Commit(); - configurationPlugin.Close(); - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/ConfigurationOption.cs b/OpenSim/Framework/General/ConfigurationOption.cs deleted file mode 100644 index ec39d3d..0000000 --- a/OpenSim/Framework/General/ConfigurationOption.cs +++ /dev/null @@ -1,60 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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. -* -*/ - -namespace OpenSim.Framework -{ - public class ConfigurationOption - { - public enum ConfigurationTypes - { - TYPE_STRING, - TYPE_STRING_NOT_EMPTY, - TYPE_UINT16, - TYPE_UINT32, - TYPE_UINT64, - TYPE_INT16, - TYPE_INT32, - TYPE_INT64, - TYPE_IP_ADDRESS, - TYPE_CHARACTER, - TYPE_BOOLEAN, - TYPE_BYTE, - TYPE_LLUUID, - TYPE_LLVECTOR3, - TYPE_FLOAT, - TYPE_DOUBLE - } ; - - public string configurationKey = ""; - public string configurationQuestion = ""; - public string configurationDefault = ""; - - public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING; - public bool configurationUseDefaultNoPrompt = false; - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/Culture.cs b/OpenSim/Framework/General/Culture.cs deleted file mode 100644 index f8cadfe..0000000 --- a/OpenSim/Framework/General/Culture.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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.Globalization; -using System.Threading; - -namespace OpenSim.Framework -{ - public class Culture - { - private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", true); - - public static NumberFormatInfo NumberFormatInfo - { - get { return m_cultureInfo.NumberFormat; } - } - - public static IFormatProvider FormatProvider - { - get { return m_cultureInfo; } - } - - public static void SetCurrentCulture() - { - Thread.CurrentThread.CurrentCulture = m_cultureInfo; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/EstateSettings.cs b/OpenSim/Framework/General/EstateSettings.cs deleted file mode 100644 index 63b62c6..0000000 --- a/OpenSim/Framework/General/EstateSettings.cs +++ /dev/null @@ -1,707 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.IO; -using libsecondlife; - -namespace OpenSim.Framework -{ - public class EstateSettings - { - //Settings to this island - private float m_billableFactor; - - public float billableFactor - { - get { return m_billableFactor; } - set - { - m_billableFactor = value; - configMember.forceSetConfigurationOption("billable_factor", m_billableFactor.ToString()); - } - } - - - private uint m_estateID; - - public uint estateID - { - get { return m_estateID; } - set - { - m_estateID = value; - configMember.forceSetConfigurationOption("estate_id", m_estateID.ToString()); - } - } - - - private uint m_parentEstateID; - - public uint parentEstateID - { - get { return m_parentEstateID; } - set - { - m_parentEstateID = value; - configMember.forceSetConfigurationOption("parent_estate_id", m_parentEstateID.ToString()); - } - } - - private byte m_maxAgents; - - public byte maxAgents - { - get { return m_maxAgents; } - set - { - m_maxAgents = value; - configMember.forceSetConfigurationOption("max_agents", m_maxAgents.ToString()); - } - } - - private float m_objectBonusFactor; - - public float objectBonusFactor - { - get { return m_objectBonusFactor; } - set - { - m_objectBonusFactor = value; - configMember.forceSetConfigurationOption("object_bonus_factor", m_objectBonusFactor.ToString()); - } - } - - private int m_redirectGridX; - - public int redirectGridX - { - get { return m_redirectGridX; } - set - { - m_redirectGridX = value; - configMember.forceSetConfigurationOption("redirect_grid_x", m_redirectGridX.ToString()); - } - } - - private int m_redirectGridY; - - public int redirectGridY - { - get { return m_redirectGridY; } - set - { - m_redirectGridY = value; - configMember.forceSetConfigurationOption("redirect_grid_y", m_redirectGridY.ToString()); - } - } - - private Simulator.RegionFlags m_regionFlags; - - public Simulator.RegionFlags regionFlags - { - get { return m_regionFlags; } - set - { - m_regionFlags = value; - configMember.forceSetConfigurationOption("region_flags", m_regionFlags.ToString()); - } - } - - - private Simulator.SimAccess m_simAccess; - - public Simulator.SimAccess simAccess - { - get { return m_simAccess; } - set - { - m_simAccess = value; - configMember.forceSetConfigurationOption("sim_access", m_simAccess.ToString()); - } - } - - private float m_sunHour; - - public float sunHour - { - get { return m_sunHour; } - set - { - m_sunHour = value; - configMember.forceSetConfigurationOption("sun_hour", m_sunHour.ToString()); - } - } - - private float m_terrainRaiseLimit; - - public float terrainRaiseLimit - { - get { return m_terrainRaiseLimit; } - set - { - m_terrainRaiseLimit = value; - configMember.forceSetConfigurationOption("terrain_raise_limit", m_terrainRaiseLimit.ToString()); - } - } - - private float m_terrainLowerLimit; - - public float terrainLowerLimit - { - get { return m_terrainLowerLimit; } - set - { - m_terrainLowerLimit = value; - configMember.forceSetConfigurationOption("terrain_lower_limit", m_terrainLowerLimit.ToString()); - } - } - - private bool m_useFixedSun; - - public bool useFixedSun - { - get { return m_useFixedSun; } - set - { - m_useFixedSun = value; - configMember.forceSetConfigurationOption("use_fixed_sun", m_useFixedSun.ToString()); - } - } - - - private int m_pricePerMeter; - - public int pricePerMeter - { - get { return m_pricePerMeter; } - set - { - m_pricePerMeter = value; - configMember.forceSetConfigurationOption("price_per_meter", m_pricePerMeter.ToString()); - } - } - - - private ushort m_regionWaterHeight; - - public ushort regionWaterHeight - { - get { return m_regionWaterHeight; } - set - { - m_regionWaterHeight = value; - configMember.forceSetConfigurationOption("region_water_height", m_regionWaterHeight.ToString()); - } - } - - - private bool m_regionAllowTerraform; - - public bool regionAllowTerraform - { - get { return m_regionAllowTerraform; } - set - { - m_regionAllowTerraform = value; - configMember.forceSetConfigurationOption("region_allow_terraform", m_regionAllowTerraform.ToString()); - } - } - - - // Region Information - // Low resolution 'base' textures. No longer used. - private LLUUID m_terrainBase0; - - public LLUUID terrainBase0 - { - get { return m_terrainBase0; } - set - { - m_terrainBase0 = value; - configMember.forceSetConfigurationOption("terrain_base_0", m_terrainBase0.ToString()); - } - } - - private LLUUID m_terrainBase1; - - public LLUUID terrainBase1 - { - get { return m_terrainBase1; } - set - { - m_terrainBase1 = value; - configMember.forceSetConfigurationOption("terrain_base_1", m_terrainBase1.ToString()); - } - } - - private LLUUID m_terrainBase2; - - public LLUUID terrainBase2 - { - get { return m_terrainBase2; } - set - { - m_terrainBase2 = value; - configMember.forceSetConfigurationOption("terrain_base_2", m_terrainBase2.ToString()); - } - } - - private LLUUID m_terrainBase3; - - public LLUUID terrainBase3 - { - get { return m_terrainBase3; } - set - { - m_terrainBase3 = value; - configMember.forceSetConfigurationOption("terrain_base_3", m_terrainBase3.ToString()); - } - } - - - // Higher resolution terrain textures - private LLUUID m_terrainDetail0; - - public LLUUID terrainDetail0 - { - get { return m_terrainDetail0; } - set - { - m_terrainDetail0 = value; - configMember.forceSetConfigurationOption("terrain_detail_0", m_terrainDetail0.ToString()); - } - } - - private LLUUID m_terrainDetail1; - - public LLUUID terrainDetail1 - { - get { return m_terrainDetail1; } - set - { - m_terrainDetail1 = value; - configMember.forceSetConfigurationOption("terrain_detail_1", m_terrainDetail1.ToString()); - } - } - - private LLUUID m_terrainDetail2; - - public LLUUID terrainDetail2 - { - get { return m_terrainDetail2; } - set - { - m_terrainDetail2 = value; - configMember.forceSetConfigurationOption("terrain_detail_2", m_terrainDetail2.ToString()); - } - } - - private LLUUID m_terrainDetail3; - - public LLUUID terrainDetail3 - { - get { return m_terrainDetail3; } - set - { - m_terrainDetail3 = value; - configMember.forceSetConfigurationOption("terrain_detail_3", m_terrainDetail3.ToString()); - } - } - - // First quad - each point is bilinearly interpolated at each meter of terrain - private float m_terrainStartHeight0; - - public float terrainStartHeight0 - { - get { return m_terrainStartHeight0; } - set - { - m_terrainStartHeight0 = value; - configMember.forceSetConfigurationOption("terrain_start_height_0", m_terrainStartHeight0.ToString()); - } - } - - - private float m_terrainStartHeight1; - - public float terrainStartHeight1 - { - get { return m_terrainStartHeight1; } - set - { - m_terrainStartHeight1 = value; - configMember.forceSetConfigurationOption("terrain_start_height_1", m_terrainStartHeight1.ToString()); - } - } - - private float m_terrainStartHeight2; - - public float terrainStartHeight2 - { - get { return m_terrainStartHeight2; } - set - { - m_terrainStartHeight2 = value; - configMember.forceSetConfigurationOption("terrain_start_height_2", m_terrainStartHeight2.ToString()); - } - } - - private float m_terrainStartHeight3; - - public float terrainStartHeight3 - { - get { return m_terrainStartHeight3; } - set - { - m_terrainStartHeight3 = value; - configMember.forceSetConfigurationOption("terrain_start_height_3", m_terrainStartHeight3.ToString()); - } - } - - // Second quad - also bilinearly interpolated. - // Terrain texturing is done that: - // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y] - private float m_terrainHeightRange0; - - public float terrainHeightRange0 - { - get { return m_terrainHeightRange0; } - set - { - m_terrainHeightRange0 = value; - configMember.forceSetConfigurationOption("terrain_height_range_0", m_terrainHeightRange0.ToString()); - } - } - - private float m_terrainHeightRange1; - - public float terrainHeightRange1 - { - get { return m_terrainHeightRange1; } - set - { - m_terrainHeightRange1 = value; - configMember.forceSetConfigurationOption("terrain_height_range_1", m_terrainHeightRange1.ToString()); - } - } - - private float m_terrainHeightRange2; - - public float terrainHeightRange2 - { - get { return m_terrainHeightRange2; } - set - { - m_terrainHeightRange2 = value; - configMember.forceSetConfigurationOption("terrain_height_range_2", m_terrainHeightRange2.ToString()); - } - } - - private float m_terrainHeightRange3; - - public float terrainHeightRange3 - { - get { return m_terrainHeightRange3; } - set - { - m_terrainHeightRange3 = value; - configMember.forceSetConfigurationOption("terrain_height_range_3", m_terrainHeightRange3.ToString()); - } - } - - // Terrain Default (Must be in F32 Format!) - private string m_terrainFile; - - public string terrainFile - { - get { return m_terrainFile; } - set - { - m_terrainFile = value; - configMember.forceSetConfigurationOption("terrain_file", m_terrainFile.ToString()); - } - } - - private double m_terrainMultiplier; - - public double terrainMultiplier - { - get { return m_terrainMultiplier; } - set - { - m_terrainMultiplier = value; - configMember.forceSetConfigurationOption("terrain_multiplier", m_terrainMultiplier.ToString()); - } - } - - private float m_waterHeight; - - public float waterHeight - { - get { return m_waterHeight; } - set - { - m_waterHeight = value; - configMember.forceSetConfigurationOption("water_height", m_waterHeight.ToString()); - } - } - - private LLUUID m_terrainImageID; - - public LLUUID terrainImageID - { - get { return m_terrainImageID; } - set - { - m_terrainImageID = value; - configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString()); - } - } - - private ConfigurationMember configMember; - - public EstateSettings() - { - // Temporary hack to prevent multiple loadings. - if (configMember == null) - { - configMember = - new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", - loadConfigurationOptions, handleIncomingConfiguration); - configMember.performConfigurationRetrieve(); - } - } - - public void loadConfigurationOptions() - { - configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", - "0.0", true); - configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", - true); - configMember.addConfigurationOption("parent_estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, - "", "0", true); - configMember.addConfigurationOption("max_agents", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "40", - true); - - configMember.addConfigurationOption("object_bonus_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, - "", "1.0", true); - configMember.addConfigurationOption("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", - "0", true); - configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", - "0", true); - configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", - "0", true); - configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "21", - true); - configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", - true); - configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, - "", "0", true); - configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, - "", "0", true); - configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", - "false", true); - configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, - "", "1", true); - configMember.addConfigurationOption("region_water_height", - ConfigurationOption.ConfigurationTypes.TYPE_UINT16, "", "20", true); - configMember.addConfigurationOption("region_allow_terraform", - ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "true", true); - - configMember.addConfigurationOption("terrain_base_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", - "b8d3965a-ad78-bf43-699b-bff8eca6c975", true); - configMember.addConfigurationOption("terrain_base_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", - "abb783e6-3e93-26c0-248a-247666855da3", true); - configMember.addConfigurationOption("terrain_base_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", - "179cdabd-398a-9b6b-1391-4dc333ba321f", true); - configMember.addConfigurationOption("terrain_base_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", - "beb169c7-11ea-fff2-efe5-0f24dc881df2", true); - - configMember.addConfigurationOption("terrain_detail_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, - "", "00000000-0000-0000-0000-000000000000", true); - configMember.addConfigurationOption("terrain_detail_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, - "", "00000000-0000-0000-0000-000000000000", true); - configMember.addConfigurationOption("terrain_detail_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, - "", "00000000-0000-0000-0000-000000000000", true); - configMember.addConfigurationOption("terrain_detail_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, - "", "00000000-0000-0000-0000-000000000000", true); - - configMember.addConfigurationOption("terrain_start_height_0", - ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); - configMember.addConfigurationOption("terrain_start_height_1", - ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); - configMember.addConfigurationOption("terrain_start_height_2", - ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); - configMember.addConfigurationOption("terrain_start_height_3", - ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); - - configMember.addConfigurationOption("terrain_height_range_0", - ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); - configMember.addConfigurationOption("terrain_height_range_1", - ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); - configMember.addConfigurationOption("terrain_height_range_2", - ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); - configMember.addConfigurationOption("terrain_height_range_3", - ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); - - configMember.addConfigurationOption("terrain_file", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "", - "default.r32", true); - configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, - "", "60.0", true); - configMember.addConfigurationOption("water_height", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, "", - "20.0", true); - configMember.addConfigurationOption("terrain_image_id", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, - "", "00000000-0000-0000-0000-000000000000", true); - } - - public bool handleIncomingConfiguration(string configuration_key, object configuration_result) - { - switch (configuration_key) - { - case "billable_factor": - m_billableFactor = (float) configuration_result; - break; - case "estate_id": - m_estateID = (uint) configuration_result; - break; - case "parent_estate_id": - m_parentEstateID = (uint) configuration_result; - break; - case "max_agents": - m_maxAgents = (byte) configuration_result; - break; - - case "object_bonus_factor": - m_objectBonusFactor = (float) configuration_result; - break; - case "redirect_grid_x": - m_redirectGridX = (int) configuration_result; - break; - case "redirect_grid_y": - m_redirectGridY = (int) configuration_result; - break; - case "region_flags": - m_regionFlags = (Simulator.RegionFlags) ((uint) configuration_result); - break; - case "sim_access": - m_simAccess = (Simulator.SimAccess) ((byte) configuration_result); - break; - case "sun_hour": - m_sunHour = (float) configuration_result; - break; - case "terrain_raise_limit": - m_terrainRaiseLimit = (float) configuration_result; - break; - case "terrain_lower_limit": - m_terrainLowerLimit = (float) configuration_result; - break; - case "use_fixed_sun": - m_useFixedSun = (bool) configuration_result; - break; - case "price_per_meter": - m_pricePerMeter = Convert.ToInt32(configuration_result); - break; - case "region_water_height": - m_regionWaterHeight = (ushort) configuration_result; - break; - case "region_allow_terraform": - m_regionAllowTerraform = (bool) configuration_result; - break; - - case "terrain_base_0": - m_terrainBase0 = (LLUUID) configuration_result; - break; - case "terrain_base_1": - m_terrainBase1 = (LLUUID) configuration_result; - break; - case "terrain_base_2": - m_terrainBase2 = (LLUUID) configuration_result; - break; - case "terrain_base_3": - m_terrainBase3 = (LLUUID) configuration_result; - break; - - case "terrain_detail_0": - m_terrainDetail0 = (LLUUID) configuration_result; - break; - case "terrain_detail_1": - m_terrainDetail1 = (LLUUID) configuration_result; - break; - case "terrain_detail_2": - m_terrainDetail2 = (LLUUID) configuration_result; - break; - case "terrain_detail_3": - m_terrainDetail3 = (LLUUID) configuration_result; - break; - - case "terrain_start_height_0": - m_terrainStartHeight0 = (float) configuration_result; - break; - case "terrain_start_height_1": - m_terrainStartHeight1 = (float) configuration_result; - break; - case "terrain_start_height_2": - m_terrainStartHeight2 = (float) configuration_result; - break; - case "terrain_start_height_3": - m_terrainStartHeight3 = (float) configuration_result; - break; - - case "terrain_height_range_0": - m_terrainHeightRange0 = (float) configuration_result; - break; - case "terrain_height_range_1": - m_terrainHeightRange1 = (float) configuration_result; - break; - case "terrain_height_range_2": - m_terrainHeightRange2 = (float) configuration_result; - break; - case "terrain_height_range_3": - m_terrainHeightRange3 = (float) configuration_result; - break; - - case "terrain_file": - m_terrainFile = (string) configuration_result; - break; - case "terrain_multiplier": - m_terrainMultiplier = Convert.ToDouble(configuration_result); - break; - case "water_height": - double tmpVal = (double) configuration_result; - m_waterHeight = (float) tmpVal; - break; - case "terrain_image_id": - m_terrainImageID = (LLUUID) configuration_result; - break; - } - - return true; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/GridConfig.cs b/OpenSim/Framework/General/GridConfig.cs deleted file mode 100644 index 021e6c5..0000000 --- a/OpenSim/Framework/General/GridConfig.cs +++ /dev/null @@ -1,136 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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. -* -*/ - -namespace OpenSim.Framework -{ - public class GridConfig - { - public string GridOwner = ""; - public string DefaultAssetServer = ""; - public string AssetSendKey = ""; - public string AssetRecvKey = ""; - - public string DefaultUserServer = ""; - public string UserSendKey = ""; - public string UserRecvKey = ""; - - public string SimSendKey = ""; - public string SimRecvKey = ""; - - public string DatabaseProvider = ""; - - public static uint DefaultHttpPort = 8001; - public uint HttpPort = DefaultHttpPort; - - private ConfigurationMember configMember; - - public GridConfig(string description, string filename) - { - configMember = - new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); - configMember.performConfigurationRetrieve(); - } - - public void loadConfigurationOptions() - { - configMember.addConfigurationOption("grid_owner", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "OGS Grid Owner", "OGS development team", false); - configMember.addConfigurationOption("default_asset_server", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "Default Asset Server URI", - "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/", - false); - configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "Key to send to asset server", "null", false); - configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "Key to expect from asset server", "null", false); - - configMember.addConfigurationOption("default_user_server", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "Default User Server URI", - "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/", false); - configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "Key to send to user server", "null", false); - configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "Key to expect from user server", "null", false); - - configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "Key to send to a simulator", "null", false); - configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "Key to expect from a simulator", "null", false); - configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); - - configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, - "Http Listener port", DefaultHttpPort.ToString(), false); - } - - public bool handleIncomingConfiguration(string configuration_key, object configuration_result) - { - switch (configuration_key) - { - case "grid_owner": - GridOwner = (string) configuration_result; - break; - case "default_asset_server": - DefaultAssetServer = (string) configuration_result; - break; - case "asset_send_key": - AssetSendKey = (string) configuration_result; - break; - case "asset_recv_key": - AssetRecvKey = (string) configuration_result; - break; - case "default_user_server": - DefaultUserServer = (string) configuration_result; - break; - case "user_send_key": - UserSendKey = (string) configuration_result; - break; - case "user_recv_key": - UserRecvKey = (string) configuration_result; - break; - case "sim_send_key": - SimSendKey = (string) configuration_result; - break; - case "sim_recv_key": - SimRecvKey = (string) configuration_result; - break; - case "database_provider": - DatabaseProvider = (string) configuration_result; - break; - case "http_port": - HttpPort = (uint) configuration_result; - break; - } - - return true; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/IAssetProvider.cs b/OpenSim/Framework/General/IAssetProvider.cs deleted file mode 100644 index ad1cf66..0000000 --- a/OpenSim/Framework/General/IAssetProvider.cs +++ /dev/null @@ -1,41 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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 libsecondlife; - -namespace OpenSim.Framework -{ - public interface IAssetProvider : IPlugin - { - AssetBase FetchAsset(LLUUID uuid); - void CreateAsset(AssetBase asset); - void UpdateAsset(AssetBase asset); - bool ExistsAsset(LLUUID uuid); - void CommitAssets(); // force a sync to the database - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/IAssetServer.cs b/OpenSim/Framework/General/IAssetServer.cs deleted file mode 100644 index 9a7dbab..0000000 --- a/OpenSim/Framework/General/IAssetServer.cs +++ /dev/null @@ -1,69 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; - -namespace OpenSim.Framework -{ - /// - /// Description of IAssetServer. - /// - public interface IAssetServer - { - void SetReceiver(IAssetReceiver receiver); - void FetchAsset(LLUUID assetID, bool isTexture); - void UpdateAsset(AssetBase asset); - void StoreAndCommitAsset(AssetBase asset); - void Close(); - void LoadAsset(AssetBase info, bool image, string filename); - List GetDefaultAssets(); - AssetBase CreateImageAsset(string assetIdStr, string name, string filename); - void ForEachDefaultAsset(Action action); - AssetBase CreateAsset(string assetIdStr, string name, string filename, bool isImage); - void ForEachXmlAsset(Action action); - } - - // could change to delegate? - public interface IAssetReceiver - { - void AssetReceived(AssetBase asset, bool IsTexture); - void AssetNotFound(LLUUID assetID); - } - - public interface IAssetPlugin - { - IAssetServer GetAssetServer(); - } - - public struct ARequest - { - public LLUUID AssetID; - public bool IsTexture; - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/IClientAPI.cs b/OpenSim/Framework/General/IClientAPI.cs deleted file mode 100644 index 4482ae6..0000000 --- a/OpenSim/Framework/General/IClientAPI.cs +++ /dev/null @@ -1,447 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; -using libsecondlife.Packets; - -namespace OpenSim.Framework -{ - // Base Args Interface - public interface IEventArgs - { - IScene Scene { get; set; } - - IClientAPI Sender { get; set; } - } - - public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock); - - public delegate void ChatFromViewer(Object sender, ChatFromViewerArgs e); - - public enum ChatTypeEnum - { - Whisper = 0, - Say = 1, - Shout = 2, - Broadcast = 0xFF - } ; - - /// - /// ChatFromViewer Arguments - /// - public class ChatFromViewerArgs : EventArgs, IEventArgs - { - protected string m_message; - protected ChatTypeEnum m_type; - protected int m_channel; - protected LLVector3 m_position; - protected string m_from; - - protected IClientAPI m_sender; - protected IScene m_scene; - - /// - /// The message sent by the user - /// - public string Message - { - get { return m_message; } - set { m_message = value; } - } - - /// - /// The type of message, eg say, shout, broadcast. - /// - public ChatTypeEnum Type - { - get { return m_type; } - set { m_type = value; } - } - - /// - /// Which channel was this message sent on? Different channels may have different listeners. Public chat is on channel zero. - /// - public int Channel - { - get { return m_channel; } - set { m_channel = value; } - } - - /// - /// The position of the sender at the time of the message broadcast. - /// - public LLVector3 Position - { - get { return m_position; } - set { m_position = value; } - } - - /// - /// The name of the sender (needed for scripts) - /// - public string From - { - get { return m_from; } - set { m_from = value; } - } - - /// - /// The client responsible for sending the message, or null. - /// - public IClientAPI Sender - { - get { return m_sender; } - set { m_sender = value; } - } - - public IScene Scene - { - get { return m_scene; } - set { m_scene = value; } - } - - public ChatFromViewerArgs() - { - m_position = new LLVector3(); - } - } - - public class TextureRequestArgs : EventArgs - { - protected LLUUID m_requestedAssetID; - private sbyte m_discardLevel; - private uint m_packetNumber; - - public uint PacketNumber - { - get { return m_packetNumber; } - set { m_packetNumber = value; } - } - - public sbyte DiscardLevel - { - get { return m_discardLevel; } - set { m_discardLevel = value; } - } - - public LLUUID RequestedAssetID - { - get { return m_requestedAssetID; } - set { m_requestedAssetID = value; } - } - } - - public delegate void TextureRequest(Object sender, TextureRequestArgs e); - - public delegate void ImprovedInstantMessage( - LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, - string fromAgentName, string message, byte dialog); // Cut down from full list - public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos); - - public delegate void ModifyTerrain( - float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient); - - public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); - - public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID, int seq); - - public delegate void LinkObjects(uint parent, List children); - - public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY); - - public delegate void TeleportLocationRequest( - IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags); - - public delegate void DisconnectUser(); - - public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID); - - public delegate void GenericCall(IClientAPI remoteClient); - - public delegate void GenericCall2(); - - public delegate void GenericCall3(Packet packet); - - // really don't want to be passing packets in these events, so this is very temporary. - public delegate void GenericCall4(Packet packet, IClientAPI remoteClient); - - public delegate void GenericCall5(IClientAPI remoteClient, bool status); - - public delegate void GenericCall6(LLUUID uid); - - public delegate void GenericCall7(uint localID, string message); - - public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); - - public delegate void ObjectExtraParams(uint localID, ushort type, bool inUse, byte[] data); - - public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); - - public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient); - - public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient); - - public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); - - public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient); - - public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); - - public delegate void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); - - public delegate void UpdatePrimGroupRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient); - - public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags); - - public delegate void StatusChange(bool status); - - public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); - - public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); - - public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset); - - public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID); - - public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); - - public delegate void ParcelPropertiesRequest( - int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); - - public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client); - - public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client); - - public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); - - public delegate void ParcelSelectObjects(int land_local_id, int request_type, IClientAPI remote_client); - - public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client); - - public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client); - - public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client); - - public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); - - public delegate void CreateInventoryFolder( - IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); - - public delegate void CreateNewInventoryItem( - IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, - sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask); - - public delegate void FetchInventoryDescendents( - IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); - - public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID); - - public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); - - public delegate void UpdateInventoryItemTransaction( - IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID); - - public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID); - - public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID); - - public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID); - - public delegate void UDPAssetUploadRequest( - IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal); - - public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); - - public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName); - - public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); - - public interface IClientAPI - { - event ImprovedInstantMessage OnInstantMessage; - event ChatFromViewer OnChatFromViewer; - event TextureRequest OnRequestTexture; - event RezObject OnRezObject; - event ModifyTerrain OnModifyTerrain; - event SetAppearance OnSetAppearance; - event StartAnim OnStartAnim; - event LinkObjects OnLinkObjects; - event RequestMapBlocks OnRequestMapBlocks; - event TeleportLocationRequest OnTeleportLocationRequest; - event DisconnectUser OnDisconnectUser; - event RequestAvatarProperties OnRequestAvatarProperties; - - event GenericCall4 OnDeRezObject; - event GenericCall OnRegionHandShakeReply; - event GenericCall OnRequestWearables; - event GenericCall2 OnCompleteMovementToRegion; - event UpdateAgent OnAgentUpdate; - event AgentRequestSit OnAgentRequestSit; - event AgentSit OnAgentSit; - event GenericCall OnRequestAvatarsData; - event AddNewPrim OnAddPrim; - event ObjectDuplicate OnObjectDuplicate; - event UpdateVector OnGrabObject; - event ObjectSelect OnDeGrabObject; - event MoveObject OnGrabUpdate; - - event UpdateShape OnUpdatePrimShape; - event ObjectExtraParams OnUpdateExtraParams; - event ObjectSelect OnObjectSelect; - event ObjectDeselect OnObjectDeselect; - event GenericCall7 OnObjectDescription; - event GenericCall7 OnObjectName; - event UpdatePrimFlags OnUpdatePrimFlags; - event UpdatePrimTexture OnUpdatePrimTexture; - event UpdateVector OnUpdatePrimGroupPosition; - event UpdateVector OnUpdatePrimSinglePosition; - event UpdatePrimRotation OnUpdatePrimGroupRotation; - event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; - event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; - event UpdateVector OnUpdatePrimScale; - event StatusChange OnChildAgentStatus; - event GenericCall2 OnStopMovement; - event GenericCall6 OnRemoveAvatar; - - event CreateNewInventoryItem OnCreateNewInventoryItem; - event CreateInventoryFolder OnCreateNewInventoryFolder; - event FetchInventoryDescendents OnFetchInventoryDescendents; - event FetchInventory OnFetchInventory; - event RequestTaskInventory OnRequestTaskInventory; - event UpdateInventoryItemTransaction OnUpdateInventoryItem; - event UDPAssetUploadRequest OnAssetUploadRequest; - event XferReceive OnXferReceive; - event RequestXfer OnRequestXfer; - event ConfirmXfer OnConfirmXfer; - event RezScript OnRezScript; - event UpdateTaskInventory OnUpdateTaskInventory; - event RemoveTaskInventory OnRemoveTaskItem; - - event UUIDNameRequest OnNameFromUUIDRequest; - - event ParcelPropertiesRequest OnParcelPropertiesRequest; - event ParcelDivideRequest OnParcelDivideRequest; - event ParcelJoinRequest OnParcelJoinRequest; - event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; - event ParcelSelectObjects OnParcelSelectObjects; - event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; - event EstateOwnerMessageRequest OnEstateOwnerMessage; - - LLVector3 StartPos { get; set; } - - LLUUID AgentId { get; } - - LLUUID SessionId { get; } - - string FirstName { get; } - - string LastName { get; } - - uint CircuitCode { get; set; } - - void OutPacket(Packet newPack); - void SendWearables(AvatarWearable[] wearables); - void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry); - void SendStartPingCheck(byte seq); - void SendKillObject(ulong regionHandle, uint localID); - void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId); - void SendRegionHandshake(RegionInfo regionInfo); - void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); - void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); - - void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, - LLUUID imSessionID, string fromName, byte dialog, uint timeStamp); - - void SendLayerData(float[] map); - void SendLayerData(int px, int py, float[] map); - void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look); - void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint); - AgentCircuitData RequestClientInfo(); - - void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint, - string capsURL); - - void SendMapBlock(List mapBlocks); - void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags); - - void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, - uint flags, string capsURL); - - void SendTeleportCancel(); - void SendTeleportLocationStart(); - void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); - - void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, - LLVector3 Pos, byte[] textureEntry, uint parentID); - - void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, - LLVector3 velocity, LLQuaternion rotation); - - void SendCoarseLocationUpdate(List CoarseLocations); - - void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); - - void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, - LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, - uint parentID, byte[] particleSystem, LLQuaternion rotation); - - void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, - LLQuaternion rotation); - - void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items); - void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); - void SendInventoryItemUpdate(InventoryItemBase Item); - void SendRemoveInventoryItem(LLUUID itemID); - void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName); - void SendXferPacket(ulong xferID, uint packet, byte[] data); - - void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID); - void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags); - - void SendNameReply(LLUUID profileId, string firstname, string lastname); - void SendAlertMessage(string message); - void SendAgentAlertMessage(string message, bool modal); - void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); - bool AddMoney(int debit); - - void SendViewerTime(int phase); - - void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, - uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); - - void SetDebug(int newDebug); - void InPacket(Packet NewPack); - void Close(); - event ViewerEffectEventHandler OnViewerEffect; - event Action OnLogout; - event Action OnConnectionClosed; - void SendLogoutPacket(); - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/IGenericConfig.cs b/OpenSim/Framework/General/IGenericConfig.cs deleted file mode 100644 index 889d178..0000000 --- a/OpenSim/Framework/General/IGenericConfig.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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. -* -*/ -namespace OpenSim.Framework -{ - public interface IGenericConfig - { - void SetFileName(string fileName); - void LoadData(); - void LoadDataFromString(string data); - string GetAttribute(string attributeName); - bool SetAttribute(string attributeName, string attributeValue); - void Commit(); - void Close(); - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/IPlugin.cs b/OpenSim/Framework/General/IPlugin.cs deleted file mode 100644 index e649274..0000000 --- a/OpenSim/Framework/General/IPlugin.cs +++ /dev/null @@ -1,53 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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. -* -*/ - -namespace OpenSim.Framework -{ - /// - /// This interface, describes a generic plugin - /// - public interface IPlugin - { - /// - /// Returns the plugin version - /// - /// Plugin version in MAJOR.MINOR.REVISION.BUILD format - string Version { get; } - - /// - /// Returns the plugin name - /// - /// Plugin name, eg MySQL User Provider - string Name { get; } - - /// - /// Initialises the plugin (artificial constructor) - /// - void Initialise(); - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/IRegionCommsListener.cs b/OpenSim/Framework/General/IRegionCommsListener.cs deleted file mode 100644 index 1a24469..0000000 --- a/OpenSim/Framework/General/IRegionCommsListener.cs +++ /dev/null @@ -1,49 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Collections.Generic; -using libsecondlife; - -namespace OpenSim.Framework -{ - public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent); - - public delegate void UpdateNeighbours(List neighbours); - - public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); - - public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID); - - public interface IRegionCommsListener - { - event ExpectUserDelegate OnExpectUser; - event GenericCall2 OnExpectChildAgent; - event AgentCrossing OnAvatarCrossingIntoRegion; - event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; - event UpdateNeighbours OnNeighboursUpdate; - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/IScene.cs b/OpenSim/Framework/General/IScene.cs deleted file mode 100644 index 3d6ca1c..0000000 --- a/OpenSim/Framework/General/IScene.cs +++ /dev/null @@ -1,43 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; - -namespace OpenSim.Framework -{ - public interface IScene - { - void AddNewClient(IClientAPI client, bool child); - void RemoveClient(LLUUID agentID); - - RegionInfo RegionInfo { get; } - object SyncRoot { get; } - uint NextLocalId { get; } - - ClientManager ClientManager { get; } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/IUserData.cs b/OpenSim/Framework/General/IUserData.cs deleted file mode 100644 index cb2502a..0000000 --- a/OpenSim/Framework/General/IUserData.cs +++ /dev/null @@ -1,134 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; - -namespace OpenSim.Framework -{ - /// - /// An interface for connecting to user storage servers. - /// - public interface IUserData - { - /// - /// Returns a user profile from a database via their UUID - /// - /// The accounts UUID - /// The user data profile - UserProfileData GetUserByUUID(LLUUID user); - - /// - /// Returns a users profile by searching their username - /// - /// The users username - /// The user data profile - UserProfileData GetUserByName(string name); - - /// - /// Returns a users profile by searching their username parts - /// - /// Account firstname - /// Account lastname - /// The user data profile - UserProfileData GetUserByName(string fname, string lname); - - /// - /// Returns the current agent for a user searching by it's UUID - /// - /// The users UUID - /// The current agent session - UserAgentData GetAgentByUUID(LLUUID user); - - /// - /// Returns the current session agent for a user searching by username - /// - /// The users account name - /// The current agent session - UserAgentData GetAgentByName(string name); - - /// - /// Returns the current session agent for a user searching by username parts - /// - /// The users first account name - /// The users account surname - /// The current agent session - UserAgentData GetAgentByName(string fname, string lname); - - /// - /// Adds a new User profile to the database - /// - /// UserProfile to add - void AddNewUserProfile(UserProfileData user); - - /// - /// Updates an existing user profile - /// - /// UserProfile to update - bool UpdateUserProfile(UserProfileData user); - - /// - /// Adds a new agent to the database - /// - /// The agent to add - void AddNewUserAgent(UserAgentData agent); - - /// - /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES) - /// - /// The account to transfer from - /// The account to transfer to - /// The amount to transfer - /// Successful? - bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount); - - /// - /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account. - /// - /// User to transfer from - /// User to transfer to - /// Specified inventory item - /// Successful? - bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); - - /// - /// Returns the plugin version - /// - /// Plugin version in MAJOR.MINOR.REVISION.BUILD format - string GetVersion(); - - /// - /// Returns the plugin name - /// - /// Plugin name, eg MySQL User Provider - string getName(); - - /// - /// Initialises the plugin (artificial constructor) - /// - void Initialise(); - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/IUserService.cs b/OpenSim/Framework/General/IUserService.cs deleted file mode 100644 index ed9032b..0000000 --- a/OpenSim/Framework/General/IUserService.cs +++ /dev/null @@ -1,48 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; - -namespace OpenSim.Framework.Interfaces -{ - public interface IUserService - { - UserProfileData GetUserProfile(string firstName, string lastName); - UserProfileData GetUserProfile(string name); - UserProfileData GetUserProfile(LLUUID userId); - void clearUserAgent(LLUUID avatarID); - - UserProfileData SetupMasterUser(string firstName, string lastName); - UserProfileData SetupMasterUser(string firstName, string lastName, string password); - - /// - /// - /// - /// - void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/InventoryConfig.cs b/OpenSim/Framework/General/InventoryConfig.cs deleted file mode 100644 index 8e64b68..0000000 --- a/OpenSim/Framework/General/InventoryConfig.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Framework -{ - /// - /// UserConfig -- For User Server Configuration - /// - public class InventoryConfig - { - public string DefaultStartupMsg = ""; - public string UserServerURL = ""; - public string UserSendKey = ""; - public string UserRecvKey = ""; - - public string DatabaseProvider = ""; - public static uint DefaultHttpPort = 8004; - - public int HttpPort = 8004; - - private ConfigurationMember configMember; - - public InventoryConfig(string description, string filename) - { - configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); - configMember.performConfigurationRetrieve(); - } - - public void loadConfigurationOptions() - { - configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false); - configMember.addConfigurationOption("default_user_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default User Server URI", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString(), false); - configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null", false); - configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null", false); - configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); - configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Http Listener port", DefaultHttpPort.ToString(), false); - } - - public bool handleIncomingConfiguration(string configuration_key, object configuration_result) - { - switch (configuration_key) - { - case "default_startup_message": - this.DefaultStartupMsg = (string)configuration_result; - break; - case "default_user_server": - this.UserServerURL = (string)configuration_result; - break; - case "user_send_key": - this.UserSendKey = (string)configuration_result; - break; - case "user_recv_key": - this.UserRecvKey = (string)configuration_result; - break; - case "database_provider": - this.DatabaseProvider = (string)configuration_result; - break; - case "http_port": - HttpPort = (int)configuration_result; - break; - } - - return true; - } - } -} diff --git a/OpenSim/Framework/General/InventoryItemBase.cs b/OpenSim/Framework/General/InventoryItemBase.cs deleted file mode 100644 index 331013f..0000000 --- a/OpenSim/Framework/General/InventoryItemBase.cs +++ /dev/null @@ -1,273 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Xml.Serialization; -using System.Collections; -using System.Collections.Generic; -using libsecondlife; - -namespace OpenSim.Framework -{ - /// - /// Inventory Item - contains all the properties associated with an individual inventory piece. - /// - public class InventoryItemBase - { - /// - /// A UUID containing the ID for the inventory item itself - /// - public LLUUID inventoryID; - - /// - /// The UUID of the associated asset on the asset server - /// - public LLUUID assetID; - - /// - /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) - /// - public int assetType; - - /// - /// The type of inventory item. (Can be slightly different to the asset type - /// - public int invType; - - /// - /// The folder this item is contained in - /// - public LLUUID parentFolderID; - - /// - /// The owner of this inventory item - /// - public LLUUID avatarID; - - /// - /// The creator of this item - /// - public LLUUID creatorsID; - - /// - /// The name of the inventory item (must be less than 64 characters) - /// - public string inventoryName; - - /// - /// The description of the inventory item (must be less than 64 characters) - /// - public string inventoryDescription; - - /// - /// A mask containing the permissions for the next owner (cannot be enforced) - /// - public uint inventoryNextPermissions; - - /// - /// A mask containing permissions for the current owner (cannot be enforced) - /// - public uint inventoryCurrentPermissions; - - /// - /// - /// - public uint inventoryBasePermissions; - - /// - /// - /// - public uint inventoryEveryOnePermissions; - } - - /// - /// A Class for folders which contain users inventory - /// - public class InventoryFolderBase - { - /// - /// The name of the folder (64 characters or less) - /// - public string name; - - /// - /// The agent who's inventory this is contained by - /// - public LLUUID agentID; - - /// - /// The folder this folder is contained in - /// - public LLUUID parentID; - - /// - /// The UUID for this folder - /// - public LLUUID folderID; - - /// - /// Tyep of Items normally stored in this folder - /// - public short type; - - /// - /// - /// - public ushort version; - } - - /// - /// An interface for accessing inventory data from a storage server - /// - public interface IInventoryData - { - /// - /// Initialises the interface - /// - void Initialise(); - - /// - /// Closes the interface - /// - void Close(); - - /// - /// The plugin being loaded - /// - /// A string containing the plugin name - string getName(); - - /// - /// The plugins version - /// - /// A string containing the plugin version - string getVersion(); - - /// - /// Returns a list of inventory items contained within the specified folder - /// - /// The UUID of the target folder - /// A List of InventoryItemBase items - List getInventoryInFolder(LLUUID folderID); - - /// - /// Returns a list of the root folders within a users inventory - /// - /// The user whos inventory is to be searched - /// A list of folder objects - List getUserRootFolders(LLUUID user); - - /// - /// Returns the users inventory root folder. - /// - /// The UUID of the user who is having inventory being returned - /// Root inventory folder - InventoryFolderBase getUserRootFolder(LLUUID user); - - /// - /// Returns a list of inventory folders contained in the folder 'parentID' - /// - /// The folder to get subfolders for - /// A list of inventory folders - List getInventoryFolders(LLUUID parentID); - - /// - /// Returns an inventory item by its UUID - /// - /// The UUID of the item to be returned - /// A class containing item information - InventoryItemBase getInventoryItem(LLUUID item); - - /// - /// Returns a specified inventory folder by its UUID - /// - /// The UUID of the folder to be returned - /// A class containing folder information - InventoryFolderBase getInventoryFolder(LLUUID folder); - - /// - /// Creates a new inventory item based on item - /// - /// The item to be created - void addInventoryItem(InventoryItemBase item); - - /// - /// Updates an inventory item with item (updates based on ID) - /// - /// The updated item - void updateInventoryItem(InventoryItemBase item); - - /// - /// - /// - /// - void deleteInventoryItem(LLUUID item); - - /// - /// Adds a new folder specified by folder - /// - /// The inventory folder - void addInventoryFolder(InventoryFolderBase folder); - - /// - /// Updates a folder based on its ID with folder - /// - /// The inventory folder - void updateInventoryFolder(InventoryFolderBase folder); - - /// - /// Deletes a folder based on its ID with folder - /// - /// The id of the folder - void deleteInventoryFolder(LLUUID folder); - } - - /* - * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder - * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize - * into this simpler class, and then use that. - */ - [XmlRoot(ElementName = "inventory", IsNullable = true)] - public class SerializableInventory - { - [XmlRoot(ElementName = "folder", IsNullable = true)] - public class SerializableFolder : InventoryFolderBase - { - [XmlArray(ElementName = "folders", IsNullable = true)] - [XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof(SerializableFolder))] - public ArrayList SubFolders; - - [XmlArray(ElementName = "items", IsNullable = true)] - [XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof(InventoryItemBase))] - public ArrayList Items; - } - - [XmlElement(ElementName = "folder", IsNullable = true)] - public SerializableFolder root; - } - -} diff --git a/OpenSim/Framework/General/LandData.cs b/OpenSim/Framework/General/LandData.cs deleted file mode 100644 index ca948ef..0000000 --- a/OpenSim/Framework/General/LandData.cs +++ /dev/null @@ -1,123 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; - -namespace OpenSim.Framework -{ - public class LandData - { - public byte[] landBitmapByteArray = new byte[512]; - public string landName = "Your Parcel"; - public string landDesc = ""; - public LLUUID ownerID = new LLUUID(); - public bool isGroupOwned = false; - public LLVector3 AABBMin = new LLVector3(); - public LLVector3 AABBMax = new LLVector3(); - public int area = 0; - public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned - public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID - public Parcel.ParcelCategory category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category - public int claimDate = 0; //Unemplemented - public int claimPrice = 0; //Unemplemented - public LLUUID groupID = new LLUUID(); //Unemplemented - public int groupPrims = 0; - public int otherPrims = 0; - public int ownerPrims = 0; - public int selectedPrims = 0; - public int simwidePrims = 0; - public int simwideArea = 0; - public int salePrice = 0; //Unemeplemented. Parcels price. - public Parcel.ParcelStatus landStatus = Parcel.ParcelStatus.Leased; - - public uint landFlags = (uint) Parcel.ParcelFlags.AllowFly | (uint) Parcel.ParcelFlags.AllowLandmark | - (uint) Parcel.ParcelFlags.AllowAllObjectEntry | - (uint) Parcel.ParcelFlags.AllowDeedToGroup | (uint) Parcel.ParcelFlags.AllowTerraform | - (uint) Parcel.ParcelFlags.CreateObjects | (uint) Parcel.ParcelFlags.AllowOtherScripts | - (uint) Parcel.ParcelFlags.SoundLocal; - - public byte landingType = 0; - public byte mediaAutoScale = 0; - public LLUUID mediaID = LLUUID.Zero; - public int localID = 0; - public LLUUID globalID = new LLUUID(); - - public string mediaURL = ""; - public string musicURL = ""; - public float passHours = 0; - public int passPrice = 0; - public LLUUID snapshotID = LLUUID.Zero; - public LLVector3 userLocation = new LLVector3(); - public LLVector3 userLookAt = new LLVector3(); - - public LandData() - { - globalID = LLUUID.Random(); - } - - public LandData Copy() - { - LandData landData = new LandData(); - - landData.AABBMax = AABBMax; - landData.AABBMin = AABBMin; - landData.area = area; - landData.auctionID = auctionID; - landData.authBuyerID = authBuyerID; - landData.category = category; - landData.claimDate = claimDate; - landData.claimPrice = claimPrice; - landData.globalID = globalID; - landData.groupID = groupID; - landData.groupPrims = groupPrims; - landData.otherPrims = otherPrims; - landData.ownerPrims = ownerPrims; - landData.selectedPrims = selectedPrims; - landData.isGroupOwned = isGroupOwned; - landData.localID = localID; - landData.landingType = landingType; - landData.mediaAutoScale = mediaAutoScale; - landData.mediaID = mediaID; - landData.mediaURL = mediaURL; - landData.musicURL = musicURL; - landData.ownerID = ownerID; - landData.landBitmapByteArray = (byte[]) landBitmapByteArray.Clone(); - landData.landDesc = landDesc; - landData.landFlags = landFlags; - landData.landName = landName; - landData.landStatus = landStatus; - landData.passHours = passHours; - landData.passPrice = passPrice; - landData.salePrice = salePrice; - landData.snapshotID = snapshotID; - landData.userLocation = userLocation; - landData.userLookAt = userLookAt; - - return landData; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/Login.cs b/OpenSim/Framework/General/Login.cs deleted file mode 100644 index 7ceed19..0000000 --- a/OpenSim/Framework/General/Login.cs +++ /dev/null @@ -1,50 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; - -namespace OpenSim.Framework -{ - public class Login - { - public string First = "Test"; - public string Last = "User"; - public LLUUID Agent; - public LLUUID Session; - public LLUUID SecureSession = LLUUID.Zero; - public LLUUID InventoryFolder; - public LLUUID BaseFolder; - public uint CircuitCode; - public string CapsPath = ""; - public LLVector3 StartPos; - - public Login() - { - StartPos = new LLVector3(128, 128, 70); - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/MapBlockData.cs b/OpenSim/Framework/General/MapBlockData.cs deleted file mode 100644 index 8609533..0000000 --- a/OpenSim/Framework/General/MapBlockData.cs +++ /dev/null @@ -1,50 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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 libsecondlife; - -namespace OpenSim.Framework -{ - public class MapBlockData - { - public uint Flags; - public ushort X; - public ushort Y; - public byte Agents; - public byte Access; - public byte WaterHeight; - public LLUUID MapImageId; - public String Name; - public uint RegionFlags; - - public MapBlockData() - { - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/NeighbourInfo.cs b/OpenSim/Framework/General/NeighbourInfo.cs deleted file mode 100644 index d5a0a2f..0000000 --- a/OpenSim/Framework/General/NeighbourInfo.cs +++ /dev/null @@ -1,42 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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. -* -*/ -namespace OpenSim.Framework -{ - public class NeighbourInfo - { - public NeighbourInfo() - { - } - - public ulong regionhandle; - public uint RegionLocX; - public uint RegionLocY; - public string sim_ip; - public uint sim_port; - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/NetworkServersInfo.cs b/OpenSim/Framework/General/NetworkServersInfo.cs deleted file mode 100644 index b9ce143..0000000 --- a/OpenSim/Framework/General/NetworkServersInfo.cs +++ /dev/null @@ -1,100 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 Nini.Config; - -namespace OpenSim.Framework -{ - public class NetworkServersInfo - { - public string AssetURL = "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/"; - public string AssetSendKey = ""; - - public string GridURL = ""; - public string GridSendKey = ""; - public string GridRecvKey = ""; - public string UserURL = ""; - public string UserSendKey = ""; - public string UserRecvKey = ""; - public bool isSandbox; - - public string InventoryURL = ""; - - public static int DefaultHttpListenerPort = 9000; - public int HttpListenerPort = DefaultHttpListenerPort; - - public static int RemotingListenerPort = 8895; - - - public NetworkServersInfo() - { - } - - public NetworkServersInfo(uint defaultHomeLocX, uint defaultHomeLocY) - { - m_defaultHomeLocX = defaultHomeLocX; - m_defaultHomeLocY = defaultHomeLocY; - } - - private uint? m_defaultHomeLocX; - - public uint DefaultHomeLocX - { - get { return m_defaultHomeLocX.Value; } - } - - private uint? m_defaultHomeLocY; - - public uint DefaultHomeLocY - { - get { return m_defaultHomeLocY.Value; } - } - - public void loadFromConfiguration(IConfigSource config) - { - m_defaultHomeLocX = (uint) config.Configs["StandAlone"].GetInt("default_location_x", 1000); - m_defaultHomeLocY = (uint) config.Configs["StandAlone"].GetInt("default_location_y", 1000); - - HttpListenerPort = config.Configs["Network"].GetInt("http_listener_port", DefaultHttpListenerPort); - RemotingListenerPort = config.Configs["Network"].GetInt("remoting_listener_port", RemotingListenerPort); - GridURL = - config.Configs["Network"].GetString("grid_server_url", - "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString()); - GridSendKey = config.Configs["Network"].GetString("grid_send_key", "null"); - GridRecvKey = config.Configs["Network"].GetString("grid_recv_key", "null"); - UserURL = - config.Configs["Network"].GetString("user_server_url", - "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString()); - UserSendKey = config.Configs["Network"].GetString("user_send_key", "null"); - UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null"); - AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL); - InventoryURL = config.Configs["Network"].GetString("inventory_server_url", - "http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString()); - } - } -} diff --git a/OpenSim/Framework/General/PrimitiveBaseShape.cs b/OpenSim/Framework/General/PrimitiveBaseShape.cs deleted file mode 100644 index 5cdbfb2..0000000 --- a/OpenSim/Framework/General/PrimitiveBaseShape.cs +++ /dev/null @@ -1,214 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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.Xml.Serialization; -using libsecondlife; - -namespace OpenSim.Framework -{ - public enum ProfileShape : byte - { - Circle = 0, - Square = 1, - IsometricTriangle = 2, - EquilateralTriangle = 3, - RightTriangle = 4, - HalfCircle = 5 - } - - public enum HollowShape : byte - { - Same = 0, - Circle = 16, - Square = 32, - Triangle = 48 - } - - public enum PCodeEnum : byte - { - Primitive = 9, - Avatar = 47 - } - - public enum Extrusion : byte - { - Straight = 16, - Curve1 = 32, - Curve2 = 48, - Flexible = 128 - } - - public class PrimitiveBaseShape - { - private static byte[] m_defaultTextureEntry; - - public byte PCode; - public ushort PathBegin; - public ushort PathEnd; - public byte PathScaleX; - public byte PathScaleY; - public byte PathShearX; - public byte PathShearY; - public sbyte PathSkew; - public ushort ProfileBegin; - public ushort ProfileEnd; - public LLVector3 Scale; - public byte PathCurve; - public byte ProfileCurve; - public ushort ProfileHollow; - public sbyte PathRadiusOffset; - public byte PathRevolutions; - public sbyte PathTaperX; - public sbyte PathTaperY; - public sbyte PathTwist; - public sbyte PathTwistBegin; - public byte[] TextureEntry; // a LL textureEntry in byte[] format - public byte[] ExtraParams; - - public ProfileShape ProfileShape - { - get { return (ProfileShape) (ProfileCurve & 0xf); } - set - { - byte oldValueMasked = (byte) (ProfileCurve & 0xf0); - ProfileCurve = (byte) (oldValueMasked | (byte) value); - } - } - - [XmlIgnore] - public HollowShape HollowShape - { - get { return (HollowShape) (ProfileHollow & 0xf0); } - set - { - byte oldValueMasked = (byte) (ProfileHollow & 0xf0); - ProfileHollow = (byte) (oldValueMasked | (byte) value); - } - } - - public LLVector3 PrimScale - { - get { return Scale; } - } - - static PrimitiveBaseShape() - { - m_defaultTextureEntry = - new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes(); - } - - public PrimitiveBaseShape() - { - PCode = (byte) PCodeEnum.Primitive; - ExtraParams = new byte[1]; - TextureEntry = m_defaultTextureEntry; - } - - //void returns need to change of course - public virtual void GetMesh() - { - } - - public PrimitiveBaseShape Copy() - { - return (PrimitiveBaseShape) MemberwiseClone(); - } - } - - public class GenericShape : PrimitiveBaseShape - { - public GenericShape() - : base() - { - } - } - - public class BoxShape : PrimitiveBaseShape - { - public BoxShape() - : base() - { - PathCurve = (byte) Extrusion.Straight; - ProfileShape = ProfileShape.Square; - PathScaleX = 100; - PathScaleY = 100; - } - - public BoxShape(float side) - : this() - { - SetSide(side); - } - - public void SetSide(float side) - { - Scale = new LLVector3(side, side, side); - } - - public static BoxShape Default - { - get - { - BoxShape boxShape = new BoxShape(); - - boxShape.SetSide(0.5f); - - return boxShape; - } - } - } - - public class CylinderShape : PrimitiveBaseShape - { - public CylinderShape() - : base() - { - PathCurve = (byte) Extrusion.Straight; - ProfileShape = ProfileShape.Circle; - PathScaleX = 100; - PathScaleY = 100; - } - - public CylinderShape(float radius, float heigth) - : this() - { - SetRadius(radius); - SetHeigth(heigth); - } - - private void SetHeigth(float heigth) - { - Scale.Z = heigth; - } - - private void SetRadius(float radius) - { - Scale.X = Scale.Y = radius*2f; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/Properties/AssemblyInfo.cs b/OpenSim/Framework/General/Properties/AssemblyInfo.cs deleted file mode 100644 index b3206a7..0000000 --- a/OpenSim/Framework/General/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly : AssemblyTitle("OpenSim.FrameWork")] -[assembly : AssemblyDescription("")] -[assembly : AssemblyConfiguration("")] -[assembly : AssemblyCompany("")] -[assembly : AssemblyProduct("OpenSim.FrameWork")] -[assembly : AssemblyCopyright("Copyright © 2007")] -[assembly : AssemblyTrademark("")] -[assembly : AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. - -[assembly : ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM - -[assembly : Guid("a08e20c7-f191-4137-b1f0-9291408fa521")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// - -[assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/OpenSim/Framework/General/RegionCommsListener.cs b/OpenSim/Framework/General/RegionCommsListener.cs deleted file mode 100644 index ee0d503..0000000 --- a/OpenSim/Framework/General/RegionCommsListener.cs +++ /dev/null @@ -1,112 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Collections.Generic; -using libsecondlife; - -namespace OpenSim.Framework -{ - public class RegionCommsListener : IRegionCommsListener - { - public event ExpectUserDelegate OnExpectUser; - public event GenericCall2 OnExpectChildAgent; - public event AgentCrossing OnAvatarCrossingIntoRegion; - public event UpdateNeighbours OnNeighboursUpdate; - public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; - - /// - /// - /// - /// - /// - public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) - { - if (OnExpectUser != null) - { - OnExpectUser(regionHandle, agent); - return true; - } - - return false; - } - - public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, - bool isFlying) - { - if (OnAvatarCrossingIntoRegion != null) - { - OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying); - return true; - } - return false; - } - - public virtual bool TriggerAcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentID) - { - if (OnAcknowledgeAgentCrossed != null) - { - OnAcknowledgeAgentCrossed(regionHandle, agentID); - return true; - } - return false; - } - - /// - /// - /// - /// TODO: Doesnt take any args?? - /// - public virtual bool TriggerExpectChildAgent() - { - if (OnExpectChildAgent != null) - { - OnExpectChildAgent(); - return true; - } - - return false; - } - - /// - /// - /// - /// Added to avoid a unused compiler warning on OnNeighboursUpdate, TODO: Check me - /// - /// - public virtual bool TriggerOnNeighboursUpdate(List neighbours) - { - if (OnNeighboursUpdate != null) - { - OnNeighboursUpdate(neighbours); - return true; - } - - return false; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/RegionHandle.cs b/OpenSim/Framework/General/RegionHandle.cs deleted file mode 100644 index 440aaf6..0000000 --- a/OpenSim/Framework/General/RegionHandle.cs +++ /dev/null @@ -1,150 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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.Net; -using System.Net.Sockets; - -namespace OpenSim.Framework -{ - /// - /// A class for manipulating RegionHandle coordinates - /// - internal class RegionHandle - { - private UInt64 handle; - - /// - /// Initialises a new grid-aware RegionHandle - /// - /// IP Address of the Grid Server for this region - /// Grid X Coordinate - /// Grid Y Coordinate - public RegionHandle(string ip, short x, short y) - { - IPAddress addr = IPAddress.Parse(ip); - - if (addr.AddressFamily != AddressFamily.InterNetwork) - throw new Exception("Bad RegionHandle Parameter - must be an IPv4 address"); - - uint baseHandle = BitConverter.ToUInt32(addr.GetAddressBytes(), 0); - - // Split the IP address in half - short a = (short) ((baseHandle << 16) & 0xFFFF); - short b = (short) ((baseHandle << 0) & 0xFFFF); - - // Raise the bounds a little - uint nx = (uint) x; - uint ny = (uint) y; - - // Multiply grid coords to get region coords - nx *= 256; - ny *= 256; - - // Stuff the IP address in too - nx = (uint) a << 16; - ny = (uint) b << 16; - - handle = ((UInt64) nx << 32) | (uint) ny; - } - - /// - /// Initialises a new RegionHandle that is not inter-grid aware - /// - /// Grid X Coordinate - /// Grid Y Coordinate - public RegionHandle(uint x, uint y) - { - handle = ((x*256) << 32) | (y*256); - } - - /// - /// Initialises a new RegionHandle from an existing value - /// - /// A U64 RegionHandle - public RegionHandle(UInt64 Region) - { - handle = Region; - } - - /// - /// Returns the Grid Masked RegionHandle - For use in Teleport packets and other packets where sending the grid IP address may be handy. - /// - /// Do not use for SimulatorEnable packets. The client will choke. - /// Region Handle including IP Address encoding - public UInt64 getTeleportHandle() - { - return handle; - } - - /// - /// Returns a RegionHandle which may be used for SimulatorEnable packets. Removes the IP address encoding and returns the lower bounds. - /// - /// A U64 RegionHandle for use in SimulatorEnable packets. - public UInt64 getNeighbourHandle() - { - UInt64 mask = 0x0000FFFF0000FFFF; - - return handle | mask; - } - - /// - /// Returns the IP Address of the GridServer from a Grid-Encoded RegionHandle - /// - /// Grid Server IP Address - public IPAddress getGridIP() - { - uint a = (uint) ((handle >> 16) & 0xFFFF); - uint b = (uint) ((handle >> 48) & 0xFFFF); - - return new IPAddress((long) (a << 16) | (long) b); - } - - /// - /// Returns the X Coordinate from a Grid-Encoded RegionHandle - /// - /// X Coordinate - public uint getGridX() - { - uint x = (uint) ((handle >> 32) & 0xFFFF); - - return x; - } - - /// - /// Returns the Y Coordinate from a Grid-Encoded RegionHandle - /// - /// Y Coordinate - public uint getGridY() - { - uint y = (uint) ((handle >> 0) & 0xFFFF); - - return y; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/RegionInfo.cs b/OpenSim/Framework/General/RegionInfo.cs deleted file mode 100644 index 1257849..0000000 --- a/OpenSim/Framework/General/RegionInfo.cs +++ /dev/null @@ -1,328 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Net; -using System.Net.Sockets; -using libsecondlife; -using Nini.Config; - -namespace OpenSim.Framework -{ - public class SimpleRegionInfo - { - public SimpleRegionInfo() - { - } - - public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) - { - m_regionLocX = regionLocX; - m_regionLocY = regionLocY; - - m_internalEndPoint = internalEndPoint; - m_externalHostName = externalUri; - } - - public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) - { - m_regionLocX = regionLocX; - m_regionLocY = regionLocY; - - m_externalHostName = externalUri; - - m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); - } - - public LLUUID RegionID = new LLUUID(); - - private uint m_remotingPort; - - public uint RemotingPort - { - get { return m_remotingPort; } - set { m_remotingPort = value; } - } - - public string RemotingAddress; - - - public IPEndPoint ExternalEndPoint - { - get - { - // Old one defaults to IPv6 - //return new IPEndPoint( Dns.GetHostAddresses( m_externalHostName )[0], m_internalEndPoint.Port ); - - IPAddress ia = null; - // If it is already an IP, don't resolve it - just return directly - if (IPAddress.TryParse(m_externalHostName, out ia)) - return new IPEndPoint(ia, m_internalEndPoint.Port); - - // Reset for next check - ia = null; - - - // New method favors IPv4 - foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) - { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } - } - - return new IPEndPoint(ia, m_internalEndPoint.Port); - } - - set { m_externalHostName = value.ToString(); } - } - - protected string m_externalHostName; - - public string ExternalHostName - { - get { return m_externalHostName; } - set { m_externalHostName = value; } - } - - protected IPEndPoint m_internalEndPoint; - - public IPEndPoint InternalEndPoint - { - get { return m_internalEndPoint; } - set { m_internalEndPoint = value; } - } - - protected uint? m_regionLocX; - - public uint RegionLocX - { - get { return m_regionLocX.Value; } - set { m_regionLocX = value; } - } - - protected uint? m_regionLocY; - - public uint RegionLocY - { - get { return m_regionLocY.Value; } - set { m_regionLocY = value; } - } - - public ulong RegionHandle - { - get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); } - } - } - - public class RegionInfo : SimpleRegionInfo - { - public string RegionName = ""; - - public string DataStore = ""; - public bool isSandbox = false; - - public LLUUID MasterAvatarAssignedUUID = new LLUUID(); - public string MasterAvatarFirstName = ""; - public string MasterAvatarLastName = ""; - public string MasterAvatarSandboxPassword = ""; - - // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. - private static EstateSettings m_estateSettings; - - public EstateSettings EstateSettings - { - get - { - if (m_estateSettings == null) - { - m_estateSettings = new EstateSettings(); - } - - return m_estateSettings; - } - } - - public ConfigurationMember configMember; - - public RegionInfo(string description, string filename) - { - configMember = - new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); - configMember.performConfigurationRetrieve(); - } - - public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : - base(regionLocX, regionLocY, internalEndPoint, externalUri) - { - } - - public RegionInfo() - { - } - - //not in use, should swap to nini though. - public void LoadFromNiniSource(IConfigSource source) - { - LoadFromNiniSource(source, "RegionInfo"); - } - - //not in use, should swap to nini though. - public void LoadFromNiniSource(IConfigSource source, string sectionName) - { - string errorMessage = ""; - RegionID = - new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated())); - RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); - m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); - m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); - DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); - - string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); - IPAddress ipAddressResult; - if (IPAddress.TryParse(ipAddress, out ipAddressResult)) - { - m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); - } - else - { - errorMessage = "needs an IP Address (IPAddress)"; - } - m_internalEndPoint.Port = - source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort); - - string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); - if (externalHost != "SYSTEMIP") - { - m_externalHostName = externalHost; - } - else - { - m_externalHostName = Util.GetLocalHost().ToString(); - } - - MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); - MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); - MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); - - if (errorMessage != "") - { - // a error - } - } - - public void loadConfigurationOptions() - { - configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, - "UUID of Region (Default is recommended, random UUID)", - LLUUID.Random().ToString(), true); - configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "Region Name", "OpenSim Test", false); - configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, - "Grid Location (X Axis)", "1000", false); - configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, - "Grid Location (Y Axis)", "1000", false); - configMember.addConfigurationOption("datastore", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "Filename for local storage", "OpenSim.db", false); - configMember.addConfigurationOption("internal_ip_address", - ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, - "Internal IP Address for incoming UDP client connections", "0.0.0.0", - false); - configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, - "Internal IP Port for incoming UDP client connections", - NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); - configMember.addConfigurationOption("external_host_name", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "External Host Name", "127.0.0.1", false); - configMember.addConfigurationOption("master_avatar_first", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "First Name of Master Avatar", "Test", false); - configMember.addConfigurationOption("master_avatar_last", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "Last Name of Master Avatar", "User", false); - configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "(Sandbox Mode Only)Password for Master Avatar account", "test", false); - } - - public bool handleIncomingConfiguration(string configuration_key, object configuration_result) - { - switch (configuration_key) - { - case "sim_UUID": - RegionID = (LLUUID) configuration_result; - break; - case "sim_name": - RegionName = (string) configuration_result; - break; - case "sim_location_x": - m_regionLocX = (uint) configuration_result; - break; - case "sim_location_y": - m_regionLocY = (uint) configuration_result; - break; - case "datastore": - DataStore = (string) configuration_result; - break; - case "internal_ip_address": - IPAddress address = (IPAddress) configuration_result; - m_internalEndPoint = new IPEndPoint(address, 0); - break; - case "internal_ip_port": - m_internalEndPoint.Port = (int) configuration_result; - break; - case "external_host_name": - if ((string) configuration_result != "SYSTEMIP") - { - m_externalHostName = (string) configuration_result; - } - else - { - m_externalHostName = Util.GetLocalHost().ToString(); - } - break; - case "master_avatar_first": - MasterAvatarFirstName = (string) configuration_result; - break; - case "master_avatar_last": - MasterAvatarLastName = (string) configuration_result; - break; - case "master_avatar_pass": - string tempMD5Passwd = (string) configuration_result; - MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); - break; - } - - return true; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/Remoting.cs b/OpenSim/Framework/General/Remoting.cs deleted file mode 100644 index 667ae69..0000000 --- a/OpenSim/Framework/General/Remoting.cs +++ /dev/null @@ -1,134 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Security.Cryptography; -using System.Text; - -namespace OpenSim.Framework -{ - /// - /// NEEDS AUDIT. - /// - /// - /// Suggested implementation - /// Store two digests for each foreign host. A local copy of the local hash using the local challenge (when issued), and a local copy of the remote hash using the remote challenge. - /// When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message. - /// When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[]. - /// Both hosts should be performing these operations for this to be effective. - /// - internal class RemoteDigest - { - private byte[] currentHash; - private byte[] secret; - - private SHA512Managed SHA512; - - /// - /// Initialises a new RemoteDigest authentication mechanism - /// - /// Needs an audit by a cryptographic professional - was not "roll your own"'d by choice but rather a serious lack of decent authentication mechanisms in .NET remoting - /// The shared secret between systems (for inter-sim, this is provided in encrypted form during connection, for grid this is input manually in setup) - /// Binary salt - some common value - to be decided what - /// The challenge key provided by the third party - public RemoteDigest(string sharedSecret, byte[] salt, string challenge) - { - SHA512 = new SHA512Managed(); - Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret, salt); - secret = RFC2898.GetBytes(512); - ASCIIEncoding ASCII = new ASCIIEncoding(); - - currentHash = SHA512.ComputeHash(AppendArrays(secret, ASCII.GetBytes(challenge))); - } - - /// - /// Authenticates a piece of incoming data against the local digest. Upon successful authentication, digest string is incremented. - /// - /// The incoming data - /// The remote digest - /// - public bool Authenticate(byte[] data, byte[] digest) - { - byte[] newHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data)); - if (digest == newHash) - { - currentHash = newHash; - return true; - } - else - { - throw new Exception("Hash comparison failed. Key resync required."); - } - } - - /// - /// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message. - /// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the - /// hashes will get out of sync and throw an exception when validation is attempted. - /// - /// The outgoing data - /// The local digest - public byte[] Sign(byte[] data) - { - currentHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data)); - return currentHash; - } - - /// - /// Generates a new challenge string to be issued to a foreign host. Challenges are 1024-bit (effective strength of less than 512-bits) messages generated using the Crytographic Random Number Generator. - /// - /// A 128-character hexadecimal string containing the challenge. - public static string GenerateChallenge() - { - RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider(); - byte[] bytes = new byte[64]; - RNG.GetBytes(bytes); - - StringBuilder sb = new StringBuilder(bytes.Length*2); - foreach (byte b in bytes) - { - sb.AppendFormat("{0:x2}", b); - } - return sb.ToString(); - } - - /// - /// Helper function, merges two byte arrays - /// - /// Sourced from MSDN Forum - /// A - /// B - /// C - private byte[] AppendArrays(byte[] a, byte[] b) - { - byte[] c = new byte[a.Length + b.Length]; - Buffer.BlockCopy(a, 0, c, 0, a.Length); - Buffer.BlockCopy(b, 0, c, a.Length, b.Length); - return c; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/UUID.cs b/OpenSim/Framework/General/UUID.cs deleted file mode 100644 index 3b292b1..0000000 --- a/OpenSim/Framework/General/UUID.cs +++ /dev/null @@ -1,155 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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 libsecondlife; - -namespace OpenSim.Framework -{ - internal class UUID - { - public LLUUID llUUID; - - public UUID(string uuid) - { - llUUID = new LLUUID(uuid); - } - - public UUID(byte[] uuid) - { - llUUID = new LLUUID(uuid, 0); - } - - public UUID(byte[] uuid, int offset) - { - llUUID = new LLUUID(uuid, offset); - } - - public UUID() - { - llUUID = LLUUID.Zero; - } - - public UUID(ulong uuid) - { - llUUID = new LLUUID(uuid); - } - - public UUID(UInt32 first, UInt32 second, UInt32 third, UInt32 fourth) - { - byte[] uuid = new byte[16]; - - byte[] n = BitConverter.GetBytes(first); - n.CopyTo(uuid, 0); - n = BitConverter.GetBytes(second); - n.CopyTo(uuid, 4); - n = BitConverter.GetBytes(third); - n.CopyTo(uuid, 8); - n = BitConverter.GetBytes(fourth); - n.CopyTo(uuid, 12); - - llUUID = new LLUUID(uuid, 0); - } - - public override string ToString() - { - return llUUID.ToString(); - } - - public string ToStringHyphenated() - { - return llUUID.ToStringHyphenated(); - } - - public byte[] GetBytes() - { - return llUUID.GetBytes(); - } - - public UInt32[] GetInts() - { - UInt32[] ints = new UInt32[4]; - ints[0] = BitConverter.ToUInt32(llUUID.Data, 0); - ints[1] = BitConverter.ToUInt32(llUUID.Data, 4); - ints[2] = BitConverter.ToUInt32(llUUID.Data, 8); - ints[3] = BitConverter.ToUInt32(llUUID.Data, 12); - - return ints; - } - - public LLUUID GetLLUUID() - { - return llUUID; - } - - public uint CRC() - { - return llUUID.CRC(); - } - - public override int GetHashCode() - { - return llUUID.GetHashCode(); - } - - public void Combine(UUID other) - { - llUUID.Combine(other.GetLLUUID()); - } - - public void Combine(LLUUID other) - { - llUUID.Combine(other); - } - - public override bool Equals(Object other) - { - return llUUID.Equals(other); - } - - public static bool operator ==(UUID a, UUID b) - { - return a.llUUID.Equals(b.GetLLUUID()); - } - - public static bool operator !=(UUID a, UUID b) - { - return !a.llUUID.Equals(b.GetLLUUID()); - } - - public static bool operator ==(UUID a, LLUUID b) - { - return a.Equals(b); - } - - public static bool operator !=(UUID a, LLUUID b) - { - return !a.Equals(b); - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/UserConfig.cs b/OpenSim/Framework/General/UserConfig.cs deleted file mode 100644 index fdb8f82..0000000 --- a/OpenSim/Framework/General/UserConfig.cs +++ /dev/null @@ -1,103 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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. -* -*/ - -namespace OpenSim.Framework -{ - /// - /// UserConfig -- For User Server Configuration - /// - public class UserConfig - { - public string DefaultStartupMsg = ""; - public string GridServerURL = ""; - public string GridSendKey = ""; - public string GridRecvKey = ""; - - public string DatabaseProvider = ""; - - public static uint DefaultHttpPort = 8002; - public uint HttpPort = DefaultHttpPort; - - private ConfigurationMember configMember; - - public UserConfig(string description, string filename) - { - configMember = - new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); - configMember.performConfigurationRetrieve(); - } - - public void loadConfigurationOptions() - { - configMember.addConfigurationOption("default_startup_message", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "Default Startup Message", "Welcome to OGS", false); - - configMember.addConfigurationOption("default_grid_server", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "Default Grid Server URI", - "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/", false); - configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "Key to send to grid server", "null", false); - configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "Key to expect from grid server", "null", false); - configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); - - configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, - "Http Listener port", DefaultHttpPort.ToString(), false); - } - - public bool handleIncomingConfiguration(string configuration_key, object configuration_result) - { - switch (configuration_key) - { - case "default_startup_message": - DefaultStartupMsg = (string) configuration_result; - break; - case "default_grid_server": - GridServerURL = (string) configuration_result; - break; - case "grid_send_key": - GridSendKey = (string) configuration_result; - break; - case "grid_recv_key": - GridRecvKey = (string) configuration_result; - break; - case "database_provider": - DatabaseProvider = (string) configuration_result; - break; - case "http_port": - HttpPort = (uint) configuration_result; - break; - } - - return true; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/UserProfileData.cs b/OpenSim/Framework/General/UserProfileData.cs deleted file mode 100644 index d10aa36..0000000 --- a/OpenSim/Framework/General/UserProfileData.cs +++ /dev/null @@ -1,214 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; - -namespace OpenSim.Framework -{ - /// - /// Information about a particular user known to the userserver - /// - public class UserProfileData - { - /// - /// The ID value for this user - /// - public LLUUID UUID; - - /// - /// The first component of a users account name - /// - public string username; - - /// - /// The second component of a users account name - /// - public string surname; - - /// - /// A salted hash containing the users password, in the format md5(md5(password) + ":" + salt) - /// - /// This is double MD5'd because the client sends an unsalted MD5 to the loginserver - public string passwordHash; - - /// - /// The salt used for the users hash, should be 32 bytes or longer - /// - public string passwordSalt; - - /// - /// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into - /// - public ulong homeRegion - { - get { return Helpers.UIntsToLong((homeRegionX*256), (homeRegionY*256)); } - set - { - homeRegionX = (uint) (value >> 40); - homeRegionY = (((uint) (value)) >> 8); - } - } - - public uint homeRegionX; - public uint homeRegionY; - - /// - /// The coordinates inside the region of the home location - /// - public LLVector3 homeLocation; - - /// - /// Where the user will be looking when they rez. - /// - public LLVector3 homeLookAt; - - /// - /// A UNIX Timestamp (seconds since epoch) for the users creation - /// - public int created; - - /// - /// A UNIX Timestamp for the users last login date / time - /// - public int lastLogin; - - public LLUUID rootInventoryFolderID; - - /// - /// A URI to the users inventory server, used for foreigners and large grids - /// - public string userInventoryURI = String.Empty; - - /// - /// A URI to the users asset server, used for foreigners and large grids. - /// - public string userAssetURI = String.Empty; - - /// - /// A uint mask containing the "I can do" fields of the users profile - /// - public uint profileCanDoMask; - - /// - /// A uint mask containing the "I want to do" part of the users profile - /// - public uint profileWantDoMask; // Profile window "I want to" mask - - /// - /// The about text listed in a users profile. - /// - public string profileAboutText = String.Empty; - - /// - /// The first life about text listed in a users profile - /// - public string profileFirstText = String.Empty; - - /// - /// The profile image for an avatar stored on the asset server - /// - public LLUUID profileImage; - - /// - /// The profile image for the users first life tab - /// - public LLUUID profileFirstImage; - - /// - /// The users last registered agent (filled in on the user server) - /// - public UserAgentData currentAgent; - } - - /// - /// Information about a users session - /// - public class UserAgentData - { - /// - /// The UUID of the users avatar (not the agent!) - /// - public LLUUID UUID; - - /// - /// The IP address of the user - /// - public string agentIP = String.Empty; - - /// - /// The port of the user - /// - public uint agentPort; - - /// - /// Is the user online? - /// - public bool agentOnline; - - /// - /// The session ID for the user (also the agent ID) - /// - public LLUUID sessionID; - - /// - /// The "secure" session ID for the user - /// - /// Not very secure. Dont rely on it for anything more than Linden Lab does. - public LLUUID secureSessionID; - - /// - /// The region the user logged into initially - /// - public LLUUID regionID; - - /// - /// A unix timestamp from when the user logged in - /// - public int loginTime; - - /// - /// When this agent expired and logged out, 0 if still online - /// - public int logoutTime; - - /// - /// Current region the user is logged into - /// - public LLUUID currentRegion; - - /// - /// Region handle of the current region the user is in - /// - public ulong currentHandle; - - /// - /// The position of the user within the region - /// - public LLVector3 currentPos; - } -} \ No newline at end of file diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs deleted file mode 100644 index c731561..0000000 --- a/OpenSim/Framework/General/Util.cs +++ /dev/null @@ -1,371 +0,0 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* 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. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Data; -using System.IO; -using System.Net; -using System.Net.Sockets; -using System.Security.Cryptography; -using System.Text; -using libsecondlife; -using Nini.Config; - -namespace OpenSim.Framework -{ - public class Util - { - private static Random randomClass = new Random(); - private static uint nextXferID = 5000; - private static object XferLock = new object(); - private static Dictionary capsURLS = new Dictionary(); - - - public static ulong UIntsToLong(uint X, uint Y) - { - return Helpers.UIntsToLong(X, Y); - } - - public static Random RandomClass - { - get { return randomClass; } - } - - public static uint GetNextXferID() - { - uint id = 0; - lock (XferLock) - { - id = nextXferID; - nextXferID++; - } - return id; - } - - public Util() - { - } - - public static string GetFileName(string file) - { - // Return just the filename on UNIX platforms - // TODO: this should be customisable with a prefix, but that's something to do later. - if (Environment.OSVersion.Platform == PlatformID.Unix) - { - return file; - } - - // Return %APPDATA%/OpenSim/file for 2K/XP/NT/2K3/VISTA - // TODO: Switch this to System.Enviroment.SpecialFolders.ApplicationData - if (Environment.OSVersion.Platform == PlatformID.Win32NT) - { - if (!Directory.Exists("%APPDATA%\\OpenSim\\")) - { - Directory.CreateDirectory("%APPDATA%\\OpenSim"); - } - - return "%APPDATA%\\OpenSim\\" + file; - } - - // Catch all - covers older windows versions - // (but those probably wont work anyway) - return file; - } - - public static bool IsEnvironmentSupported(ref string reason) - { - // Must have .NET 2.0 (Generics / libsl) - if (Environment.Version.Major < 2) - { - reason = ".NET 1.0/1.1 lacks components that is used by OpenSim"; - return false; - } - - // Windows 95/98/ME are unsupported - if (Environment.OSVersion.Platform == PlatformID.Win32Windows && - Environment.OSVersion.Platform != PlatformID.Win32NT) - { - reason = "Windows 95/98/ME will not run OpenSim"; - return false; - } - - // Windows 2000 / Pre-SP2 XP - if (Environment.OSVersion.Version.Major == 5 && ( - Environment.OSVersion.Version.Minor == 0)) - { - reason = "Please update to Windows XP Service Pack 2 or Server2003"; - return false; - } - - return true; - } - - public static int UnixTimeSinceEpoch() - { - TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); - int timestamp = (int) t.TotalSeconds; - return timestamp; - } - - public static string Md5Hash(string pass) - { - MD5 md5 = MD5CryptoServiceProvider.Create(); - byte[] dataMd5 = md5.ComputeHash(Encoding.Default.GetBytes(pass)); - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < dataMd5.Length; i++) - sb.AppendFormat("{0:x2}", dataMd5[i]); - return sb.ToString(); - } - - public static string GetRandomCapsPath() - { - LLUUID caps = LLUUID.Random(); - string capsPath = caps.ToStringHyphenated(); - capsPath = capsPath.Remove(capsPath.Length - 4, 4); - return capsPath; - } - - public static int fast_distance2d(int x, int y) - { - x = Math.Abs(x); - y = Math.Abs(y); - - int min = Math.Min(x, y); - - return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); - } - - public static string FieldToString(byte[] bytes) - { - return FieldToString(bytes, String.Empty); - } - - /// - /// Convert a variable length field (byte array) to a string, with a - /// field name prepended to each line of the output - /// - /// If the byte array has unprintable characters in it, a - /// hex dump will be put in the string instead - /// The byte array to convert to a string - /// A field name to prepend to each line of output - /// An ASCII string or a string containing a hex dump, minus - /// the null terminator - public static string FieldToString(byte[] bytes, string fieldName) - { - // Check for a common case - if (bytes.Length == 0) return String.Empty; - - StringBuilder output = new StringBuilder(); - bool printable = true; - - for (int i = 0; i < bytes.Length; ++i) - { - // Check if there are any unprintable characters in the array - if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09 - && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00) - { - printable = false; - break; - } - } - - if (printable) - { - if (fieldName.Length > 0) - { - output.Append(fieldName); - output.Append(": "); - } - - if (bytes[bytes.Length - 1] == 0x00) - output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1)); - else - output.Append(UTF8Encoding.UTF8.GetString(bytes)); - } - else - { - for (int i = 0; i < bytes.Length; i += 16) - { - if (i != 0) - output.Append(Environment.NewLine); - if (fieldName.Length > 0) - { - output.Append(fieldName); - output.Append(": "); - } - - for (int j = 0; j < 16; j++) - { - if ((i + j) < bytes.Length) - output.Append(String.Format("{0:X2} ", bytes[i + j])); - else - output.Append(" "); - } - - for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) - { - if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) - output.Append((char) bytes[i + j]); - else - output.Append("."); - } - } - } - - return output.ToString(); - } - - /// - /// Returns a IP address from a specified DNS, favouring IPv4 addresses. - /// - /// DNS Hostname - /// An IP address, or null - public static IPAddress GetHostFromDNS(string dnsAddress) - { - // Is it already a valid IP? No need to look it up. - IPAddress ipa; - if (IPAddress.TryParse(dnsAddress, out ipa)) - return ipa; - - // Not an IP, lookup required - IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList; - - foreach (IPAddress host in hosts) - { - if (host.AddressFamily == AddressFamily.InterNetwork) - { - return host; - } - } - - if (hosts.Length > 0) - return hosts[0]; - - return null; - } - - public static IPAddress GetLocalHost() - { - string dnsAddress = "localhost"; - - IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList; - - foreach (IPAddress host in hosts) - { - if (!IPAddress.IsLoopback(host) && host.AddressFamily == AddressFamily.InterNetwork) - { - return host; - } - } - - if (hosts.Length > 0) - return hosts[0]; - - return null; - } - - // - // directory locations - // - - public static string homeDir() - { - string temp; -// string personal=(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); -// temp = Path.Combine(personal,".OpenSim"); - temp = "."; - return temp; - } - - public static string configDir() - { - string temp; - temp = "."; - return temp; - } - - public static string dataDir() - { - string temp; - temp = "."; - return temp; - } - - public static string logDir() - { - string temp; - temp = "."; - return temp; - } - - public static string GetCapsURL(LLUUID userID) - { - if (capsURLS.ContainsKey(userID)) - { - return capsURLS[userID]; - } - return ""; - } - - public static void SetCapsURL(LLUUID userID, string url) - { - if (capsURLS.ContainsKey(userID)) - { - capsURLS[userID] = url; - } - else - { - capsURLS.Add(userID, url); - } - } - - // Nini (config) related Methods - public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName) - { - if (!File.Exists(fileName)) - { - //create new file - } - XmlConfigSource config = new XmlConfigSource(fileName); - AddDataRowToConfig(config, row); - config.Save(); - - return config; - } - - public static void AddDataRowToConfig(IConfigSource config, DataRow row) - { - config.Configs.Add((string) row[0]); - for (int i = 0; i < row.Table.Columns.Count; i++) - { - config.Configs[(string) row[0]].Set(row.Table.Columns[i].ColumnName, row[i]); - } - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs new file mode 100644 index 0000000..021e6c5 --- /dev/null +++ b/OpenSim/Framework/GridConfig.cs @@ -0,0 +1,136 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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. +* +*/ + +namespace OpenSim.Framework +{ + public class GridConfig + { + public string GridOwner = ""; + public string DefaultAssetServer = ""; + public string AssetSendKey = ""; + public string AssetRecvKey = ""; + + public string DefaultUserServer = ""; + public string UserSendKey = ""; + public string UserRecvKey = ""; + + public string SimSendKey = ""; + public string SimRecvKey = ""; + + public string DatabaseProvider = ""; + + public static uint DefaultHttpPort = 8001; + public uint HttpPort = DefaultHttpPort; + + private ConfigurationMember configMember; + + public GridConfig(string description, string filename) + { + configMember = + new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); + configMember.performConfigurationRetrieve(); + } + + public void loadConfigurationOptions() + { + configMember.addConfigurationOption("grid_owner", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "OGS Grid Owner", "OGS development team", false); + configMember.addConfigurationOption("default_asset_server", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Default Asset Server URI", + "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/", + false); + configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to send to asset server", "null", false); + configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to expect from asset server", "null", false); + + configMember.addConfigurationOption("default_user_server", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Default User Server URI", + "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/", false); + configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to send to user server", "null", false); + configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to expect from user server", "null", false); + + configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to send to a simulator", "null", false); + configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to expect from a simulator", "null", false); + configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); + + configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, + "Http Listener port", DefaultHttpPort.ToString(), false); + } + + public bool handleIncomingConfiguration(string configuration_key, object configuration_result) + { + switch (configuration_key) + { + case "grid_owner": + GridOwner = (string) configuration_result; + break; + case "default_asset_server": + DefaultAssetServer = (string) configuration_result; + break; + case "asset_send_key": + AssetSendKey = (string) configuration_result; + break; + case "asset_recv_key": + AssetRecvKey = (string) configuration_result; + break; + case "default_user_server": + DefaultUserServer = (string) configuration_result; + break; + case "user_send_key": + UserSendKey = (string) configuration_result; + break; + case "user_recv_key": + UserRecvKey = (string) configuration_result; + break; + case "sim_send_key": + SimSendKey = (string) configuration_result; + break; + case "sim_recv_key": + SimRecvKey = (string) configuration_result; + break; + case "database_provider": + DatabaseProvider = (string) configuration_result; + break; + case "http_port": + HttpPort = (uint) configuration_result; + break; + } + + return true; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/IAssetProvider.cs b/OpenSim/Framework/IAssetProvider.cs new file mode 100644 index 0000000..ad1cf66 --- /dev/null +++ b/OpenSim/Framework/IAssetProvider.cs @@ -0,0 +1,41 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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 libsecondlife; + +namespace OpenSim.Framework +{ + public interface IAssetProvider : IPlugin + { + AssetBase FetchAsset(LLUUID uuid); + void CreateAsset(AssetBase asset); + void UpdateAsset(AssetBase asset); + bool ExistsAsset(LLUUID uuid); + void CommitAssets(); // force a sync to the database + } +} \ No newline at end of file diff --git a/OpenSim/Framework/IAssetServer.cs b/OpenSim/Framework/IAssetServer.cs new file mode 100644 index 0000000..9a7dbab --- /dev/null +++ b/OpenSim/Framework/IAssetServer.cs @@ -0,0 +1,69 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; + +namespace OpenSim.Framework +{ + /// + /// Description of IAssetServer. + /// + public interface IAssetServer + { + void SetReceiver(IAssetReceiver receiver); + void FetchAsset(LLUUID assetID, bool isTexture); + void UpdateAsset(AssetBase asset); + void StoreAndCommitAsset(AssetBase asset); + void Close(); + void LoadAsset(AssetBase info, bool image, string filename); + List GetDefaultAssets(); + AssetBase CreateImageAsset(string assetIdStr, string name, string filename); + void ForEachDefaultAsset(Action action); + AssetBase CreateAsset(string assetIdStr, string name, string filename, bool isImage); + void ForEachXmlAsset(Action action); + } + + // could change to delegate? + public interface IAssetReceiver + { + void AssetReceived(AssetBase asset, bool IsTexture); + void AssetNotFound(LLUUID assetID); + } + + public interface IAssetPlugin + { + IAssetServer GetAssetServer(); + } + + public struct ARequest + { + public LLUUID AssetID; + public bool IsTexture; + } +} \ No newline at end of file diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs new file mode 100644 index 0000000..4482ae6 --- /dev/null +++ b/OpenSim/Framework/IClientAPI.cs @@ -0,0 +1,447 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; +using libsecondlife.Packets; + +namespace OpenSim.Framework +{ + // Base Args Interface + public interface IEventArgs + { + IScene Scene { get; set; } + + IClientAPI Sender { get; set; } + } + + public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock); + + public delegate void ChatFromViewer(Object sender, ChatFromViewerArgs e); + + public enum ChatTypeEnum + { + Whisper = 0, + Say = 1, + Shout = 2, + Broadcast = 0xFF + } ; + + /// + /// ChatFromViewer Arguments + /// + public class ChatFromViewerArgs : EventArgs, IEventArgs + { + protected string m_message; + protected ChatTypeEnum m_type; + protected int m_channel; + protected LLVector3 m_position; + protected string m_from; + + protected IClientAPI m_sender; + protected IScene m_scene; + + /// + /// The message sent by the user + /// + public string Message + { + get { return m_message; } + set { m_message = value; } + } + + /// + /// The type of message, eg say, shout, broadcast. + /// + public ChatTypeEnum Type + { + get { return m_type; } + set { m_type = value; } + } + + /// + /// Which channel was this message sent on? Different channels may have different listeners. Public chat is on channel zero. + /// + public int Channel + { + get { return m_channel; } + set { m_channel = value; } + } + + /// + /// The position of the sender at the time of the message broadcast. + /// + public LLVector3 Position + { + get { return m_position; } + set { m_position = value; } + } + + /// + /// The name of the sender (needed for scripts) + /// + public string From + { + get { return m_from; } + set { m_from = value; } + } + + /// + /// The client responsible for sending the message, or null. + /// + public IClientAPI Sender + { + get { return m_sender; } + set { m_sender = value; } + } + + public IScene Scene + { + get { return m_scene; } + set { m_scene = value; } + } + + public ChatFromViewerArgs() + { + m_position = new LLVector3(); + } + } + + public class TextureRequestArgs : EventArgs + { + protected LLUUID m_requestedAssetID; + private sbyte m_discardLevel; + private uint m_packetNumber; + + public uint PacketNumber + { + get { return m_packetNumber; } + set { m_packetNumber = value; } + } + + public sbyte DiscardLevel + { + get { return m_discardLevel; } + set { m_discardLevel = value; } + } + + public LLUUID RequestedAssetID + { + get { return m_requestedAssetID; } + set { m_requestedAssetID = value; } + } + } + + public delegate void TextureRequest(Object sender, TextureRequestArgs e); + + public delegate void ImprovedInstantMessage( + LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, + string fromAgentName, string message, byte dialog); // Cut down from full list + public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos); + + public delegate void ModifyTerrain( + float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient); + + public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); + + public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID, int seq); + + public delegate void LinkObjects(uint parent, List children); + + public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY); + + public delegate void TeleportLocationRequest( + IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags); + + public delegate void DisconnectUser(); + + public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID); + + public delegate void GenericCall(IClientAPI remoteClient); + + public delegate void GenericCall2(); + + public delegate void GenericCall3(Packet packet); + + // really don't want to be passing packets in these events, so this is very temporary. + public delegate void GenericCall4(Packet packet, IClientAPI remoteClient); + + public delegate void GenericCall5(IClientAPI remoteClient, bool status); + + public delegate void GenericCall6(LLUUID uid); + + public delegate void GenericCall7(uint localID, string message); + + public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); + + public delegate void ObjectExtraParams(uint localID, ushort type, bool inUse, byte[] data); + + public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); + + public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient); + + public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient); + + public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); + + public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient); + + public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); + + public delegate void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); + + public delegate void UpdatePrimGroupRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient); + + public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags); + + public delegate void StatusChange(bool status); + + public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); + + public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); + + public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset); + + public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID); + + public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); + + public delegate void ParcelPropertiesRequest( + int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); + + public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client); + + public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client); + + public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); + + public delegate void ParcelSelectObjects(int land_local_id, int request_type, IClientAPI remote_client); + + public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client); + + public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client); + + public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client); + + public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); + + public delegate void CreateInventoryFolder( + IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); + + public delegate void CreateNewInventoryItem( + IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, + sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask); + + public delegate void FetchInventoryDescendents( + IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); + + public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID); + + public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); + + public delegate void UpdateInventoryItemTransaction( + IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID); + + public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID); + + public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID); + + public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID); + + public delegate void UDPAssetUploadRequest( + IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal); + + public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); + + public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName); + + public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); + + public interface IClientAPI + { + event ImprovedInstantMessage OnInstantMessage; + event ChatFromViewer OnChatFromViewer; + event TextureRequest OnRequestTexture; + event RezObject OnRezObject; + event ModifyTerrain OnModifyTerrain; + event SetAppearance OnSetAppearance; + event StartAnim OnStartAnim; + event LinkObjects OnLinkObjects; + event RequestMapBlocks OnRequestMapBlocks; + event TeleportLocationRequest OnTeleportLocationRequest; + event DisconnectUser OnDisconnectUser; + event RequestAvatarProperties OnRequestAvatarProperties; + + event GenericCall4 OnDeRezObject; + event GenericCall OnRegionHandShakeReply; + event GenericCall OnRequestWearables; + event GenericCall2 OnCompleteMovementToRegion; + event UpdateAgent OnAgentUpdate; + event AgentRequestSit OnAgentRequestSit; + event AgentSit OnAgentSit; + event GenericCall OnRequestAvatarsData; + event AddNewPrim OnAddPrim; + event ObjectDuplicate OnObjectDuplicate; + event UpdateVector OnGrabObject; + event ObjectSelect OnDeGrabObject; + event MoveObject OnGrabUpdate; + + event UpdateShape OnUpdatePrimShape; + event ObjectExtraParams OnUpdateExtraParams; + event ObjectSelect OnObjectSelect; + event ObjectDeselect OnObjectDeselect; + event GenericCall7 OnObjectDescription; + event GenericCall7 OnObjectName; + event UpdatePrimFlags OnUpdatePrimFlags; + event UpdatePrimTexture OnUpdatePrimTexture; + event UpdateVector OnUpdatePrimGroupPosition; + event UpdateVector OnUpdatePrimSinglePosition; + event UpdatePrimRotation OnUpdatePrimGroupRotation; + event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; + event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; + event UpdateVector OnUpdatePrimScale; + event StatusChange OnChildAgentStatus; + event GenericCall2 OnStopMovement; + event GenericCall6 OnRemoveAvatar; + + event CreateNewInventoryItem OnCreateNewInventoryItem; + event CreateInventoryFolder OnCreateNewInventoryFolder; + event FetchInventoryDescendents OnFetchInventoryDescendents; + event FetchInventory OnFetchInventory; + event RequestTaskInventory OnRequestTaskInventory; + event UpdateInventoryItemTransaction OnUpdateInventoryItem; + event UDPAssetUploadRequest OnAssetUploadRequest; + event XferReceive OnXferReceive; + event RequestXfer OnRequestXfer; + event ConfirmXfer OnConfirmXfer; + event RezScript OnRezScript; + event UpdateTaskInventory OnUpdateTaskInventory; + event RemoveTaskInventory OnRemoveTaskItem; + + event UUIDNameRequest OnNameFromUUIDRequest; + + event ParcelPropertiesRequest OnParcelPropertiesRequest; + event ParcelDivideRequest OnParcelDivideRequest; + event ParcelJoinRequest OnParcelJoinRequest; + event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; + event ParcelSelectObjects OnParcelSelectObjects; + event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; + event EstateOwnerMessageRequest OnEstateOwnerMessage; + + LLVector3 StartPos { get; set; } + + LLUUID AgentId { get; } + + LLUUID SessionId { get; } + + string FirstName { get; } + + string LastName { get; } + + uint CircuitCode { get; set; } + + void OutPacket(Packet newPack); + void SendWearables(AvatarWearable[] wearables); + void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry); + void SendStartPingCheck(byte seq); + void SendKillObject(ulong regionHandle, uint localID); + void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId); + void SendRegionHandshake(RegionInfo regionInfo); + void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); + void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); + + void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, + LLUUID imSessionID, string fromName, byte dialog, uint timeStamp); + + void SendLayerData(float[] map); + void SendLayerData(int px, int py, float[] map); + void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look); + void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint); + AgentCircuitData RequestClientInfo(); + + void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint, + string capsURL); + + void SendMapBlock(List mapBlocks); + void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags); + + void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, + uint flags, string capsURL); + + void SendTeleportCancel(); + void SendTeleportLocationStart(); + void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); + + void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, + LLVector3 Pos, byte[] textureEntry, uint parentID); + + void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, + LLVector3 velocity, LLQuaternion rotation); + + void SendCoarseLocationUpdate(List CoarseLocations); + + void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); + + void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, + LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, + uint parentID, byte[] particleSystem, LLQuaternion rotation); + + void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, + LLQuaternion rotation); + + void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items); + void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); + void SendInventoryItemUpdate(InventoryItemBase Item); + void SendRemoveInventoryItem(LLUUID itemID); + void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName); + void SendXferPacket(ulong xferID, uint packet, byte[] data); + + void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID); + void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags); + + void SendNameReply(LLUUID profileId, string firstname, string lastname); + void SendAlertMessage(string message); + void SendAgentAlertMessage(string message, bool modal); + void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); + bool AddMoney(int debit); + + void SendViewerTime(int phase); + + void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, + uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); + + void SetDebug(int newDebug); + void InPacket(Packet NewPack); + void Close(); + event ViewerEffectEventHandler OnViewerEffect; + event Action OnLogout; + event Action OnConnectionClosed; + void SendLogoutPacket(); + } +} \ No newline at end of file diff --git a/OpenSim/Framework/IGenericConfig.cs b/OpenSim/Framework/IGenericConfig.cs new file mode 100644 index 0000000..889d178 --- /dev/null +++ b/OpenSim/Framework/IGenericConfig.cs @@ -0,0 +1,40 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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. +* +*/ +namespace OpenSim.Framework +{ + public interface IGenericConfig + { + void SetFileName(string fileName); + void LoadData(); + void LoadDataFromString(string data); + string GetAttribute(string attributeName); + bool SetAttribute(string attributeName, string attributeValue); + void Commit(); + void Close(); + } +} \ No newline at end of file diff --git a/OpenSim/Framework/IPlugin.cs b/OpenSim/Framework/IPlugin.cs new file mode 100644 index 0000000..e649274 --- /dev/null +++ b/OpenSim/Framework/IPlugin.cs @@ -0,0 +1,53 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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. +* +*/ + +namespace OpenSim.Framework +{ + /// + /// This interface, describes a generic plugin + /// + public interface IPlugin + { + /// + /// Returns the plugin version + /// + /// Plugin version in MAJOR.MINOR.REVISION.BUILD format + string Version { get; } + + /// + /// Returns the plugin name + /// + /// Plugin name, eg MySQL User Provider + string Name { get; } + + /// + /// Initialises the plugin (artificial constructor) + /// + void Initialise(); + } +} \ No newline at end of file diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs new file mode 100644 index 0000000..1a24469 --- /dev/null +++ b/OpenSim/Framework/IRegionCommsListener.cs @@ -0,0 +1,49 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Collections.Generic; +using libsecondlife; + +namespace OpenSim.Framework +{ + public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent); + + public delegate void UpdateNeighbours(List neighbours); + + public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); + + public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID); + + public interface IRegionCommsListener + { + event ExpectUserDelegate OnExpectUser; + event GenericCall2 OnExpectChildAgent; + event AgentCrossing OnAvatarCrossingIntoRegion; + event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; + event UpdateNeighbours OnNeighboursUpdate; + } +} \ No newline at end of file diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs new file mode 100644 index 0000000..3d6ca1c --- /dev/null +++ b/OpenSim/Framework/IScene.cs @@ -0,0 +1,43 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; + +namespace OpenSim.Framework +{ + public interface IScene + { + void AddNewClient(IClientAPI client, bool child); + void RemoveClient(LLUUID agentID); + + RegionInfo RegionInfo { get; } + object SyncRoot { get; } + uint NextLocalId { get; } + + ClientManager ClientManager { get; } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs new file mode 100644 index 0000000..cb2502a --- /dev/null +++ b/OpenSim/Framework/IUserData.cs @@ -0,0 +1,134 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; + +namespace OpenSim.Framework +{ + /// + /// An interface for connecting to user storage servers. + /// + public interface IUserData + { + /// + /// Returns a user profile from a database via their UUID + /// + /// The accounts UUID + /// The user data profile + UserProfileData GetUserByUUID(LLUUID user); + + /// + /// Returns a users profile by searching their username + /// + /// The users username + /// The user data profile + UserProfileData GetUserByName(string name); + + /// + /// Returns a users profile by searching their username parts + /// + /// Account firstname + /// Account lastname + /// The user data profile + UserProfileData GetUserByName(string fname, string lname); + + /// + /// Returns the current agent for a user searching by it's UUID + /// + /// The users UUID + /// The current agent session + UserAgentData GetAgentByUUID(LLUUID user); + + /// + /// Returns the current session agent for a user searching by username + /// + /// The users account name + /// The current agent session + UserAgentData GetAgentByName(string name); + + /// + /// Returns the current session agent for a user searching by username parts + /// + /// The users first account name + /// The users account surname + /// The current agent session + UserAgentData GetAgentByName(string fname, string lname); + + /// + /// Adds a new User profile to the database + /// + /// UserProfile to add + void AddNewUserProfile(UserProfileData user); + + /// + /// Updates an existing user profile + /// + /// UserProfile to update + bool UpdateUserProfile(UserProfileData user); + + /// + /// Adds a new agent to the database + /// + /// The agent to add + void AddNewUserAgent(UserAgentData agent); + + /// + /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES) + /// + /// The account to transfer from + /// The account to transfer to + /// The amount to transfer + /// Successful? + bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount); + + /// + /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account. + /// + /// User to transfer from + /// User to transfer to + /// Specified inventory item + /// Successful? + bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); + + /// + /// Returns the plugin version + /// + /// Plugin version in MAJOR.MINOR.REVISION.BUILD format + string GetVersion(); + + /// + /// Returns the plugin name + /// + /// Plugin name, eg MySQL User Provider + string getName(); + + /// + /// Initialises the plugin (artificial constructor) + /// + void Initialise(); + } +} \ No newline at end of file diff --git a/OpenSim/Framework/IUserService.cs b/OpenSim/Framework/IUserService.cs new file mode 100644 index 0000000..ed9032b --- /dev/null +++ b/OpenSim/Framework/IUserService.cs @@ -0,0 +1,48 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; + +namespace OpenSim.Framework.Interfaces +{ + public interface IUserService + { + UserProfileData GetUserProfile(string firstName, string lastName); + UserProfileData GetUserProfile(string name); + UserProfileData GetUserProfile(LLUUID userId); + void clearUserAgent(LLUUID avatarID); + + UserProfileData SetupMasterUser(string firstName, string lastName); + UserProfileData SetupMasterUser(string firstName, string lastName, string password); + + /// + /// + /// + /// + void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); + } +} \ No newline at end of file diff --git a/OpenSim/Framework/InventoryConfig.cs b/OpenSim/Framework/InventoryConfig.cs new file mode 100644 index 0000000..8e64b68 --- /dev/null +++ b/OpenSim/Framework/InventoryConfig.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework +{ + /// + /// UserConfig -- For User Server Configuration + /// + public class InventoryConfig + { + public string DefaultStartupMsg = ""; + public string UserServerURL = ""; + public string UserSendKey = ""; + public string UserRecvKey = ""; + + public string DatabaseProvider = ""; + public static uint DefaultHttpPort = 8004; + + public int HttpPort = 8004; + + private ConfigurationMember configMember; + + public InventoryConfig(string description, string filename) + { + configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); + configMember.performConfigurationRetrieve(); + } + + public void loadConfigurationOptions() + { + configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false); + configMember.addConfigurationOption("default_user_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default User Server URI", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString(), false); + configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null", false); + configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null", false); + configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); + configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Http Listener port", DefaultHttpPort.ToString(), false); + } + + public bool handleIncomingConfiguration(string configuration_key, object configuration_result) + { + switch (configuration_key) + { + case "default_startup_message": + this.DefaultStartupMsg = (string)configuration_result; + break; + case "default_user_server": + this.UserServerURL = (string)configuration_result; + break; + case "user_send_key": + this.UserSendKey = (string)configuration_result; + break; + case "user_recv_key": + this.UserRecvKey = (string)configuration_result; + break; + case "database_provider": + this.DatabaseProvider = (string)configuration_result; + break; + case "http_port": + HttpPort = (int)configuration_result; + break; + } + + return true; + } + } +} diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs new file mode 100644 index 0000000..331013f --- /dev/null +++ b/OpenSim/Framework/InventoryItemBase.cs @@ -0,0 +1,273 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Xml.Serialization; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; + +namespace OpenSim.Framework +{ + /// + /// Inventory Item - contains all the properties associated with an individual inventory piece. + /// + public class InventoryItemBase + { + /// + /// A UUID containing the ID for the inventory item itself + /// + public LLUUID inventoryID; + + /// + /// The UUID of the associated asset on the asset server + /// + public LLUUID assetID; + + /// + /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) + /// + public int assetType; + + /// + /// The type of inventory item. (Can be slightly different to the asset type + /// + public int invType; + + /// + /// The folder this item is contained in + /// + public LLUUID parentFolderID; + + /// + /// The owner of this inventory item + /// + public LLUUID avatarID; + + /// + /// The creator of this item + /// + public LLUUID creatorsID; + + /// + /// The name of the inventory item (must be less than 64 characters) + /// + public string inventoryName; + + /// + /// The description of the inventory item (must be less than 64 characters) + /// + public string inventoryDescription; + + /// + /// A mask containing the permissions for the next owner (cannot be enforced) + /// + public uint inventoryNextPermissions; + + /// + /// A mask containing permissions for the current owner (cannot be enforced) + /// + public uint inventoryCurrentPermissions; + + /// + /// + /// + public uint inventoryBasePermissions; + + /// + /// + /// + public uint inventoryEveryOnePermissions; + } + + /// + /// A Class for folders which contain users inventory + /// + public class InventoryFolderBase + { + /// + /// The name of the folder (64 characters or less) + /// + public string name; + + /// + /// The agent who's inventory this is contained by + /// + public LLUUID agentID; + + /// + /// The folder this folder is contained in + /// + public LLUUID parentID; + + /// + /// The UUID for this folder + /// + public LLUUID folderID; + + /// + /// Tyep of Items normally stored in this folder + /// + public short type; + + /// + /// + /// + public ushort version; + } + + /// + /// An interface for accessing inventory data from a storage server + /// + public interface IInventoryData + { + /// + /// Initialises the interface + /// + void Initialise(); + + /// + /// Closes the interface + /// + void Close(); + + /// + /// The plugin being loaded + /// + /// A string containing the plugin name + string getName(); + + /// + /// The plugins version + /// + /// A string containing the plugin version + string getVersion(); + + /// + /// Returns a list of inventory items contained within the specified folder + /// + /// The UUID of the target folder + /// A List of InventoryItemBase items + List getInventoryInFolder(LLUUID folderID); + + /// + /// Returns a list of the root folders within a users inventory + /// + /// The user whos inventory is to be searched + /// A list of folder objects + List getUserRootFolders(LLUUID user); + + /// + /// Returns the users inventory root folder. + /// + /// The UUID of the user who is having inventory being returned + /// Root inventory folder + InventoryFolderBase getUserRootFolder(LLUUID user); + + /// + /// Returns a list of inventory folders contained in the folder 'parentID' + /// + /// The folder to get subfolders for + /// A list of inventory folders + List getInventoryFolders(LLUUID parentID); + + /// + /// Returns an inventory item by its UUID + /// + /// The UUID of the item to be returned + /// A class containing item information + InventoryItemBase getInventoryItem(LLUUID item); + + /// + /// Returns a specified inventory folder by its UUID + /// + /// The UUID of the folder to be returned + /// A class containing folder information + InventoryFolderBase getInventoryFolder(LLUUID folder); + + /// + /// Creates a new inventory item based on item + /// + /// The item to be created + void addInventoryItem(InventoryItemBase item); + + /// + /// Updates an inventory item with item (updates based on ID) + /// + /// The updated item + void updateInventoryItem(InventoryItemBase item); + + /// + /// + /// + /// + void deleteInventoryItem(LLUUID item); + + /// + /// Adds a new folder specified by folder + /// + /// The inventory folder + void addInventoryFolder(InventoryFolderBase folder); + + /// + /// Updates a folder based on its ID with folder + /// + /// The inventory folder + void updateInventoryFolder(InventoryFolderBase folder); + + /// + /// Deletes a folder based on its ID with folder + /// + /// The id of the folder + void deleteInventoryFolder(LLUUID folder); + } + + /* + * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder + * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize + * into this simpler class, and then use that. + */ + [XmlRoot(ElementName = "inventory", IsNullable = true)] + public class SerializableInventory + { + [XmlRoot(ElementName = "folder", IsNullable = true)] + public class SerializableFolder : InventoryFolderBase + { + [XmlArray(ElementName = "folders", IsNullable = true)] + [XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof(SerializableFolder))] + public ArrayList SubFolders; + + [XmlArray(ElementName = "items", IsNullable = true)] + [XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof(InventoryItemBase))] + public ArrayList Items; + } + + [XmlElement(ElementName = "folder", IsNullable = true)] + public SerializableFolder root; + } + +} diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs new file mode 100644 index 0000000..ca948ef --- /dev/null +++ b/OpenSim/Framework/LandData.cs @@ -0,0 +1,123 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; + +namespace OpenSim.Framework +{ + public class LandData + { + public byte[] landBitmapByteArray = new byte[512]; + public string landName = "Your Parcel"; + public string landDesc = ""; + public LLUUID ownerID = new LLUUID(); + public bool isGroupOwned = false; + public LLVector3 AABBMin = new LLVector3(); + public LLVector3 AABBMax = new LLVector3(); + public int area = 0; + public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned + public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID + public Parcel.ParcelCategory category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category + public int claimDate = 0; //Unemplemented + public int claimPrice = 0; //Unemplemented + public LLUUID groupID = new LLUUID(); //Unemplemented + public int groupPrims = 0; + public int otherPrims = 0; + public int ownerPrims = 0; + public int selectedPrims = 0; + public int simwidePrims = 0; + public int simwideArea = 0; + public int salePrice = 0; //Unemeplemented. Parcels price. + public Parcel.ParcelStatus landStatus = Parcel.ParcelStatus.Leased; + + public uint landFlags = (uint) Parcel.ParcelFlags.AllowFly | (uint) Parcel.ParcelFlags.AllowLandmark | + (uint) Parcel.ParcelFlags.AllowAllObjectEntry | + (uint) Parcel.ParcelFlags.AllowDeedToGroup | (uint) Parcel.ParcelFlags.AllowTerraform | + (uint) Parcel.ParcelFlags.CreateObjects | (uint) Parcel.ParcelFlags.AllowOtherScripts | + (uint) Parcel.ParcelFlags.SoundLocal; + + public byte landingType = 0; + public byte mediaAutoScale = 0; + public LLUUID mediaID = LLUUID.Zero; + public int localID = 0; + public LLUUID globalID = new LLUUID(); + + public string mediaURL = ""; + public string musicURL = ""; + public float passHours = 0; + public int passPrice = 0; + public LLUUID snapshotID = LLUUID.Zero; + public LLVector3 userLocation = new LLVector3(); + public LLVector3 userLookAt = new LLVector3(); + + public LandData() + { + globalID = LLUUID.Random(); + } + + public LandData Copy() + { + LandData landData = new LandData(); + + landData.AABBMax = AABBMax; + landData.AABBMin = AABBMin; + landData.area = area; + landData.auctionID = auctionID; + landData.authBuyerID = authBuyerID; + landData.category = category; + landData.claimDate = claimDate; + landData.claimPrice = claimPrice; + landData.globalID = globalID; + landData.groupID = groupID; + landData.groupPrims = groupPrims; + landData.otherPrims = otherPrims; + landData.ownerPrims = ownerPrims; + landData.selectedPrims = selectedPrims; + landData.isGroupOwned = isGroupOwned; + landData.localID = localID; + landData.landingType = landingType; + landData.mediaAutoScale = mediaAutoScale; + landData.mediaID = mediaID; + landData.mediaURL = mediaURL; + landData.musicURL = musicURL; + landData.ownerID = ownerID; + landData.landBitmapByteArray = (byte[]) landBitmapByteArray.Clone(); + landData.landDesc = landDesc; + landData.landFlags = landFlags; + landData.landName = landName; + landData.landStatus = landStatus; + landData.passHours = passHours; + landData.passPrice = passPrice; + landData.salePrice = salePrice; + landData.snapshotID = snapshotID; + landData.userLocation = userLocation; + landData.userLookAt = userLookAt; + + return landData; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/Login.cs b/OpenSim/Framework/Login.cs new file mode 100644 index 0000000..7ceed19 --- /dev/null +++ b/OpenSim/Framework/Login.cs @@ -0,0 +1,50 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; + +namespace OpenSim.Framework +{ + public class Login + { + public string First = "Test"; + public string Last = "User"; + public LLUUID Agent; + public LLUUID Session; + public LLUUID SecureSession = LLUUID.Zero; + public LLUUID InventoryFolder; + public LLUUID BaseFolder; + public uint CircuitCode; + public string CapsPath = ""; + public LLVector3 StartPos; + + public Login() + { + StartPos = new LLVector3(128, 128, 70); + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/MapBlockData.cs b/OpenSim/Framework/MapBlockData.cs new file mode 100644 index 0000000..8609533 --- /dev/null +++ b/OpenSim/Framework/MapBlockData.cs @@ -0,0 +1,50 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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 libsecondlife; + +namespace OpenSim.Framework +{ + public class MapBlockData + { + public uint Flags; + public ushort X; + public ushort Y; + public byte Agents; + public byte Access; + public byte WaterHeight; + public LLUUID MapImageId; + public String Name; + public uint RegionFlags; + + public MapBlockData() + { + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/NeighbourInfo.cs b/OpenSim/Framework/NeighbourInfo.cs new file mode 100644 index 0000000..d5a0a2f --- /dev/null +++ b/OpenSim/Framework/NeighbourInfo.cs @@ -0,0 +1,42 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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. +* +*/ +namespace OpenSim.Framework +{ + public class NeighbourInfo + { + public NeighbourInfo() + { + } + + public ulong regionhandle; + public uint RegionLocX; + public uint RegionLocY; + public string sim_ip; + public uint sim_port; + } +} \ No newline at end of file diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs new file mode 100644 index 0000000..b9ce143 --- /dev/null +++ b/OpenSim/Framework/NetworkServersInfo.cs @@ -0,0 +1,100 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 Nini.Config; + +namespace OpenSim.Framework +{ + public class NetworkServersInfo + { + public string AssetURL = "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/"; + public string AssetSendKey = ""; + + public string GridURL = ""; + public string GridSendKey = ""; + public string GridRecvKey = ""; + public string UserURL = ""; + public string UserSendKey = ""; + public string UserRecvKey = ""; + public bool isSandbox; + + public string InventoryURL = ""; + + public static int DefaultHttpListenerPort = 9000; + public int HttpListenerPort = DefaultHttpListenerPort; + + public static int RemotingListenerPort = 8895; + + + public NetworkServersInfo() + { + } + + public NetworkServersInfo(uint defaultHomeLocX, uint defaultHomeLocY) + { + m_defaultHomeLocX = defaultHomeLocX; + m_defaultHomeLocY = defaultHomeLocY; + } + + private uint? m_defaultHomeLocX; + + public uint DefaultHomeLocX + { + get { return m_defaultHomeLocX.Value; } + } + + private uint? m_defaultHomeLocY; + + public uint DefaultHomeLocY + { + get { return m_defaultHomeLocY.Value; } + } + + public void loadFromConfiguration(IConfigSource config) + { + m_defaultHomeLocX = (uint) config.Configs["StandAlone"].GetInt("default_location_x", 1000); + m_defaultHomeLocY = (uint) config.Configs["StandAlone"].GetInt("default_location_y", 1000); + + HttpListenerPort = config.Configs["Network"].GetInt("http_listener_port", DefaultHttpListenerPort); + RemotingListenerPort = config.Configs["Network"].GetInt("remoting_listener_port", RemotingListenerPort); + GridURL = + config.Configs["Network"].GetString("grid_server_url", + "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString()); + GridSendKey = config.Configs["Network"].GetString("grid_send_key", "null"); + GridRecvKey = config.Configs["Network"].GetString("grid_recv_key", "null"); + UserURL = + config.Configs["Network"].GetString("user_server_url", + "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString()); + UserSendKey = config.Configs["Network"].GetString("user_send_key", "null"); + UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null"); + AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL); + InventoryURL = config.Configs["Network"].GetString("inventory_server_url", + "http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString()); + } + } +} diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs new file mode 100644 index 0000000..5cdbfb2 --- /dev/null +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -0,0 +1,214 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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.Xml.Serialization; +using libsecondlife; + +namespace OpenSim.Framework +{ + public enum ProfileShape : byte + { + Circle = 0, + Square = 1, + IsometricTriangle = 2, + EquilateralTriangle = 3, + RightTriangle = 4, + HalfCircle = 5 + } + + public enum HollowShape : byte + { + Same = 0, + Circle = 16, + Square = 32, + Triangle = 48 + } + + public enum PCodeEnum : byte + { + Primitive = 9, + Avatar = 47 + } + + public enum Extrusion : byte + { + Straight = 16, + Curve1 = 32, + Curve2 = 48, + Flexible = 128 + } + + public class PrimitiveBaseShape + { + private static byte[] m_defaultTextureEntry; + + public byte PCode; + public ushort PathBegin; + public ushort PathEnd; + public byte PathScaleX; + public byte PathScaleY; + public byte PathShearX; + public byte PathShearY; + public sbyte PathSkew; + public ushort ProfileBegin; + public ushort ProfileEnd; + public LLVector3 Scale; + public byte PathCurve; + public byte ProfileCurve; + public ushort ProfileHollow; + public sbyte PathRadiusOffset; + public byte PathRevolutions; + public sbyte PathTaperX; + public sbyte PathTaperY; + public sbyte PathTwist; + public sbyte PathTwistBegin; + public byte[] TextureEntry; // a LL textureEntry in byte[] format + public byte[] ExtraParams; + + public ProfileShape ProfileShape + { + get { return (ProfileShape) (ProfileCurve & 0xf); } + set + { + byte oldValueMasked = (byte) (ProfileCurve & 0xf0); + ProfileCurve = (byte) (oldValueMasked | (byte) value); + } + } + + [XmlIgnore] + public HollowShape HollowShape + { + get { return (HollowShape) (ProfileHollow & 0xf0); } + set + { + byte oldValueMasked = (byte) (ProfileHollow & 0xf0); + ProfileHollow = (byte) (oldValueMasked | (byte) value); + } + } + + public LLVector3 PrimScale + { + get { return Scale; } + } + + static PrimitiveBaseShape() + { + m_defaultTextureEntry = + new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes(); + } + + public PrimitiveBaseShape() + { + PCode = (byte) PCodeEnum.Primitive; + ExtraParams = new byte[1]; + TextureEntry = m_defaultTextureEntry; + } + + //void returns need to change of course + public virtual void GetMesh() + { + } + + public PrimitiveBaseShape Copy() + { + return (PrimitiveBaseShape) MemberwiseClone(); + } + } + + public class GenericShape : PrimitiveBaseShape + { + public GenericShape() + : base() + { + } + } + + public class BoxShape : PrimitiveBaseShape + { + public BoxShape() + : base() + { + PathCurve = (byte) Extrusion.Straight; + ProfileShape = ProfileShape.Square; + PathScaleX = 100; + PathScaleY = 100; + } + + public BoxShape(float side) + : this() + { + SetSide(side); + } + + public void SetSide(float side) + { + Scale = new LLVector3(side, side, side); + } + + public static BoxShape Default + { + get + { + BoxShape boxShape = new BoxShape(); + + boxShape.SetSide(0.5f); + + return boxShape; + } + } + } + + public class CylinderShape : PrimitiveBaseShape + { + public CylinderShape() + : base() + { + PathCurve = (byte) Extrusion.Straight; + ProfileShape = ProfileShape.Circle; + PathScaleX = 100; + PathScaleY = 100; + } + + public CylinderShape(float radius, float heigth) + : this() + { + SetRadius(radius); + SetHeigth(heigth); + } + + private void SetHeigth(float heigth) + { + Scale.Z = heigth; + } + + private void SetRadius(float radius) + { + Scale.X = Scale.Y = radius*2f; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs new file mode 100644 index 0000000..ee0d503 --- /dev/null +++ b/OpenSim/Framework/RegionCommsListener.cs @@ -0,0 +1,112 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Collections.Generic; +using libsecondlife; + +namespace OpenSim.Framework +{ + public class RegionCommsListener : IRegionCommsListener + { + public event ExpectUserDelegate OnExpectUser; + public event GenericCall2 OnExpectChildAgent; + public event AgentCrossing OnAvatarCrossingIntoRegion; + public event UpdateNeighbours OnNeighboursUpdate; + public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; + + /// + /// + /// + /// + /// + public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) + { + if (OnExpectUser != null) + { + OnExpectUser(regionHandle, agent); + return true; + } + + return false; + } + + public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, + bool isFlying) + { + if (OnAvatarCrossingIntoRegion != null) + { + OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying); + return true; + } + return false; + } + + public virtual bool TriggerAcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentID) + { + if (OnAcknowledgeAgentCrossed != null) + { + OnAcknowledgeAgentCrossed(regionHandle, agentID); + return true; + } + return false; + } + + /// + /// + /// + /// TODO: Doesnt take any args?? + /// + public virtual bool TriggerExpectChildAgent() + { + if (OnExpectChildAgent != null) + { + OnExpectChildAgent(); + return true; + } + + return false; + } + + /// + /// + /// + /// Added to avoid a unused compiler warning on OnNeighboursUpdate, TODO: Check me + /// + /// + public virtual bool TriggerOnNeighboursUpdate(List neighbours) + { + if (OnNeighboursUpdate != null) + { + OnNeighboursUpdate(neighbours); + return true; + } + + return false; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/RegionHandle.cs b/OpenSim/Framework/RegionHandle.cs new file mode 100644 index 0000000..440aaf6 --- /dev/null +++ b/OpenSim/Framework/RegionHandle.cs @@ -0,0 +1,150 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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.Net; +using System.Net.Sockets; + +namespace OpenSim.Framework +{ + /// + /// A class for manipulating RegionHandle coordinates + /// + internal class RegionHandle + { + private UInt64 handle; + + /// + /// Initialises a new grid-aware RegionHandle + /// + /// IP Address of the Grid Server for this region + /// Grid X Coordinate + /// Grid Y Coordinate + public RegionHandle(string ip, short x, short y) + { + IPAddress addr = IPAddress.Parse(ip); + + if (addr.AddressFamily != AddressFamily.InterNetwork) + throw new Exception("Bad RegionHandle Parameter - must be an IPv4 address"); + + uint baseHandle = BitConverter.ToUInt32(addr.GetAddressBytes(), 0); + + // Split the IP address in half + short a = (short) ((baseHandle << 16) & 0xFFFF); + short b = (short) ((baseHandle << 0) & 0xFFFF); + + // Raise the bounds a little + uint nx = (uint) x; + uint ny = (uint) y; + + // Multiply grid coords to get region coords + nx *= 256; + ny *= 256; + + // Stuff the IP address in too + nx = (uint) a << 16; + ny = (uint) b << 16; + + handle = ((UInt64) nx << 32) | (uint) ny; + } + + /// + /// Initialises a new RegionHandle that is not inter-grid aware + /// + /// Grid X Coordinate + /// Grid Y Coordinate + public RegionHandle(uint x, uint y) + { + handle = ((x*256) << 32) | (y*256); + } + + /// + /// Initialises a new RegionHandle from an existing value + /// + /// A U64 RegionHandle + public RegionHandle(UInt64 Region) + { + handle = Region; + } + + /// + /// Returns the Grid Masked RegionHandle - For use in Teleport packets and other packets where sending the grid IP address may be handy. + /// + /// Do not use for SimulatorEnable packets. The client will choke. + /// Region Handle including IP Address encoding + public UInt64 getTeleportHandle() + { + return handle; + } + + /// + /// Returns a RegionHandle which may be used for SimulatorEnable packets. Removes the IP address encoding and returns the lower bounds. + /// + /// A U64 RegionHandle for use in SimulatorEnable packets. + public UInt64 getNeighbourHandle() + { + UInt64 mask = 0x0000FFFF0000FFFF; + + return handle | mask; + } + + /// + /// Returns the IP Address of the GridServer from a Grid-Encoded RegionHandle + /// + /// Grid Server IP Address + public IPAddress getGridIP() + { + uint a = (uint) ((handle >> 16) & 0xFFFF); + uint b = (uint) ((handle >> 48) & 0xFFFF); + + return new IPAddress((long) (a << 16) | (long) b); + } + + /// + /// Returns the X Coordinate from a Grid-Encoded RegionHandle + /// + /// X Coordinate + public uint getGridX() + { + uint x = (uint) ((handle >> 32) & 0xFFFF); + + return x; + } + + /// + /// Returns the Y Coordinate from a Grid-Encoded RegionHandle + /// + /// Y Coordinate + public uint getGridY() + { + uint y = (uint) ((handle >> 0) & 0xFFFF); + + return y; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs new file mode 100644 index 0000000..1257849 --- /dev/null +++ b/OpenSim/Framework/RegionInfo.cs @@ -0,0 +1,328 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Net; +using System.Net.Sockets; +using libsecondlife; +using Nini.Config; + +namespace OpenSim.Framework +{ + public class SimpleRegionInfo + { + public SimpleRegionInfo() + { + } + + public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) + { + m_regionLocX = regionLocX; + m_regionLocY = regionLocY; + + m_internalEndPoint = internalEndPoint; + m_externalHostName = externalUri; + } + + public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) + { + m_regionLocX = regionLocX; + m_regionLocY = regionLocY; + + m_externalHostName = externalUri; + + m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); + } + + public LLUUID RegionID = new LLUUID(); + + private uint m_remotingPort; + + public uint RemotingPort + { + get { return m_remotingPort; } + set { m_remotingPort = value; } + } + + public string RemotingAddress; + + + public IPEndPoint ExternalEndPoint + { + get + { + // Old one defaults to IPv6 + //return new IPEndPoint( Dns.GetHostAddresses( m_externalHostName )[0], m_internalEndPoint.Port ); + + IPAddress ia = null; + // If it is already an IP, don't resolve it - just return directly + if (IPAddress.TryParse(m_externalHostName, out ia)) + return new IPEndPoint(ia, m_internalEndPoint.Port); + + // Reset for next check + ia = null; + + + // New method favors IPv4 + foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) + { + if (ia == null) + ia = Adr; + + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } + } + + return new IPEndPoint(ia, m_internalEndPoint.Port); + } + + set { m_externalHostName = value.ToString(); } + } + + protected string m_externalHostName; + + public string ExternalHostName + { + get { return m_externalHostName; } + set { m_externalHostName = value; } + } + + protected IPEndPoint m_internalEndPoint; + + public IPEndPoint InternalEndPoint + { + get { return m_internalEndPoint; } + set { m_internalEndPoint = value; } + } + + protected uint? m_regionLocX; + + public uint RegionLocX + { + get { return m_regionLocX.Value; } + set { m_regionLocX = value; } + } + + protected uint? m_regionLocY; + + public uint RegionLocY + { + get { return m_regionLocY.Value; } + set { m_regionLocY = value; } + } + + public ulong RegionHandle + { + get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); } + } + } + + public class RegionInfo : SimpleRegionInfo + { + public string RegionName = ""; + + public string DataStore = ""; + public bool isSandbox = false; + + public LLUUID MasterAvatarAssignedUUID = new LLUUID(); + public string MasterAvatarFirstName = ""; + public string MasterAvatarLastName = ""; + public string MasterAvatarSandboxPassword = ""; + + // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. + private static EstateSettings m_estateSettings; + + public EstateSettings EstateSettings + { + get + { + if (m_estateSettings == null) + { + m_estateSettings = new EstateSettings(); + } + + return m_estateSettings; + } + } + + public ConfigurationMember configMember; + + public RegionInfo(string description, string filename) + { + configMember = + new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); + configMember.performConfigurationRetrieve(); + } + + public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : + base(regionLocX, regionLocY, internalEndPoint, externalUri) + { + } + + public RegionInfo() + { + } + + //not in use, should swap to nini though. + public void LoadFromNiniSource(IConfigSource source) + { + LoadFromNiniSource(source, "RegionInfo"); + } + + //not in use, should swap to nini though. + public void LoadFromNiniSource(IConfigSource source, string sectionName) + { + string errorMessage = ""; + RegionID = + new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated())); + RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); + m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); + m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); + DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); + + string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); + IPAddress ipAddressResult; + if (IPAddress.TryParse(ipAddress, out ipAddressResult)) + { + m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); + } + else + { + errorMessage = "needs an IP Address (IPAddress)"; + } + m_internalEndPoint.Port = + source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort); + + string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); + if (externalHost != "SYSTEMIP") + { + m_externalHostName = externalHost; + } + else + { + m_externalHostName = Util.GetLocalHost().ToString(); + } + + MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); + MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); + MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); + + if (errorMessage != "") + { + // a error + } + } + + public void loadConfigurationOptions() + { + configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, + "UUID of Region (Default is recommended, random UUID)", + LLUUID.Random().ToString(), true); + configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Region Name", "OpenSim Test", false); + configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, + "Grid Location (X Axis)", "1000", false); + configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, + "Grid Location (Y Axis)", "1000", false); + configMember.addConfigurationOption("datastore", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Filename for local storage", "OpenSim.db", false); + configMember.addConfigurationOption("internal_ip_address", + ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, + "Internal IP Address for incoming UDP client connections", "0.0.0.0", + false); + configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, + "Internal IP Port for incoming UDP client connections", + NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); + configMember.addConfigurationOption("external_host_name", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "External Host Name", "127.0.0.1", false); + configMember.addConfigurationOption("master_avatar_first", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "First Name of Master Avatar", "Test", false); + configMember.addConfigurationOption("master_avatar_last", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Last Name of Master Avatar", "User", false); + configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "(Sandbox Mode Only)Password for Master Avatar account", "test", false); + } + + public bool handleIncomingConfiguration(string configuration_key, object configuration_result) + { + switch (configuration_key) + { + case "sim_UUID": + RegionID = (LLUUID) configuration_result; + break; + case "sim_name": + RegionName = (string) configuration_result; + break; + case "sim_location_x": + m_regionLocX = (uint) configuration_result; + break; + case "sim_location_y": + m_regionLocY = (uint) configuration_result; + break; + case "datastore": + DataStore = (string) configuration_result; + break; + case "internal_ip_address": + IPAddress address = (IPAddress) configuration_result; + m_internalEndPoint = new IPEndPoint(address, 0); + break; + case "internal_ip_port": + m_internalEndPoint.Port = (int) configuration_result; + break; + case "external_host_name": + if ((string) configuration_result != "SYSTEMIP") + { + m_externalHostName = (string) configuration_result; + } + else + { + m_externalHostName = Util.GetLocalHost().ToString(); + } + break; + case "master_avatar_first": + MasterAvatarFirstName = (string) configuration_result; + break; + case "master_avatar_last": + MasterAvatarLastName = (string) configuration_result; + break; + case "master_avatar_pass": + string tempMD5Passwd = (string) configuration_result; + MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); + break; + } + + return true; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/Remoting.cs b/OpenSim/Framework/Remoting.cs new file mode 100644 index 0000000..667ae69 --- /dev/null +++ b/OpenSim/Framework/Remoting.cs @@ -0,0 +1,134 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Security.Cryptography; +using System.Text; + +namespace OpenSim.Framework +{ + /// + /// NEEDS AUDIT. + /// + /// + /// Suggested implementation + /// Store two digests for each foreign host. A local copy of the local hash using the local challenge (when issued), and a local copy of the remote hash using the remote challenge. + /// When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message. + /// When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[]. + /// Both hosts should be performing these operations for this to be effective. + /// + internal class RemoteDigest + { + private byte[] currentHash; + private byte[] secret; + + private SHA512Managed SHA512; + + /// + /// Initialises a new RemoteDigest authentication mechanism + /// + /// Needs an audit by a cryptographic professional - was not "roll your own"'d by choice but rather a serious lack of decent authentication mechanisms in .NET remoting + /// The shared secret between systems (for inter-sim, this is provided in encrypted form during connection, for grid this is input manually in setup) + /// Binary salt - some common value - to be decided what + /// The challenge key provided by the third party + public RemoteDigest(string sharedSecret, byte[] salt, string challenge) + { + SHA512 = new SHA512Managed(); + Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret, salt); + secret = RFC2898.GetBytes(512); + ASCIIEncoding ASCII = new ASCIIEncoding(); + + currentHash = SHA512.ComputeHash(AppendArrays(secret, ASCII.GetBytes(challenge))); + } + + /// + /// Authenticates a piece of incoming data against the local digest. Upon successful authentication, digest string is incremented. + /// + /// The incoming data + /// The remote digest + /// + public bool Authenticate(byte[] data, byte[] digest) + { + byte[] newHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data)); + if (digest == newHash) + { + currentHash = newHash; + return true; + } + else + { + throw new Exception("Hash comparison failed. Key resync required."); + } + } + + /// + /// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message. + /// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the + /// hashes will get out of sync and throw an exception when validation is attempted. + /// + /// The outgoing data + /// The local digest + public byte[] Sign(byte[] data) + { + currentHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data)); + return currentHash; + } + + /// + /// Generates a new challenge string to be issued to a foreign host. Challenges are 1024-bit (effective strength of less than 512-bits) messages generated using the Crytographic Random Number Generator. + /// + /// A 128-character hexadecimal string containing the challenge. + public static string GenerateChallenge() + { + RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider(); + byte[] bytes = new byte[64]; + RNG.GetBytes(bytes); + + StringBuilder sb = new StringBuilder(bytes.Length*2); + foreach (byte b in bytes) + { + sb.AppendFormat("{0:x2}", b); + } + return sb.ToString(); + } + + /// + /// Helper function, merges two byte arrays + /// + /// Sourced from MSDN Forum + /// A + /// B + /// C + private byte[] AppendArrays(byte[] a, byte[] b) + { + byte[] c = new byte[a.Length + b.Length]; + Buffer.BlockCopy(a, 0, c, 0, a.Length); + Buffer.BlockCopy(b, 0, c, a.Length, b.Length); + return c; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/UUID.cs b/OpenSim/Framework/UUID.cs new file mode 100644 index 0000000..3b292b1 --- /dev/null +++ b/OpenSim/Framework/UUID.cs @@ -0,0 +1,155 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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 libsecondlife; + +namespace OpenSim.Framework +{ + internal class UUID + { + public LLUUID llUUID; + + public UUID(string uuid) + { + llUUID = new LLUUID(uuid); + } + + public UUID(byte[] uuid) + { + llUUID = new LLUUID(uuid, 0); + } + + public UUID(byte[] uuid, int offset) + { + llUUID = new LLUUID(uuid, offset); + } + + public UUID() + { + llUUID = LLUUID.Zero; + } + + public UUID(ulong uuid) + { + llUUID = new LLUUID(uuid); + } + + public UUID(UInt32 first, UInt32 second, UInt32 third, UInt32 fourth) + { + byte[] uuid = new byte[16]; + + byte[] n = BitConverter.GetBytes(first); + n.CopyTo(uuid, 0); + n = BitConverter.GetBytes(second); + n.CopyTo(uuid, 4); + n = BitConverter.GetBytes(third); + n.CopyTo(uuid, 8); + n = BitConverter.GetBytes(fourth); + n.CopyTo(uuid, 12); + + llUUID = new LLUUID(uuid, 0); + } + + public override string ToString() + { + return llUUID.ToString(); + } + + public string ToStringHyphenated() + { + return llUUID.ToStringHyphenated(); + } + + public byte[] GetBytes() + { + return llUUID.GetBytes(); + } + + public UInt32[] GetInts() + { + UInt32[] ints = new UInt32[4]; + ints[0] = BitConverter.ToUInt32(llUUID.Data, 0); + ints[1] = BitConverter.ToUInt32(llUUID.Data, 4); + ints[2] = BitConverter.ToUInt32(llUUID.Data, 8); + ints[3] = BitConverter.ToUInt32(llUUID.Data, 12); + + return ints; + } + + public LLUUID GetLLUUID() + { + return llUUID; + } + + public uint CRC() + { + return llUUID.CRC(); + } + + public override int GetHashCode() + { + return llUUID.GetHashCode(); + } + + public void Combine(UUID other) + { + llUUID.Combine(other.GetLLUUID()); + } + + public void Combine(LLUUID other) + { + llUUID.Combine(other); + } + + public override bool Equals(Object other) + { + return llUUID.Equals(other); + } + + public static bool operator ==(UUID a, UUID b) + { + return a.llUUID.Equals(b.GetLLUUID()); + } + + public static bool operator !=(UUID a, UUID b) + { + return !a.llUUID.Equals(b.GetLLUUID()); + } + + public static bool operator ==(UUID a, LLUUID b) + { + return a.Equals(b); + } + + public static bool operator !=(UUID a, LLUUID b) + { + return !a.Equals(b); + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs new file mode 100644 index 0000000..fdb8f82 --- /dev/null +++ b/OpenSim/Framework/UserConfig.cs @@ -0,0 +1,103 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS 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 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. +* +*/ + +namespace OpenSim.Framework +{ + /// + /// UserConfig -- For User Server Configuration + /// + public class UserConfig + { + public string DefaultStartupMsg = ""; + public string GridServerURL = ""; + public string GridSendKey = ""; + public string GridRecvKey = ""; + + public string DatabaseProvider = ""; + + public static uint DefaultHttpPort = 8002; + public uint HttpPort = DefaultHttpPort; + + private ConfigurationMember configMember; + + public UserConfig(string description, string filename) + { + configMember = + new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); + configMember.performConfigurationRetrieve(); + } + + public void loadConfigurationOptions() + { + configMember.addConfigurationOption("default_startup_message", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Default Startup Message", "Welcome to OGS", false); + + configMember.addConfigurationOption("default_grid_server", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Default Grid Server URI", + "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/", false); + configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to send to grid server", "null", false); + configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to expect from grid server", "null", false); + configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); + + configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, + "Http Listener port", DefaultHttpPort.ToString(), false); + } + + public bool handleIncomingConfiguration(string configuration_key, object configuration_result) + { + switch (configuration_key) + { + case "default_startup_message": + DefaultStartupMsg = (string) configuration_result; + break; + case "default_grid_server": + GridServerURL = (string) configuration_result; + break; + case "grid_send_key": + GridSendKey = (string) configuration_result; + break; + case "grid_recv_key": + GridRecvKey = (string) configuration_result; + break; + case "database_provider": + DatabaseProvider = (string) configuration_result; + break; + case "http_port": + HttpPort = (uint) configuration_result; + break; + } + + return true; + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs new file mode 100644 index 0000000..d10aa36 --- /dev/null +++ b/OpenSim/Framework/UserProfileData.cs @@ -0,0 +1,214 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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 libsecondlife; + +namespace OpenSim.Framework +{ + /// + /// Information about a particular user known to the userserver + /// + public class UserProfileData + { + /// + /// The ID value for this user + /// + public LLUUID UUID; + + /// + /// The first component of a users account name + /// + public string username; + + /// + /// The second component of a users account name + /// + public string surname; + + /// + /// A salted hash containing the users password, in the format md5(md5(password) + ":" + salt) + /// + /// This is double MD5'd because the client sends an unsalted MD5 to the loginserver + public string passwordHash; + + /// + /// The salt used for the users hash, should be 32 bytes or longer + /// + public string passwordSalt; + + /// + /// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into + /// + public ulong homeRegion + { + get { return Helpers.UIntsToLong((homeRegionX*256), (homeRegionY*256)); } + set + { + homeRegionX = (uint) (value >> 40); + homeRegionY = (((uint) (value)) >> 8); + } + } + + public uint homeRegionX; + public uint homeRegionY; + + /// + /// The coordinates inside the region of the home location + /// + public LLVector3 homeLocation; + + /// + /// Where the user will be looking when they rez. + /// + public LLVector3 homeLookAt; + + /// + /// A UNIX Timestamp (seconds since epoch) for the users creation + /// + public int created; + + /// + /// A UNIX Timestamp for the users last login date / time + /// + public int lastLogin; + + public LLUUID rootInventoryFolderID; + + /// + /// A URI to the users inventory server, used for foreigners and large grids + /// + public string userInventoryURI = String.Empty; + + /// + /// A URI to the users asset server, used for foreigners and large grids. + /// + public string userAssetURI = String.Empty; + + /// + /// A uint mask containing the "I can do" fields of the users profile + /// + public uint profileCanDoMask; + + /// + /// A uint mask containing the "I want to do" part of the users profile + /// + public uint profileWantDoMask; // Profile window "I want to" mask + + /// + /// The about text listed in a users profile. + /// + public string profileAboutText = String.Empty; + + /// + /// The first life about text listed in a users profile + /// + public string profileFirstText = String.Empty; + + /// + /// The profile image for an avatar stored on the asset server + /// + public LLUUID profileImage; + + /// + /// The profile image for the users first life tab + /// + public LLUUID profileFirstImage; + + /// + /// The users last registered agent (filled in on the user server) + /// + public UserAgentData currentAgent; + } + + /// + /// Information about a users session + /// + public class UserAgentData + { + /// + /// The UUID of the users avatar (not the agent!) + /// + public LLUUID UUID; + + /// + /// The IP address of the user + /// + public string agentIP = String.Empty; + + /// + /// The port of the user + /// + public uint agentPort; + + /// + /// Is the user online? + /// + public bool agentOnline; + + /// + /// The session ID for the user (also the agent ID) + /// + public LLUUID sessionID; + + /// + /// The "secure" session ID for the user + /// + /// Not very secure. Dont rely on it for anything more than Linden Lab does. + public LLUUID secureSessionID; + + /// + /// The region the user logged into initially + /// + public LLUUID regionID; + + /// + /// A unix timestamp from when the user logged in + /// + public int loginTime; + + /// + /// When this agent expired and logged out, 0 if still online + /// + public int logoutTime; + + /// + /// Current region the user is logged into + /// + public LLUUID currentRegion; + + /// + /// Region handle of the current region the user is in + /// + public ulong currentHandle; + + /// + /// The position of the user within the region + /// + public LLVector3 currentPos; + } +} \ No newline at end of file diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs new file mode 100644 index 0000000..c731561 --- /dev/null +++ b/OpenSim/Framework/Util.cs @@ -0,0 +1,371 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* 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. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project 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 DEVELOPERS ``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 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.Data; +using System.IO; +using System.Net; +using System.Net.Sockets; +using System.Security.Cryptography; +using System.Text; +using libsecondlife; +using Nini.Config; + +namespace OpenSim.Framework +{ + public class Util + { + private static Random randomClass = new Random(); + private static uint nextXferID = 5000; + private static object XferLock = new object(); + private static Dictionary capsURLS = new Dictionary(); + + + public static ulong UIntsToLong(uint X, uint Y) + { + return Helpers.UIntsToLong(X, Y); + } + + public static Random RandomClass + { + get { return randomClass; } + } + + public static uint GetNextXferID() + { + uint id = 0; + lock (XferLock) + { + id = nextXferID; + nextXferID++; + } + return id; + } + + public Util() + { + } + + public static string GetFileName(string file) + { + // Return just the filename on UNIX platforms + // TODO: this should be customisable with a prefix, but that's something to do later. + if (Environment.OSVersion.Platform == PlatformID.Unix) + { + return file; + } + + // Return %APPDATA%/OpenSim/file for 2K/XP/NT/2K3/VISTA + // TODO: Switch this to System.Enviroment.SpecialFolders.ApplicationData + if (Environment.OSVersion.Platform == PlatformID.Win32NT) + { + if (!Directory.Exists("%APPDATA%\\OpenSim\\")) + { + Directory.CreateDirectory("%APPDATA%\\OpenSim"); + } + + return "%APPDATA%\\OpenSim\\" + file; + } + + // Catch all - covers older windows versions + // (but those probably wont work anyway) + return file; + } + + public static bool IsEnvironmentSupported(ref string reason) + { + // Must have .NET 2.0 (Generics / libsl) + if (Environment.Version.Major < 2) + { + reason = ".NET 1.0/1.1 lacks components that is used by OpenSim"; + return false; + } + + // Windows 95/98/ME are unsupported + if (Environment.OSVersion.Platform == PlatformID.Win32Windows && + Environment.OSVersion.Platform != PlatformID.Win32NT) + { + reason = "Windows 95/98/ME will not run OpenSim"; + return false; + } + + // Windows 2000 / Pre-SP2 XP + if (Environment.OSVersion.Version.Major == 5 && ( + Environment.OSVersion.Version.Minor == 0)) + { + reason = "Please update to Windows XP Service Pack 2 or Server2003"; + return false; + } + + return true; + } + + public static int UnixTimeSinceEpoch() + { + TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); + int timestamp = (int) t.TotalSeconds; + return timestamp; + } + + public static string Md5Hash(string pass) + { + MD5 md5 = MD5CryptoServiceProvider.Create(); + byte[] dataMd5 = md5.ComputeHash(Encoding.Default.GetBytes(pass)); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < dataMd5.Length; i++) + sb.AppendFormat("{0:x2}", dataMd5[i]); + return sb.ToString(); + } + + public static string GetRandomCapsPath() + { + LLUUID caps = LLUUID.Random(); + string capsPath = caps.ToStringHyphenated(); + capsPath = capsPath.Remove(capsPath.Length - 4, 4); + return capsPath; + } + + public static int fast_distance2d(int x, int y) + { + x = Math.Abs(x); + y = Math.Abs(y); + + int min = Math.Min(x, y); + + return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); + } + + public static string FieldToString(byte[] bytes) + { + return FieldToString(bytes, String.Empty); + } + + /// + /// Convert a variable length field (byte array) to a string, with a + /// field name prepended to each line of the output + /// + /// If the byte array has unprintable characters in it, a + /// hex dump will be put in the string instead + /// The byte array to convert to a string + /// A field name to prepend to each line of output + /// An ASCII string or a string containing a hex dump, minus + /// the null terminator + public static string FieldToString(byte[] bytes, string fieldName) + { + // Check for a common case + if (bytes.Length == 0) return String.Empty; + + StringBuilder output = new StringBuilder(); + bool printable = true; + + for (int i = 0; i < bytes.Length; ++i) + { + // Check if there are any unprintable characters in the array + if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09 + && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00) + { + printable = false; + break; + } + } + + if (printable) + { + if (fieldName.Length > 0) + { + output.Append(fieldName); + output.Append(": "); + } + + if (bytes[bytes.Length - 1] == 0x00) + output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1)); + else + output.Append(UTF8Encoding.UTF8.GetString(bytes)); + } + else + { + for (int i = 0; i < bytes.Length; i += 16) + { + if (i != 0) + output.Append(Environment.NewLine); + if (fieldName.Length > 0) + { + output.Append(fieldName); + output.Append(": "); + } + + for (int j = 0; j < 16; j++) + { + if ((i + j) < bytes.Length) + output.Append(String.Format("{0:X2} ", bytes[i + j])); + else + output.Append(" "); + } + + for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) + { + if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) + output.Append((char) bytes[i + j]); + else + output.Append("."); + } + } + } + + return output.ToString(); + } + + /// + /// Returns a IP address from a specified DNS, favouring IPv4 addresses. + /// + /// DNS Hostname + /// An IP address, or null + public static IPAddress GetHostFromDNS(string dnsAddress) + { + // Is it already a valid IP? No need to look it up. + IPAddress ipa; + if (IPAddress.TryParse(dnsAddress, out ipa)) + return ipa; + + // Not an IP, lookup required + IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList; + + foreach (IPAddress host in hosts) + { + if (host.AddressFamily == AddressFamily.InterNetwork) + { + return host; + } + } + + if (hosts.Length > 0) + return hosts[0]; + + return null; + } + + public static IPAddress GetLocalHost() + { + string dnsAddress = "localhost"; + + IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList; + + foreach (IPAddress host in hosts) + { + if (!IPAddress.IsLoopback(host) && host.AddressFamily == AddressFamily.InterNetwork) + { + return host; + } + } + + if (hosts.Length > 0) + return hosts[0]; + + return null; + } + + // + // directory locations + // + + public static string homeDir() + { + string temp; +// string personal=(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); +// temp = Path.Combine(personal,".OpenSim"); + temp = "."; + return temp; + } + + public static string configDir() + { + string temp; + temp = "."; + return temp; + } + + public static string dataDir() + { + string temp; + temp = "."; + return temp; + } + + public static string logDir() + { + string temp; + temp = "."; + return temp; + } + + public static string GetCapsURL(LLUUID userID) + { + if (capsURLS.ContainsKey(userID)) + { + return capsURLS[userID]; + } + return ""; + } + + public static void SetCapsURL(LLUUID userID, string url) + { + if (capsURLS.ContainsKey(userID)) + { + capsURLS[userID] = url; + } + else + { + capsURLS.Add(userID, url); + } + } + + // Nini (config) related Methods + public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName) + { + if (!File.Exists(fileName)) + { + //create new file + } + XmlConfigSource config = new XmlConfigSource(fileName); + AddDataRowToConfig(config, row); + config.Save(); + + return config; + } + + public static void AddDataRowToConfig(IConfigSource config, DataRow row) + { + config.Configs.Add((string) row[0]); + for (int i = 0; i < row.Table.Columns.Count; i++) + { + config.Configs[(string) row[0]].Set(row.Table.Columns[i].ColumnName, row[i]); + } + } + } +} \ No newline at end of file -- cgit v1.1