From d9cc908471922a1239bb8a757e07084072852982 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sat, 16 Aug 2008 19:20:14 +0000 Subject: Mantis#1965. Thank you kindly, HomerHorwitz for a patch that: Places touched: - Added two events for in-packets to LLCLientView: RegionHandleRequest and ParcelInfoRequest - Added sending of two out-packets to LLCLientView: RegionIDAndHandleReply and ParcelInfoReply. - Scene handles the RegionHandleRequest, LandManagementModule the ParcelInfoRequest - Added inter-region request for LandData by RegionHandle and local position. This was implemented as XML-RPC request. The returned LandData isn't complete, it only contains the data necessary for answering the ParcelInfoRequest - Added new CAPS (0009) for RemoteParcelRequest and some methods for LandData handling to LandManagementModule - Added methods for fake parcelID creation and parsing to Util - Fixed missing implementation of interface methods. - Added new file: OpenSim/Framework/Communications/Capabilities/LLSDRemoteParcelResponse.cs NOTE: This is part of the patch, too. Due to the many places touched, I would consider this patch as experimental. --- .../Communications/Local/LocalBackEndServices.cs | 15 +++ .../Region/Communications/OGS1/OGS1GridServices.cs | 101 +++++++++++++++++++++ 2 files changed, 116 insertions(+) (limited to 'OpenSim/Region/Communications') diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 5cf62f3..8149bcc 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -491,5 +491,20 @@ namespace OpenSim.Region.Communications.Local return false; } + + public LandData RequestLandData (ulong regionHandle, uint x, uint y) + { + m_log.DebugFormat("[INTERREGION STANDALONE] requests land data in {0}, at {1}, {2}", + regionHandle, x, y); + + if (m_regionListeners.ContainsKey(regionHandle)) + { + LandData land = m_regionListeners[regionHandle].TriggerGetLandData(x, y); + return land; + } + + m_log.Debug("[INTERREGION STANDALONE] didn't find land data locally."); + return null; + } } } 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 @@ using System; using System.Collections; using System.Collections.Generic; +using System.IO; using System.Net; using System.Net.Sockets; using System.Reflection; @@ -92,6 +93,7 @@ namespace OpenSim.Region.Communications.OGS1 httpServer.AddXmlRPCHandler("expect_user", ExpectUser); httpServer.AddXmlRPCHandler("logoff_user", LogOffUser); httpServer.AddXmlRPCHandler("check", PingCheckReply); + httpServer.AddXmlRPCHandler("land_data", LandData); StartRemoting(); } @@ -1624,5 +1626,104 @@ namespace OpenSim.Region.Communications.OGS1 } } } + + public LandData RequestLandData (ulong regionHandle, uint x, uint y) + { + m_log.DebugFormat("[OGS1 GRID SERVICES] requests land data in {0}, at {1}, {2}", + regionHandle, x, y); + LandData landData = m_localBackend.RequestLandData(regionHandle, x, y); + if (landData == null) + { + Hashtable hash = new Hashtable(); + hash["region_handle"] = regionHandle.ToString(); + hash["x"] = x.ToString(); + hash["y"] = y.ToString(); + + IList paramList = new ArrayList(); + paramList.Add(hash); + + // this might be cached, as we probably requested it just a moment ago... + RegionInfo info = RequestNeighbourInfo(regionHandle); + + try + { + XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); + string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; + XmlRpcResponse response = request.Send(uri, 10000); + if (response.IsFault) + { + m_log.ErrorFormat("[OGS1 GRID SERVICES] remote call returned an error: {0}", response.FaultString); + } + else + { + hash = (Hashtable)response.Value; + try { + landData = new LandData(); + landData.AABBMax = LLVector3.Parse((string)hash["AABBMax"]); + landData.AABBMin = LLVector3.Parse((string)hash["AABBMin"]); + landData.Area = Convert.ToInt32(hash["Area"]); + landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]); + landData.Description = (string)hash["Description"]; + landData.Flags = Convert.ToUInt32(hash["Flags"]); + landData.GlobalID = new LLUUID((string)hash["GlobalID"]); + landData.Name = (string)hash["Name"]; + landData.OwnerID = new LLUUID((string)hash["OwnerID"]); + landData.SalePrice = Convert.ToInt32(hash["SalePrice"]); + landData.SnapshotID = new LLUUID((string)hash["SnapshotID"]); + landData.UserLocation = LLVector3.Parse((string)hash["UserLocation"]); + m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name); + } + catch (Exception e) + { + m_log.Error("[OGS1 GRID SERVICES] Got exception while parsing land-data:", e); + } + } + } + catch (Exception e) + { + m_log.ErrorFormat("[OGS1 GRID SERVICES] Couldn't contact region {0}: {1}", regionHandle, e); + } + } + return landData; + } + + // Grid Request Processing + /// + /// Someone asked us about parcel-information + /// + /// + /// + public XmlRpcResponse LandData(XmlRpcRequest request) + { + Hashtable requestData = (Hashtable)request.Params[0]; + ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]); + uint x = Convert.ToUInt32(requestData["x"]); + uint y = Convert.ToUInt32(requestData["y"]); + m_log.DebugFormat("[OGS1 GRID SERVICES]: Got XML reqeuest for land data at {0}, {1} in region {2}", x, y, regionHandle); + + LandData landData = m_localBackend.RequestLandData(regionHandle, x, y); + Hashtable hash = new Hashtable(); + if (landData != null) + { + // for now, only push out the data we need for answering a ParcelInfoReqeust + // 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 + hash["AABBMax"] = landData.AABBMax.ToString().Replace(" ", ""); + hash["AABBMin"] = landData.AABBMin.ToString().Replace(" ", ""); + hash["Area"] = landData.Area.ToString(); + hash["AuctionID"] = landData.AuctionID.ToString(); + hash["Description"] = landData.Description; + hash["Flags"] = landData.Flags.ToString(); + hash["GlobalID"] = landData.GlobalID.ToString(); + hash["Name"] = landData.Name; + hash["OwnerID"] = landData.OwnerID.ToString(); + hash["SalePrice"] = landData.SalePrice.ToString(); + hash["SnapshotID"] = landData.SnapshotID.ToString(); + hash["UserLocation"] = landData.UserLocation.ToString().Replace(" ", ""); + } + + XmlRpcResponse response = new XmlRpcResponse(); + response.Value = hash; + return response; + } } } -- cgit v1.1