aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs81
1 files changed, 56 insertions, 25 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 918544f..67a65ff 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -341,26 +341,54 @@ namespace OpenSim.Services.Connectors.SimianGrid
341 341
342 public List<GridRegion> GetHyperlinks(UUID scopeID) 342 public List<GridRegion> GetHyperlinks(UUID scopeID)
343 { 343 {
344 // Hypergrid/linked regions are not supported 344 List<GridRegion> foundRegions = new List<GridRegion>();
345 return new List<GridRegion>(); 345
346 NameValueCollection requestArgs = new NameValueCollection
347 {
348 { "RequestMethod", "GetScenes" },
349 { "HyperGrid", "true" },
350 { "Enabled", "1" }
351 };
352
353 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
354 if (response["Success"].AsBoolean())
355 {
356 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name);
357
358 OSDArray array = response["Scenes"] as OSDArray;
359 if (array != null)
360 {
361 for (int i = 0; i < array.Count; i++)
362 {
363 GridRegion region = ResponseToGridRegion(array[i] as OSDMap);
364 if (region != null)
365 foundRegions.Add(region);
366 }
367 }
368 }
369
370 return foundRegions;
346 } 371 }
347 372
348 public int GetRegionFlags(UUID scopeID, UUID regionID) 373 public int GetRegionFlags(UUID scopeID, UUID regionID)
349 { 374 {
350 const int REGION_ONLINE = 4;
351
352 NameValueCollection requestArgs = new NameValueCollection 375 NameValueCollection requestArgs = new NameValueCollection
353 { 376 {
354 { "RequestMethod", "GetScene" }, 377 { "RequestMethod", "GetScene" },
355 { "SceneID", regionID.ToString() } 378 { "SceneID", regionID.ToString() }
356 }; 379 };
357 380
358 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); 381 m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString());
359 382
360 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); 383 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
361 if (response["Success"].AsBoolean()) 384 if (response["Success"].AsBoolean())
362 { 385 {
363 return response["Enabled"].AsBoolean() ? REGION_ONLINE : 0; 386 OSDMap extraData = response["ExtraData"] as OSDMap;
387 int enabled = response["Enabled"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.RegionOnline : 0;
388 int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.Hyperlink : 0;
389 int flags = enabled | hypergrid;
390 m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags);
391 return flags;
364 } 392 }
365 else 393 else
366 { 394 {
@@ -411,24 +439,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
411 Vector3d minPosition = response["MinPosition"].AsVector3d(); 439 Vector3d minPosition = response["MinPosition"].AsVector3d();
412 region.RegionLocX = (int)minPosition.X; 440 region.RegionLocX = (int)minPosition.X;
413 region.RegionLocY = (int)minPosition.Y; 441 region.RegionLocY = (int)minPosition.Y;
414 442
415 Uri httpAddress = response["Address"].AsUri(); 443 if ( ! extraData["HyperGrid"] ) {
416 region.ExternalHostName = httpAddress.Host; 444 Uri httpAddress = response["Address"].AsUri();
417 region.HttpPort = (uint)httpAddress.Port; 445 region.ExternalHostName = httpAddress.Host;
418 446 region.HttpPort = (uint)httpAddress.Port;
419 region.ServerURI = extraData["ServerURI"].AsString(); 447
420 448 IPAddress internalAddress;
421 IPAddress internalAddress; 449 IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress);
422 IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress); 450 if (internalAddress == null)
423 if (internalAddress == null) 451 internalAddress = IPAddress.Any;
424 internalAddress = IPAddress.Any; 452
425 453 region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger());
426 region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger()); 454 region.TerrainImage = extraData["MapTexture"].AsUUID();
427 region.TerrainImage = extraData["MapTexture"].AsUUID(); 455 region.Access = (byte)extraData["Access"].AsInteger();
428 region.Access = (byte)extraData["Access"].AsInteger(); 456 region.RegionSecret = extraData["RegionSecret"].AsString();
429 region.RegionSecret = extraData["RegionSecret"].AsString(); 457 region.EstateOwner = extraData["EstateOwner"].AsUUID();
430 region.EstateOwner = extraData["EstateOwner"].AsUUID(); 458 region.Token = extraData["Token"].AsString();
431 region.Token = extraData["Token"].AsString(); 459 region.ServerURI = extraData["ServerURI"].AsString();
460 } else {
461 region.ServerURI = response["Address"];
462 }
432 463
433 return region; 464 return region;
434 } 465 }