From 97ebdd4607a3d6aa312adb07292b13ae2b120929 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 19 Sep 2009 16:57:15 +0100 Subject: Adding Xml serialization of Dictionary where object is either another Dictionary or a value that is convertible to a string. --- OpenSim/Server/Base/ServerUtils.cs | 72 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 0a36bbe..ae7ec0f 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -183,5 +183,77 @@ namespace OpenSim.Server.Base return result; } + + public static string BuildQueryString(Dictionary data) + { + string qstring = String.Empty; + + foreach(KeyValuePair kvp in data) + { + string part; + if (kvp.Value != String.Empty) + { + part = System.Web.HttpUtility.UrlEncode(kvp.Key) + + "=" + System.Web.HttpUtility.UrlEncode(kvp.Value); + } + else + { + part = System.Web.HttpUtility.UrlEncode(kvp.Key); + } + + if (qstring != String.Empty) + qstring += "&"; + + qstring += part; + } + + return qstring; + } + + public static string BuildXmlResponse(Dictionary data) + { + XmlDocument doc = new XmlDocument(); + + XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, + "", ""); + + doc.AppendChild(xmlnode); + + XmlElement rootElement = doc.CreateElement("", "ServerResponse", + ""); + + doc.AppendChild(rootElement); + + BuildXmlData(rootElement, data); + + return doc.InnerXml; + } + + private static void BuildXmlData(XmlElement parent, Dictionary data) + { + foreach (KeyValuePair kvp in data) + { + XmlElement elem = parent.OwnerDocument.CreateElement("", + kvp.Key, ""); + + if (kvp.Value is Dictionary) + { + XmlAttribute type = parent.OwnerDocument.CreateAttribute("", + "type", ""); + type.Value = "List"; + + elem.Attributes.Append(type); + + BuildXmlData(elem, (Dictionary)kvp.Value); + } + else + { + elem.AppendChild(parent.OwnerDocument.CreateTextNode( + kvp.Value.ToString())); + } + + parent.AppendChild(elem); + } + } } } -- cgit v1.1 From 2f624800d37bae36cecf1bff191b646d59d86746 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 19 Sep 2009 18:06:25 +0100 Subject: Adding the deserializer for server form/xml replies --- OpenSim/Server/Base/ServerUtils.cs | 42 ++++++++++++++++++++++ .../AuthenticationServerPostHandler.cs | 6 ++-- 2 files changed, 45 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index ae7ec0f..6c2b3ed 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -255,5 +255,47 @@ namespace OpenSim.Server.Base parent.AppendChild(elem); } } + + public static Dictionary ParseXmlResponse(string data) + { + Dictionary ret = new Dictionary(); + + XmlDocument doc = new XmlDocument(); + + doc.LoadXml(data); + + XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse"); + + if (rootL.Count != 1) + return ret; + + XmlNode rootNode = rootL[0]; + + ret = ParseElement(rootNode); + + return ret; + } + + private static Dictionary ParseElement(XmlNode element) + { + Dictionary ret = new Dictionary(); + + XmlNodeList partL = element.ChildNodes; + + foreach (XmlNode part in partL) + { + XmlNode type = part.Attributes.GetNamedItem("Type"); + if (type == null || type.Value != "List") + { + ret[part.Name] = part.InnerText; + } + else + { + ret[part.Name] = ParseElement(part); + } + } + + return ret; + } } } diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index 6cf7d56..490a13a 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs @@ -157,7 +157,7 @@ namespace OpenSim.Server.Handlers.Authentication doc.AppendChild(xmlnode); - XmlElement rootElement = doc.CreateElement("", "Authentication", + XmlElement rootElement = doc.CreateElement("", "ServerResponse", ""); doc.AppendChild(rootElement); @@ -179,7 +179,7 @@ namespace OpenSim.Server.Handlers.Authentication doc.AppendChild(xmlnode); - XmlElement rootElement = doc.CreateElement("", "Authentication", + XmlElement rootElement = doc.CreateElement("", "ServerResponse", ""); doc.AppendChild(rootElement); @@ -201,7 +201,7 @@ namespace OpenSim.Server.Handlers.Authentication doc.AppendChild(xmlnode); - XmlElement rootElement = doc.CreateElement("", "Authentication", + XmlElement rootElement = doc.CreateElement("", "ServerResponse", ""); doc.AppendChild(rootElement); -- cgit v1.1 From 390137d540b9ae39eba3ba9136bd49d5e992bc5f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 21 Sep 2009 11:05:01 -0700 Subject: Added grid handler and grid remote connector. --- .../Server/Handlers/Grid/GridServerConnector.cs | 60 +++++ .../Server/Handlers/Grid/GridServerPostHandler.cs | 269 +++++++++++++++++++++ 2 files changed, 329 insertions(+) create mode 100644 OpenSim/Server/Handlers/Grid/GridServerConnector.cs create mode 100644 OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs new file mode 100644 index 0000000..b80c479 --- /dev/null +++ b/OpenSim/Server/Handlers/Grid/GridServerConnector.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 OpenSimulator 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 Nini.Config; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Base; + +namespace OpenSim.Server.Handlers.Grid +{ + public class GridServiceConnector : ServiceConnector + { + private IGridService m_GridService; + + public GridServiceConnector(IConfigSource config, IHttpServer server) : + base(config, server) + { + IConfig serverConfig = config.Configs["GridService"]; + if (serverConfig == null) + throw new Exception("No section 'Server' in config file"); + + string gridService = serverConfig.GetString("GridServiceModule", + String.Empty); + + if (gridService == String.Empty) + throw new Exception("No AuthenticationService in config file"); + + Object[] args = new Object[] { config }; + m_GridService = ServerUtils.LoadPlugin(gridService, args); + + server.AddStreamHandler(new GridServerPostHandler(m_GridService)); + } + } +} diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs new file mode 100644 index 0000000..39c0584 --- /dev/null +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -0,0 +1,269 @@ +/* + * 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 OpenSimulator 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; +using log4net; +using System; +using System.Reflection; +using System.IO; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; +using System.Xml.Serialization; +using System.Collections.Generic; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework; +using OpenSim.Framework.Servers.HttpServer; +using OpenMetaverse; + +namespace OpenSim.Server.Handlers.Grid +{ + public class GridServerPostHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private IGridService m_GridService; + + public GridServerPostHandler(IGridService service) : + base("POST", "/grid") + { + m_GridService = service; + } + + public override byte[] Handle(string path, Stream requestData, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + StreamReader sr = new StreamReader(requestData); + string body = sr.ReadToEnd(); + sr.Close(); + + Dictionary request = + ServerUtils.ParseQueryString(body); + + if (!request.ContainsKey("METHOD")) + return FailureResult(); + + string method = request["METHOD"]; + + switch (method) + { + case "register": + return Register(request); + + case "deregister": + return Deregister(request); + + case "get_neighbours": + return GetNeighbours(request); + + case "get_region_by_uuid": + return GetRegionByUUID(request); + + case "get_region_by_position": + return GetRegionByPosition(request); + + case "get_region_by_name": + return GetRegionByName(request); + + case "get_regions_by_name": + return GetRegionsByName(request); + + case "get_region_range": + return GetRegionRange(request); + + default: + m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method); + return FailureResult(); + } + + } + + #region Method-specific handlers + + byte[] Register(Dictionary request) + { + UUID scopeID = UUID.Zero; + if (request["SCOPEID"] != null) + UUID.TryParse(request["SCOPEID"], out scopeID); + else + m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region"); + + Dictionary rinfoData = new Dictionary(); + foreach (KeyValuePair kvp in request) + rinfoData[kvp.Key] = kvp.Value; + SimpleRegionInfo rinfo = new SimpleRegionInfo(rinfoData); + + bool result = m_GridService.RegisterRegion(scopeID, rinfo); + + if (result) + return SuccessResult(); + else + return FailureResult(); + } + + byte[] Deregister(Dictionary request) + { + UUID regionID = UUID.Zero; + if (request["REGIONID"] != null) + UUID.TryParse(request["REGIONID"], out regionID); + else + m_log.WarnFormat("[GRID HANDLER]: no regionID in request to deregister region"); + + bool result = m_GridService.DeregisterRegion(regionID); + + if (result) + return SuccessResult(); + else + return FailureResult(); + + } + + byte[] GetNeighbours(Dictionary request) + { + UUID scopeID = UUID.Zero; + if (request["SCOPEID"] != null) + UUID.TryParse(request["SCOPEID"], out scopeID); + else + m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); + + UUID regionID = UUID.Zero; + if (request["REGIONID"] != null) + UUID.TryParse(request["REGIONID"], out scopeID); + else + m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); + + List rinfos = m_GridService.GetNeighbours(scopeID, regionID); + + Dictionary result = new Dictionary(); + int i = 0; + foreach (SimpleRegionInfo rinfo in rinfos) + { + Dictionary rinfoDict = rinfo.ToKeyValuePairs(); + result["region" + i] = rinfoDict; + i++; + } + + string xmlString = ServerUtils.BuildXmlResponse(result); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + + } + + byte[] GetRegionByUUID(Dictionary request) + { + // TODO + return new byte[0]; + } + + byte[] GetRegionByPosition(Dictionary request) + { + // TODO + return new byte[0]; + } + + byte[] GetRegionByName(Dictionary request) + { + // TODO + return new byte[0]; + } + + byte[] GetRegionsByName(Dictionary request) + { + // TODO + return new byte[0]; + } + + byte[] GetRegionRange(Dictionary request) + { + // TODO + return new byte[0]; + } + + #endregion + + #region Misc + + private byte[] SuccessResult() + { + XmlDocument doc = new XmlDocument(); + + XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, + "", ""); + + doc.AppendChild(xmlnode); + + XmlElement rootElement = doc.CreateElement("", "ServerResponse", + ""); + + doc.AppendChild(rootElement); + + XmlElement result = doc.CreateElement("", "Result", ""); + result.AppendChild(doc.CreateTextNode("Success")); + + rootElement.AppendChild(result); + + return DocToBytes(doc); + } + + private byte[] FailureResult() + { + XmlDocument doc = new XmlDocument(); + + XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, + "", ""); + + doc.AppendChild(xmlnode); + + XmlElement rootElement = doc.CreateElement("", "ServerResponse", + ""); + + doc.AppendChild(rootElement); + + XmlElement result = doc.CreateElement("", "Result", ""); + result.AppendChild(doc.CreateTextNode("Failure")); + + rootElement.AppendChild(result); + + return DocToBytes(doc); + } + + private byte[] DocToBytes(XmlDocument doc) + { + MemoryStream ms = new MemoryStream(); + XmlTextWriter xw = new XmlTextWriter(ms, null); + xw.Formatting = Formatting.Indented; + doc.WriteTo(xw); + xw.Flush(); + + return ms.GetBuffer(); + } + + #endregion + } +} -- cgit v1.1 From 34f4738159300ab6370e3db47df5187b6cea8771 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 22 Sep 2009 11:58:40 -0700 Subject: Added HGGridConnector and related code. --- OpenSim/Server/Handlers/Grid/GridServerConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs index b80c479..7bf2e66 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs @@ -49,7 +49,7 @@ namespace OpenSim.Server.Handlers.Grid String.Empty); if (gridService == String.Empty) - throw new Exception("No AuthenticationService in config file"); + throw new Exception("No GridService in config file"); Object[] args = new Object[] { config }; m_GridService = ServerUtils.LoadPlugin(gridService, args); -- cgit v1.1 From 882d2c9cc399c4c7d1809702104ce94c9c2c7b17 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 22 Sep 2009 20:25:00 -0700 Subject: Added hg console commands to the module. Added the IN connector module for link-region and corresponding handler to be used in the regions only. No service as such is needed. This will replace the current link-region machinery. Compiles but not tested. --- .../Handlers/Grid/HypergridServerConnector.cs | 112 +++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs new file mode 100644 index 0000000..b8d9c7d --- /dev/null +++ b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.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 OpenSimulator 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; +using System.Collections.Generic; +using System.Reflection; +using System.Net; +using Nini.Config; +using OpenSim.Framework; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Base; + +using log4net; +using Nwc.XmlRpc; + +namespace OpenSim.Server.Handlers.Grid +{ + public class HypergridServiceInConnector : ServiceConnector + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + private List m_RegionsOnSim = new List(); + + public HypergridServiceInConnector(IConfigSource config, IHttpServer server) : + base(config, server) + { + server.AddXmlRPCHandler("link_region", LinkRegionRequest, false); + } + + /// + /// Someone wants to link to us + /// + /// + /// + public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient) + { + Hashtable requestData = (Hashtable)request.Params[0]; + //string host = (string)requestData["host"]; + //string portstr = (string)requestData["port"]; + string name = (string)requestData["region_name"]; + + m_log.DebugFormat("[HGrid]: Hyperlink request"); + + SimpleRegionInfo regInfo = null; + foreach (SimpleRegionInfo r in m_RegionsOnSim) + { + if ((r.RegionName != null) && (name != null) && (r.RegionName.ToLower() == name.ToLower())) + { + regInfo = r; + break; + } + } + + if (regInfo == null) + regInfo = m_RegionsOnSim[0]; // Send out the first region + + Hashtable hash = new Hashtable(); + hash["uuid"] = regInfo.RegionID.ToString(); + hash["handle"] = regInfo.RegionHandle.ToString(); + //m_log.Debug(">> Here " + regInfo.RegionHandle); + //hash["region_image"] = regInfo.RegionSettings.TerrainImageID.ToString(); + hash["region_name"] = regInfo.RegionName; + hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); + //m_log.Debug(">> Here: " + regInfo.InternalEndPoint.Port); + + + XmlRpcResponse response = new XmlRpcResponse(); + response.Value = hash; + return response; + } + + public void AddRegion(SimpleRegionInfo rinfo) + { + m_RegionsOnSim.Add(rinfo); + } + + public void RemoveRegion(SimpleRegionInfo rinfo) + { + if (m_RegionsOnSim.Contains(rinfo)) + m_RegionsOnSim.Remove(rinfo); + } + } +} -- cgit v1.1 From 67276589c883fe1a74d8d52057db1431d637dade Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 23 Sep 2009 17:20:07 -0700 Subject: Changed IGridService to use the new GridRegion data structure instead of old SimpleRegionInfo. Added grid configs to standalones. --- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 39c0584..e72c2eb 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -38,6 +38,7 @@ using System.Xml.Serialization; using System.Collections.Generic; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; using OpenMetaverse; @@ -117,7 +118,7 @@ namespace OpenSim.Server.Handlers.Grid Dictionary rinfoData = new Dictionary(); foreach (KeyValuePair kvp in request) rinfoData[kvp.Key] = kvp.Value; - SimpleRegionInfo rinfo = new SimpleRegionInfo(rinfoData); + GridRegion rinfo = new GridRegion(rinfoData); bool result = m_GridService.RegisterRegion(scopeID, rinfo); @@ -158,11 +159,11 @@ namespace OpenSim.Server.Handlers.Grid else m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); - List rinfos = m_GridService.GetNeighbours(scopeID, regionID); + List rinfos = m_GridService.GetNeighbours(scopeID, regionID); Dictionary result = new Dictionary(); int i = 0; - foreach (SimpleRegionInfo rinfo in rinfos) + foreach (GridRegion rinfo in rinfos) { Dictionary rinfoDict = rinfo.ToKeyValuePairs(); result["region" + i] = rinfoDict; -- cgit v1.1 From 2824bbc47b30ab6fb9a12bce3201bb5b79b20bd5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 24 Sep 2009 05:48:35 -0700 Subject: Changed name of the hyperlink XMLRPC method to linkk-region, so that it doesn't conflict with the existing one. --- OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs index b8d9c7d..ad63485 100644 --- a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs @@ -53,7 +53,7 @@ namespace OpenSim.Server.Handlers.Grid public HypergridServiceInConnector(IConfigSource config, IHttpServer server) : base(config, server) { - server.AddXmlRPCHandler("link_region", LinkRegionRequest, false); + server.AddXmlRPCHandler("linkk_region", LinkRegionRequest, false); } /// -- cgit v1.1 From dd3d52ae1faefbca85e2fe8d8cea67f7db4005ac Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 24 Sep 2009 13:33:58 -0700 Subject: Added test GridClient, which allowed me to remove a few bugs out of the new code. --- OpenSim/Server/Base/ServerUtils.cs | 4 +++- OpenSim/Server/Handlers/Grid/GridServerConnector.cs | 2 +- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 11 +++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 6c2b3ed..656fcf5 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -258,6 +258,8 @@ namespace OpenSim.Server.Base public static Dictionary ParseXmlResponse(string data) { + //m_log.DebugFormat("[XXX]: received xml string: {0}", data); + Dictionary ret = new Dictionary(); XmlDocument doc = new XmlDocument(); @@ -284,7 +286,7 @@ namespace OpenSim.Server.Base foreach (XmlNode part in partL) { - XmlNode type = part.Attributes.GetNamedItem("Type"); + XmlNode type = part.Attributes.GetNamedItem("type"); if (type == null || type.Value != "List") { ret[part.Name] = part.InnerText; diff --git a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs index 7bf2e66..ebdf489 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs @@ -45,7 +45,7 @@ namespace OpenSim.Server.Handlers.Grid if (serverConfig == null) throw new Exception("No section 'Server' in config file"); - string gridService = serverConfig.GetString("GridServiceModule", + string gridService = serverConfig.GetString("LocalServiceModule", String.Empty); if (gridService == String.Empty) diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index e72c2eb..eaeed6f 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -63,6 +63,7 @@ namespace OpenSim.Server.Handlers.Grid StreamReader sr = new StreamReader(requestData); string body = sr.ReadToEnd(); sr.Close(); + body = body.Trim(); Dictionary request = ServerUtils.ParseQueryString(body); @@ -98,11 +99,11 @@ namespace OpenSim.Server.Handlers.Grid case "get_region_range": return GetRegionRange(request); - default: - m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method); - return FailureResult(); } + m_log.DebugFormat("[GRID HANDLER XXX]: unknown method {0} request {1}", method.Length, method); + return FailureResult(); + } #region Method-specific handlers @@ -155,11 +156,12 @@ namespace OpenSim.Server.Handlers.Grid UUID regionID = UUID.Zero; if (request["REGIONID"] != null) - UUID.TryParse(request["REGIONID"], out scopeID); + UUID.TryParse(request["REGIONID"], out regionID); else m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); List rinfos = m_GridService.GetNeighbours(scopeID, regionID); + //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); Dictionary result = new Dictionary(); int i = 0; @@ -171,6 +173,7 @@ namespace OpenSim.Server.Handlers.Grid } string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); return encoding.GetBytes(xmlString); -- cgit v1.1 From 1faaa0a43a851c44af40336336ddbe3a7dbe83af Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 24 Sep 2009 15:30:00 -0700 Subject: GridServerPostHandler finished. GridClient tests all work. More guards on getting parameters and replies over the wire. --- .../Server/Handlers/Grid/GridServerPostHandler.cs | 187 +++++++++++++++++++-- 1 file changed, 172 insertions(+), 15 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index eaeed6f..f50e6a2 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -164,12 +164,17 @@ namespace OpenSim.Server.Handlers.Grid //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); Dictionary result = new Dictionary(); - int i = 0; - foreach (GridRegion rinfo in rinfos) + if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) + result["result"] = "null"; + else { - Dictionary rinfoDict = rinfo.ToKeyValuePairs(); - result["region" + i] = rinfoDict; - i++; + int i = 0; + foreach (GridRegion rinfo in rinfos) + { + Dictionary rinfoDict = rinfo.ToKeyValuePairs(); + result["region" + i] = rinfoDict; + i++; + } } string xmlString = ServerUtils.BuildXmlResponse(result); @@ -181,32 +186,184 @@ namespace OpenSim.Server.Handlers.Grid byte[] GetRegionByUUID(Dictionary request) { - // TODO - return new byte[0]; + UUID scopeID = UUID.Zero; + if (request["SCOPEID"] != null) + UUID.TryParse(request["SCOPEID"], out scopeID); + else + m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); + + UUID regionID = UUID.Zero; + if (request["REGIONID"] != null) + UUID.TryParse(request["REGIONID"], out regionID); + else + m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); + + GridRegion rinfo = m_GridService.GetRegionByUUID(scopeID, regionID); + //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); + + Dictionary result = new Dictionary(); + if (rinfo == null) + result["result"] = "null"; + else + result["result"] = rinfo.ToKeyValuePairs(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); } byte[] GetRegionByPosition(Dictionary request) { - // TODO - return new byte[0]; + UUID scopeID = UUID.Zero; + if (request["SCOPEID"] != null) + UUID.TryParse(request["SCOPEID"], out scopeID); + else + m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by position"); + + int x = 0, y = 0; + if (request["X"] != null) + Int32.TryParse(request["X"], out x); + else + m_log.WarnFormat("[GRID HANDLER]: no X in request to get region by position"); + if (request["Y"] != null) + Int32.TryParse(request["Y"], out y); + else + m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position"); + + GridRegion rinfo = m_GridService.GetRegionByPosition(scopeID, x, y); + //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); + + Dictionary result = new Dictionary(); + if (rinfo == null) + result["result"] = "null"; + else + result["result"] = rinfo.ToKeyValuePairs(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); } byte[] GetRegionByName(Dictionary request) { - // TODO - return new byte[0]; + UUID scopeID = UUID.Zero; + if (request["SCOPEID"] != null) + UUID.TryParse(request["SCOPEID"], out scopeID); + else + m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name"); + + string regionName = string.Empty; + if (request["NAME"] != null) + regionName = request["NAME"]; + else + m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name"); + + GridRegion rinfo = m_GridService.GetRegionByName(scopeID, regionName); + //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); + + Dictionary result = new Dictionary(); + if (rinfo == null) + result["result"] = "null"; + else + result["result"] = rinfo.ToKeyValuePairs(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); } byte[] GetRegionsByName(Dictionary request) { - // TODO - return new byte[0]; + UUID scopeID = UUID.Zero; + if (request["SCOPEID"] != null) + UUID.TryParse(request["SCOPEID"], out scopeID); + else + m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get regions by name"); + + string regionName = string.Empty; + if (request["NAME"] != null) + regionName = request["NAME"]; + else + m_log.WarnFormat("[GRID HANDLER]: no NAME in request to get regions by name"); + + int max = 0; + if (request["MAX"] != null) + Int32.TryParse(request["MAX"], out max); + else + m_log.WarnFormat("[GRID HANDLER]: no MAX in request to get regions by name"); + + List rinfos = m_GridService.GetRegionsByName(scopeID, regionName, max); + //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); + + Dictionary result = new Dictionary(); + if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) + result["result"] = "null"; + else + { + int i = 0; + foreach (GridRegion rinfo in rinfos) + { + Dictionary rinfoDict = rinfo.ToKeyValuePairs(); + result["region" + i] = rinfoDict; + i++; + } + } + + string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); } byte[] GetRegionRange(Dictionary request) { - // TODO - return new byte[0]; + UUID scopeID = UUID.Zero; + if (request["SCOPEID"] != null) + UUID.TryParse(request["SCOPEID"], out scopeID); + else + m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range"); + + int xmin = 0, xmax = 0, ymin = 0, ymax = 0; + if (request["XMIN"] != null) + Int32.TryParse(request["XMIN"], out xmin); + else + m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range"); + if (request["XMAX"] != null) + Int32.TryParse(request["XMAX"], out xmax); + else + m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range"); + if (request["YMIN"] != null) + Int32.TryParse(request["YMIN"], out ymin); + else + m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range"); + if (request["YMAX"] != null) + Int32.TryParse(request["YMAX"], out ymax); + else + m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range"); + + + List rinfos = m_GridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax); + + Dictionary result = new Dictionary(); + if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) + result["result"] = "null"; + else + { + int i = 0; + foreach (GridRegion rinfo in rinfos) + { + Dictionary rinfoDict = rinfo.ToKeyValuePairs(); + result["region" + i] = rinfoDict; + i++; + } + } + string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); } #endregion -- cgit v1.1 From 730458be1f8c74da1c112df36ec54233b30caed0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Sep 2009 14:31:29 +0100 Subject: minor: remove some mono compiler warnings --- OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs index 69acd25..f987de4 100644 --- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs @@ -44,7 +44,7 @@ namespace OpenSim.Server.Handlers.Authorization { public class AuthorizationServerPostHandler : BaseStreamHandler { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IAuthorizationService m_AuthorizationService; -- cgit v1.1 From b2772b3a2ded5149db6cd31dab745c2369d74075 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 25 Sep 2009 07:38:05 -0700 Subject: Added GridForm.html in Tests/Clients/Grid that shows how to interact with a grid server via regular Web forms. May be good for developing administrative tools. --- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index f50e6a2..711639f 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -64,7 +64,9 @@ namespace OpenSim.Server.Handlers.Grid string body = sr.ReadToEnd(); sr.Close(); body = body.Trim(); - + + //m_log.DebugFormat("[XXX]: query String: {0}", body); + Dictionary request = ServerUtils.ParseQueryString(body); @@ -101,7 +103,7 @@ namespace OpenSim.Server.Handlers.Grid } - m_log.DebugFormat("[GRID HANDLER XXX]: unknown method {0} request {1}", method.Length, method); + m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); return FailureResult(); } @@ -320,26 +322,27 @@ namespace OpenSim.Server.Handlers.Grid byte[] GetRegionRange(Dictionary request) { + //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange"); UUID scopeID = UUID.Zero; - if (request["SCOPEID"] != null) + if (request.ContainsKey("SCOPEID")) UUID.TryParse(request["SCOPEID"], out scopeID); else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range"); int xmin = 0, xmax = 0, ymin = 0, ymax = 0; - if (request["XMIN"] != null) + if (request.ContainsKey("XMIN")) Int32.TryParse(request["XMIN"], out xmin); else m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range"); - if (request["XMAX"] != null) + if (request.ContainsKey("XMAX")) Int32.TryParse(request["XMAX"], out xmax); else m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range"); - if (request["YMIN"] != null) + if (request.ContainsKey("YMIN")) Int32.TryParse(request["YMIN"], out ymin); else m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range"); - if (request["YMAX"] != null) + if (request.ContainsKey("YMAX")) Int32.TryParse(request["YMAX"], out ymax); else m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range"); -- cgit v1.1 From dcfd08b8dd57e667db8e0b5900da4648a020160e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 26 Sep 2009 11:01:18 -0700 Subject: Fixed a bug with link-region. --- .../Server/Handlers/Grid/HypergridServerConnector.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs index ad63485..d2e791b 100644 --- a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs @@ -36,6 +36,7 @@ using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; using log4net; using Nwc.XmlRpc; @@ -48,12 +49,12 @@ namespace OpenSim.Server.Handlers.Grid LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private List m_RegionsOnSim = new List(); + private List m_RegionsOnSim = new List(); public HypergridServiceInConnector(IConfigSource config, IHttpServer server) : base(config, server) { - server.AddXmlRPCHandler("linkk_region", LinkRegionRequest, false); + server.AddXmlRPCHandler("link_region", LinkRegionRequest, false); } /// @@ -70,8 +71,8 @@ namespace OpenSim.Server.Handlers.Grid m_log.DebugFormat("[HGrid]: Hyperlink request"); - SimpleRegionInfo regInfo = null; - foreach (SimpleRegionInfo r in m_RegionsOnSim) + GridRegion regInfo = null; + foreach (GridRegion r in m_RegionsOnSim) { if ((r.RegionName != null) && (name != null) && (r.RegionName.ToLower() == name.ToLower())) { @@ -85,9 +86,9 @@ namespace OpenSim.Server.Handlers.Grid Hashtable hash = new Hashtable(); hash["uuid"] = regInfo.RegionID.ToString(); + m_log.Debug(">> Here " + regInfo.RegionID); hash["handle"] = regInfo.RegionHandle.ToString(); - //m_log.Debug(">> Here " + regInfo.RegionHandle); - //hash["region_image"] = regInfo.RegionSettings.TerrainImageID.ToString(); + hash["region_image"] = regInfo.TerrainImage.ToString(); hash["region_name"] = regInfo.RegionName; hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); //m_log.Debug(">> Here: " + regInfo.InternalEndPoint.Port); @@ -98,12 +99,12 @@ namespace OpenSim.Server.Handlers.Grid return response; } - public void AddRegion(SimpleRegionInfo rinfo) + public void AddRegion(GridRegion rinfo) { m_RegionsOnSim.Add(rinfo); } - public void RemoveRegion(SimpleRegionInfo rinfo) + public void RemoveRegion(GridRegion rinfo) { if (m_RegionsOnSim.Contains(rinfo)) m_RegionsOnSim.Remove(rinfo); -- cgit v1.1 From f4bf581b96347b8d7f115eca74fa84a644eb729c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 26 Sep 2009 21:00:51 -0700 Subject: Moved all HG1 operations to HGGridConnector.cs and HypergridServerConnector.cs/HypergridServiceConnector.cs, away from Region.Communications and HGNetworkServersInfo. Fixed small bugs with hyperlinked regions' map positions. --- .../Handlers/Grid/HypergridServerConnector.cs | 111 +++++++++++++++++++-- 1 file changed, 103 insertions(+), 8 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs index d2e791b..c47f652 100644 --- a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs @@ -38,6 +38,7 @@ using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; using GridRegion = OpenSim.Services.Interfaces.GridRegion; +using OpenMetaverse; using log4net; using Nwc.XmlRpc; @@ -50,11 +51,25 @@ namespace OpenSim.Server.Handlers.Grid MethodBase.GetCurrentMethod().DeclaringType); private List m_RegionsOnSim = new List(); + private IHyperlinkService m_HyperlinkService; - public HypergridServiceInConnector(IConfigSource config, IHttpServer server) : + public HypergridServiceInConnector(IConfigSource config, IHttpServer server, IHyperlinkService hyperService) : base(config, server) { + m_HyperlinkService = hyperService; server.AddXmlRPCHandler("link_region", LinkRegionRequest, false); + server.AddXmlRPCHandler("expect_hg_user", ExpectHGUser, false); + } + + public void AddRegion(GridRegion rinfo) + { + m_RegionsOnSim.Add(rinfo); + } + + public void RemoveRegion(GridRegion rinfo) + { + if (m_RegionsOnSim.Contains(rinfo)) + m_RegionsOnSim.Remove(rinfo); } /// @@ -99,15 +114,95 @@ namespace OpenSim.Server.Handlers.Grid return response; } - public void AddRegion(GridRegion rinfo) + /// + /// Received from other HGrid nodes when a user wants to teleport here. This call allows + /// the region to prepare for direct communication from the client. Sends back an empty + /// xmlrpc response on completion. + /// This is somewhat similar to OGS1's ExpectUser, but with the additional task of + /// registering the user in the local user cache. + /// + /// + /// + public XmlRpcResponse ExpectHGUser(XmlRpcRequest request, IPEndPoint remoteClient) { - m_RegionsOnSim.Add(rinfo); - } + Hashtable requestData = (Hashtable)request.Params[0]; + ForeignUserProfileData userData = new ForeignUserProfileData(); - public void RemoveRegion(GridRegion rinfo) - { - if (m_RegionsOnSim.Contains(rinfo)) - m_RegionsOnSim.Remove(rinfo); + userData.FirstName = (string)requestData["firstname"]; + userData.SurName = (string)requestData["lastname"]; + userData.ID = new UUID((string)requestData["agent_id"]); + UUID sessionID = new UUID((string)requestData["session_id"]); + userData.HomeLocation = new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), + (float)Convert.ToDecimal((string)requestData["startpos_y"]), + (float)Convert.ToDecimal((string)requestData["startpos_z"])); + + userData.UserServerURI = (string)requestData["userserver_id"]; + userData.UserAssetURI = (string)requestData["assetserver_id"]; + userData.UserInventoryURI = (string)requestData["inventoryserver_id"]; + + m_log.DebugFormat("[HGrid]: Prepare for connection from {0} {1} (@{2}) UUID={3}", + userData.FirstName, userData.SurName, userData.UserServerURI, userData.ID); + + ulong userRegionHandle = 0; + int userhomeinternalport = 0; + if (requestData.ContainsKey("region_uuid")) + { + UUID uuid = UUID.Zero; + UUID.TryParse((string)requestData["region_uuid"], out uuid); + userData.HomeRegionID = uuid; + userRegionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); + userData.UserHomeAddress = (string)requestData["home_address"]; + userData.UserHomePort = (string)requestData["home_port"]; + userhomeinternalport = Convert.ToInt32((string)requestData["internal_port"]); + + m_log.Debug("[HGrid]: home_address: " + userData.UserHomeAddress + + "; home_port: " + userData.UserHomePort); + } + else + m_log.WarnFormat("[HGrid]: User has no home region information"); + + XmlRpcResponse resp = new XmlRpcResponse(); + + // Let's check if someone is trying to get in with a stolen local identity. + // The need for this test is a consequence of not having truly global names :-/ + bool comingHome = false; + if (m_HyperlinkService.CheckUserAtEntry(userData.ID, sessionID, out comingHome) == false) + { + m_log.WarnFormat("[HGrid]: Access denied to foreign user."); + Hashtable respdata = new Hashtable(); + respdata["success"] = "FALSE"; + respdata["reason"] = "Foreign user has the same ID as a local user, or logins disabled."; + resp.Value = respdata; + return resp; + } + + // Finally, everything looks ok + //m_log.Debug("XXX---- EVERYTHING OK ---XXX"); + + if (!comingHome) + { + // We don't do this if the user is coming to the home grid + GridRegion home = new GridRegion(); + home.RegionID = userData.HomeRegionID; + home.ExternalHostName = userData.UserHomeAddress; + home.HttpPort = Convert.ToUInt32(userData.UserHomePort); + uint x = 0, y = 0; + Utils.LongToUInts(userRegionHandle, out x, out y); + home.RegionLocX = (int)x; + home.RegionLocY = (int)y; + home.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)userhomeinternalport); + + m_HyperlinkService.AcceptUser(userData, home); + } + // else the user is coming to a non-home region of the home grid + // We simply drop this user information altogether + + Hashtable respdata2 = new Hashtable(); + respdata2["success"] = "TRUE"; + resp.Value = respdata2; + + return resp; } + } } -- cgit v1.1 From 5d09c53a1a42b38e1ee35cfbb5571d70b75380f4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 27 Sep 2009 10:14:10 -0700 Subject: Unpacking the mess with OtherRegionUp, so we can have a real cache of the neighbours in the grid service modules. --- OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs index c0933a8..d6ef22e 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs @@ -36,6 +36,7 @@ using OpenSim.Server.Handlers.Base; using OpenSim.Services.Interfaces; using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -148,11 +149,14 @@ namespace OpenSim.Server.Handlers.Neighbour } // Finally! - bool success = m_NeighbourService.HelloNeighbour(regionhandle, aRegion); - + GridRegion thisRegion = m_NeighbourService.HelloNeighbour(regionhandle, aRegion); + OSDMap resp = new OSDMap(1); - resp["success"] = OSD.FromBoolean(success); + if (thisRegion != null) + resp["success"] = OSD.FromBoolean(true); + else + resp["success"] = OSD.FromBoolean(false); httpResponse.StatusCode = (int)HttpStatusCode.OK; -- cgit v1.1 From 0ed7371f3ed97bfe10c88dd128c311699ec54a30 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 28 Sep 2009 13:27:33 +0100 Subject: Change DocToBytes to return no trailing whitespace. --- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 711639f..b9a4867 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -425,7 +425,7 @@ namespace OpenSim.Server.Handlers.Grid doc.WriteTo(xw); xw.Flush(); - return ms.GetBuffer(); + return ms.ToArray(); } #endregion -- cgit v1.1 From 9bdb585a93f824223f20f248e1411ba6da760624 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Sep 2009 10:56:05 -0700 Subject: Added Protocol versions back, this time in a range model. --- OpenSim/Server/Base/ProtocolVersions.cs | 56 ++++++++++++++++++++++ .../Server/Handlers/Grid/GridServerPostHandler.cs | 18 +++++++ 2 files changed, 74 insertions(+) create mode 100644 OpenSim/Server/Base/ProtocolVersions.cs (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ProtocolVersions.cs b/OpenSim/Server/Base/ProtocolVersions.cs new file mode 100644 index 0000000..6df27b7 --- /dev/null +++ b/OpenSim/Server/Base/ProtocolVersions.cs @@ -0,0 +1,56 @@ +/* + * 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 OpenSimulator 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.Server.Base +{ + public class ProtocolVersions + { + /// + /// This is the external protocol versions. It is separate from the OpenSimulator project version. + /// + /// These version numbers should be increased by 1 every time a code + /// change in the Service.Connectors and Server.Handlers, espectively, + /// makes the previous OpenSimulator revision incompatible + /// with the new revision. + /// + /// Changes which are compatible with an older revision (e.g. older revisions experience degraded functionality + /// but not outright failure) do not need a version number increment. + /// + /// Having this version number allows the grid service to reject connections from regions running a version + /// of the code that is too old. + /// + /// + + // The range of acceptable servers for client-side connectors + public readonly static int ClientProtocolVersionMin = 0; + public readonly static int ClientProtocolVersionMax = 0; + + // The range of acceptable clients in server-side handlers + public readonly static int ServerProtocolVersionMin = 0; + public readonly static int ServerProtocolVersionMax = 0; + } +} diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 711639f..3d72fec 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -118,6 +118,24 @@ namespace OpenSim.Server.Handlers.Grid else m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region"); + int versionNumberMin = 0, versionNumberMax = 0; + if (request.ContainsKey("VERSIONMIN")) + Int32.TryParse(request["VERSIONMIN"], out versionNumberMin); + else + m_log.WarnFormat("[GRID HANDLER]: no minimum protocol version in request to register region"); + + if (request.ContainsKey("VERSIONMAX")) + Int32.TryParse(request["VERSIONMAX"], out versionNumberMax); + else + m_log.WarnFormat("[GRID HANDLER]: no maximum protocol version in request to register region"); + + // Check the protocol version + if ((versionNumberMin > ProtocolVersions.ServerProtocolVersionMax && versionNumberMax < ProtocolVersions.ServerProtocolVersionMax)) + { + // Can't do, there is no overlap in the acceptable ranges + FailureResult(); + } + Dictionary rinfoData = new Dictionary(); foreach (KeyValuePair kvp in request) rinfoData[kvp.Key] = kvp.Value; -- cgit v1.1 From 276b0a0cbe2cec5ff0e937a2d2eda6b48b5691b2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Sep 2009 11:17:34 -0700 Subject: Forgot a return statement. --- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 3d72fec..e751365 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -133,7 +133,7 @@ namespace OpenSim.Server.Handlers.Grid if ((versionNumberMin > ProtocolVersions.ServerProtocolVersionMax && versionNumberMax < ProtocolVersions.ServerProtocolVersionMax)) { // Can't do, there is no overlap in the acceptable ranges - FailureResult(); + return FailureResult(); } Dictionary rinfoData = new Dictionary(); -- cgit v1.1 From a1aa362866fc59d331780ac799beee4a6d2613c6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 28 Sep 2009 22:48:57 +0100 Subject: Allow the notation config_name@port/dll_name:class_name as a handler spec in OpenSim.Server.ini This allows things like "8003/AssetServirce.dll local@8004/InventoryService.dll" The config name is not yet supported by any modules --- OpenSim/Server/Base/HttpServerBase.cs | 18 ++++++++++++ OpenSim/Server/ServerMain.cs | 52 +++++++++++++++++++++++++++++++---- 2 files changed, 64 insertions(+), 6 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 791e1ef..6a1f37c 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -26,6 +26,7 @@ */ using System; +using System.Collections.Generic; using System.Threading; using System.Reflection; using OpenSim.Framework; @@ -45,12 +46,27 @@ namespace OpenSim.Server.Base // The http server instance // protected BaseHttpServer m_HttpServer = null; + protected uint m_Port = 0; + protected Dictionary m_Servers = + new Dictionary(); public IHttpServer HttpServer { get { return m_HttpServer; } } + public IHttpServer GetHttpServer(uint port) + { + if (port == m_Port) + return HttpServer; + + if (m_Servers.ContainsKey(port)) + return m_Servers[port]; + + m_Servers[port] = new BaseHttpServer(port); + return m_Servers[port]; + } + // Handle all the automagical stuff // public HttpServerBase(string prompt, string[] args) : base(prompt, args) @@ -74,6 +90,8 @@ namespace OpenSim.Server.Base Thread.CurrentThread.Abort(); } + m_Port = port; + m_HttpServer = new BaseHttpServer(port); MainServer.Instance = m_HttpServer; diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 77dfebb..8851894 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -30,6 +30,7 @@ using log4net; using System.Reflection; using System; using System.Collections.Generic; +using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Base; using OpenSim.Server.Handlers.Base; @@ -60,22 +61,61 @@ namespace OpenSim.Server string connList = serverConfig.GetString("ServiceConnectors", String.Empty); string[] conns = connList.Split(new char[] {',', ' '}); - foreach (string conn in conns) + foreach (string c in conns) { - if (conn == String.Empty) + if (c == String.Empty) continue; + string configName = String.Empty; + string conn = c; + uint port = 0; + + string[] split1 = conn.Split(new char[] {'/'}); + if (split1.Length > 1) + { + conn = split1[1]; + + string[] split2 = split1[0].Split(new char[] {'@'}); + if (split2.Length > 1) + { + configName = split2[0]; + port = Convert.ToUInt32(split2[1]); + } + else + { + port = Convert.ToUInt32(split1[0]); + } + } string[] parts = conn.Split(new char[] {':'}); string friendlyName = parts[0]; if (parts.Length > 1) friendlyName = parts[1]; + IHttpServer server = m_Server.HttpServer; + if (port != 0) + server = m_Server.GetHttpServer(port); + m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName); - Object[] modargs = new Object[] { m_Server.Config, m_Server.HttpServer }; - IServiceConnector connector = - ServerUtils.LoadPlugin(conn, - modargs); + IServiceConnector connector = null; + try + { + Object[] modargs = new Object[] { m_Server.Config, server, + configName }; + connector = ServerUtils.LoadPlugin(conn, + modargs); + + if (connector == null) + { + modargs = new Object[] { m_Server.Config, server }; + connector = + ServerUtils.LoadPlugin(conn, + modargs); + } + } + catch (Exception) + { + } if (connector != null) { -- cgit v1.1 From f00126dc2dfc9e23aa50227f02ee9adbe1efdfa6 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Tue, 29 Sep 2009 08:32:59 +0900 Subject: Add copyright header. Formatting cleanup. --- OpenSim/Server/Base/ServerUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 656fcf5..db3a4ce 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -188,7 +188,7 @@ namespace OpenSim.Server.Base { string qstring = String.Empty; - foreach(KeyValuePair kvp in data) + foreach (KeyValuePair kvp in data) { string part; if (kvp.Value != String.Empty) -- cgit v1.1 From f4e8ac35560c9c57a4ce64a7b3ee4343086cd128 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Sep 2009 18:53:07 -0700 Subject: Fixed a bug that was causing exceptions to the thrown in ROBUST MainServer. --- OpenSim/Server/ServerMain.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 8851894..01f2649 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -61,6 +61,7 @@ namespace OpenSim.Server string connList = serverConfig.GetString("ServiceConnectors", String.Empty); string[] conns = connList.Split(new char[] {',', ' '}); + int i = 0; foreach (string c in conns) { if (c == String.Empty) @@ -100,11 +101,14 @@ namespace OpenSim.Server IServiceConnector connector = null; try { - Object[] modargs = new Object[] { m_Server.Config, server, + Object[] modargs = null; + if (configName != string.Empty) + { + modargs = new Object[] { m_Server.Config, server, configName }; - connector = ServerUtils.LoadPlugin(conn, - modargs); - + connector = ServerUtils.LoadPlugin(conn, + modargs); + } if (connector == null) { modargs = new Object[] { m_Server.Config, server }; -- cgit v1.1 From 1096103d66d7391943efa85553f46a633cf0d3ee Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 29 Sep 2009 09:44:12 +0100 Subject: Fix loading modules with alternate configurations and ports into ROBUST. Make all current modules support the configuration name option --- OpenSim/Server/Base/HttpServerBase.cs | 10 ++++++- OpenSim/Server/Base/ServerUtils.cs | 4 ++- .../Server/Handlers/Asset/AssetServerConnector.cs | 13 +++++---- .../AuthenticationServerConnector.cs | 12 +++++--- .../Authorization/AuthorizationServerConnector.cs | 11 ++++--- OpenSim/Server/Handlers/Base/ServerConnector.cs | 2 +- .../Freeswitch/FreeswitchServerConnector.cs | 14 +++++---- .../Server/Handlers/Grid/GridServerConnector.cs | 11 +++---- .../Handlers/Grid/HypergridServerConnector.cs | 2 +- .../Inventory/InventoryServerInConnector.cs | 11 +++---- .../Server/Handlers/Land/LandServiceInConnector.cs | 2 +- .../Neighbour/NeighbourServiceInConnector.cs | 2 +- .../Simulation/SimulationServiceInConnector.cs | 2 +- OpenSim/Server/ServerMain.cs | 34 +++++++++------------- 14 files changed, 75 insertions(+), 55 deletions(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 6a1f37c..ed0210f 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -41,7 +41,7 @@ namespace OpenSim.Server.Base { // Logger // - // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // The http server instance // @@ -55,8 +55,14 @@ namespace OpenSim.Server.Base get { return m_HttpServer; } } + public uint DefaultPort + { + get { return m_Port; } + } + public IHttpServer GetHttpServer(uint port) { + m_Log.InfoFormat("[SERVER]: Requested port {0}", port); if (port == m_Port) return HttpServer; @@ -64,6 +70,8 @@ namespace OpenSim.Server.Base return m_Servers[port]; m_Servers[port] = new BaseHttpServer(port); + m_Servers[port].Start(); + return m_Servers[port]; } diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index db3a4ce..9beadd8 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -141,7 +141,9 @@ namespace OpenSim.Server.Base } catch (Exception e) { - m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException); + if (!(e is System.MissingMethodException)) + m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException); + return null; } return plug; diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index 7c74e05..f7eb292 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs @@ -37,13 +37,17 @@ namespace OpenSim.Server.Handlers.Asset public class AssetServiceConnector : ServiceConnector { private IAssetService m_AssetService; + private string m_ConfigName = "AssetService"; - public AssetServiceConnector(IConfigSource config, IHttpServer server) : - base(config, server) + public AssetServiceConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { - IConfig serverConfig = config.Configs["AssetService"]; + if (configName != String.Empty) + m_ConfigName = configName; + + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) - throw new Exception("No section 'Server' in config file"); + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); string assetService = serverConfig.GetString("LocalServiceModule", String.Empty); @@ -55,7 +59,6 @@ namespace OpenSim.Server.Handlers.Asset m_AssetService = ServerUtils.LoadPlugin(assetService, args); - //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no")); server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService)); diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs index 589dc3b..2abef0a 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs @@ -37,13 +37,17 @@ namespace OpenSim.Server.Handlers.Authentication public class AuthenticationServiceConnector : ServiceConnector { private IAuthenticationService m_AuthenticationService; + private string m_ConfigName = "AuthenticationService"; - public AuthenticationServiceConnector(IConfigSource config, IHttpServer server) : - base(config, server) + public AuthenticationServiceConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { - IConfig serverConfig = config.Configs["AuthenticationService"]; + if (configName != String.Empty) + m_ConfigName = configName; + + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) - throw new Exception("No section 'Server' in config file"); + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); string authenticationService = serverConfig.GetString("AuthenticationServiceModule", String.Empty); diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerConnector.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerConnector.cs index 0d9f239..20fd0f7 100644 --- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerConnector.cs +++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerConnector.cs @@ -37,13 +37,16 @@ namespace OpenSim.Server.Handlers.Authorization public class AuthorizationServerConnector : ServiceConnector { private IAuthorizationService m_AuthorizationService; + private string m_ConfigName = "AuthorizationService"; - public AuthorizationServerConnector(IConfigSource config, IHttpServer server) : - base(config, server) + public AuthorizationServerConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { - IConfig serverConfig = config.Configs["AuthorizationService"]; + if (configName != String.Empty) + m_ConfigName = configName; + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) - throw new Exception("No section 'Server' in config file"); + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); string authorizationService = serverConfig.GetString("LocalServiceModule", String.Empty); diff --git a/OpenSim/Server/Handlers/Base/ServerConnector.cs b/OpenSim/Server/Handlers/Base/ServerConnector.cs index 62fe773..71876da 100644 --- a/OpenSim/Server/Handlers/Base/ServerConnector.cs +++ b/OpenSim/Server/Handlers/Base/ServerConnector.cs @@ -39,7 +39,7 @@ namespace OpenSim.Server.Handlers.Base public class ServiceConnector : IServiceConnector { - public ServiceConnector(IConfigSource config, IHttpServer server) + public ServiceConnector(IConfigSource config, IHttpServer server, string configName) { } } diff --git a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs index a4ab0d3..07bafc8 100644 --- a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs +++ b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs @@ -37,19 +37,23 @@ namespace OpenSim.Server.Handlers.Freeswitch public class FreeswitchServerConnector : ServiceConnector { private IFreeswitchService m_FreeswitchService; + private string m_ConfigName = "FreeswitchService"; - public FreeswitchServerConnector(IConfigSource config, IHttpServer server) : - base(config, server) + public FreeswitchServerConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { - IConfig serverConfig = config.Configs["FreeswitchService"]; + if (configName != String.Empty) + m_ConfigName = configName; + + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) - throw new Exception("No section 'Server' in config file"); + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); string freeswitchService = serverConfig.GetString("LocalServiceModule", String.Empty); if (freeswitchService == String.Empty) - throw new Exception("No FreeswitchService in config file"); + throw new Exception("No LocalServiceModule in config file"); Object[] args = new Object[] { config }; m_FreeswitchService = diff --git a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs index ebdf489..14daf12 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs @@ -37,19 +37,20 @@ namespace OpenSim.Server.Handlers.Grid public class GridServiceConnector : ServiceConnector { private IGridService m_GridService; + private string m_ConfigName = "GridService"; - public GridServiceConnector(IConfigSource config, IHttpServer server) : - base(config, server) + public GridServiceConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { - IConfig serverConfig = config.Configs["GridService"]; + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) - throw new Exception("No section 'Server' in config file"); + throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); string gridService = serverConfig.GetString("LocalServiceModule", String.Empty); if (gridService == String.Empty) - throw new Exception("No GridService in config file"); + throw new Exception("No LocalServiceModule in config file"); Object[] args = new Object[] { config }; m_GridService = ServerUtils.LoadPlugin(gridService, args); diff --git a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs index c47f652..115ac29 100644 --- a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs @@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Grid private IHyperlinkService m_HyperlinkService; public HypergridServiceInConnector(IConfigSource config, IHttpServer server, IHyperlinkService hyperService) : - base(config, server) + base(config, server, String.Empty) { m_HyperlinkService = hyperService; server.AddXmlRPCHandler("link_region", LinkRegionRequest, false); diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index 998b322..ca45263 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs @@ -54,19 +54,20 @@ namespace OpenSim.Server.Handlers.Inventory //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); private string m_userserver_url; + private string m_ConfigName = "InventoryService"; - public InventoryServiceInConnector(IConfigSource config, IHttpServer server) : - base(config, server) + public InventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { - IConfig serverConfig = config.Configs["InventoryService"]; + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) - throw new Exception("No section 'InventoryService' in config file"); + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); string inventoryService = serverConfig.GetString("LocalServiceModule", String.Empty); if (inventoryService == String.Empty) - throw new Exception("No InventoryService in config file"); + throw new Exception("No LocalServiceModule in config file"); Object[] args = new Object[] { config }; m_InventoryService = diff --git a/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs b/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs index 10e3b47..d368bd3 100644 --- a/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs @@ -46,7 +46,7 @@ namespace OpenSim.Server.Handlers.Land // TODO : private IAuthenticationService m_AuthenticationService; public LandServiceInConnector(IConfigSource source, IHttpServer server, ILandService service, IScene scene) : - base(source, server) + base(source, server, String.Empty) { m_LandService = service; if (m_LandService == null) diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs index b3a91cf..ac2e75f 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs @@ -46,7 +46,7 @@ namespace OpenSim.Server.Handlers.Neighbour private IAuthenticationService m_AuthenticationService = null; public NeighbourServiceInConnector(IConfigSource source, IHttpServer server, INeighbourService nService, IScene scene) : - base(source, server) + base(source, server, String.Empty) { m_NeighbourService = nService; diff --git a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs index 0bb4713..fe93fa5 100644 --- a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs @@ -41,7 +41,7 @@ namespace OpenSim.Server.Handlers.Simulation private IAuthenticationService m_AuthenticationService; public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : - base(config, server) + base(config, server, String.Empty) { IConfig serverConfig = config.Configs["SimulationService"]; if (serverConfig == null) diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 01f2649..a7b33c9 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -96,29 +96,23 @@ namespace OpenSim.Server if (port != 0) server = m_Server.GetHttpServer(port); - m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName); + if (port != m_Server.DefaultPort) + m_log.InfoFormat("[SERVER]: Loading {0} on port {1}", friendlyName, port); + else + m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName); IServiceConnector connector = null; - try - { - Object[] modargs = null; - if (configName != string.Empty) - { - modargs = new Object[] { m_Server.Config, server, - configName }; - connector = ServerUtils.LoadPlugin(conn, - modargs); - } - if (connector == null) - { - modargs = new Object[] { m_Server.Config, server }; - connector = - ServerUtils.LoadPlugin(conn, - modargs); - } - } - catch (Exception) + + Object[] modargs = new Object[] { m_Server.Config, server, + configName }; + connector = ServerUtils.LoadPlugin(conn, + modargs); + if (connector == null) { + modargs = new Object[] { m_Server.Config, server }; + connector = + ServerUtils.LoadPlugin(conn, + modargs); } if (connector != null) -- cgit v1.1 From ee205e7e812e170f670e690a4e0fa9caa652f226 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 1 Oct 2009 01:00:09 +0900 Subject: Formatting cleanup. --- OpenSim/Server/Base/ProtocolVersions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ProtocolVersions.cs b/OpenSim/Server/Base/ProtocolVersions.cs index 6df27b7..488a9e6 100644 --- a/OpenSim/Server/Base/ProtocolVersions.cs +++ b/OpenSim/Server/Base/ProtocolVersions.cs @@ -42,7 +42,7 @@ namespace OpenSim.Server.Base /// /// Having this version number allows the grid service to reject connections from regions running a version /// of the code that is too old. - /// + /// /// // The range of acceptable servers for client-side connectors -- cgit v1.1 From 606e831ff5337fb5e94dcebf9d6852bd4c434d4b Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 1 Oct 2009 09:38:36 +0900 Subject: Formatting cleanup. --- OpenSim/Server/Base/ProtocolVersions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server') diff --git a/OpenSim/Server/Base/ProtocolVersions.cs b/OpenSim/Server/Base/ProtocolVersions.cs index 488a9e6..8db5bb6 100644 --- a/OpenSim/Server/Base/ProtocolVersions.cs +++ b/OpenSim/Server/Base/ProtocolVersions.cs @@ -30,7 +30,7 @@ namespace OpenSim.Server.Base public class ProtocolVersions { /// - /// This is the external protocol versions. It is separate from the OpenSimulator project version. + /// This is the external protocol versions. It is separate from the OpenSimulator project version. /// /// These version numbers should be increased by 1 every time a code /// change in the Service.Connectors and Server.Handlers, espectively, -- cgit v1.1