diff options
author | Melanie | 2009-10-02 08:23:38 +0100 |
---|---|---|
committer | Melanie | 2009-10-02 08:23:38 +0100 |
commit | 31d8cec0f8cd47ff445edc7771e5e73825a57927 (patch) | |
tree | a2d60604317739fa530502c40ffc71bab2a5c494 /OpenSim/Server/Handlers | |
parent | Restore the missing image handling to the image manager. The missing (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-31d8cec0f8cd47ff445edc7771e5e73825a57927.zip opensim-SC-31d8cec0f8cd47ff445edc7771e5e73825a57927.tar.gz opensim-SC-31d8cec0f8cd47ff445edc7771e5e73825a57927.tar.bz2 opensim-SC-31d8cec0f8cd47ff445edc7771e5e73825a57927.tar.xz |
Merge branch 'master' into diva-textures
Diffstat (limited to 'OpenSim/Server/Handlers')
15 files changed, 773 insertions, 34 deletions
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 | |||
37 | public class AssetServiceConnector : ServiceConnector | 37 | public class AssetServiceConnector : ServiceConnector |
38 | { | 38 | { |
39 | private IAssetService m_AssetService; | 39 | private IAssetService m_AssetService; |
40 | private string m_ConfigName = "AssetService"; | ||
40 | 41 | ||
41 | public AssetServiceConnector(IConfigSource config, IHttpServer server) : | 42 | public AssetServiceConnector(IConfigSource config, IHttpServer server, string configName) : |
42 | base(config, server) | 43 | base(config, server, configName) |
43 | { | 44 | { |
44 | IConfig serverConfig = config.Configs["AssetService"]; | 45 | if (configName != String.Empty) |
46 | m_ConfigName = configName; | ||
47 | |||
48 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
45 | if (serverConfig == null) | 49 | if (serverConfig == null) |
46 | throw new Exception("No section 'Server' in config file"); | 50 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
47 | 51 | ||
48 | string assetService = serverConfig.GetString("LocalServiceModule", | 52 | string assetService = serverConfig.GetString("LocalServiceModule", |
49 | String.Empty); | 53 | String.Empty); |
@@ -55,7 +59,6 @@ namespace OpenSim.Server.Handlers.Asset | |||
55 | m_AssetService = | 59 | m_AssetService = |
56 | ServerUtils.LoadPlugin<IAssetService>(assetService, args); | 60 | ServerUtils.LoadPlugin<IAssetService>(assetService, args); |
57 | 61 | ||
58 | //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no")); | ||
59 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); | 62 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); |
60 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); | 63 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); |
61 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService)); | 64 | 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 | |||
37 | public class AuthenticationServiceConnector : ServiceConnector | 37 | public class AuthenticationServiceConnector : ServiceConnector |
38 | { | 38 | { |
39 | private IAuthenticationService m_AuthenticationService; | 39 | private IAuthenticationService m_AuthenticationService; |
40 | private string m_ConfigName = "AuthenticationService"; | ||
40 | 41 | ||
41 | public AuthenticationServiceConnector(IConfigSource config, IHttpServer server) : | 42 | public AuthenticationServiceConnector(IConfigSource config, IHttpServer server, string configName) : |
42 | base(config, server) | 43 | base(config, server, configName) |
43 | { | 44 | { |
44 | IConfig serverConfig = config.Configs["AuthenticationService"]; | 45 | if (configName != String.Empty) |
46 | m_ConfigName = configName; | ||
47 | |||
48 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
45 | if (serverConfig == null) | 49 | if (serverConfig == null) |
46 | throw new Exception("No section 'Server' in config file"); | 50 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
47 | 51 | ||
48 | string authenticationService = serverConfig.GetString("AuthenticationServiceModule", | 52 | string authenticationService = serverConfig.GetString("AuthenticationServiceModule", |
49 | String.Empty); | 53 | String.Empty); |
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 | |||
157 | 157 | ||
158 | doc.AppendChild(xmlnode); | 158 | doc.AppendChild(xmlnode); |
159 | 159 | ||
160 | XmlElement rootElement = doc.CreateElement("", "Authentication", | 160 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", |
161 | ""); | 161 | ""); |
162 | 162 | ||
163 | doc.AppendChild(rootElement); | 163 | doc.AppendChild(rootElement); |
@@ -179,7 +179,7 @@ namespace OpenSim.Server.Handlers.Authentication | |||
179 | 179 | ||
180 | doc.AppendChild(xmlnode); | 180 | doc.AppendChild(xmlnode); |
181 | 181 | ||
182 | XmlElement rootElement = doc.CreateElement("", "Authentication", | 182 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", |
183 | ""); | 183 | ""); |
184 | 184 | ||
185 | doc.AppendChild(rootElement); | 185 | doc.AppendChild(rootElement); |
@@ -201,7 +201,7 @@ namespace OpenSim.Server.Handlers.Authentication | |||
201 | 201 | ||
202 | doc.AppendChild(xmlnode); | 202 | doc.AppendChild(xmlnode); |
203 | 203 | ||
204 | XmlElement rootElement = doc.CreateElement("", "Authentication", | 204 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", |
205 | ""); | 205 | ""); |
206 | 206 | ||
207 | doc.AppendChild(rootElement); | 207 | doc.AppendChild(rootElement); |
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 | |||
37 | public class AuthorizationServerConnector : ServiceConnector | 37 | public class AuthorizationServerConnector : ServiceConnector |
38 | { | 38 | { |
39 | private IAuthorizationService m_AuthorizationService; | 39 | private IAuthorizationService m_AuthorizationService; |
40 | private string m_ConfigName = "AuthorizationService"; | ||
40 | 41 | ||
41 | public AuthorizationServerConnector(IConfigSource config, IHttpServer server) : | 42 | public AuthorizationServerConnector(IConfigSource config, IHttpServer server, string configName) : |
42 | base(config, server) | 43 | base(config, server, configName) |
43 | { | 44 | { |
44 | IConfig serverConfig = config.Configs["AuthorizationService"]; | 45 | if (configName != String.Empty) |
46 | m_ConfigName = configName; | ||
47 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
45 | if (serverConfig == null) | 48 | if (serverConfig == null) |
46 | throw new Exception("No section 'Server' in config file"); | 49 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
47 | 50 | ||
48 | string authorizationService = serverConfig.GetString("LocalServiceModule", | 51 | string authorizationService = serverConfig.GetString("LocalServiceModule", |
49 | String.Empty); | 52 | String.Empty); |
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 | |||
44 | { | 44 | { |
45 | public class AuthorizationServerPostHandler : BaseStreamHandler | 45 | public class AuthorizationServerPostHandler : BaseStreamHandler |
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private IAuthorizationService m_AuthorizationService; | 49 | private IAuthorizationService m_AuthorizationService; |
50 | 50 | ||
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 | |||
39 | 39 | ||
40 | public class ServiceConnector : IServiceConnector | 40 | public class ServiceConnector : IServiceConnector |
41 | { | 41 | { |
42 | public ServiceConnector(IConfigSource config, IHttpServer server) | 42 | public ServiceConnector(IConfigSource config, IHttpServer server, string configName) |
43 | { | 43 | { |
44 | } | 44 | } |
45 | } | 45 | } |
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 | |||
37 | public class FreeswitchServerConnector : ServiceConnector | 37 | public class FreeswitchServerConnector : ServiceConnector |
38 | { | 38 | { |
39 | private IFreeswitchService m_FreeswitchService; | 39 | private IFreeswitchService m_FreeswitchService; |
40 | private string m_ConfigName = "FreeswitchService"; | ||
40 | 41 | ||
41 | public FreeswitchServerConnector(IConfigSource config, IHttpServer server) : | 42 | public FreeswitchServerConnector(IConfigSource config, IHttpServer server, string configName) : |
42 | base(config, server) | 43 | base(config, server, configName) |
43 | { | 44 | { |
44 | IConfig serverConfig = config.Configs["FreeswitchService"]; | 45 | if (configName != String.Empty) |
46 | m_ConfigName = configName; | ||
47 | |||
48 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
45 | if (serverConfig == null) | 49 | if (serverConfig == null) |
46 | throw new Exception("No section 'Server' in config file"); | 50 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
47 | 51 | ||
48 | string freeswitchService = serverConfig.GetString("LocalServiceModule", | 52 | string freeswitchService = serverConfig.GetString("LocalServiceModule", |
49 | String.Empty); | 53 | String.Empty); |
50 | 54 | ||
51 | if (freeswitchService == String.Empty) | 55 | if (freeswitchService == String.Empty) |
52 | throw new Exception("No FreeswitchService in config file"); | 56 | throw new Exception("No LocalServiceModule in config file"); |
53 | 57 | ||
54 | Object[] args = new Object[] { config }; | 58 | Object[] args = new Object[] { config }; |
55 | m_FreeswitchService = | 59 | m_FreeswitchService = |
diff --git a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs new file mode 100644 index 0000000..14daf12 --- /dev/null +++ b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using Nini.Config; | ||
30 | using OpenSim.Server.Base; | ||
31 | using OpenSim.Services.Interfaces; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | ||
33 | using OpenSim.Server.Handlers.Base; | ||
34 | |||
35 | namespace OpenSim.Server.Handlers.Grid | ||
36 | { | ||
37 | public class GridServiceConnector : ServiceConnector | ||
38 | { | ||
39 | private IGridService m_GridService; | ||
40 | private string m_ConfigName = "GridService"; | ||
41 | |||
42 | public GridServiceConnector(IConfigSource config, IHttpServer server, string configName) : | ||
43 | base(config, server, configName) | ||
44 | { | ||
45 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
46 | if (serverConfig == null) | ||
47 | throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); | ||
48 | |||
49 | string gridService = serverConfig.GetString("LocalServiceModule", | ||
50 | String.Empty); | ||
51 | |||
52 | if (gridService == String.Empty) | ||
53 | throw new Exception("No LocalServiceModule in config file"); | ||
54 | |||
55 | Object[] args = new Object[] { config }; | ||
56 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); | ||
57 | |||
58 | server.AddStreamHandler(new GridServerPostHandler(m_GridService)); | ||
59 | } | ||
60 | } | ||
61 | } | ||
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs new file mode 100644 index 0000000..e22328d --- /dev/null +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | |||
@@ -0,0 +1,451 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using Nini.Config; | ||
29 | using log4net; | ||
30 | using System; | ||
31 | using System.Reflection; | ||
32 | using System.IO; | ||
33 | using System.Net; | ||
34 | using System.Text; | ||
35 | using System.Text.RegularExpressions; | ||
36 | using System.Xml; | ||
37 | using System.Xml.Serialization; | ||
38 | using System.Collections.Generic; | ||
39 | using OpenSim.Server.Base; | ||
40 | using OpenSim.Services.Interfaces; | ||
41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
42 | using OpenSim.Framework; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | ||
44 | using OpenMetaverse; | ||
45 | |||
46 | namespace OpenSim.Server.Handlers.Grid | ||
47 | { | ||
48 | public class GridServerPostHandler : BaseStreamHandler | ||
49 | { | ||
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
51 | |||
52 | private IGridService m_GridService; | ||
53 | |||
54 | public GridServerPostHandler(IGridService service) : | ||
55 | base("POST", "/grid") | ||
56 | { | ||
57 | m_GridService = service; | ||
58 | } | ||
59 | |||
60 | public override byte[] Handle(string path, Stream requestData, | ||
61 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
62 | { | ||
63 | StreamReader sr = new StreamReader(requestData); | ||
64 | string body = sr.ReadToEnd(); | ||
65 | sr.Close(); | ||
66 | body = body.Trim(); | ||
67 | |||
68 | //m_log.DebugFormat("[XXX]: query String: {0}", body); | ||
69 | |||
70 | Dictionary<string, string> request = | ||
71 | ServerUtils.ParseQueryString(body); | ||
72 | |||
73 | if (!request.ContainsKey("METHOD")) | ||
74 | return FailureResult(); | ||
75 | |||
76 | string method = request["METHOD"]; | ||
77 | |||
78 | switch (method) | ||
79 | { | ||
80 | case "register": | ||
81 | return Register(request); | ||
82 | |||
83 | case "deregister": | ||
84 | return Deregister(request); | ||
85 | |||
86 | case "get_neighbours": | ||
87 | return GetNeighbours(request); | ||
88 | |||
89 | case "get_region_by_uuid": | ||
90 | return GetRegionByUUID(request); | ||
91 | |||
92 | case "get_region_by_position": | ||
93 | return GetRegionByPosition(request); | ||
94 | |||
95 | case "get_region_by_name": | ||
96 | return GetRegionByName(request); | ||
97 | |||
98 | case "get_regions_by_name": | ||
99 | return GetRegionsByName(request); | ||
100 | |||
101 | case "get_region_range": | ||
102 | return GetRegionRange(request); | ||
103 | |||
104 | } | ||
105 | |||
106 | m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); | ||
107 | return FailureResult(); | ||
108 | |||
109 | } | ||
110 | |||
111 | #region Method-specific handlers | ||
112 | |||
113 | byte[] Register(Dictionary<string, string> request) | ||
114 | { | ||
115 | UUID scopeID = UUID.Zero; | ||
116 | if (request["SCOPEID"] != null) | ||
117 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
118 | else | ||
119 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region"); | ||
120 | |||
121 | int versionNumberMin = 0, versionNumberMax = 0; | ||
122 | if (request.ContainsKey("VERSIONMIN")) | ||
123 | Int32.TryParse(request["VERSIONMIN"], out versionNumberMin); | ||
124 | else | ||
125 | m_log.WarnFormat("[GRID HANDLER]: no minimum protocol version in request to register region"); | ||
126 | |||
127 | if (request.ContainsKey("VERSIONMAX")) | ||
128 | Int32.TryParse(request["VERSIONMAX"], out versionNumberMax); | ||
129 | else | ||
130 | m_log.WarnFormat("[GRID HANDLER]: no maximum protocol version in request to register region"); | ||
131 | |||
132 | // Check the protocol version | ||
133 | if ((versionNumberMin > ProtocolVersions.ServerProtocolVersionMax && versionNumberMax < ProtocolVersions.ServerProtocolVersionMax)) | ||
134 | { | ||
135 | // Can't do, there is no overlap in the acceptable ranges | ||
136 | return FailureResult(); | ||
137 | } | ||
138 | |||
139 | Dictionary<string, object> rinfoData = new Dictionary<string, object>(); | ||
140 | foreach (KeyValuePair<string, string> kvp in request) | ||
141 | rinfoData[kvp.Key] = kvp.Value; | ||
142 | GridRegion rinfo = new GridRegion(rinfoData); | ||
143 | |||
144 | bool result = m_GridService.RegisterRegion(scopeID, rinfo); | ||
145 | |||
146 | if (result) | ||
147 | return SuccessResult(); | ||
148 | else | ||
149 | return FailureResult(); | ||
150 | } | ||
151 | |||
152 | byte[] Deregister(Dictionary<string, string> request) | ||
153 | { | ||
154 | UUID regionID = UUID.Zero; | ||
155 | if (request["REGIONID"] != null) | ||
156 | UUID.TryParse(request["REGIONID"], out regionID); | ||
157 | else | ||
158 | m_log.WarnFormat("[GRID HANDLER]: no regionID in request to deregister region"); | ||
159 | |||
160 | bool result = m_GridService.DeregisterRegion(regionID); | ||
161 | |||
162 | if (result) | ||
163 | return SuccessResult(); | ||
164 | else | ||
165 | return FailureResult(); | ||
166 | |||
167 | } | ||
168 | |||
169 | byte[] GetNeighbours(Dictionary<string, string> request) | ||
170 | { | ||
171 | UUID scopeID = UUID.Zero; | ||
172 | if (request["SCOPEID"] != null) | ||
173 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
174 | else | ||
175 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); | ||
176 | |||
177 | UUID regionID = UUID.Zero; | ||
178 | if (request["REGIONID"] != null) | ||
179 | UUID.TryParse(request["REGIONID"], out regionID); | ||
180 | else | ||
181 | m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); | ||
182 | |||
183 | List<GridRegion> rinfos = m_GridService.GetNeighbours(scopeID, regionID); | ||
184 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
185 | |||
186 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
187 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) | ||
188 | result["result"] = "null"; | ||
189 | else | ||
190 | { | ||
191 | int i = 0; | ||
192 | foreach (GridRegion rinfo in rinfos) | ||
193 | { | ||
194 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
195 | result["region" + i] = rinfoDict; | ||
196 | i++; | ||
197 | } | ||
198 | } | ||
199 | |||
200 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
201 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
202 | UTF8Encoding encoding = new UTF8Encoding(); | ||
203 | return encoding.GetBytes(xmlString); | ||
204 | |||
205 | } | ||
206 | |||
207 | byte[] GetRegionByUUID(Dictionary<string, string> request) | ||
208 | { | ||
209 | UUID scopeID = UUID.Zero; | ||
210 | if (request["SCOPEID"] != null) | ||
211 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
212 | else | ||
213 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); | ||
214 | |||
215 | UUID regionID = UUID.Zero; | ||
216 | if (request["REGIONID"] != null) | ||
217 | UUID.TryParse(request["REGIONID"], out regionID); | ||
218 | else | ||
219 | m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); | ||
220 | |||
221 | GridRegion rinfo = m_GridService.GetRegionByUUID(scopeID, regionID); | ||
222 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
223 | |||
224 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
225 | if (rinfo == null) | ||
226 | result["result"] = "null"; | ||
227 | else | ||
228 | result["result"] = rinfo.ToKeyValuePairs(); | ||
229 | |||
230 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
231 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
232 | UTF8Encoding encoding = new UTF8Encoding(); | ||
233 | return encoding.GetBytes(xmlString); | ||
234 | } | ||
235 | |||
236 | byte[] GetRegionByPosition(Dictionary<string, string> request) | ||
237 | { | ||
238 | UUID scopeID = UUID.Zero; | ||
239 | if (request["SCOPEID"] != null) | ||
240 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
241 | else | ||
242 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by position"); | ||
243 | |||
244 | int x = 0, y = 0; | ||
245 | if (request["X"] != null) | ||
246 | Int32.TryParse(request["X"], out x); | ||
247 | else | ||
248 | m_log.WarnFormat("[GRID HANDLER]: no X in request to get region by position"); | ||
249 | if (request["Y"] != null) | ||
250 | Int32.TryParse(request["Y"], out y); | ||
251 | else | ||
252 | m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position"); | ||
253 | |||
254 | GridRegion rinfo = m_GridService.GetRegionByPosition(scopeID, x, y); | ||
255 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
256 | |||
257 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
258 | if (rinfo == null) | ||
259 | result["result"] = "null"; | ||
260 | else | ||
261 | result["result"] = rinfo.ToKeyValuePairs(); | ||
262 | |||
263 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
264 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
265 | UTF8Encoding encoding = new UTF8Encoding(); | ||
266 | return encoding.GetBytes(xmlString); | ||
267 | } | ||
268 | |||
269 | byte[] GetRegionByName(Dictionary<string, string> request) | ||
270 | { | ||
271 | UUID scopeID = UUID.Zero; | ||
272 | if (request["SCOPEID"] != null) | ||
273 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
274 | else | ||
275 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name"); | ||
276 | |||
277 | string regionName = string.Empty; | ||
278 | if (request["NAME"] != null) | ||
279 | regionName = request["NAME"]; | ||
280 | else | ||
281 | m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name"); | ||
282 | |||
283 | GridRegion rinfo = m_GridService.GetRegionByName(scopeID, regionName); | ||
284 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
285 | |||
286 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
287 | if (rinfo == null) | ||
288 | result["result"] = "null"; | ||
289 | else | ||
290 | result["result"] = rinfo.ToKeyValuePairs(); | ||
291 | |||
292 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
293 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
294 | UTF8Encoding encoding = new UTF8Encoding(); | ||
295 | return encoding.GetBytes(xmlString); | ||
296 | } | ||
297 | |||
298 | byte[] GetRegionsByName(Dictionary<string, string> request) | ||
299 | { | ||
300 | UUID scopeID = UUID.Zero; | ||
301 | if (request["SCOPEID"] != null) | ||
302 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
303 | else | ||
304 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get regions by name"); | ||
305 | |||
306 | string regionName = string.Empty; | ||
307 | if (request["NAME"] != null) | ||
308 | regionName = request["NAME"]; | ||
309 | else | ||
310 | m_log.WarnFormat("[GRID HANDLER]: no NAME in request to get regions by name"); | ||
311 | |||
312 | int max = 0; | ||
313 | if (request["MAX"] != null) | ||
314 | Int32.TryParse(request["MAX"], out max); | ||
315 | else | ||
316 | m_log.WarnFormat("[GRID HANDLER]: no MAX in request to get regions by name"); | ||
317 | |||
318 | List<GridRegion> rinfos = m_GridService.GetRegionsByName(scopeID, regionName, max); | ||
319 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
320 | |||
321 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
322 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) | ||
323 | result["result"] = "null"; | ||
324 | else | ||
325 | { | ||
326 | int i = 0; | ||
327 | foreach (GridRegion rinfo in rinfos) | ||
328 | { | ||
329 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
330 | result["region" + i] = rinfoDict; | ||
331 | i++; | ||
332 | } | ||
333 | } | ||
334 | |||
335 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
336 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
337 | UTF8Encoding encoding = new UTF8Encoding(); | ||
338 | return encoding.GetBytes(xmlString); | ||
339 | } | ||
340 | |||
341 | byte[] GetRegionRange(Dictionary<string, string> request) | ||
342 | { | ||
343 | //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange"); | ||
344 | UUID scopeID = UUID.Zero; | ||
345 | if (request.ContainsKey("SCOPEID")) | ||
346 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
347 | else | ||
348 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range"); | ||
349 | |||
350 | int xmin = 0, xmax = 0, ymin = 0, ymax = 0; | ||
351 | if (request.ContainsKey("XMIN")) | ||
352 | Int32.TryParse(request["XMIN"], out xmin); | ||
353 | else | ||
354 | m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range"); | ||
355 | if (request.ContainsKey("XMAX")) | ||
356 | Int32.TryParse(request["XMAX"], out xmax); | ||
357 | else | ||
358 | m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range"); | ||
359 | if (request.ContainsKey("YMIN")) | ||
360 | Int32.TryParse(request["YMIN"], out ymin); | ||
361 | else | ||
362 | m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range"); | ||
363 | if (request.ContainsKey("YMAX")) | ||
364 | Int32.TryParse(request["YMAX"], out ymax); | ||
365 | else | ||
366 | m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range"); | ||
367 | |||
368 | |||
369 | List<GridRegion> rinfos = m_GridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax); | ||
370 | |||
371 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
372 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) | ||
373 | result["result"] = "null"; | ||
374 | else | ||
375 | { | ||
376 | int i = 0; | ||
377 | foreach (GridRegion rinfo in rinfos) | ||
378 | { | ||
379 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
380 | result["region" + i] = rinfoDict; | ||
381 | i++; | ||
382 | } | ||
383 | } | ||
384 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
385 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
386 | UTF8Encoding encoding = new UTF8Encoding(); | ||
387 | return encoding.GetBytes(xmlString); | ||
388 | } | ||
389 | |||
390 | #endregion | ||
391 | |||
392 | #region Misc | ||
393 | |||
394 | private byte[] SuccessResult() | ||
395 | { | ||
396 | XmlDocument doc = new XmlDocument(); | ||
397 | |||
398 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, | ||
399 | "", ""); | ||
400 | |||
401 | doc.AppendChild(xmlnode); | ||
402 | |||
403 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", | ||
404 | ""); | ||
405 | |||
406 | doc.AppendChild(rootElement); | ||
407 | |||
408 | XmlElement result = doc.CreateElement("", "Result", ""); | ||
409 | result.AppendChild(doc.CreateTextNode("Success")); | ||
410 | |||
411 | rootElement.AppendChild(result); | ||
412 | |||
413 | return DocToBytes(doc); | ||
414 | } | ||
415 | |||
416 | private byte[] FailureResult() | ||
417 | { | ||
418 | XmlDocument doc = new XmlDocument(); | ||
419 | |||
420 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, | ||
421 | "", ""); | ||
422 | |||
423 | doc.AppendChild(xmlnode); | ||
424 | |||
425 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", | ||
426 | ""); | ||
427 | |||
428 | doc.AppendChild(rootElement); | ||
429 | |||
430 | XmlElement result = doc.CreateElement("", "Result", ""); | ||
431 | result.AppendChild(doc.CreateTextNode("Failure")); | ||
432 | |||
433 | rootElement.AppendChild(result); | ||
434 | |||
435 | return DocToBytes(doc); | ||
436 | } | ||
437 | |||
438 | private byte[] DocToBytes(XmlDocument doc) | ||
439 | { | ||
440 | MemoryStream ms = new MemoryStream(); | ||
441 | XmlTextWriter xw = new XmlTextWriter(ms, null); | ||
442 | xw.Formatting = Formatting.Indented; | ||
443 | doc.WriteTo(xw); | ||
444 | xw.Flush(); | ||
445 | |||
446 | return ms.ToArray(); | ||
447 | } | ||
448 | |||
449 | #endregion | ||
450 | } | ||
451 | } | ||
diff --git a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs new file mode 100644 index 0000000..115ac29 --- /dev/null +++ b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs | |||
@@ -0,0 +1,208 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using System.Net; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Server.Handlers.Base; | ||
39 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
40 | |||
41 | using OpenMetaverse; | ||
42 | using log4net; | ||
43 | using Nwc.XmlRpc; | ||
44 | |||
45 | namespace OpenSim.Server.Handlers.Grid | ||
46 | { | ||
47 | public class HypergridServiceInConnector : ServiceConnector | ||
48 | { | ||
49 | private static readonly ILog m_log = | ||
50 | LogManager.GetLogger( | ||
51 | MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
53 | private List<GridRegion> m_RegionsOnSim = new List<GridRegion>(); | ||
54 | private IHyperlinkService m_HyperlinkService; | ||
55 | |||
56 | public HypergridServiceInConnector(IConfigSource config, IHttpServer server, IHyperlinkService hyperService) : | ||
57 | base(config, server, String.Empty) | ||
58 | { | ||
59 | m_HyperlinkService = hyperService; | ||
60 | server.AddXmlRPCHandler("link_region", LinkRegionRequest, false); | ||
61 | server.AddXmlRPCHandler("expect_hg_user", ExpectHGUser, false); | ||
62 | } | ||
63 | |||
64 | public void AddRegion(GridRegion rinfo) | ||
65 | { | ||
66 | m_RegionsOnSim.Add(rinfo); | ||
67 | } | ||
68 | |||
69 | public void RemoveRegion(GridRegion rinfo) | ||
70 | { | ||
71 | if (m_RegionsOnSim.Contains(rinfo)) | ||
72 | m_RegionsOnSim.Remove(rinfo); | ||
73 | } | ||
74 | |||
75 | /// <summary> | ||
76 | /// Someone wants to link to us | ||
77 | /// </summary> | ||
78 | /// <param name="request"></param> | ||
79 | /// <returns></returns> | ||
80 | public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient) | ||
81 | { | ||
82 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
83 | //string host = (string)requestData["host"]; | ||
84 | //string portstr = (string)requestData["port"]; | ||
85 | string name = (string)requestData["region_name"]; | ||
86 | |||
87 | m_log.DebugFormat("[HGrid]: Hyperlink request"); | ||
88 | |||
89 | GridRegion regInfo = null; | ||
90 | foreach (GridRegion r in m_RegionsOnSim) | ||
91 | { | ||
92 | if ((r.RegionName != null) && (name != null) && (r.RegionName.ToLower() == name.ToLower())) | ||
93 | { | ||
94 | regInfo = r; | ||
95 | break; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | if (regInfo == null) | ||
100 | regInfo = m_RegionsOnSim[0]; // Send out the first region | ||
101 | |||
102 | Hashtable hash = new Hashtable(); | ||
103 | hash["uuid"] = regInfo.RegionID.ToString(); | ||
104 | m_log.Debug(">> Here " + regInfo.RegionID); | ||
105 | hash["handle"] = regInfo.RegionHandle.ToString(); | ||
106 | hash["region_image"] = regInfo.TerrainImage.ToString(); | ||
107 | hash["region_name"] = regInfo.RegionName; | ||
108 | hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); | ||
109 | //m_log.Debug(">> Here: " + regInfo.InternalEndPoint.Port); | ||
110 | |||
111 | |||
112 | XmlRpcResponse response = new XmlRpcResponse(); | ||
113 | response.Value = hash; | ||
114 | return response; | ||
115 | } | ||
116 | |||
117 | /// <summary> | ||
118 | /// Received from other HGrid nodes when a user wants to teleport here. This call allows | ||
119 | /// the region to prepare for direct communication from the client. Sends back an empty | ||
120 | /// xmlrpc response on completion. | ||
121 | /// This is somewhat similar to OGS1's ExpectUser, but with the additional task of | ||
122 | /// registering the user in the local user cache. | ||
123 | /// </summary> | ||
124 | /// <param name="request"></param> | ||
125 | /// <returns></returns> | ||
126 | public XmlRpcResponse ExpectHGUser(XmlRpcRequest request, IPEndPoint remoteClient) | ||
127 | { | ||
128 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
129 | ForeignUserProfileData userData = new ForeignUserProfileData(); | ||
130 | |||
131 | userData.FirstName = (string)requestData["firstname"]; | ||
132 | userData.SurName = (string)requestData["lastname"]; | ||
133 | userData.ID = new UUID((string)requestData["agent_id"]); | ||
134 | UUID sessionID = new UUID((string)requestData["session_id"]); | ||
135 | userData.HomeLocation = new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), | ||
136 | (float)Convert.ToDecimal((string)requestData["startpos_y"]), | ||
137 | (float)Convert.ToDecimal((string)requestData["startpos_z"])); | ||
138 | |||
139 | userData.UserServerURI = (string)requestData["userserver_id"]; | ||
140 | userData.UserAssetURI = (string)requestData["assetserver_id"]; | ||
141 | userData.UserInventoryURI = (string)requestData["inventoryserver_id"]; | ||
142 | |||
143 | m_log.DebugFormat("[HGrid]: Prepare for connection from {0} {1} (@{2}) UUID={3}", | ||
144 | userData.FirstName, userData.SurName, userData.UserServerURI, userData.ID); | ||
145 | |||
146 | ulong userRegionHandle = 0; | ||
147 | int userhomeinternalport = 0; | ||
148 | if (requestData.ContainsKey("region_uuid")) | ||
149 | { | ||
150 | UUID uuid = UUID.Zero; | ||
151 | UUID.TryParse((string)requestData["region_uuid"], out uuid); | ||
152 | userData.HomeRegionID = uuid; | ||
153 | userRegionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | ||
154 | userData.UserHomeAddress = (string)requestData["home_address"]; | ||
155 | userData.UserHomePort = (string)requestData["home_port"]; | ||
156 | userhomeinternalport = Convert.ToInt32((string)requestData["internal_port"]); | ||
157 | |||
158 | m_log.Debug("[HGrid]: home_address: " + userData.UserHomeAddress + | ||
159 | "; home_port: " + userData.UserHomePort); | ||
160 | } | ||
161 | else | ||
162 | m_log.WarnFormat("[HGrid]: User has no home region information"); | ||
163 | |||
164 | XmlRpcResponse resp = new XmlRpcResponse(); | ||
165 | |||
166 | // Let's check if someone is trying to get in with a stolen local identity. | ||
167 | // The need for this test is a consequence of not having truly global names :-/ | ||
168 | bool comingHome = false; | ||
169 | if (m_HyperlinkService.CheckUserAtEntry(userData.ID, sessionID, out comingHome) == false) | ||
170 | { | ||
171 | m_log.WarnFormat("[HGrid]: Access denied to foreign user."); | ||
172 | Hashtable respdata = new Hashtable(); | ||
173 | respdata["success"] = "FALSE"; | ||
174 | respdata["reason"] = "Foreign user has the same ID as a local user, or logins disabled."; | ||
175 | resp.Value = respdata; | ||
176 | return resp; | ||
177 | } | ||
178 | |||
179 | // Finally, everything looks ok | ||
180 | //m_log.Debug("XXX---- EVERYTHING OK ---XXX"); | ||
181 | |||
182 | if (!comingHome) | ||
183 | { | ||
184 | // We don't do this if the user is coming to the home grid | ||
185 | GridRegion home = new GridRegion(); | ||
186 | home.RegionID = userData.HomeRegionID; | ||
187 | home.ExternalHostName = userData.UserHomeAddress; | ||
188 | home.HttpPort = Convert.ToUInt32(userData.UserHomePort); | ||
189 | uint x = 0, y = 0; | ||
190 | Utils.LongToUInts(userRegionHandle, out x, out y); | ||
191 | home.RegionLocX = (int)x; | ||
192 | home.RegionLocY = (int)y; | ||
193 | home.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)userhomeinternalport); | ||
194 | |||
195 | m_HyperlinkService.AcceptUser(userData, home); | ||
196 | } | ||
197 | // else the user is coming to a non-home region of the home grid | ||
198 | // We simply drop this user information altogether | ||
199 | |||
200 | Hashtable respdata2 = new Hashtable(); | ||
201 | respdata2["success"] = "TRUE"; | ||
202 | resp.Value = respdata2; | ||
203 | |||
204 | return resp; | ||
205 | } | ||
206 | |||
207 | } | ||
208 | } | ||
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 | |||
54 | //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); | 54 | //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); |
55 | 55 | ||
56 | private string m_userserver_url; | 56 | private string m_userserver_url; |
57 | private string m_ConfigName = "InventoryService"; | ||
57 | 58 | ||
58 | public InventoryServiceInConnector(IConfigSource config, IHttpServer server) : | 59 | public InventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) : |
59 | base(config, server) | 60 | base(config, server, configName) |
60 | { | 61 | { |
61 | IConfig serverConfig = config.Configs["InventoryService"]; | 62 | IConfig serverConfig = config.Configs[m_ConfigName]; |
62 | if (serverConfig == null) | 63 | if (serverConfig == null) |
63 | throw new Exception("No section 'InventoryService' in config file"); | 64 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
64 | 65 | ||
65 | string inventoryService = serverConfig.GetString("LocalServiceModule", | 66 | string inventoryService = serverConfig.GetString("LocalServiceModule", |
66 | String.Empty); | 67 | String.Empty); |
67 | 68 | ||
68 | if (inventoryService == String.Empty) | 69 | if (inventoryService == String.Empty) |
69 | throw new Exception("No InventoryService in config file"); | 70 | throw new Exception("No LocalServiceModule in config file"); |
70 | 71 | ||
71 | Object[] args = new Object[] { config }; | 72 | Object[] args = new Object[] { config }; |
72 | m_InventoryService = | 73 | 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 | |||
46 | // TODO : private IAuthenticationService m_AuthenticationService; | 46 | // TODO : private IAuthenticationService m_AuthenticationService; |
47 | 47 | ||
48 | public LandServiceInConnector(IConfigSource source, IHttpServer server, ILandService service, IScene scene) : | 48 | public LandServiceInConnector(IConfigSource source, IHttpServer server, ILandService service, IScene scene) : |
49 | base(source, server) | 49 | base(source, server, String.Empty) |
50 | { | 50 | { |
51 | m_LandService = service; | 51 | m_LandService = service; |
52 | if (m_LandService == null) | 52 | if (m_LandService == null) |
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; | |||
36 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Servers.HttpServer; | 38 | using OpenSim.Framework.Servers.HttpServer; |
39 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
39 | 40 | ||
40 | using OpenMetaverse; | 41 | using OpenMetaverse; |
41 | using OpenMetaverse.StructuredData; | 42 | using OpenMetaverse.StructuredData; |
@@ -148,11 +149,14 @@ namespace OpenSim.Server.Handlers.Neighbour | |||
148 | } | 149 | } |
149 | 150 | ||
150 | // Finally! | 151 | // Finally! |
151 | bool success = m_NeighbourService.HelloNeighbour(regionhandle, aRegion); | 152 | GridRegion thisRegion = m_NeighbourService.HelloNeighbour(regionhandle, aRegion); |
152 | 153 | ||
153 | OSDMap resp = new OSDMap(1); | 154 | OSDMap resp = new OSDMap(1); |
154 | 155 | ||
155 | resp["success"] = OSD.FromBoolean(success); | 156 | if (thisRegion != null) |
157 | resp["success"] = OSD.FromBoolean(true); | ||
158 | else | ||
159 | resp["success"] = OSD.FromBoolean(false); | ||
156 | 160 | ||
157 | httpResponse.StatusCode = (int)HttpStatusCode.OK; | 161 | httpResponse.StatusCode = (int)HttpStatusCode.OK; |
158 | 162 | ||
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 | |||
46 | private IAuthenticationService m_AuthenticationService = null; | 46 | private IAuthenticationService m_AuthenticationService = null; |
47 | 47 | ||
48 | public NeighbourServiceInConnector(IConfigSource source, IHttpServer server, INeighbourService nService, IScene scene) : | 48 | public NeighbourServiceInConnector(IConfigSource source, IHttpServer server, INeighbourService nService, IScene scene) : |
49 | base(source, server) | 49 | base(source, server, String.Empty) |
50 | { | 50 | { |
51 | 51 | ||
52 | m_NeighbourService = nService; | 52 | 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 | |||
41 | private IAuthenticationService m_AuthenticationService; | 41 | private IAuthenticationService m_AuthenticationService; |
42 | 42 | ||
43 | public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : | 43 | public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : |
44 | base(config, server) | 44 | base(config, server, String.Empty) |
45 | { | 45 | { |
46 | IConfig serverConfig = config.Configs["SimulationService"]; | 46 | IConfig serverConfig = config.Configs["SimulationService"]; |
47 | if (serverConfig == null) | 47 | if (serverConfig == null) |