aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/GridServer')
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs274
-rw-r--r--OpenSim/Grid/GridServer/Main.cs37
-rw-r--r--OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs31
3 files changed, 183 insertions, 159 deletions
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 8ac7d6a..0d966dd 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -25,27 +25,24 @@
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*/
28
28using System; 29using System;
29using System.Collections; 30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Xml; 33using System.Xml;
34using libsecondlife; 34using libsecondlife;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
36using OpenSim.Framework;
36using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
37using OpenSim.Framework.Data; 38using OpenSim.Framework.Data;
38using OpenSim.Framework.Interfaces;
39using OpenSim.Framework;
40
41using OpenSim.Framework;
42 39
43namespace OpenSim.Grid.GridServer 40namespace OpenSim.Grid.GridServer
44{ 41{
45 class GridManager 42 internal class GridManager
46 { 43 {
47 Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); 44 private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
48 Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); 45 private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
49 46
50 public GridConfig config; 47 public GridConfig config;
51 48
@@ -54,13 +51,13 @@ namespace OpenSim.Grid.GridServer
54 /// </summary> 51 /// </summary>
55 /// <param name="FileName">The filename to the grid server plugin DLL</param> 52 /// <param name="FileName">The filename to the grid server plugin DLL</param>
56 public void AddPlugin(string FileName) 53 public void AddPlugin(string FileName)
57 { 54 {
58 MainLog.Instance.Verbose("Storage: Attempting to load " + FileName); 55 MainLog.Instance.Verbose("Storage: Attempting to load " + FileName);
59 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 56 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
60 57
61 MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); 58 MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
62 foreach (Type pluginType in pluginAssembly.GetTypes()) 59 foreach (Type pluginType in pluginAssembly.GetTypes())
63 { 60 {
64 if (!pluginType.IsAbstract) 61 if (!pluginType.IsAbstract)
65 { 62 {
66 // Regions go here 63 // Regions go here
@@ -68,9 +65,10 @@ namespace OpenSim.Grid.GridServer
68 65
69 if (typeInterface != null) 66 if (typeInterface != null)
70 { 67 {
71 IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 68 IGridData plug =
69 (IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
72 plug.Initialise(); 70 plug.Initialise();
73 this._plugins.Add(plug.getName(), plug); 71 _plugins.Add(plug.getName(), plug);
74 MainLog.Instance.Verbose("Storage: Added IGridData Interface"); 72 MainLog.Instance.Verbose("Storage: Added IGridData Interface");
75 } 73 }
76 74
@@ -81,17 +79,18 @@ namespace OpenSim.Grid.GridServer
81 79
82 if (typeInterface != null) 80 if (typeInterface != null)
83 { 81 {
84 ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 82 ILogData plug =
83 (ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
85 plug.Initialise(); 84 plug.Initialise();
86 this._logplugins.Add(plug.getName(), plug); 85 _logplugins.Add(plug.getName(), plug);
87 MainLog.Instance.Verbose( "Storage: Added ILogData Interface"); 86 MainLog.Instance.Verbose("Storage: Added ILogData Interface");
88 } 87 }
89 88
90 typeInterface = null; 89 typeInterface = null;
91 } 90 }
92 } 91 }
93 92
94 pluginAssembly = null; 93 pluginAssembly = null;
95 } 94 }
96 95
97 /// <summary> 96 /// <summary>
@@ -124,7 +123,8 @@ namespace OpenSim.Grid.GridServer
124 /// <returns>A SimProfileData for the region</returns> 123 /// <returns>A SimProfileData for the region</returns>
125 public RegionProfileData getRegion(LLUUID uuid) 124 public RegionProfileData getRegion(LLUUID uuid)
126 { 125 {
127 foreach(KeyValuePair<string,IGridData> kvp in _plugins) { 126 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
127 {
128 try 128 try
129 { 129 {
130 return kvp.Value.GetProfileByLLUUID(uuid); 130 return kvp.Value.GetProfileByLLUUID(uuid);
@@ -182,7 +182,6 @@ namespace OpenSim.Grid.GridServer
182 } 182 }
183 183
184 184
185
186 /// <summary> 185 /// <summary>
187 /// Returns a XML String containing a list of the neighbouring regions 186 /// Returns a XML String containing a list of the neighbouring regions
188 /// </summary> 187 /// </summary>
@@ -193,11 +192,18 @@ namespace OpenSim.Grid.GridServer
193 string response = ""; 192 string response = "";
194 RegionProfileData central_region = getRegion(reqhandle); 193 RegionProfileData central_region = getRegion(reqhandle);
195 RegionProfileData neighbour; 194 RegionProfileData neighbour;
196 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) 195 for (int x = -1; x < 2; x++)
196 for (int y = -1; y < 2; y++)
197 { 197 {
198 if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null) 198 if (
199 getRegion(
200 Util.UIntsToLong((uint) ((central_region.regionLocX + x)*256),
201 (uint) (central_region.regionLocY + y)*256)) != null)
199 { 202 {
200 neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)); 203 neighbour =
204 getRegion(
205 Util.UIntsToLong((uint) ((central_region.regionLocX + x)*256),
206 (uint) (central_region.regionLocY + y)*256));
201 response += "<neighbour>"; 207 response += "<neighbour>";
202 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; 208 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
203 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; 209 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
@@ -205,7 +211,6 @@ namespace OpenSim.Grid.GridServer
205 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; 211 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>";
206 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; 212 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>";
207 response += "</neighbour>"; 213 response += "</neighbour>";
208
209 } 214 }
210 } 215 }
211 return response; 216 return response;
@@ -218,23 +223,21 @@ namespace OpenSim.Grid.GridServer
218 /// <returns>Startup parameters</returns> 223 /// <returns>Startup parameters</returns>
219 public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) 224 public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request)
220 { 225 {
221
222 XmlRpcResponse response = new XmlRpcResponse(); 226 XmlRpcResponse response = new XmlRpcResponse();
223 Hashtable responseData = new Hashtable(); 227 Hashtable responseData = new Hashtable();
224 response.Value = responseData; 228 response.Value = responseData;
225 229
226 RegionProfileData TheSim = null; 230 RegionProfileData TheSim = null;
227 Hashtable requestData = (Hashtable)request.Params[0]; 231 Hashtable requestData = (Hashtable) request.Params[0];
228 string myword; 232 string myword;
229 if (requestData.ContainsKey("UUID")) 233 if (requestData.ContainsKey("UUID"))
230 { 234 {
231 TheSim = getRegion(new LLUUID((string)requestData["UUID"])); 235 TheSim = getRegion(new LLUUID((string) requestData["UUID"]));
232 236
233// logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID."); 237// logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID.");
234 } 238 }
235 else if (requestData.ContainsKey("region_handle")) 239 else if (requestData.ContainsKey("region_handle"))
236 { 240 {
237
238// TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); 241// TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
239// logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle."); 242// logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle.");
240 } 243 }
@@ -254,65 +257,68 @@ namespace OpenSim.Grid.GridServer
254 myword = "connection"; 257 myword = "connection";
255 } 258 }
256 259
257 TheSim = new RegionProfileData(); 260 TheSim = new RegionProfileData();
258 261
259 TheSim.regionRecvKey = config.SimRecvKey; 262 TheSim.regionRecvKey = config.SimRecvKey;
260 TheSim.regionSendKey = config.SimSendKey; 263 TheSim.regionSendKey = config.SimSendKey;
261 TheSim.regionSecret = config.SimRecvKey; 264 TheSim.regionSecret = config.SimRecvKey;
262 TheSim.regionDataURI = ""; 265 TheSim.regionDataURI = "";
263 TheSim.regionAssetURI = config.DefaultAssetServer; 266 TheSim.regionAssetURI = config.DefaultAssetServer;
264 TheSim.regionAssetRecvKey = config.AssetRecvKey; 267 TheSim.regionAssetRecvKey = config.AssetRecvKey;
265 TheSim.regionAssetSendKey = config.AssetSendKey; 268 TheSim.regionAssetSendKey = config.AssetSendKey;
266 TheSim.regionUserURI = config.DefaultUserServer; 269 TheSim.regionUserURI = config.DefaultUserServer;
267 TheSim.regionUserSendKey = config.UserSendKey; 270 TheSim.regionUserSendKey = config.UserSendKey;
268 TheSim.regionUserRecvKey = config.UserRecvKey; 271 TheSim.regionUserRecvKey = config.UserRecvKey;
269
270 TheSim.serverIP = (string)requestData["sim_ip"];
271 TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
272 TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
273 TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
274 TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
275 TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
276 TheSim.regionLocZ = 0;
277 TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]);
278
279 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
280 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
281 System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.serverURI);
282 TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
283
284
285 TheSim.regionName = (string)requestData["sim_name"];
286 TheSim.UUID = new LLUUID((string)requestData["UUID"]);
287 272
288 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 273 TheSim.serverIP = (string) requestData["sim_ip"];
274 TheSim.serverPort = Convert.ToUInt32((string) requestData["sim_port"]);
275 TheSim.httpPort = Convert.ToUInt32((string) requestData["http_port"]);
276 TheSim.remotingPort = Convert.ToUInt32((string) requestData["remoting_port"]);
277 TheSim.regionLocX = Convert.ToUInt32((string) requestData["region_locx"]);
278 TheSim.regionLocY = Convert.ToUInt32((string) requestData["region_locy"]);
279 TheSim.regionLocZ = 0;
280 TheSim.regionMapTextureID = new LLUUID((string) requestData["map-image-id"]);
281
282 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256));
283 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
284 Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " +
285 TheSim.serverURI);
286 TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
287
288
289 TheSim.regionName = (string) requestData["sim_name"];
290 TheSim.UUID = new LLUUID((string) requestData["UUID"]);
291
292 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
293 {
294 try
289 { 295 {
290 try 296 DataResponse insertResponse = kvp.Value.AddProfile(TheSim);
291 { 297 switch (insertResponse)
292 DataResponse insertResponse = kvp.Value.AddProfile(TheSim);
293 switch(insertResponse)
294 {
295 case DataResponse.RESPONSE_OK:
296 OpenSim.Framework.Console.MainLog.Instance.Verbose("grid", "New sim " + myword + " successful: " + TheSim.regionName);
297 break;
298 case DataResponse.RESPONSE_ERROR:
299 OpenSim.Framework.Console.MainLog.Instance.Warn("storage", "New sim creation failed (Error): " + TheSim.regionName);
300 break;
301 case DataResponse.RESPONSE_INVALIDCREDENTIALS:
302 OpenSim.Framework.Console.MainLog.Instance.Warn("storage", "New sim creation failed (Invalid Credentials): " + TheSim.regionName);
303 break;
304 case DataResponse.RESPONSE_AUTHREQUIRED:
305 OpenSim.Framework.Console.MainLog.Instance.Warn("storage", "New sim creation failed (Authentication Required): " + TheSim.regionName);
306 break;
307 }
308
309 }
310 catch (Exception e)
311 { 298 {
312 OpenSim.Framework.Console.MainLog.Instance.Warn("storage", "Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key); 299 case DataResponse.RESPONSE_OK:
313 OpenSim.Framework.Console.MainLog.Instance.Warn("storage", e.ToString()); 300 MainLog.Instance.Verbose("grid", "New sim " + myword + " successful: " + TheSim.regionName);
301 break;
302 case DataResponse.RESPONSE_ERROR:
303 MainLog.Instance.Warn("storage", "New sim creation failed (Error): " + TheSim.regionName);
304 break;
305 case DataResponse.RESPONSE_INVALIDCREDENTIALS:
306 MainLog.Instance.Warn("storage",
307 "New sim creation failed (Invalid Credentials): " + TheSim.regionName);
308 break;
309 case DataResponse.RESPONSE_AUTHREQUIRED:
310 MainLog.Instance.Warn("storage",
311 "New sim creation failed (Authentication Required): " +
312 TheSim.regionName);
313 break;
314 } 314 }
315 315 }
316 catch (Exception e)
317 {
318 MainLog.Instance.Warn("storage",
319 "Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key);
320 MainLog.Instance.Warn("storage", e.ToString());
321 }
316 322
317 323
318 if (getRegion(TheSim.regionHandle) == null) 324 if (getRegion(TheSim.regionHandle) == null)
@@ -321,7 +327,7 @@ namespace OpenSim.Grid.GridServer
321 return response; 327 return response;
322 } 328 }
323 } 329 }
324 330
325 331
326 ArrayList SimNeighboursData = new ArrayList(); 332 ArrayList SimNeighboursData = new ArrayList();
327 333
@@ -332,7 +338,9 @@ namespace OpenSim.Grid.GridServer
332 338
333 if (fastMode) 339 if (fastMode)
334 { 340 {
335 Dictionary<ulong, RegionProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1); 341 Dictionary<ulong, RegionProfileData> neighbours =
342 getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1,
343 TheSim.regionLocY + 1);
336 344
337 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) 345 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
338 { 346 {
@@ -349,11 +357,18 @@ namespace OpenSim.Grid.GridServer
349 } 357 }
350 else 358 else
351 { 359 {
352 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) 360 for (int x = -1; x < 2; x++)
361 for (int y = -1; y < 2; y++)
353 { 362 {
354 if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null) 363 if (
364 getRegion(
365 Helpers.UIntsToLong((uint) ((TheSim.regionLocX + x)*256),
366 (uint) (TheSim.regionLocY + y)*256)) != null)
355 { 367 {
356 neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)); 368 neighbour =
369 getRegion(
370 Helpers.UIntsToLong((uint) ((TheSim.regionLocX + x)*256),
371 (uint) (TheSim.regionLocY + y)*256));
357 372
358 NeighbourBlock = new Hashtable(); 373 NeighbourBlock = new Hashtable();
359 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString(); 374 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
@@ -386,24 +401,24 @@ namespace OpenSim.Grid.GridServer
386 401
387 // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) 402 // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap)
388 responseData["data_uri"] = TheSim.regionDataURI; 403 responseData["data_uri"] = TheSim.regionDataURI;
389
390 404
391 return response; 405
406 return response;
392 } 407 }
393 408
394 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) 409 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
395 { 410 {
396 Hashtable requestData = (Hashtable)request.Params[0]; 411 Hashtable requestData = (Hashtable) request.Params[0];
397 Hashtable responseData = new Hashtable(); 412 Hashtable responseData = new Hashtable();
398 RegionProfileData simData = null; 413 RegionProfileData simData = null;
399 if (requestData.ContainsKey("region_UUID")) 414 if (requestData.ContainsKey("region_UUID"))
400 { 415 {
401 simData = getRegion(new LLUUID((string)requestData["region_UUID"])); 416 simData = getRegion(new LLUUID((string) requestData["region_UUID"]));
402 } 417 }
403 else if (requestData.ContainsKey("region_handle")) 418 else if (requestData.ContainsKey("region_handle"))
404 { 419 {
405 Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]); 420 Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]);
406 simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); 421 simData = getRegion(Convert.ToUInt64((string) requestData["region_handle"]));
407 } 422 }
408 423
409 if (simData == null) 424 if (simData == null)
@@ -419,7 +434,7 @@ namespace OpenSim.Grid.GridServer
419 responseData["sim_port"] = simData.serverPort.ToString(); 434 responseData["sim_port"] = simData.serverPort.ToString();
420 responseData["http_port"] = simData.httpPort.ToString(); 435 responseData["http_port"] = simData.httpPort.ToString();
421 responseData["remoting_port"] = simData.remotingPort.ToString(); 436 responseData["remoting_port"] = simData.remotingPort.ToString();
422 responseData["region_locx"] = simData.regionLocX.ToString() ; 437 responseData["region_locx"] = simData.regionLocX.ToString();
423 responseData["region_locy"] = simData.regionLocY.ToString(); 438 responseData["region_locy"] = simData.regionLocY.ToString();
424 responseData["region_UUID"] = simData.UUID.UUID.ToString(); 439 responseData["region_UUID"] = simData.UUID.UUID.ToString();
425 responseData["region_name"] = simData.regionName; 440 responseData["region_name"] = simData.regionName;
@@ -432,24 +447,24 @@ namespace OpenSim.Grid.GridServer
432 447
433 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) 448 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request)
434 { 449 {
435 int xmin=980, ymin=980, xmax=1020, ymax=1020; 450 int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020;
436 451
437 Hashtable requestData = (Hashtable)request.Params[0]; 452 Hashtable requestData = (Hashtable) request.Params[0];
438 if (requestData.ContainsKey("xmin")) 453 if (requestData.ContainsKey("xmin"))
439 { 454 {
440 xmin = (Int32)requestData["xmin"]; 455 xmin = (Int32) requestData["xmin"];
441 } 456 }
442 if (requestData.ContainsKey("ymin")) 457 if (requestData.ContainsKey("ymin"))
443 { 458 {
444 ymin = (Int32)requestData["ymin"]; 459 ymin = (Int32) requestData["ymin"];
445 } 460 }
446 if (requestData.ContainsKey("xmax")) 461 if (requestData.ContainsKey("xmax"))
447 { 462 {
448 xmax = (Int32)requestData["xmax"]; 463 xmax = (Int32) requestData["xmax"];
449 } 464 }
450 if (requestData.ContainsKey("ymax")) 465 if (requestData.ContainsKey("ymax"))
451 { 466 {
452 ymax = (Int32)requestData["ymax"]; 467 ymax = (Int32) requestData["ymax"];
453 } 468 }
454 469
455 XmlRpcResponse response = new XmlRpcResponse(); 470 XmlRpcResponse response = new XmlRpcResponse();
@@ -461,14 +476,16 @@ namespace OpenSim.Grid.GridServer
461 476
462 if (fastMode) 477 if (fastMode)
463 { 478 {
464 Dictionary<ulong, RegionProfileData> neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); 479 Dictionary<ulong, RegionProfileData> neighbours =
480 getRegions((uint) xmin, (uint) ymin, (uint) xmax, (uint) ymax);
465 481
466 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) 482 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
467 { 483 {
468 Hashtable simProfileBlock = new Hashtable(); 484 Hashtable simProfileBlock = new Hashtable();
469 simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); 485 simProfileBlock["x"] = aSim.Value.regionLocX.ToString();
470 simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); 486 simProfileBlock["y"] = aSim.Value.regionLocY.ToString();
471 System.Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + aSim.Value.regionLocY.ToString()); 487 Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " +
488 aSim.Value.regionLocY.ToString());
472 simProfileBlock["name"] = aSim.Value.regionName; 489 simProfileBlock["name"] = aSim.Value.regionName;
473 simProfileBlock["access"] = 21; 490 simProfileBlock["access"] = 21;
474 simProfileBlock["region-flags"] = 512; 491 simProfileBlock["region-flags"] = 512;
@@ -486,16 +503,17 @@ namespace OpenSim.Grid.GridServer
486 503
487 simProfileList.Add(simProfileBlock); 504 simProfileList.Add(simProfileBlock);
488 } 505 }
489 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode"); 506 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() +
507 " region(s) in range via FastMode");
490 } 508 }
491 else 509 else
492 { 510 {
493 RegionProfileData simProfile; 511 RegionProfileData simProfile;
494 for (int x = xmin; x < xmax+1; x++) 512 for (int x = xmin; x < xmax + 1; x++)
495 { 513 {
496 for (int y = ymin; y < ymax+1; y++) 514 for (int y = ymin; y < ymax + 1; y++)
497 { 515 {
498 ulong regHandle = Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256)); 516 ulong regHandle = Helpers.UIntsToLong((uint) (x*256), (uint) (y*256));
499 simProfile = getRegion(regHandle); 517 simProfile = getRegion(regHandle);
500 if (simProfile != null) 518 if (simProfile != null)
501 { 519 {
@@ -520,7 +538,8 @@ namespace OpenSim.Grid.GridServer
520 } 538 }
521 } 539 }
522 } 540 }
523 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode"); 541 MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() +
542 " region(s) in range via Standard Mode");
524 } 543 }
525 544
526 responseData["sim-profiles"] = simProfileList; 545 responseData["sim-profiles"] = simProfileList;
@@ -529,7 +548,6 @@ namespace OpenSim.Grid.GridServer
529 } 548 }
530 549
531 550
532
533 /// <summary> 551 /// <summary>
534 /// Performs a REST Get Operation 552 /// Performs a REST Get Operation
535 /// </summary> 553 /// </summary>
@@ -654,13 +672,13 @@ namespace OpenSim.Grid.GridServer
654 break; 672 break;
655 673
656 case "region_locx": 674 case "region_locx":
657 TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); 675 TheSim.regionLocX = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText);
658 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); 676 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256));
659 break; 677 break;
660 678
661 case "region_locy": 679 case "region_locy":
662 TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); 680 TheSim.regionLocY = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText);
663 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); 681 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256));
664 break; 682 break;
665 } 683 }
666 } 684 }
@@ -670,7 +688,10 @@ namespace OpenSim.Grid.GridServer
670 bool requirePublic = false; 688 bool requirePublic = false;
671 bool requireValid = true; 689 bool requireValid = true;
672 690
673 if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255."))) 691 if (requirePublic &&
692 (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") ||
693 TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") ||
694 TheSim.serverIP.StartsWith("255.")))
674 { 695 {
675 return "ERROR! Servers must register with public addresses."; 696 return "ERROR! Servers must register with public addresses.";
676 } 697 }
@@ -680,7 +701,7 @@ namespace OpenSim.Grid.GridServer
680 return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again"; 701 return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again";
681 } 702 }
682 703
683 704
684 try 705 try
685 { 706 {
686 MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered."); 707 MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered.");
@@ -689,22 +710,28 @@ namespace OpenSim.Grid.GridServer
689 try 710 try
690 { 711 {
691 //Check reservations 712 //Check reservations
692 ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY); 713 ReservationData reserveData =
693 if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) 714 kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY);
715 if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) ||
716 (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey))
694 { 717 {
695 kvp.Value.AddProfile(TheSim); 718 kvp.Value.AddProfile(TheSim);
696 MainLog.Instance.Verbose("grid", "New sim added to grid (" + TheSim.regionName + ")"); 719 MainLog.Instance.Verbose("grid", "New sim added to grid (" + TheSim.regionName + ")");
697 logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid."); 720 logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5,
721 "Region successfully updated and connected to grid.");
698 } 722 }
699 else 723 else
700 { 724 {
701 MainLog.Instance.Warn("grid", "Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");// Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); 725 MainLog.Instance.Warn("grid",
726 "Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");
727 // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + ".");
702 return "Unable to update region (RestSetSimMethod): Incorrect auth key."; 728 return "Unable to update region (RestSetSimMethod): Incorrect auth key.";
703 } 729 }
704 } 730 }
705 catch (Exception e) 731 catch (Exception e)
706 { 732 {
707 MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString()); 733 MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " +
734 e.ToString());
708 } 735 }
709 } 736 }
710 return "OK"; 737 return "OK";
@@ -714,6 +741,5 @@ namespace OpenSim.Grid.GridServer
714 return "ERROR! Could not save to database! (" + e.ToString() + ")"; 741 return "ERROR! Could not save to database! (" + e.ToString() + ")";
715 } 742 }
716 } 743 }
717
718 } 744 }
719} 745} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs
index ae1e244..9b1892d 100644
--- a/OpenSim/Grid/GridServer/Main.cs
+++ b/OpenSim/Grid/GridServer/Main.cs
@@ -28,16 +28,10 @@
28 28
29using System; 29using System;
30using System.IO; 30using System.IO;
31using System.Reflection;
32using System.Threading;
33using System.Timers; 31using System.Timers;
32using OpenSim.Framework;
34using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Servers; 34using OpenSim.Framework.Servers;
37using OpenSim.Framework;
38using OpenSim.Framework;
39
40using Timer=System.Timers.Timer;
41 35
42namespace OpenSim.Grid.GridServer 36namespace OpenSim.Grid.GridServer
43{ 37{
@@ -90,10 +84,9 @@ namespace OpenSim.Grid.GridServer
90 { 84 {
91 Directory.CreateDirectory(Util.logDir()); 85 Directory.CreateDirectory(Util.logDir());
92 } 86 }
93 m_console = new LogBase((Path.Combine(Util.logDir(),"opengrid-gridserver-console.log")), "OpenGrid", this, true); 87 m_console =
88 new LogBase((Path.Combine(Util.logDir(), "opengrid-gridserver-console.log")), "OpenGrid", this, true);
94 MainLog.Instance = m_console; 89 MainLog.Instance = m_console;
95
96
97 } 90 }
98 91
99 public void managercallback(string cmd) 92 public void managercallback(string cmd)
@@ -109,28 +102,28 @@ namespace OpenSim.Grid.GridServer
109 102
110 public void Startup() 103 public void Startup()
111 { 104 {
112 105 Cfg = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
113 this.Cfg = new GridConfig("GRID SERVER",(Path.Combine(Util.configDir(),"GridServer_Config.xml"))); //Yeah srsly, that's it. 106 //Yeah srsly, that's it.
114 if (setuponly) Environment.Exit(0); 107 if (setuponly) Environment.Exit(0);
115 108
116 m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); 109 m_console.Verbose("Main.cs:Startup() - Connecting to Storage Server");
117 m_gridManager = new GridManager(); 110 m_gridManager = new GridManager();
118 m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win 111 m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win
119 m_gridManager.config = Cfg; 112 m_gridManager.config = Cfg;
120 113
121 m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); 114 m_console.Verbose("Main.cs:Startup() - Starting HTTP process");
122 BaseHttpServer httpServer = new BaseHttpServer((int)Cfg.HttpPort); 115 BaseHttpServer httpServer = new BaseHttpServer((int) Cfg.HttpPort);
123 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); 116 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback);
124 117
125 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); 118 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod);
126 httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); 119 httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod);
127 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); 120 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod);
128 121
129 httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod )); 122 httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod));
130 httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod )); 123 httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod));
131 124
132 httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod )); 125 httpServer.AddStreamHandler(new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod));
133 httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod )); 126 httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod));
134 127
135 //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); 128 //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod);
136 //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); 129 //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod);
@@ -139,9 +132,9 @@ namespace OpenSim.Grid.GridServer
139 132
140 httpServer.Start(); 133 httpServer.Start();
141 134
142 m_console.Verbose( "Main.cs:Startup() - Starting sim status checker"); 135 m_console.Verbose("Main.cs:Startup() - Starting sim status checker");
143 136
144 Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. 137 Timer simCheckTimer = new Timer(3600000*3); // 3 Hours between updates.
145 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); 138 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
146 simCheckTimer.Enabled = true; 139 simCheckTimer.Enabled = true;
147 } 140 }
@@ -225,4 +218,4 @@ namespace OpenSim.Grid.GridServer
225 } 218 }
226 }*/ 219 }*/
227 } 220 }
228} 221} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
index 5059199..d46be9e 100644
--- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
@@ -1,4 +1,4 @@
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*
@@ -27,25 +27,29 @@
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30
30// General Information about an assembly is controlled through the following 31// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 32// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 33// associated with an assembly.
33[assembly: AssemblyTitle("OGS-GridServer")] 34
34[assembly: AssemblyDescription("")] 35[assembly : AssemblyTitle("OGS-GridServer")]
35[assembly: AssemblyConfiguration("")] 36[assembly : AssemblyDescription("")]
36[assembly: AssemblyCompany("")] 37[assembly : AssemblyConfiguration("")]
37[assembly: AssemblyProduct("OGS-GridServer")] 38[assembly : AssemblyCompany("")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 39[assembly : AssemblyProduct("OGS-GridServer")]
39[assembly: AssemblyTrademark("")] 40[assembly : AssemblyCopyright("Copyright © 2007")]
40[assembly: AssemblyCulture("")] 41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
41 43
42// Setting ComVisible to false makes the types in this assembly not visible 44// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 45// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 46// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 47
48[assembly : ComVisible(false)]
46 49
47// The following GUID is for the ID of the typelib if this project is exposed to COM 50// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] 51
52[assembly : Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
49 53
50// Version information for an assembly consists of the following four values: 54// Version information for an assembly consists of the following four values:
51// 55//
@@ -54,5 +58,6 @@ using System.Runtime.InteropServices;
54// Build Number 58// Build Number
55// Revision 59// Revision
56// 60//
57[assembly: AssemblyVersion("1.0.0.0")] 61
58[assembly: AssemblyFileVersion("1.0.0.0")] 62[assembly : AssemblyVersion("1.0.0.0")]
63[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file