diff options
Diffstat (limited to 'OpenSim/Framework/Communications/Clients')
3 files changed, 0 insertions, 622 deletions
diff --git a/OpenSim/Framework/Communications/Clients/AuthClient.cs b/OpenSim/Framework/Communications/Clients/AuthClient.cs deleted file mode 100644 index adae637..0000000 --- a/OpenSim/Framework/Communications/Clients/AuthClient.cs +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
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 Nwc.XmlRpc; | ||
32 | using OpenMetaverse; | ||
33 | |||
34 | namespace OpenSim.Framework.Communications.Clients | ||
35 | { | ||
36 | public class AuthClient | ||
37 | { | ||
38 | public static string GetNewKey(string authurl, UUID userID, UUID authToken) | ||
39 | { | ||
40 | //Hashtable keyParams = new Hashtable(); | ||
41 | //keyParams["user_id"] = userID; | ||
42 | //keyParams["auth_token"] = authKey; | ||
43 | |||
44 | List<string> SendParams = new List<string>(); | ||
45 | SendParams.Add(userID.ToString()); | ||
46 | SendParams.Add(authToken.ToString()); | ||
47 | |||
48 | XmlRpcRequest request = new XmlRpcRequest("hg_new_auth_key", SendParams); | ||
49 | XmlRpcResponse reply; | ||
50 | try | ||
51 | { | ||
52 | reply = request.Send(authurl, 6000); | ||
53 | } | ||
54 | catch (Exception e) | ||
55 | { | ||
56 | System.Console.WriteLine("[HGrid]: Failed to get new key. Reason: " + e.Message); | ||
57 | return string.Empty; | ||
58 | } | ||
59 | |||
60 | if (!reply.IsFault) | ||
61 | { | ||
62 | string newKey = string.Empty; | ||
63 | if (reply.Value != null) | ||
64 | newKey = (string)reply.Value; | ||
65 | |||
66 | return newKey; | ||
67 | } | ||
68 | else | ||
69 | { | ||
70 | System.Console.WriteLine("[HGrid]: XmlRpc request to get auth key failed with message {0}" + reply.FaultString + ", code " + reply.FaultCode); | ||
71 | return string.Empty; | ||
72 | } | ||
73 | |||
74 | } | ||
75 | |||
76 | public static bool VerifyKey(string authurl, UUID userID, string authKey) | ||
77 | { | ||
78 | List<string> SendParams = new List<string>(); | ||
79 | SendParams.Add(userID.ToString()); | ||
80 | SendParams.Add(authKey); | ||
81 | |||
82 | System.Console.WriteLine("[HGrid]: Verifying user key with authority " + authurl); | ||
83 | |||
84 | XmlRpcRequest request = new XmlRpcRequest("hg_verify_auth_key", SendParams); | ||
85 | XmlRpcResponse reply; | ||
86 | try | ||
87 | { | ||
88 | reply = request.Send(authurl, 10000); | ||
89 | } | ||
90 | catch (Exception e) | ||
91 | { | ||
92 | System.Console.WriteLine("[HGrid]: Failed to verify key. Reason: " + e.Message); | ||
93 | return false; | ||
94 | } | ||
95 | |||
96 | if (reply != null) | ||
97 | { | ||
98 | if (!reply.IsFault) | ||
99 | { | ||
100 | bool success = false; | ||
101 | if (reply.Value != null) | ||
102 | success = (bool)reply.Value; | ||
103 | |||
104 | return success; | ||
105 | } | ||
106 | else | ||
107 | { | ||
108 | System.Console.WriteLine("[HGrid]: XmlRpc request to verify key failed with message {0}" + reply.FaultString + ", code " + reply.FaultCode); | ||
109 | return false; | ||
110 | } | ||
111 | } | ||
112 | else | ||
113 | { | ||
114 | System.Console.WriteLine("[HGrid]: XmlRpc request to verify key returned null reply"); | ||
115 | return false; | ||
116 | } | ||
117 | } | ||
118 | |||
119 | public static bool VerifySession(string authurl, UUID userID, UUID sessionID) | ||
120 | { | ||
121 | Hashtable requestData = new Hashtable(); | ||
122 | requestData["avatar_uuid"] = userID.ToString(); | ||
123 | requestData["session_id"] = sessionID.ToString(); | ||
124 | ArrayList SendParams = new ArrayList(); | ||
125 | SendParams.Add(requestData); | ||
126 | XmlRpcRequest UserReq = new XmlRpcRequest("check_auth_session", SendParams); | ||
127 | XmlRpcResponse UserResp = null; | ||
128 | try | ||
129 | { | ||
130 | UserResp = UserReq.Send(authurl, 3000); | ||
131 | } | ||
132 | catch (Exception e) | ||
133 | { | ||
134 | System.Console.WriteLine("[Session Auth]: VerifySession XmlRpc: " + e.Message); | ||
135 | return false; | ||
136 | } | ||
137 | |||
138 | Hashtable responseData = (Hashtable)UserResp.Value; | ||
139 | if (responseData != null && responseData.ContainsKey("auth_session") && responseData["auth_session"] != null && responseData["auth_session"].ToString() == "TRUE") | ||
140 | { | ||
141 | //System.Console.WriteLine("[Authorization]: userserver reported authorized session for user " + userID); | ||
142 | return true; | ||
143 | } | ||
144 | else | ||
145 | { | ||
146 | //System.Console.WriteLine("[Authorization]: userserver reported unauthorized session for user " + userID); | ||
147 | return false; | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | } | ||
diff --git a/OpenSim/Framework/Communications/Clients/GridClient.cs b/OpenSim/Framework/Communications/Clients/GridClient.cs deleted file mode 100644 index 4836556..0000000 --- a/OpenSim/Framework/Communications/Clients/GridClient.cs +++ /dev/null | |||
@@ -1,392 +0,0 @@ | |||
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.Net; | ||
32 | using System.Reflection; | ||
33 | |||
34 | using log4net; | ||
35 | using OpenMetaverse; | ||
36 | using Nwc.XmlRpc; | ||
37 | |||
38 | namespace OpenSim.Framework.Communications.Clients | ||
39 | { | ||
40 | public class GridClient | ||
41 | { | ||
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
44 | public bool RegisterRegion( | ||
45 | string gridServerURL, string sendKey, string receiveKey, RegionInfo regionInfo, out bool forcefulBanLines) | ||
46 | { | ||
47 | m_log.InfoFormat( | ||
48 | "[GRID CLIENT]: Registering region {0} with grid at {1}", regionInfo.RegionName, gridServerURL); | ||
49 | |||
50 | forcefulBanLines = true; | ||
51 | |||
52 | Hashtable GridParams = new Hashtable(); | ||
53 | // Login / Authentication | ||
54 | |||
55 | GridParams["authkey"] = sendKey; | ||
56 | GridParams["recvkey"] = receiveKey; | ||
57 | GridParams["UUID"] = regionInfo.RegionID.ToString(); | ||
58 | GridParams["sim_ip"] = regionInfo.ExternalHostName; | ||
59 | GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); | ||
60 | GridParams["region_locx"] = regionInfo.RegionLocX.ToString(); | ||
61 | GridParams["region_locy"] = regionInfo.RegionLocY.ToString(); | ||
62 | GridParams["sim_name"] = regionInfo.RegionName; | ||
63 | GridParams["http_port"] = regionInfo.HttpPort.ToString(); | ||
64 | GridParams["remoting_port"] = ConfigSettings.DefaultRegionRemotingPort.ToString(); | ||
65 | GridParams["map-image-id"] = regionInfo.RegionSettings.TerrainImageID.ToString(); | ||
66 | GridParams["originUUID"] = regionInfo.originRegionID.ToString(); | ||
67 | GridParams["server_uri"] = regionInfo.ServerURI; | ||
68 | GridParams["region_secret"] = regionInfo.regionSecret; | ||
69 | GridParams["major_interface_version"] = VersionInfo.MajorInterfaceVersion.ToString(); | ||
70 | |||
71 | if (regionInfo.MasterAvatarAssignedUUID != UUID.Zero) | ||
72 | GridParams["master_avatar_uuid"] = regionInfo.MasterAvatarAssignedUUID.ToString(); | ||
73 | else | ||
74 | GridParams["master_avatar_uuid"] = regionInfo.EstateSettings.EstateOwner.ToString(); | ||
75 | |||
76 | // Package into an XMLRPC Request | ||
77 | ArrayList SendParams = new ArrayList(); | ||
78 | SendParams.Add(GridParams); | ||
79 | |||
80 | // Send Request | ||
81 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); | ||
82 | XmlRpcResponse GridResp; | ||
83 | |||
84 | try | ||
85 | { | ||
86 | // The timeout should always be significantly larger than the timeout for the grid server to request | ||
87 | // the initial status of the region before confirming registration. | ||
88 | GridResp = GridReq.Send(gridServerURL, 90000); | ||
89 | } | ||
90 | catch (Exception e) | ||
91 | { | ||
92 | Exception e2 | ||
93 | = new Exception( | ||
94 | String.Format( | ||
95 | "Unable to register region with grid at {0}. Grid service not running?", | ||
96 | gridServerURL), | ||
97 | e); | ||
98 | |||
99 | throw e2; | ||
100 | } | ||
101 | |||
102 | Hashtable GridRespData = (Hashtable)GridResp.Value; | ||
103 | // Hashtable griddatahash = GridRespData; | ||
104 | |||
105 | // Process Response | ||
106 | if (GridRespData.ContainsKey("error")) | ||
107 | { | ||
108 | string errorstring = (string)GridRespData["error"]; | ||
109 | |||
110 | Exception e = new Exception( | ||
111 | String.Format("Unable to connect to grid at {0}: {1}", gridServerURL, errorstring)); | ||
112 | |||
113 | throw e; | ||
114 | } | ||
115 | else | ||
116 | { | ||
117 | // m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY); | ||
118 | if (GridRespData.ContainsKey("allow_forceful_banlines")) | ||
119 | { | ||
120 | if ((string)GridRespData["allow_forceful_banlines"] != "TRUE") | ||
121 | { | ||
122 | forcefulBanLines = false; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | } | ||
127 | return true; | ||
128 | } | ||
129 | |||
130 | public bool DeregisterRegion(string gridServerURL, string sendKey, string receiveKey, RegionInfo regionInfo, out string errorMsg) | ||
131 | { | ||
132 | errorMsg = ""; | ||
133 | Hashtable GridParams = new Hashtable(); | ||
134 | |||
135 | GridParams["UUID"] = regionInfo.RegionID.ToString(); | ||
136 | |||
137 | // Package into an XMLRPC Request | ||
138 | ArrayList SendParams = new ArrayList(); | ||
139 | SendParams.Add(GridParams); | ||
140 | |||
141 | // Send Request | ||
142 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_after_region_moved", SendParams); | ||
143 | XmlRpcResponse GridResp = null; | ||
144 | |||
145 | try | ||
146 | { | ||
147 | GridResp = GridReq.Send(gridServerURL, 10000); | ||
148 | } | ||
149 | catch (Exception e) | ||
150 | { | ||
151 | Exception e2 | ||
152 | = new Exception( | ||
153 | String.Format( | ||
154 | "Unable to deregister region with grid at {0}. Grid service not running?", | ||
155 | gridServerURL), | ||
156 | e); | ||
157 | |||
158 | throw e2; | ||
159 | } | ||
160 | |||
161 | Hashtable GridRespData = (Hashtable)GridResp.Value; | ||
162 | |||
163 | // Hashtable griddatahash = GridRespData; | ||
164 | |||
165 | // Process Response | ||
166 | if (GridRespData != null && GridRespData.ContainsKey("error")) | ||
167 | { | ||
168 | errorMsg = (string)GridRespData["error"]; | ||
169 | return false; | ||
170 | } | ||
171 | |||
172 | return true; | ||
173 | } | ||
174 | |||
175 | public bool RequestNeighborInfo( | ||
176 | string gridServerURL, string sendKey, string receiveKey, UUID regionUUID, | ||
177 | out RegionInfo regionInfo, out string errorMsg) | ||
178 | { | ||
179 | // didn't find it so far, we have to go the long way | ||
180 | regionInfo = null; | ||
181 | errorMsg = string.Empty; | ||
182 | Hashtable requestData = new Hashtable(); | ||
183 | requestData["region_UUID"] = regionUUID.ToString(); | ||
184 | requestData["authkey"] = sendKey; | ||
185 | ArrayList SendParams = new ArrayList(); | ||
186 | SendParams.Add(requestData); | ||
187 | XmlRpcRequest gridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
188 | XmlRpcResponse gridResp = null; | ||
189 | |||
190 | try | ||
191 | { | ||
192 | gridResp = gridReq.Send(gridServerURL, 3000); | ||
193 | } | ||
194 | catch (Exception e) | ||
195 | { | ||
196 | errorMsg = e.Message; | ||
197 | return false; | ||
198 | } | ||
199 | |||
200 | Hashtable responseData = (Hashtable)gridResp.Value; | ||
201 | |||
202 | if (responseData.ContainsKey("error")) | ||
203 | { | ||
204 | errorMsg = (string)responseData["error"]; | ||
205 | return false; ; | ||
206 | } | ||
207 | |||
208 | regionInfo = BuildRegionInfo(responseData, String.Empty); | ||
209 | |||
210 | return true; | ||
211 | } | ||
212 | |||
213 | public bool RequestNeighborInfo( | ||
214 | string gridServerURL, string sendKey, string receiveKey, ulong regionHandle, | ||
215 | out RegionInfo regionInfo, out string errorMsg) | ||
216 | { | ||
217 | // didn't find it so far, we have to go the long way | ||
218 | regionInfo = null; | ||
219 | errorMsg = string.Empty; | ||
220 | |||
221 | try | ||
222 | { | ||
223 | Hashtable requestData = new Hashtable(); | ||
224 | requestData["region_handle"] = regionHandle.ToString(); | ||
225 | requestData["authkey"] = sendKey; | ||
226 | ArrayList SendParams = new ArrayList(); | ||
227 | SendParams.Add(requestData); | ||
228 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
229 | XmlRpcResponse GridResp = GridReq.Send(gridServerURL, 3000); | ||
230 | |||
231 | Hashtable responseData = (Hashtable)GridResp.Value; | ||
232 | |||
233 | if (responseData.ContainsKey("error")) | ||
234 | { | ||
235 | errorMsg = (string)responseData["error"]; | ||
236 | return false; | ||
237 | } | ||
238 | |||
239 | uint regX = Convert.ToUInt32((string)responseData["region_locx"]); | ||
240 | uint regY = Convert.ToUInt32((string)responseData["region_locy"]); | ||
241 | string externalHostName = (string)responseData["sim_ip"]; | ||
242 | uint simPort = Convert.ToUInt32(responseData["sim_port"]); | ||
243 | string regionName = (string)responseData["region_name"]; | ||
244 | UUID regionID = new UUID((string)responseData["region_UUID"]); | ||
245 | uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | ||
246 | |||
247 | uint httpPort = 9000; | ||
248 | if (responseData.ContainsKey("http_port")) | ||
249 | { | ||
250 | httpPort = Convert.ToUInt32((string)responseData["http_port"]); | ||
251 | } | ||
252 | |||
253 | // Ok, so this is definitively the wrong place to do this, way too hard coded, but it doesn't seem we GET this info? | ||
254 | |||
255 | string simURI = "http://" + externalHostName + ":" + simPort; | ||
256 | |||
257 | // string externalUri = (string) responseData["sim_uri"]; | ||
258 | |||
259 | //IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); | ||
260 | regionInfo = RegionInfo.Create(regionID, regionName, regX, regY, externalHostName, httpPort, simPort, remotingPort, simURI); | ||
261 | } | ||
262 | catch (Exception e) | ||
263 | { | ||
264 | errorMsg = e.Message; | ||
265 | return false; | ||
266 | } | ||
267 | |||
268 | return true; | ||
269 | } | ||
270 | |||
271 | public bool RequestClosestRegion( | ||
272 | string gridServerURL, string sendKey, string receiveKey, string regionName, | ||
273 | out RegionInfo regionInfo, out string errorMsg) | ||
274 | { | ||
275 | regionInfo = null; | ||
276 | errorMsg = string.Empty; | ||
277 | try | ||
278 | { | ||
279 | Hashtable requestData = new Hashtable(); | ||
280 | requestData["region_name_search"] = regionName; | ||
281 | requestData["authkey"] = sendKey; | ||
282 | ArrayList SendParams = new ArrayList(); | ||
283 | SendParams.Add(requestData); | ||
284 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
285 | XmlRpcResponse GridResp = GridReq.Send(gridServerURL, 3000); | ||
286 | |||
287 | Hashtable responseData = (Hashtable)GridResp.Value; | ||
288 | |||
289 | if (responseData.ContainsKey("error")) | ||
290 | { | ||
291 | errorMsg = (string)responseData["error"]; | ||
292 | return false; | ||
293 | } | ||
294 | |||
295 | regionInfo = BuildRegionInfo(responseData, ""); | ||
296 | |||
297 | } | ||
298 | catch (Exception e) | ||
299 | { | ||
300 | errorMsg = e.Message; | ||
301 | return false; | ||
302 | } | ||
303 | return true; | ||
304 | } | ||
305 | |||
306 | /// <summary> | ||
307 | /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates | ||
308 | /// </summary> | ||
309 | /// <remarks>REDUNDANT - OGS1 is to be phased out in favour of OGS2</remarks> | ||
310 | /// <param name="minX">Minimum X value</param> | ||
311 | /// <param name="minY">Minimum Y value</param> | ||
312 | /// <param name="maxX">Maximum X value</param> | ||
313 | /// <param name="maxY">Maximum Y value</param> | ||
314 | /// <returns>Hashtable of hashtables containing map data elements</returns> | ||
315 | public bool MapBlockQuery( | ||
316 | string gridServerURL, int minX, int minY, int maxX, int maxY, out Hashtable respData, out string errorMsg) | ||
317 | { | ||
318 | respData = new Hashtable(); | ||
319 | errorMsg = string.Empty; | ||
320 | |||
321 | Hashtable param = new Hashtable(); | ||
322 | param["xmin"] = minX; | ||
323 | param["ymin"] = minY; | ||
324 | param["xmax"] = maxX; | ||
325 | param["ymax"] = maxY; | ||
326 | IList parameters = new ArrayList(); | ||
327 | parameters.Add(param); | ||
328 | |||
329 | try | ||
330 | { | ||
331 | XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); | ||
332 | XmlRpcResponse resp = req.Send(gridServerURL, 10000); | ||
333 | respData = (Hashtable)resp.Value; | ||
334 | return true; | ||
335 | } | ||
336 | catch (Exception e) | ||
337 | { | ||
338 | errorMsg = e.Message; | ||
339 | return false; | ||
340 | } | ||
341 | } | ||
342 | |||
343 | public bool SearchRegionByName(string gridServerURL, IList parameters, out Hashtable respData, out string errorMsg) | ||
344 | { | ||
345 | respData = null; | ||
346 | errorMsg = string.Empty; | ||
347 | try | ||
348 | { | ||
349 | XmlRpcRequest request = new XmlRpcRequest("search_for_region_by_name", parameters); | ||
350 | XmlRpcResponse resp = request.Send(gridServerURL, 10000); | ||
351 | respData = (Hashtable)resp.Value; | ||
352 | if (respData != null && respData.Contains("faultCode")) | ||
353 | { | ||
354 | errorMsg = (string)respData["faultString"]; | ||
355 | return false; | ||
356 | } | ||
357 | |||
358 | return true; | ||
359 | } | ||
360 | catch (Exception e) | ||
361 | { | ||
362 | errorMsg = e.Message; | ||
363 | return false; | ||
364 | } | ||
365 | } | ||
366 | |||
367 | public RegionInfo BuildRegionInfo(Hashtable responseData, string prefix) | ||
368 | { | ||
369 | uint regX = Convert.ToUInt32((string)responseData[prefix + "region_locx"]); | ||
370 | uint regY = Convert.ToUInt32((string)responseData[prefix + "region_locy"]); | ||
371 | string internalIpStr = (string)responseData[prefix + "sim_ip"]; | ||
372 | uint port = Convert.ToUInt32(responseData[prefix + "sim_port"]); | ||
373 | |||
374 | IPEndPoint neighbourInternalEndPoint = new IPEndPoint(Util.GetHostFromDNS(internalIpStr), (int)port); | ||
375 | |||
376 | RegionInfo regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); | ||
377 | regionInfo.RemotingPort = Convert.ToUInt32((string)responseData[prefix + "remoting_port"]); | ||
378 | regionInfo.RemotingAddress = internalIpStr; | ||
379 | |||
380 | if (responseData.ContainsKey(prefix + "http_port")) | ||
381 | { | ||
382 | regionInfo.HttpPort = Convert.ToUInt32((string)responseData[prefix + "http_port"]); | ||
383 | } | ||
384 | |||
385 | regionInfo.RegionID = new UUID((string)responseData[prefix + "region_UUID"]); | ||
386 | regionInfo.RegionName = (string)responseData[prefix + "region_name"]; | ||
387 | |||
388 | regionInfo.RegionSettings.TerrainImageID = new UUID((string)responseData[prefix + "map_UUID"]); | ||
389 | return regionInfo; | ||
390 | } | ||
391 | } | ||
392 | } | ||
diff --git a/OpenSim/Framework/Communications/Clients/InventoryClient.cs b/OpenSim/Framework/Communications/Clients/InventoryClient.cs deleted file mode 100644 index e4f5e2a..0000000 --- a/OpenSim/Framework/Communications/Clients/InventoryClient.cs +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /** | ||
2 | * Copyright (c), Contributors. All rights reserved. | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without modification, | ||
6 | * are permitted provided that the following conditions are met: | ||
7 | * | ||
8 | * * Redistributions of source code must retain the above copyright notice, | ||
9 | * this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright notice, | ||
11 | * this list of conditions and the following disclaimer in the documentation | ||
12 | * and/or other materials provided with the distribution. | ||
13 | * * Neither the name of the Organizations nor the names of Individual | ||
14 | * Contributors may be used to endorse or promote products derived from | ||
15 | * this software without specific prior written permission. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using OpenSim.Framework.Servers; | ||
31 | using OpenSim.Framework.Servers.HttpServer; | ||
32 | |||
33 | using OpenMetaverse; | ||
34 | |||
35 | namespace OpenSim.Framework.Communications.Clients | ||
36 | { | ||
37 | public class InventoryClient | ||
38 | { | ||
39 | private string ServerURL; | ||
40 | |||
41 | public InventoryClient(string url) | ||
42 | { | ||
43 | ServerURL = url; | ||
44 | } | ||
45 | |||
46 | public void GetInventoryItemAsync(InventoryItemBase item, ReturnResponse<InventoryItemBase> callBack) | ||
47 | { | ||
48 | System.Console.WriteLine("[HGrid] GetInventory from " + ServerURL); | ||
49 | try | ||
50 | { | ||
51 | RestSessionObjectPosterResponse<InventoryItemBase, InventoryItemBase> requester | ||
52 | = new RestSessionObjectPosterResponse<InventoryItemBase, InventoryItemBase>(); | ||
53 | requester.ResponseCallback = callBack; | ||
54 | |||
55 | requester.BeginPostObject(ServerURL + "/GetItem/", item, string.Empty, string.Empty); | ||
56 | } | ||
57 | catch (Exception e) | ||
58 | { | ||
59 | System.Console.WriteLine("[HGrid]: Exception posting to inventory: " + e); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | public InventoryItemBase GetInventoryItem(InventoryItemBase item) | ||
64 | { | ||
65 | System.Console.WriteLine("[HGrid] GetInventory " + item.ID + " from " + ServerURL); | ||
66 | try | ||
67 | { | ||
68 | item = SynchronousRestSessionObjectPoster<Guid, InventoryItemBase>.BeginPostObject("POST", ServerURL + "/GetItem/", item.ID.Guid, "", ""); | ||
69 | return item; | ||
70 | } | ||
71 | catch (Exception e) | ||
72 | { | ||
73 | System.Console.WriteLine("[HGrid]: Exception posting to inventory: " + e); | ||
74 | } | ||
75 | return null; | ||
76 | } | ||
77 | |||
78 | } | ||
79 | } | ||