aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications
diff options
context:
space:
mode:
authorHomer Horwitz2008-10-03 23:00:42 +0000
committerHomer Horwitz2008-10-03 23:00:42 +0000
commit16d68749a457acf079a6737f4ca9a9adb9e53e2f (patch)
tree901b2c31e53eeb97f30ac46f2b7f406a01e1755a /OpenSim/Region/Communications
parentFix: Mantis#2326: Fix: privilege escalation through attach from ground (diff)
downloadopensim-SC_OLD-16d68749a457acf079a6737f4ca9a9adb9e53e2f.zip
opensim-SC_OLD-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.gz
opensim-SC_OLD-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.bz2
opensim-SC_OLD-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.xz
Add the missing bits for the new region-search:
- Added lookup in the data-layer - MySQL works - SQLite doesn't have a grid-db, so it won't work there - I added MSSQL-code to the best of my knowledge; but I don't know MSSQL :-) - Added the plumbing up to OGS1GridServices. This speaks with the grid-server via XMLRPC. - Modified MapSearchModule to use the new data. It's backward compatible; if used with an old grid-server, it just returns one found region instead of a list. - Refactored a bit. Note: This updates data, grid-server and region code. No new files.
Diffstat (limited to 'OpenSim/Region/Communications')
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs15
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs119
2 files changed, 91 insertions, 43 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index a861ceb..9034e49 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -514,5 +514,20 @@ namespace OpenSim.Region.Communications.Local
514 m_log.Debug("[INTERREGION STANDALONE] didn't find land data locally."); 514 m_log.Debug("[INTERREGION STANDALONE] didn't find land data locally.");
515 return null; 515 return null;
516 } 516 }
517
518 public List<RegionInfo> RequestNamedRegions (string name, int maxNumber)
519 {
520 List<RegionInfo> regions = new List<RegionInfo>();
521 foreach (RegionInfo info in m_regions.Values)
522 {
523 if (info.RegionName.StartsWith(name))
524 {
525 regions.Add(info);
526 if (regions.Count >= maxNumber) break;
527 }
528 }
529
530 return regions;
531 }
517 } 532 }
518} 533}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index a2d3823..397062b 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -352,27 +352,7 @@ namespace OpenSim.Region.Communications.OGS1
352 return null; 352 return null;
353 } 353 }
354 354
355 uint regX = Convert.ToUInt32((string) responseData["region_locx"]); 355 regionInfo = buildRegionInfo(responseData, String.Empty);
356 uint regY = Convert.ToUInt32((string) responseData["region_locy"]);
357 string internalIpStr = (string) responseData["sim_ip"];
358 uint port = Convert.ToUInt32(responseData["sim_port"]);
359 // string externalUri = (string) responseData["sim_uri"];
360
361 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port);
362 // string neighbourExternalUri = externalUri;
363 regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
364
365 regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
366 regionInfo.RemotingAddress = internalIpStr;
367
368 if (responseData.ContainsKey("http_port"))
369 {
370 regionInfo.HttpPort = Convert.ToUInt32((string) responseData["http_port"]);
371 }
372
373 regionInfo.RegionID = new UUID((string) responseData["region_UUID"]);
374 regionInfo.RegionName = (string) responseData["region_name"];
375
376 if (requestData.ContainsKey("regionHandle")) 356 if (requestData.ContainsKey("regionHandle"))
377 { 357 {
378 m_remoteRegionInfoCache.Add(Convert.ToUInt64((string) requestData["regionHandle"]), regionInfo); 358 m_remoteRegionInfoCache.Add(Convert.ToUInt64((string) requestData["regionHandle"]), regionInfo);
@@ -479,30 +459,11 @@ namespace OpenSim.Region.Communications.OGS1
479 459
480 if (responseData.ContainsKey("error")) 460 if (responseData.ContainsKey("error"))
481 { 461 {
482 m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server" + responseData["error"]); 462 m_log.ErrorFormat("[OGS1 GRID SERVICES]: Error received from grid server: ", responseData["error"]);
483 return null; 463 return null;
484 } 464 }
485 465
486 uint regX = Convert.ToUInt32((string) responseData["region_locx"]); 466 regionInfo = buildRegionInfo(responseData, "");
487 uint regY = Convert.ToUInt32((string) responseData["region_locy"]);
488 string internalIpStr = (string) responseData["sim_ip"];
489 uint port = Convert.ToUInt32(responseData["sim_port"]);
490 // string externalUri = (string) responseData["sim_uri"];
491
492 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port);
493 // string neighbourExternalUri = externalUri;
494 regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
495
496 regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
497 regionInfo.RemotingAddress = internalIpStr;
498
499 if (responseData.ContainsKey("http_port"))
500 {
501 regionInfo.HttpPort = Convert.ToUInt32((string) responseData["http_port"]);
502 }
503
504 regionInfo.RegionID = new UUID((string) responseData["region_UUID"]);
505 regionInfo.RegionName = (string) responseData["region_name"];
506 467
507 if (!m_remoteRegionInfoCache.ContainsKey(regionInfo.RegionHandle)) 468 if (!m_remoteRegionInfoCache.ContainsKey(regionInfo.RegionHandle))
508 m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo); 469 m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo);
@@ -1676,7 +1637,8 @@ namespace OpenSim.Region.Communications.OGS1
1676 else 1637 else
1677 { 1638 {
1678 hash = (Hashtable)response.Value; 1639 hash = (Hashtable)response.Value;
1679 try { 1640 try
1641 {
1680 landData = new LandData(); 1642 landData = new LandData();
1681 landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]); 1643 landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]);
1682 landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]); 1644 landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]);
@@ -1745,5 +1707,76 @@ namespace OpenSim.Region.Communications.OGS1
1745 response.Value = hash; 1707 response.Value = hash;
1746 return response; 1708 return response;
1747 } 1709 }
1710
1711 public List<RegionInfo> RequestNamedRegions (string name, int maxNumber)
1712 {
1713 // no asking of the local backend first, here, as we have to ask the gridserver anyway.
1714 Hashtable hash = new Hashtable();
1715 hash["name"] = name;
1716 hash["maxNumber"] = maxNumber.ToString();
1717
1718 IList paramList = new ArrayList();
1719 paramList.Add(hash);
1720
1721 Hashtable result = XmlRpcSearchForRegionByName(paramList);
1722 if (result == null) return null;
1723
1724 uint numberFound = Convert.ToUInt32(result["numFound"]);
1725 List<RegionInfo> infos = new List<RegionInfo>();
1726 for (int i = 0; i < numberFound; ++i)
1727 {
1728 string prefix = "region" + i + ".";
1729 RegionInfo info = buildRegionInfo(result, prefix);
1730 infos.Add(info);
1731 }
1732 return infos;
1733 }
1734
1735 private RegionInfo buildRegionInfo(Hashtable responseData, string prefix)
1736 {
1737 uint regX = Convert.ToUInt32((string) responseData[prefix + "region_locx"]);
1738 uint regY = Convert.ToUInt32((string) responseData[prefix + "region_locy"]);
1739 string internalIpStr = (string) responseData[prefix + "sim_ip"];
1740 uint port = Convert.ToUInt32(responseData[prefix + "sim_port"]);
1741
1742 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(Util.GetHostFromDNS(internalIpStr), (int) port);
1743
1744 RegionInfo regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
1745 regionInfo.RemotingPort = Convert.ToUInt32((string) responseData[prefix + "remoting_port"]);
1746 regionInfo.RemotingAddress = internalIpStr;
1747
1748 if (responseData.ContainsKey(prefix + "http_port"))
1749 {
1750 regionInfo.HttpPort = Convert.ToUInt32((string) responseData[prefix + "http_port"]);
1751 }
1752
1753 regionInfo.RegionID = new UUID((string) responseData[prefix + "region_UUID"]);
1754 regionInfo.RegionName = (string) responseData[prefix + "region_name"];
1755
1756 regionInfo.RegionSettings.TerrainImageID = new UUID((string) responseData[prefix + "map_UUID"]);
1757 return regionInfo;
1758 }
1759
1760 private Hashtable XmlRpcSearchForRegionByName(IList parameters)
1761 {
1762 try
1763 {
1764 XmlRpcRequest request = new XmlRpcRequest("search_for_region_by_name", parameters);
1765 XmlRpcResponse resp = request.Send(serversInfo.GridURL, 10000);
1766 Hashtable respData = (Hashtable) resp.Value;
1767 if (respData != null && respData.Contains("faultCode"))
1768 {
1769 m_log.WarnFormat("[OGS1 GRID SERVICES]: Got an error while contacting GridServer: {0}", respData["faultString"]);
1770 return null;
1771 }
1772
1773 return respData;
1774 }
1775 catch (Exception e)
1776 {
1777 m_log.Error("[OGS1 GRID SERVICES]: MapBlockQuery XMLRPC failure: ", e);
1778 return null;
1779 }
1780 }
1748 } 1781 }
1749} \ No newline at end of file 1782} \ No newline at end of file