diff options
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1GridServices.cs')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 65b8763..9a4c166 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | ||
31 | using System.Net; | 32 | using System.Net; |
32 | using System.Net.Sockets; | 33 | using System.Net.Sockets; |
33 | using System.Reflection; | 34 | using System.Reflection; |
@@ -92,6 +93,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
92 | httpServer.AddXmlRPCHandler("expect_user", ExpectUser); | 93 | httpServer.AddXmlRPCHandler("expect_user", ExpectUser); |
93 | httpServer.AddXmlRPCHandler("logoff_user", LogOffUser); | 94 | httpServer.AddXmlRPCHandler("logoff_user", LogOffUser); |
94 | httpServer.AddXmlRPCHandler("check", PingCheckReply); | 95 | httpServer.AddXmlRPCHandler("check", PingCheckReply); |
96 | httpServer.AddXmlRPCHandler("land_data", LandData); | ||
95 | 97 | ||
96 | StartRemoting(); | 98 | StartRemoting(); |
97 | } | 99 | } |
@@ -1624,5 +1626,104 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1624 | } | 1626 | } |
1625 | } | 1627 | } |
1626 | } | 1628 | } |
1629 | |||
1630 | public LandData RequestLandData (ulong regionHandle, uint x, uint y) | ||
1631 | { | ||
1632 | m_log.DebugFormat("[OGS1 GRID SERVICES] requests land data in {0}, at {1}, {2}", | ||
1633 | regionHandle, x, y); | ||
1634 | LandData landData = m_localBackend.RequestLandData(regionHandle, x, y); | ||
1635 | if (landData == null) | ||
1636 | { | ||
1637 | Hashtable hash = new Hashtable(); | ||
1638 | hash["region_handle"] = regionHandle.ToString(); | ||
1639 | hash["x"] = x.ToString(); | ||
1640 | hash["y"] = y.ToString(); | ||
1641 | |||
1642 | IList paramList = new ArrayList(); | ||
1643 | paramList.Add(hash); | ||
1644 | |||
1645 | // this might be cached, as we probably requested it just a moment ago... | ||
1646 | RegionInfo info = RequestNeighbourInfo(regionHandle); | ||
1647 | |||
1648 | try | ||
1649 | { | ||
1650 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); | ||
1651 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; | ||
1652 | XmlRpcResponse response = request.Send(uri, 10000); | ||
1653 | if (response.IsFault) | ||
1654 | { | ||
1655 | m_log.ErrorFormat("[OGS1 GRID SERVICES] remote call returned an error: {0}", response.FaultString); | ||
1656 | } | ||
1657 | else | ||
1658 | { | ||
1659 | hash = (Hashtable)response.Value; | ||
1660 | try { | ||
1661 | landData = new LandData(); | ||
1662 | landData.AABBMax = LLVector3.Parse((string)hash["AABBMax"]); | ||
1663 | landData.AABBMin = LLVector3.Parse((string)hash["AABBMin"]); | ||
1664 | landData.Area = Convert.ToInt32(hash["Area"]); | ||
1665 | landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]); | ||
1666 | landData.Description = (string)hash["Description"]; | ||
1667 | landData.Flags = Convert.ToUInt32(hash["Flags"]); | ||
1668 | landData.GlobalID = new LLUUID((string)hash["GlobalID"]); | ||
1669 | landData.Name = (string)hash["Name"]; | ||
1670 | landData.OwnerID = new LLUUID((string)hash["OwnerID"]); | ||
1671 | landData.SalePrice = Convert.ToInt32(hash["SalePrice"]); | ||
1672 | landData.SnapshotID = new LLUUID((string)hash["SnapshotID"]); | ||
1673 | landData.UserLocation = LLVector3.Parse((string)hash["UserLocation"]); | ||
1674 | m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name); | ||
1675 | } | ||
1676 | catch (Exception e) | ||
1677 | { | ||
1678 | m_log.Error("[OGS1 GRID SERVICES] Got exception while parsing land-data:", e); | ||
1679 | } | ||
1680 | } | ||
1681 | } | ||
1682 | catch (Exception e) | ||
1683 | { | ||
1684 | m_log.ErrorFormat("[OGS1 GRID SERVICES] Couldn't contact region {0}: {1}", regionHandle, e); | ||
1685 | } | ||
1686 | } | ||
1687 | return landData; | ||
1688 | } | ||
1689 | |||
1690 | // Grid Request Processing | ||
1691 | /// <summary> | ||
1692 | /// Someone asked us about parcel-information | ||
1693 | /// </summary> | ||
1694 | /// <param name="request"></param> | ||
1695 | /// <returns></returns> | ||
1696 | public XmlRpcResponse LandData(XmlRpcRequest request) | ||
1697 | { | ||
1698 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
1699 | ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]); | ||
1700 | uint x = Convert.ToUInt32(requestData["x"]); | ||
1701 | uint y = Convert.ToUInt32(requestData["y"]); | ||
1702 | m_log.DebugFormat("[OGS1 GRID SERVICES]: Got XML reqeuest for land data at {0}, {1} in region {2}", x, y, regionHandle); | ||
1703 | |||
1704 | LandData landData = m_localBackend.RequestLandData(regionHandle, x, y); | ||
1705 | Hashtable hash = new Hashtable(); | ||
1706 | if (landData != null) | ||
1707 | { | ||
1708 | // for now, only push out the data we need for answering a ParcelInfoReqeust | ||
1709 | // FIXME: these Replace calls are necessary as LLVector3.Parse can't parse vectors with spaces in them. Can be removed as soon as we switch to a newer version | ||
1710 | hash["AABBMax"] = landData.AABBMax.ToString().Replace(" ", ""); | ||
1711 | hash["AABBMin"] = landData.AABBMin.ToString().Replace(" ", ""); | ||
1712 | hash["Area"] = landData.Area.ToString(); | ||
1713 | hash["AuctionID"] = landData.AuctionID.ToString(); | ||
1714 | hash["Description"] = landData.Description; | ||
1715 | hash["Flags"] = landData.Flags.ToString(); | ||
1716 | hash["GlobalID"] = landData.GlobalID.ToString(); | ||
1717 | hash["Name"] = landData.Name; | ||
1718 | hash["OwnerID"] = landData.OwnerID.ToString(); | ||
1719 | hash["SalePrice"] = landData.SalePrice.ToString(); | ||
1720 | hash["SnapshotID"] = landData.SnapshotID.ToString(); | ||
1721 | hash["UserLocation"] = landData.UserLocation.ToString().Replace(" ", ""); | ||
1722 | } | ||
1723 | |||
1724 | XmlRpcResponse response = new XmlRpcResponse(); | ||
1725 | response.Value = hash; | ||
1726 | return response; | ||
1727 | } | ||
1627 | } | 1728 | } |
1628 | } | 1729 | } |