From 44a7db0e44d175fcb854b7bfd11d3b97ed6b934c Mon Sep 17 00:00:00 2001 From: Tleiades Hax Date: Wed, 17 Oct 2007 09:36:11 +0000 Subject: Renamed SimProfileData to RegionProfileData --- OpenSim/Framework/Data.DB4o/DB4oGridData.cs | 9 +- OpenSim/Framework/Data.DB4o/DB4oManager.cs | 9 +- OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs | 14 +- OpenSim/Framework/Data.MSSQL/MSSQLManager.cs | 6 +- OpenSim/Framework/Data.MySQL/MySQLGridData.cs | 18 +-- OpenSim/Framework/Data.MySQL/MySQLManager.cs | 6 +- OpenSim/Framework/Data.SQLite/SQLiteGridData.cs | 14 +- OpenSim/Framework/Data.SQLite/SQLiteManager.cs | 6 +- OpenSim/Framework/Data/GridData.cs | 8 +- OpenSim/Framework/Data/RegionProfileData.cs | 192 ++++++++++++++++++++++++ OpenSim/Framework/Data/SimProfileData.cs | 192 ------------------------ 11 files changed, 238 insertions(+), 236 deletions(-) create mode 100644 OpenSim/Framework/Data/RegionProfileData.cs delete mode 100644 OpenSim/Framework/Data/SimProfileData.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs index a01d1a4..bc7225a 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs @@ -56,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o /// maximum X coordinate /// maximum Y coordinate /// An array of region profiles - public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) + public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) { return null; } @@ -66,7 +66,8 @@ namespace OpenSim.Framework.Data.DB4o /// /// The handle to search for /// A region profile - public SimProfileData GetProfileByHandle(ulong handle) { + public RegionProfileData GetProfileByHandle(ulong handle) + { lock (manager.simProfiles) { foreach (LLUUID UUID in manager.simProfiles.Keys) @@ -85,7 +86,7 @@ namespace OpenSim.Framework.Data.DB4o /// /// The region ID code /// A region profile - public SimProfileData GetProfileByLLUUID(LLUUID uuid) + public RegionProfileData GetProfileByLLUUID(LLUUID uuid) { lock (manager.simProfiles) { @@ -100,7 +101,7 @@ namespace OpenSim.Framework.Data.DB4o /// /// The profile to add /// A dataresponse enum indicating success - public DataResponse AddProfile(SimProfileData profile) + public DataResponse AddProfile(RegionProfileData profile) { lock (manager.simProfiles) { diff --git a/OpenSim/Framework/Data.DB4o/DB4oManager.cs b/OpenSim/Framework/Data.DB4o/DB4oManager.cs index 224b842..10c8490 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oManager.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oManager.cs @@ -41,7 +41,7 @@ namespace OpenSim.Framework.Data.DB4o /// /// A list of the current regions connected (in-memory cache) /// - public Dictionary simProfiles = new Dictionary(); + public Dictionary simProfiles = new Dictionary(); /// /// Database File Name /// @@ -56,9 +56,10 @@ namespace OpenSim.Framework.Data.DB4o dbfl = db4odb; IObjectContainer database; database = Db4oFactory.OpenFile(dbfl); - IObjectSet result = database.Get(typeof(SimProfileData)); + IObjectSet result = database.Get(typeof(RegionProfileData)); // Loads the file into the in-memory cache - foreach(SimProfileData row in result) { + foreach (RegionProfileData row in result) + { simProfiles.Add(row.UUID, row); } database.Close(); @@ -69,7 +70,7 @@ namespace OpenSim.Framework.Data.DB4o /// /// The profile to add /// Successful? - public bool AddRow(SimProfileData row) + public bool AddRow(RegionProfileData row) { if (simProfiles.ContainsKey(row.UUID)) { diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs index 09ce6d2..e628882 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs @@ -86,7 +86,7 @@ namespace OpenSim.Framework.Data.MSSQL /// maximum X coordinate /// maximum Y coordinate /// An array of region profiles - public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) + public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) { return null; } @@ -96,7 +96,7 @@ namespace OpenSim.Framework.Data.MSSQL /// /// Region location handle /// Sim profile - public SimProfileData GetProfileByHandle(ulong handle) + public RegionProfileData GetProfileByHandle(ulong handle) { Dictionary param = new Dictionary(); param["handle"] = handle.ToString(); @@ -104,7 +104,7 @@ namespace OpenSim.Framework.Data.MSSQL IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); IDataReader reader = result.ExecuteReader(); - SimProfileData row = database.getRow(reader); + RegionProfileData row = database.getRow(reader); reader.Close(); result.Dispose(); @@ -116,7 +116,7 @@ namespace OpenSim.Framework.Data.MSSQL /// /// The region UUID /// The sim profile - public SimProfileData GetProfileByLLUUID(LLUUID uuid) + public RegionProfileData GetProfileByLLUUID(LLUUID uuid) { Dictionary param = new Dictionary(); param["uuid"] = uuid.ToStringHyphenated(); @@ -124,7 +124,7 @@ namespace OpenSim.Framework.Data.MSSQL IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); IDataReader reader = result.ExecuteReader(); - SimProfileData row = database.getRow(reader); + RegionProfileData row = database.getRow(reader); reader.Close(); result.Dispose(); @@ -136,7 +136,7 @@ namespace OpenSim.Framework.Data.MSSQL /// /// The profile to add /// A dataresponse enum indicating success - public DataResponse AddProfile(SimProfileData profile) + public DataResponse AddProfile(RegionProfileData profile) { if (database.insertRow(profile)) { @@ -162,7 +162,7 @@ namespace OpenSim.Framework.Data.MSSQL if (throwHissyFit) throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); - SimProfileData data = GetProfileByLLUUID(uuid); + RegionProfileData data = GetProfileByLLUUID(uuid); return (handle == data.regionHandle && authkey == data.regionSecret); } diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs index 1efd51e..77d29f7 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs @@ -98,9 +98,9 @@ namespace OpenSim.Framework.Data.MSSQL /// /// An active database reader /// A region row - public SimProfileData getRow(IDataReader reader) + public RegionProfileData getRow(IDataReader reader) { - SimProfileData regionprofile = new SimProfileData(); + RegionProfileData regionprofile = new RegionProfileData(); if (reader.Read()) { @@ -154,7 +154,7 @@ namespace OpenSim.Framework.Data.MSSQL /// /// The region profile to insert /// Successful? - public bool insertRow(SimProfileData profile) + public bool insertRow(RegionProfileData profile) { string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index 5709bf0..9876ab1 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs @@ -96,7 +96,7 @@ namespace OpenSim.Framework.Data.MySQL /// Maximum X coordinate /// Maximum Y coordinate /// - public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax) + public RegionProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax) { try { @@ -111,9 +111,9 @@ namespace OpenSim.Framework.Data.MySQL IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param); IDataReader reader = result.ExecuteReader(); - SimProfileData row; + RegionProfileData row; - List rows = new List(); + List rows = new List(); while ((row = database.readSimRow(reader)) != null) { @@ -139,7 +139,7 @@ namespace OpenSim.Framework.Data.MySQL /// /// Region location handle /// Sim profile - public SimProfileData GetProfileByHandle(ulong handle) + public RegionProfileData GetProfileByHandle(ulong handle) { try { @@ -151,7 +151,7 @@ namespace OpenSim.Framework.Data.MySQL IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param); IDataReader reader = result.ExecuteReader(); - SimProfileData row = database.readSimRow(reader); + RegionProfileData row = database.readSimRow(reader); reader.Close(); result.Dispose(); @@ -171,7 +171,7 @@ namespace OpenSim.Framework.Data.MySQL /// /// The region UUID /// The sim profile - public SimProfileData GetProfileByLLUUID(LLUUID uuid) + public RegionProfileData GetProfileByLLUUID(LLUUID uuid) { try { @@ -183,7 +183,7 @@ namespace OpenSim.Framework.Data.MySQL IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param); IDataReader reader = result.ExecuteReader(); - SimProfileData row = database.readSimRow(reader); + RegionProfileData row = database.readSimRow(reader); reader.Close(); result.Dispose(); @@ -203,7 +203,7 @@ namespace OpenSim.Framework.Data.MySQL /// /// The profile to add /// Successful? - public DataResponse AddProfile(SimProfileData profile) + public DataResponse AddProfile(RegionProfileData profile) { lock (database) { @@ -232,7 +232,7 @@ namespace OpenSim.Framework.Data.MySQL if (throwHissyFit) throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); - SimProfileData data = GetProfileByLLUUID(uuid); + RegionProfileData data = GetProfileByLLUUID(uuid); return (handle == data.regionHandle && authkey == data.regionSecret); } diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs index d3f6976..8600d6b 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs @@ -267,9 +267,9 @@ namespace OpenSim.Framework.Data.MySQL /// /// An active database reader /// A region profile - public SimProfileData readSimRow(IDataReader reader) + public RegionProfileData readSimRow(IDataReader reader) { - SimProfileData retval = new SimProfileData(); + RegionProfileData retval = new RegionProfileData(); if (reader.Read()) { @@ -583,7 +583,7 @@ namespace OpenSim.Framework.Data.MySQL /// /// The region to insert /// Success? - public bool insertRegion(SimProfileData regiondata) + public bool insertRegion(RegionProfileData regiondata) { string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs index a7ff0f7..2fc80b4 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs @@ -86,7 +86,7 @@ namespace OpenSim.Framework.Data.SQLite /// maximum X coordinate /// maximum Y coordinate /// An array of region profiles - public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) + public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) { return null; } @@ -96,7 +96,7 @@ namespace OpenSim.Framework.Data.SQLite /// /// Region location handle /// Sim profile - public SimProfileData GetProfileByHandle(ulong handle) + public RegionProfileData GetProfileByHandle(ulong handle) { Dictionary param = new Dictionary(); param["handle"] = handle.ToString(); @@ -104,7 +104,7 @@ namespace OpenSim.Framework.Data.SQLite IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); IDataReader reader = result.ExecuteReader(); - SimProfileData row = database.getRow(reader); + RegionProfileData row = database.getRow(reader); reader.Close(); result.Dispose(); @@ -116,7 +116,7 @@ namespace OpenSim.Framework.Data.SQLite /// /// The region UUID /// The sim profile - public SimProfileData GetProfileByLLUUID(LLUUID uuid) + public RegionProfileData GetProfileByLLUUID(LLUUID uuid) { Dictionary param = new Dictionary(); param["uuid"] = uuid.ToStringHyphenated(); @@ -124,7 +124,7 @@ namespace OpenSim.Framework.Data.SQLite IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); IDataReader reader = result.ExecuteReader(); - SimProfileData row = database.getRow(reader); + RegionProfileData row = database.getRow(reader); reader.Close(); result.Dispose(); @@ -136,7 +136,7 @@ namespace OpenSim.Framework.Data.SQLite /// /// The profile to add /// A dataresponse enum indicating success - public DataResponse AddProfile(SimProfileData profile) + public DataResponse AddProfile(RegionProfileData profile) { if (database.insertRow(profile)) { @@ -162,7 +162,7 @@ namespace OpenSim.Framework.Data.SQLite if (throwHissyFit) throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); - SimProfileData data = GetProfileByLLUUID(uuid); + RegionProfileData data = GetProfileByLLUUID(uuid); return (handle == data.regionHandle && authkey == data.regionSecret); } diff --git a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs index f73f480..5954fba 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs @@ -161,9 +161,9 @@ namespace OpenSim.Framework.Data.SQLite /// /// An active database reader /// A region profile - public SimProfileData getRow(IDataReader reader) + public RegionProfileData getRow(IDataReader reader) { - SimProfileData retval = new SimProfileData(); + RegionProfileData retval = new RegionProfileData(); if (reader.Read()) { @@ -217,7 +217,7 @@ namespace OpenSim.Framework.Data.SQLite /// /// The region to insert /// Success? - public bool insertRow(SimProfileData profile) + public bool insertRow(RegionProfileData profile) { string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs index 7075922..2a5b8f6 100644 --- a/OpenSim/Framework/Data/GridData.cs +++ b/OpenSim/Framework/Data/GridData.cs @@ -47,14 +47,14 @@ namespace OpenSim.Framework.Data /// /// A 64bit Region Handle /// A simprofile - SimProfileData GetProfileByHandle(ulong regionHandle); + RegionProfileData GetProfileByHandle(ulong regionHandle); /// /// Returns a sim profile from a UUID /// /// A 128bit UUID /// A sim profile - SimProfileData GetProfileByLLUUID(LLUUID UUID); + RegionProfileData GetProfileByLLUUID(LLUUID UUID); /// /// Returns all profiles within the specified range @@ -64,7 +64,7 @@ namespace OpenSim.Framework.Data /// Maximum sim coordinate (X) /// Maximum sim coordinate (Y) /// An array containing all the sim profiles in the specified range - SimProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); + RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); /// /// Authenticates a sim by use of it's recv key. @@ -103,7 +103,7 @@ namespace OpenSim.Framework.Data /// /// The profile to add /// RESPONSE_OK if successful, error if not. - DataResponse AddProfile(SimProfileData profile); + DataResponse AddProfile(RegionProfileData profile); ReservationData GetReservationAtPoint(uint x, uint y); diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs new file mode 100644 index 0000000..5e5dac6 --- /dev/null +++ b/OpenSim/Framework/Data/RegionProfileData.cs @@ -0,0 +1,192 @@ +/* +* 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; +using Nwc.XmlRpc; + +using System; +using System.Collections; + +namespace OpenSim.Framework.Data +{ + /// + /// A class which contains information known to the grid server about a region + /// + public class RegionProfileData + { + /// + /// The name of the region + /// + public string regionName = ""; + + /// + /// A 64-bit number combining map position into a (mostly) unique ID + /// + public ulong regionHandle; + + /// + /// OGS/OpenSim Specific ID for a region + /// + public LLUUID UUID; + + /// + /// Coordinates of the region + /// + public uint regionLocX; + public uint regionLocY; + public uint regionLocZ; // Reserved (round-robin, layers, etc) + + /// + /// Authentication secrets + /// + /// Not very secure, needs improvement. + public string regionSendKey = ""; + public string regionRecvKey = ""; + public string regionSecret = ""; + + /// + /// Whether the region is online + /// + public bool regionOnline; + + /// + /// Information about the server that the region is currently hosted on + /// + public string serverIP = ""; + public uint serverPort; + public string serverURI = ""; + + public uint httpPort; + public uint remotingPort; + public string httpServerURI = ""; + + /// + /// Set of optional overrides. Can be used to create non-eulicidean spaces. + /// + public ulong regionNorthOverrideHandle; + public ulong regionSouthOverrideHandle; + public ulong regionEastOverrideHandle; + public ulong regionWestOverrideHandle; + + /// + /// Optional: URI Location of the region database + /// + /// Used for floating sim pools where the region data is not nessecarily coupled to a specific server + public string regionDataURI = ""; + + /// + /// Region Asset Details + /// + public string regionAssetURI = ""; + public string regionAssetSendKey = ""; + public string regionAssetRecvKey = ""; + + /// + /// Region Userserver Details + /// + public string regionUserURI = ""; + public string regionUserSendKey = ""; + public string regionUserRecvKey = ""; + + /// + /// Region Map Texture Asset + /// + public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006"); + + /// + /// Get Sim profile data from grid server when in grid mode + /// + /// + /// + /// + /// + public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) + { + Hashtable requestData = new Hashtable(); + requestData["region_uuid"] = region_uuid.UUID.ToString(); + requestData["authkey"] = gridserver_sendkey; + ArrayList SendParams = new ArrayList(); + SendParams.Add(requestData); + XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); + XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); + + Hashtable responseData = (Hashtable)GridResp.Value; + + if (responseData.ContainsKey("error")) + { + return null; + } + + RegionProfileData simData = new RegionProfileData(); + simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); + simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); + simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); + simData.serverIP = (string)responseData["sim_ip"]; + simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); + simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); + simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); + simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; + simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; + simData.UUID = new LLUUID((string)responseData["region_UUID"]); + simData.regionName = (string)responseData["region_name"]; + + return simData; + } + public RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) + { + Hashtable requestData = new Hashtable(); + requestData["region_handle"] = region_handle.ToString(); + requestData["authkey"] = gridserver_sendkey; + ArrayList SendParams = new ArrayList(); + SendParams.Add(requestData); + XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); + XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); + + Hashtable responseData = (Hashtable)GridResp.Value; + + if (responseData.ContainsKey("error")) + { + return null; + } + + RegionProfileData simData = new RegionProfileData(); + simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); + simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); + simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); + simData.serverIP = (string)responseData["sim_ip"]; + simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); + simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); + simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); + simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; + simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; + simData.UUID = new LLUUID((string)responseData["region_UUID"]); + simData.regionName = (string)responseData["region_name"]; + + return simData; + } + } +} diff --git a/OpenSim/Framework/Data/SimProfileData.cs b/OpenSim/Framework/Data/SimProfileData.cs deleted file mode 100644 index abde1f3..0000000 --- a/OpenSim/Framework/Data/SimProfileData.cs +++ /dev/null @@ -1,192 +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; -using Nwc.XmlRpc; - -using System; -using System.Collections; - -namespace OpenSim.Framework.Data -{ - /// - /// A class which contains information known to the grid server about a region - /// - public class SimProfileData - { - /// - /// The name of the region - /// - public string regionName = ""; - - /// - /// A 64-bit number combining map position into a (mostly) unique ID - /// - public ulong regionHandle; - - /// - /// OGS/OpenSim Specific ID for a region - /// - public LLUUID UUID; - - /// - /// Coordinates of the region - /// - public uint regionLocX; - public uint regionLocY; - public uint regionLocZ; // Reserved (round-robin, layers, etc) - - /// - /// Authentication secrets - /// - /// Not very secure, needs improvement. - public string regionSendKey = ""; - public string regionRecvKey = ""; - public string regionSecret = ""; - - /// - /// Whether the region is online - /// - public bool regionOnline; - - /// - /// Information about the server that the region is currently hosted on - /// - public string serverIP = ""; - public uint serverPort; - public string serverURI = ""; - - public uint httpPort; - public uint remotingPort; - public string httpServerURI = ""; - - /// - /// Set of optional overrides. Can be used to create non-eulicidean spaces. - /// - public ulong regionNorthOverrideHandle; - public ulong regionSouthOverrideHandle; - public ulong regionEastOverrideHandle; - public ulong regionWestOverrideHandle; - - /// - /// Optional: URI Location of the region database - /// - /// Used for floating sim pools where the region data is not nessecarily coupled to a specific server - public string regionDataURI = ""; - - /// - /// Region Asset Details - /// - public string regionAssetURI = ""; - public string regionAssetSendKey = ""; - public string regionAssetRecvKey = ""; - - /// - /// Region Userserver Details - /// - public string regionUserURI = ""; - public string regionUserSendKey = ""; - public string regionUserRecvKey = ""; - - /// - /// Region Map Texture Asset - /// - public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006"); - - /// - /// Get Sim profile data from grid server when in grid mode - /// - /// - /// - /// - /// - public SimProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) - { - Hashtable requestData = new Hashtable(); - requestData["region_uuid"] = region_uuid.UUID.ToString(); - requestData["authkey"] = gridserver_sendkey; - ArrayList SendParams = new ArrayList(); - SendParams.Add(requestData); - XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); - XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); - - Hashtable responseData = (Hashtable)GridResp.Value; - - if (responseData.ContainsKey("error")) - { - return null; - } - - SimProfileData simData = new SimProfileData(); - simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); - simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); - simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); - simData.serverIP = (string)responseData["sim_ip"]; - simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); - simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); - simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); - simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; - simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; - simData.UUID = new LLUUID((string)responseData["region_UUID"]); - simData.regionName = (string)responseData["region_name"]; - - return simData; - } - public SimProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) - { - Hashtable requestData = new Hashtable(); - requestData["region_handle"] = region_handle.ToString(); - requestData["authkey"] = gridserver_sendkey; - ArrayList SendParams = new ArrayList(); - SendParams.Add(requestData); - XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); - XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); - - Hashtable responseData = (Hashtable)GridResp.Value; - - if (responseData.ContainsKey("error")) - { - return null; - } - - SimProfileData simData = new SimProfileData(); - simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); - simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); - simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); - simData.serverIP = (string)responseData["sim_ip"]; - simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); - simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); - simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); - simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; - simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; - simData.UUID = new LLUUID((string)responseData["region_UUID"]); - simData.regionName = (string)responseData["region_name"]; - - return simData; - } - } -} -- cgit v1.1