aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJeff Ames2009-05-05 09:32:30 +0000
committerJeff Ames2009-05-05 09:32:30 +0000
commit6ae88d129a2d85f57202e854f118dff047e65cf1 (patch)
treec063517af905ce778db5907a5dfa81dd2b313736
parentRemove bin directory from HttpServer. (diff)
downloadopensim-SC_OLD-6ae88d129a2d85f57202e854f118dff047e65cf1.zip
opensim-SC_OLD-6ae88d129a2d85f57202e854f118dff047e65cf1.tar.gz
opensim-SC_OLD-6ae88d129a2d85f57202e854f118dff047e65cf1.tar.bz2
opensim-SC_OLD-6ae88d129a2d85f57202e854f118dff047e65cf1.tar.xz
Update svn properties.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Clients/GridClient.cs756
-rw-r--r--OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs226
2 files changed, 491 insertions, 491 deletions
diff --git a/OpenSim/Framework/Communications/Clients/GridClient.cs b/OpenSim/Framework/Communications/Clients/GridClient.cs
index 48083b7..28c3e00 100644
--- a/OpenSim/Framework/Communications/Clients/GridClient.cs
+++ b/OpenSim/Framework/Communications/Clients/GridClient.cs
@@ -1,378 +1,378 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32 32
33using OpenMetaverse; 33using OpenMetaverse;
34using Nwc.XmlRpc; 34using Nwc.XmlRpc;
35 35
36namespace OpenSim.Framework.Communications.Clients 36namespace OpenSim.Framework.Communications.Clients
37{ 37{
38 public class GridClient 38 public class GridClient
39 { 39 {
40 40
41 public bool RegisterRegion(string gridServerURL, string sendKey, string receiveKey, RegionInfo regionInfo, out bool forcefulBanLines) 41 public bool RegisterRegion(string gridServerURL, string sendKey, string receiveKey, RegionInfo regionInfo, out bool forcefulBanLines)
42 { 42 {
43 forcefulBanLines = true; 43 forcefulBanLines = true;
44 44
45 Hashtable GridParams = new Hashtable(); 45 Hashtable GridParams = new Hashtable();
46 // Login / Authentication 46 // Login / Authentication
47 47
48 GridParams["authkey"] = sendKey; 48 GridParams["authkey"] = sendKey;
49 GridParams["recvkey"] = receiveKey; 49 GridParams["recvkey"] = receiveKey;
50 GridParams["UUID"] = regionInfo.RegionID.ToString(); 50 GridParams["UUID"] = regionInfo.RegionID.ToString();
51 GridParams["sim_ip"] = regionInfo.ExternalHostName; 51 GridParams["sim_ip"] = regionInfo.ExternalHostName;
52 GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); 52 GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString();
53 GridParams["region_locx"] = regionInfo.RegionLocX.ToString(); 53 GridParams["region_locx"] = regionInfo.RegionLocX.ToString();
54 GridParams["region_locy"] = regionInfo.RegionLocY.ToString(); 54 GridParams["region_locy"] = regionInfo.RegionLocY.ToString();
55 GridParams["sim_name"] = regionInfo.RegionName; 55 GridParams["sim_name"] = regionInfo.RegionName;
56 GridParams["http_port"] = regionInfo.HttpPort.ToString(); 56 GridParams["http_port"] = regionInfo.HttpPort.ToString();
57 GridParams["remoting_port"] = ConfigSettings.DefaultRegionRemotingPort.ToString(); 57 GridParams["remoting_port"] = ConfigSettings.DefaultRegionRemotingPort.ToString();
58 GridParams["map-image-id"] = regionInfo.RegionSettings.TerrainImageID.ToString(); 58 GridParams["map-image-id"] = regionInfo.RegionSettings.TerrainImageID.ToString();
59 GridParams["originUUID"] = regionInfo.originRegionID.ToString(); 59 GridParams["originUUID"] = regionInfo.originRegionID.ToString();
60 GridParams["server_uri"] = regionInfo.ServerURI; 60 GridParams["server_uri"] = regionInfo.ServerURI;
61 GridParams["region_secret"] = regionInfo.regionSecret; 61 GridParams["region_secret"] = regionInfo.regionSecret;
62 GridParams["major_interface_version"] = VersionInfo.MajorInterfaceVersion.ToString(); 62 GridParams["major_interface_version"] = VersionInfo.MajorInterfaceVersion.ToString();
63 63
64 if (regionInfo.MasterAvatarAssignedUUID != UUID.Zero) 64 if (regionInfo.MasterAvatarAssignedUUID != UUID.Zero)
65 GridParams["master_avatar_uuid"] = regionInfo.MasterAvatarAssignedUUID.ToString(); 65 GridParams["master_avatar_uuid"] = regionInfo.MasterAvatarAssignedUUID.ToString();
66 else 66 else
67 GridParams["master_avatar_uuid"] = regionInfo.EstateSettings.EstateOwner.ToString(); 67 GridParams["master_avatar_uuid"] = regionInfo.EstateSettings.EstateOwner.ToString();
68 68
69 // Package into an XMLRPC Request 69 // Package into an XMLRPC Request
70 ArrayList SendParams = new ArrayList(); 70 ArrayList SendParams = new ArrayList();
71 SendParams.Add(GridParams); 71 SendParams.Add(GridParams);
72 72
73 // Send Request 73 // Send Request
74 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); 74 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
75 XmlRpcResponse GridResp; 75 XmlRpcResponse GridResp;
76 76
77 try 77 try
78 { 78 {
79 // The timeout should always be significantly larger than the timeout for the grid server to request 79 // The timeout should always be significantly larger than the timeout for the grid server to request
80 // the initial status of the region before confirming registration. 80 // the initial status of the region before confirming registration.
81 GridResp = GridReq.Send(gridServerURL, 90000); 81 GridResp = GridReq.Send(gridServerURL, 90000);
82 } 82 }
83 catch (Exception e) 83 catch (Exception e)
84 { 84 {
85 Exception e2 85 Exception e2
86 = new Exception( 86 = new Exception(
87 String.Format( 87 String.Format(
88 "Unable to register region with grid at {0}. Grid service not running?", 88 "Unable to register region with grid at {0}. Grid service not running?",
89 gridServerURL), 89 gridServerURL),
90 e); 90 e);
91 91
92 throw e2; 92 throw e2;
93 } 93 }
94 94
95 Hashtable GridRespData = (Hashtable)GridResp.Value; 95 Hashtable GridRespData = (Hashtable)GridResp.Value;
96 // Hashtable griddatahash = GridRespData; 96 // Hashtable griddatahash = GridRespData;
97 97
98 // Process Response 98 // Process Response
99 if (GridRespData.ContainsKey("error")) 99 if (GridRespData.ContainsKey("error"))
100 { 100 {
101 string errorstring = (string)GridRespData["error"]; 101 string errorstring = (string)GridRespData["error"];
102 102
103 Exception e = new Exception( 103 Exception e = new Exception(
104 String.Format("Unable to connect to grid at {0}: {1}", gridServerURL, errorstring)); 104 String.Format("Unable to connect to grid at {0}: {1}", gridServerURL, errorstring));
105 105
106 throw e; 106 throw e;
107 } 107 }
108 else 108 else
109 { 109 {
110 // m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY); 110 // m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY);
111 if (GridRespData.ContainsKey("allow_forceful_banlines")) 111 if (GridRespData.ContainsKey("allow_forceful_banlines"))
112 { 112 {
113 if ((string)GridRespData["allow_forceful_banlines"] != "TRUE") 113 if ((string)GridRespData["allow_forceful_banlines"] != "TRUE")
114 { 114 {
115 forcefulBanLines = false; 115 forcefulBanLines = false;
116 } 116 }
117 } 117 }
118 118
119 } 119 }
120 return true; 120 return true;
121 } 121 }
122 122
123 public bool DeregisterRegion(string gridServerURL, string sendKey, string receiveKey, RegionInfo regionInfo, out string errorMsg) 123 public bool DeregisterRegion(string gridServerURL, string sendKey, string receiveKey, RegionInfo regionInfo, out string errorMsg)
124 { 124 {
125 errorMsg = ""; 125 errorMsg = "";
126 Hashtable GridParams = new Hashtable(); 126 Hashtable GridParams = new Hashtable();
127 127
128 GridParams["UUID"] = regionInfo.RegionID.ToString(); 128 GridParams["UUID"] = regionInfo.RegionID.ToString();
129 129
130 // Package into an XMLRPC Request 130 // Package into an XMLRPC Request
131 ArrayList SendParams = new ArrayList(); 131 ArrayList SendParams = new ArrayList();
132 SendParams.Add(GridParams); 132 SendParams.Add(GridParams);
133 133
134 // Send Request 134 // Send Request
135 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_after_region_moved", SendParams); 135 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_after_region_moved", SendParams);
136 XmlRpcResponse GridResp = null; 136 XmlRpcResponse GridResp = null;
137 137
138 try 138 try
139 { 139 {
140 GridResp = GridReq.Send(gridServerURL, 10000); 140 GridResp = GridReq.Send(gridServerURL, 10000);
141 } 141 }
142 catch (Exception e) 142 catch (Exception e)
143 { 143 {
144 Exception e2 144 Exception e2
145 = new Exception( 145 = new Exception(
146 String.Format( 146 String.Format(
147 "Unable to deregister region with grid at {0}. Grid service not running?", 147 "Unable to deregister region with grid at {0}. Grid service not running?",
148 gridServerURL), 148 gridServerURL),
149 e); 149 e);
150 150
151 throw e2; 151 throw e2;
152 } 152 }
153 153
154 Hashtable GridRespData = (Hashtable)GridResp.Value; 154 Hashtable GridRespData = (Hashtable)GridResp.Value;
155 155
156 // Hashtable griddatahash = GridRespData; 156 // Hashtable griddatahash = GridRespData;
157 157
158 // Process Response 158 // Process Response
159 if (GridRespData != null && GridRespData.ContainsKey("error")) 159 if (GridRespData != null && GridRespData.ContainsKey("error"))
160 { 160 {
161 errorMsg = (string)GridRespData["error"]; 161 errorMsg = (string)GridRespData["error"];
162 return false; 162 return false;
163 } 163 }
164 164
165 return true; 165 return true;
166 } 166 }
167 167
168 public bool RequestNeighborInfo(string gridServerURL, string sendKey, string receiveKey, UUID regionUUID, out RegionInfo regionInfo, out string errorMsg) 168 public bool RequestNeighborInfo(string gridServerURL, string sendKey, string receiveKey, UUID regionUUID, out RegionInfo regionInfo, out string errorMsg)
169 { 169 {
170 // didn't find it so far, we have to go the long way 170 // didn't find it so far, we have to go the long way
171 regionInfo = null; 171 regionInfo = null;
172 errorMsg = string.Empty; 172 errorMsg = string.Empty;
173 Hashtable requestData = new Hashtable(); 173 Hashtable requestData = new Hashtable();
174 requestData["region_UUID"] = regionUUID.ToString(); 174 requestData["region_UUID"] = regionUUID.ToString();
175 requestData["authkey"] = sendKey; 175 requestData["authkey"] = sendKey;
176 ArrayList SendParams = new ArrayList(); 176 ArrayList SendParams = new ArrayList();
177 SendParams.Add(requestData); 177 SendParams.Add(requestData);
178 XmlRpcRequest gridReq = new XmlRpcRequest("simulator_data_request", SendParams); 178 XmlRpcRequest gridReq = new XmlRpcRequest("simulator_data_request", SendParams);
179 XmlRpcResponse gridResp = null; 179 XmlRpcResponse gridResp = null;
180 180
181 try 181 try
182 { 182 {
183 gridResp = gridReq.Send(gridServerURL, 3000); 183 gridResp = gridReq.Send(gridServerURL, 3000);
184 } 184 }
185 catch (Exception e) 185 catch (Exception e)
186 { 186 {
187 errorMsg = e.Message; 187 errorMsg = e.Message;
188 return false; 188 return false;
189 } 189 }
190 190
191 Hashtable responseData = (Hashtable)gridResp.Value; 191 Hashtable responseData = (Hashtable)gridResp.Value;
192 192
193 if (responseData.ContainsKey("error")) 193 if (responseData.ContainsKey("error"))
194 { 194 {
195 errorMsg = (string)responseData["error"]; 195 errorMsg = (string)responseData["error"];
196 return false; ; 196 return false; ;
197 } 197 }
198 198
199 regionInfo = BuildRegionInfo(responseData, String.Empty); 199 regionInfo = BuildRegionInfo(responseData, String.Empty);
200 200
201 return true; 201 return true;
202 } 202 }
203 203
204 public bool RequestNeighborInfo(string gridServerURL, string sendKey, string receiveKey, ulong regionHandle, out RegionInfo regionInfo, out string errorMsg) 204 public bool RequestNeighborInfo(string gridServerURL, string sendKey, string receiveKey, ulong regionHandle, out RegionInfo regionInfo, out string errorMsg)
205 { 205 {
206 // didn't find it so far, we have to go the long way 206 // didn't find it so far, we have to go the long way
207 regionInfo = null; 207 regionInfo = null;
208 errorMsg = string.Empty; 208 errorMsg = string.Empty;
209 209
210 try 210 try
211 { 211 {
212 Hashtable requestData = new Hashtable(); 212 Hashtable requestData = new Hashtable();
213 requestData["region_handle"] = regionHandle.ToString(); 213 requestData["region_handle"] = regionHandle.ToString();
214 requestData["authkey"] = sendKey; 214 requestData["authkey"] = sendKey;
215 ArrayList SendParams = new ArrayList(); 215 ArrayList SendParams = new ArrayList();
216 SendParams.Add(requestData); 216 SendParams.Add(requestData);
217 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 217 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
218 XmlRpcResponse GridResp = GridReq.Send(gridServerURL, 3000); 218 XmlRpcResponse GridResp = GridReq.Send(gridServerURL, 3000);
219 219
220 Hashtable responseData = (Hashtable)GridResp.Value; 220 Hashtable responseData = (Hashtable)GridResp.Value;
221 221
222 if (responseData.ContainsKey("error")) 222 if (responseData.ContainsKey("error"))
223 { 223 {
224 errorMsg = (string)responseData["error"]; 224 errorMsg = (string)responseData["error"];
225 return false; 225 return false;
226 } 226 }
227 227
228 uint regX = Convert.ToUInt32((string)responseData["region_locx"]); 228 uint regX = Convert.ToUInt32((string)responseData["region_locx"]);
229 uint regY = Convert.ToUInt32((string)responseData["region_locy"]); 229 uint regY = Convert.ToUInt32((string)responseData["region_locy"]);
230 string externalHostName = (string)responseData["sim_ip"]; 230 string externalHostName = (string)responseData["sim_ip"];
231 uint simPort = Convert.ToUInt32(responseData["sim_port"]); 231 uint simPort = Convert.ToUInt32(responseData["sim_port"]);
232 string regionName = (string)responseData["region_name"]; 232 string regionName = (string)responseData["region_name"];
233 UUID regionID = new UUID((string)responseData["region_UUID"]); 233 UUID regionID = new UUID((string)responseData["region_UUID"]);
234 uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); 234 uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
235 235
236 uint httpPort = 9000; 236 uint httpPort = 9000;
237 if (responseData.ContainsKey("http_port")) 237 if (responseData.ContainsKey("http_port"))
238 { 238 {
239 httpPort = Convert.ToUInt32((string)responseData["http_port"]); 239 httpPort = Convert.ToUInt32((string)responseData["http_port"]);
240 } 240 }
241 241
242 // Ok, so this is definitively the wrong place to do this, way too hard coded, but it doesn't seem we GET this info? 242 // Ok, so this is definitively the wrong place to do this, way too hard coded, but it doesn't seem we GET this info?
243 243
244 string simURI = "http://" + externalHostName + ":" + simPort; 244 string simURI = "http://" + externalHostName + ":" + simPort;
245 245
246 // string externalUri = (string) responseData["sim_uri"]; 246 // string externalUri = (string) responseData["sim_uri"];
247 247
248 //IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); 248 //IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port);
249 regionInfo = RegionInfo.Create(regionID, regionName, regX, regY, externalHostName, httpPort, simPort, remotingPort, simURI); 249 regionInfo = RegionInfo.Create(regionID, regionName, regX, regY, externalHostName, httpPort, simPort, remotingPort, simURI);
250 } 250 }
251 catch (Exception e) 251 catch (Exception e)
252 { 252 {
253 errorMsg = e.Message; 253 errorMsg = e.Message;
254 return false; 254 return false;
255 } 255 }
256 256
257 return true; 257 return true;
258 } 258 }
259 259
260 public bool RequestClosestRegion(string gridServerURL, string sendKey, string receiveKey, string regionName, out RegionInfo regionInfo, out string errorMsg) 260 public bool RequestClosestRegion(string gridServerURL, string sendKey, string receiveKey, string regionName, out RegionInfo regionInfo, out string errorMsg)
261 { 261 {
262 regionInfo = null; 262 regionInfo = null;
263 errorMsg = string.Empty; 263 errorMsg = string.Empty;
264 try 264 try
265 { 265 {
266 Hashtable requestData = new Hashtable(); 266 Hashtable requestData = new Hashtable();
267 requestData["region_name_search"] = regionName; 267 requestData["region_name_search"] = regionName;
268 requestData["authkey"] = sendKey; 268 requestData["authkey"] = sendKey;
269 ArrayList SendParams = new ArrayList(); 269 ArrayList SendParams = new ArrayList();
270 SendParams.Add(requestData); 270 SendParams.Add(requestData);
271 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 271 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
272 XmlRpcResponse GridResp = GridReq.Send(gridServerURL, 3000); 272 XmlRpcResponse GridResp = GridReq.Send(gridServerURL, 3000);
273 273
274 Hashtable responseData = (Hashtable)GridResp.Value; 274 Hashtable responseData = (Hashtable)GridResp.Value;
275 275
276 if (responseData.ContainsKey("error")) 276 if (responseData.ContainsKey("error"))
277 { 277 {
278 errorMsg = (string)responseData["error"]; 278 errorMsg = (string)responseData["error"];
279 return false; 279 return false;
280 } 280 }
281 281
282 regionInfo = BuildRegionInfo(responseData, ""); 282 regionInfo = BuildRegionInfo(responseData, "");
283 283
284 } 284 }
285 catch (Exception e) 285 catch (Exception e)
286 { 286 {
287 errorMsg = e.Message; 287 errorMsg = e.Message;
288 return false; 288 return false;
289 } 289 }
290 return true; 290 return true;
291 } 291 }
292 292
293 /// <summary> 293 /// <summary>
294 /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates 294 /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates
295 /// </summary> 295 /// </summary>
296 /// <remarks>REDUNDANT - OGS1 is to be phased out in favour of OGS2</remarks> 296 /// <remarks>REDUNDANT - OGS1 is to be phased out in favour of OGS2</remarks>
297 /// <param name="minX">Minimum X value</param> 297 /// <param name="minX">Minimum X value</param>
298 /// <param name="minY">Minimum Y value</param> 298 /// <param name="minY">Minimum Y value</param>
299 /// <param name="maxX">Maximum X value</param> 299 /// <param name="maxX">Maximum X value</param>
300 /// <param name="maxY">Maximum Y value</param> 300 /// <param name="maxY">Maximum Y value</param>
301 /// <returns>Hashtable of hashtables containing map data elements</returns> 301 /// <returns>Hashtable of hashtables containing map data elements</returns>
302 public bool MapBlockQuery(string gridServerURL, int minX, int minY, int maxX, int maxY, out Hashtable respData, out string errorMsg) 302 public bool MapBlockQuery(string gridServerURL, int minX, int minY, int maxX, int maxY, out Hashtable respData, out string errorMsg)
303 { 303 {
304 respData = new Hashtable(); 304 respData = new Hashtable();
305 errorMsg = string.Empty; 305 errorMsg = string.Empty;
306 306
307 Hashtable param = new Hashtable(); 307 Hashtable param = new Hashtable();
308 param["xmin"] = minX; 308 param["xmin"] = minX;
309 param["ymin"] = minY; 309 param["ymin"] = minY;
310 param["xmax"] = maxX; 310 param["xmax"] = maxX;
311 param["ymax"] = maxY; 311 param["ymax"] = maxY;
312 IList parameters = new ArrayList(); 312 IList parameters = new ArrayList();
313 parameters.Add(param); 313 parameters.Add(param);
314 314
315 try 315 try
316 { 316 {
317 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); 317 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
318 XmlRpcResponse resp = req.Send(gridServerURL, 10000); 318 XmlRpcResponse resp = req.Send(gridServerURL, 10000);
319 respData = (Hashtable)resp.Value; 319 respData = (Hashtable)resp.Value;
320 return true; 320 return true;
321 } 321 }
322 catch (Exception e) 322 catch (Exception e)
323 { 323 {
324 errorMsg = e.Message; 324 errorMsg = e.Message;
325 return false; 325 return false;
326 } 326 }
327 } 327 }
328 328
329 public bool SearchRegionByName(string gridServerURL, IList parameters, out Hashtable respData, out string errorMsg) 329 public bool SearchRegionByName(string gridServerURL, IList parameters, out Hashtable respData, out string errorMsg)
330 { 330 {
331 respData = null; 331 respData = null;
332 errorMsg = string.Empty; 332 errorMsg = string.Empty;
333 try 333 try
334 { 334 {
335 XmlRpcRequest request = new XmlRpcRequest("search_for_region_by_name", parameters); 335 XmlRpcRequest request = new XmlRpcRequest("search_for_region_by_name", parameters);
336 XmlRpcResponse resp = request.Send(gridServerURL, 10000); 336 XmlRpcResponse resp = request.Send(gridServerURL, 10000);
337 respData = (Hashtable)resp.Value; 337 respData = (Hashtable)resp.Value;
338 if (respData != null && respData.Contains("faultCode")) 338 if (respData != null && respData.Contains("faultCode"))
339 { 339 {
340 errorMsg = (string)respData["faultString"]; 340 errorMsg = (string)respData["faultString"];
341 return false; 341 return false;
342 } 342 }
343 343
344 return true; 344 return true;
345 } 345 }
346 catch (Exception e) 346 catch (Exception e)
347 { 347 {
348 errorMsg = e.Message; 348 errorMsg = e.Message;
349 return false; 349 return false;
350 } 350 }
351 } 351 }
352 352
353 public RegionInfo BuildRegionInfo(Hashtable responseData, string prefix) 353 public RegionInfo BuildRegionInfo(Hashtable responseData, string prefix)
354 { 354 {
355 uint regX = Convert.ToUInt32((string)responseData[prefix + "region_locx"]); 355 uint regX = Convert.ToUInt32((string)responseData[prefix + "region_locx"]);
356 uint regY = Convert.ToUInt32((string)responseData[prefix + "region_locy"]); 356 uint regY = Convert.ToUInt32((string)responseData[prefix + "region_locy"]);
357 string internalIpStr = (string)responseData[prefix + "sim_ip"]; 357 string internalIpStr = (string)responseData[prefix + "sim_ip"];
358 uint port = Convert.ToUInt32(responseData[prefix + "sim_port"]); 358 uint port = Convert.ToUInt32(responseData[prefix + "sim_port"]);
359 359
360 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(Util.GetHostFromDNS(internalIpStr), (int)port); 360 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(Util.GetHostFromDNS(internalIpStr), (int)port);
361 361
362 RegionInfo regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); 362 RegionInfo regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
363 regionInfo.RemotingPort = Convert.ToUInt32((string)responseData[prefix + "remoting_port"]); 363 regionInfo.RemotingPort = Convert.ToUInt32((string)responseData[prefix + "remoting_port"]);
364 regionInfo.RemotingAddress = internalIpStr; 364 regionInfo.RemotingAddress = internalIpStr;
365 365
366 if (responseData.ContainsKey(prefix + "http_port")) 366 if (responseData.ContainsKey(prefix + "http_port"))
367 { 367 {
368 regionInfo.HttpPort = Convert.ToUInt32((string)responseData[prefix + "http_port"]); 368 regionInfo.HttpPort = Convert.ToUInt32((string)responseData[prefix + "http_port"]);
369 } 369 }
370 370
371 regionInfo.RegionID = new UUID((string)responseData[prefix + "region_UUID"]); 371 regionInfo.RegionID = new UUID((string)responseData[prefix + "region_UUID"]);
372 regionInfo.RegionName = (string)responseData[prefix + "region_name"]; 372 regionInfo.RegionName = (string)responseData[prefix + "region_name"];
373 373
374 regionInfo.RegionSettings.TerrainImageID = new UUID((string)responseData[prefix + "map_UUID"]); 374 regionInfo.RegionSettings.TerrainImageID = new UUID((string)responseData[prefix + "map_UUID"]);
375 return regionInfo; 375 return regionInfo;
376 } 376 }
377 } 377 }
378} 378}
diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
index f9076ab..3e7ec73 100644
--- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
+++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
@@ -1,113 +1,113 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Net; 30using System.Net;
31using System.Reflection; 31using System.Reflection;
32using System.Text; 32using System.Text;
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenMetaverse.StructuredData; 36using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Services; 39using OpenSim.Framework.Communications.Services;
40using OpenSim.Framework.Communications.Cache; 40using OpenSim.Framework.Communications.Cache;
41using OpenSim.Framework.Console; 41using OpenSim.Framework.Console;
42using OpenSim.Framework.Servers; 42using OpenSim.Framework.Servers;
43using OpenSim.Framework.Servers.HttpServer; 43using OpenSim.Framework.Servers.HttpServer;
44using OpenSim.Framework.Statistics; 44using OpenSim.Framework.Statistics;
45using OpenSim.Region.Framework; 45using OpenSim.Region.Framework;
46using OpenSim.Region.Framework.Interfaces; 46using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes; 47using OpenSim.Region.Framework.Scenes;
48 48
49 49
50 50
51namespace OpenSim.Region.Framework.Scenes 51namespace OpenSim.Region.Framework.Scenes
52{ 52{
53 53
54 54
55 public class RegionStatsHandler : IStreamedRequestHandler 55 public class RegionStatsHandler : IStreamedRequestHandler
56 { 56 {
57 private string osRXStatsURI = String.Empty; 57 private string osRXStatsURI = String.Empty;
58 private string osXStatsURI = String.Empty; 58 private string osXStatsURI = String.Empty;
59 //private string osSecret = String.Empty; 59 //private string osSecret = String.Empty;
60 private OpenSim.Framework.RegionInfo regionInfo; 60 private OpenSim.Framework.RegionInfo regionInfo;
61 public string localZone = TimeZone.CurrentTimeZone.StandardName; 61 public string localZone = TimeZone.CurrentTimeZone.StandardName;
62 public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); 62 public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
63 63
64 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 64 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
65 65
66 public RegionStatsHandler(OpenSim.Framework.RegionInfo region_info ) 66 public RegionStatsHandler(OpenSim.Framework.RegionInfo region_info )
67 { 67 {
68 regionInfo = region_info; 68 regionInfo = region_info;
69 osRXStatsURI = Util.SHA1Hash(regionInfo.regionSecret); 69 osRXStatsURI = Util.SHA1Hash(regionInfo.regionSecret);
70 osXStatsURI = Util.SHA1Hash(regionInfo.osSecret); 70 osXStatsURI = Util.SHA1Hash(regionInfo.osSecret);
71 71
72 } 72 }
73 73
74 public byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) 74 public byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
75 { 75 {
76 return Encoding.UTF8.GetBytes(Report()); 76 return Encoding.UTF8.GetBytes(Report());
77 } 77 }
78 78
79 public string ContentType 79 public string ContentType
80 { 80 {
81 get { return "text/plain"; } 81 get { return "text/plain"; }
82 } 82 }
83 83
84 public string HttpMethod 84 public string HttpMethod
85 { 85 {
86 get { return "GET"; } 86 get { return "GET"; }
87 } 87 }
88 88
89 public string Path 89 public string Path
90 { 90 {
91 // This is for the region and is the regionSecret hashed 91 // This is for the region and is the regionSecret hashed
92 get { return "/" + osRXStatsURI + "/"; } 92 get { return "/" + osRXStatsURI + "/"; }
93 } 93 }
94 94
95 private string Report() 95 private string Report()
96 { 96 {
97 OSDMap args = new OSDMap(30); 97 OSDMap args = new OSDMap(30);
98 //int time = Util.ToUnixTime( DateTime.Now ); 98 //int time = Util.ToUnixTime( DateTime.Now );
99 args["OSStatsURI"] = OSD.FromString("http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/" + osXStatsURI + "/"); 99 args["OSStatsURI"] = OSD.FromString("http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/" + osXStatsURI + "/");
100 args["TimeZoneName"] = OSD.FromString(localZone); 100 args["TimeZoneName"] = OSD.FromString(localZone);
101 args["TimeZoneOffs"] = OSD.FromReal(utcOffset.TotalHours); 101 args["TimeZoneOffs"] = OSD.FromReal(utcOffset.TotalHours);
102 args["UxTime"] = OSD.FromInteger(Util.ToUnixTime(DateTime.Now)); 102 args["UxTime"] = OSD.FromInteger(Util.ToUnixTime(DateTime.Now));
103 args["Memory"] = OSD.FromReal(Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)); 103 args["Memory"] = OSD.FromReal(Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0));
104 args["Version"] = OSD.FromString(VersionInfo.Version); 104 args["Version"] = OSD.FromString(VersionInfo.Version);
105 105
106 string strBuffer = ""; 106 string strBuffer = "";
107 strBuffer = OSDParser.SerializeJsonString(args); 107 strBuffer = OSDParser.SerializeJsonString(args);
108 108
109 return strBuffer; 109 return strBuffer;
110 110
111 } 111 }
112 } 112 }
113} 113}