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. --- .../Framework/Communications/Capabilities/Caps.cs | 4 ++- .../Capabilities/LLSDRemoteParcelResponse.cs | 42 ++++++++++++++++++++++ OpenSim/Framework/Communications/IGridServices.cs | 2 ++ OpenSim/Framework/IClientAPI.cs | 9 +++++ OpenSim/Framework/IRegionCommsListener.cs | 5 ++- OpenSim/Framework/RegionCommsListener.cs | 15 ++++++-- OpenSim/Framework/Util.cs | 19 ++++++++++ 7 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 OpenSim/Framework/Communications/Capabilities/LLSDRemoteParcelResponse.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 7350d4d..1aa8eb0 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -86,11 +86,13 @@ namespace OpenSim.Framework.Communications.Capabilities private static readonly string m_notecardTaskUpdatePath = "0005/"; // private static readonly string m_fetchInventoryPath = "0006/"; - // The following two entries are in a module, however, there also here so that we don't re-assign + // The following entries are in a module, however, they are also here so that we don't re-assign // the path to another cap by mistake. // private static readonly string m_parcelVoiceInfoRequestPath = "0007/"; // This is in a module. // private static readonly string m_provisionVoiceAccountRequestPath = "0008/";// This is in a module. + // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. + //private string eventQueue = "0100/"; private BaseHttpServer m_httpListener; private LLUUID m_agentID; diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDRemoteParcelResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDRemoteParcelResponse.cs new file mode 100644 index 0000000..27adea0 --- /dev/null +++ b/OpenSim/Framework/Communications/Capabilities/LLSDRemoteParcelResponse.cs @@ -0,0 +1,42 @@ +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using libsecondlife; + +namespace OpenSim.Framework.Communications.Capabilities +{ + [LLSDType("MAP")] + public class LLSDRemoteParcelResponse + { + public LLUUID parcel_id; + + public LLSDRemoteParcelResponse() + { + } + } +} diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs index 3ecda68..509f408 100644 --- a/OpenSim/Framework/Communications/IGridServices.cs +++ b/OpenSim/Framework/Communications/IGridServices.cs @@ -57,5 +57,7 @@ namespace OpenSim.Framework.Communications RegionInfo RequestClosestRegion(string regionName); Dictionary GetGridSettings(); List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); + // not complete yet, only contains the fields needed for ParcelInfoReqeust + LandData RequestLandData(ulong regionHandle, uint x, uint y); } } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 36842cc..536050c 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -293,6 +293,9 @@ namespace OpenSim.Framework public delegate void EstateBlueBoxMessageRequest(IClientAPI remoteClient, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message); public delegate void EstateDebugRegionRequest(IClientAPI remoteClient, LLUUID invoice, LLUUID senderID, bool scripted, bool collisionEvents, bool physics); public delegate void EstateTeleportOneUserHomeRequest(IClientAPI remoteClient, LLUUID invoice, LLUUID senderID, LLUUID prey); + public delegate void RegionHandleRequest(IClientAPI remoteClient, LLUUID regionID); + public delegate void ParcelInfoRequest(IClientAPI remoteClient, LLUUID parcelID); + public delegate void ScriptReset(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID); public delegate void GetScriptRunning(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID); public delegate void SetScriptRunning(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID, bool running); @@ -498,6 +501,9 @@ namespace OpenSim.Framework event EstateDebugRegionRequest OnEstateDebugRegionRequest; event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; event UUIDNameRequest OnUUIDGroupNameRequest; + + event RegionHandleRequest OnRegionHandleRequest; + event ParcelInfoRequest OnParcelInfoRequest; event RequestObjectPropertiesFamily OnObjectGroupRequest; event ScriptReset OnScriptReset; @@ -721,5 +727,8 @@ namespace OpenSim.Framework void SendSetFollowCamProperties(LLUUID objectID, SortedDictionary parameters); void SendClearFollowCamProperties(LLUUID objectID); + + void SendRegionHandle(LLUUID regoinID, ulong handle); + void SendParcelInfo(RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y); } } diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs index ce84a40..1758508 100644 --- a/OpenSim/Framework/IRegionCommsListener.cs +++ b/OpenSim/Framework/IRegionCommsListener.cs @@ -52,6 +52,8 @@ namespace OpenSim.Framework public delegate void LogOffUser(ulong regionHandle, LLUUID agentID, LLUUID regionSecret, string message); + public delegate LandData GetLandData(uint x, uint y); + public interface IRegionCommsListener { event ExpectUserDelegate OnExpectUser; @@ -66,5 +68,6 @@ namespace OpenSim.Framework event RegionUp OnRegionUp; event ChildAgentUpdate OnChildAgentUpdate; event LogOffUser OnLogOffUser; + event GetLandData OnGetLandData; } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs index 4045b44..0b50a81 100644 --- a/OpenSim/Framework/RegionCommsListener.cs +++ b/OpenSim/Framework/RegionCommsListener.cs @@ -46,7 +46,8 @@ namespace OpenSim.Framework private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; private RegionUp handlerRegionUp = null; // OnRegionUp; private LogOffUser handlerLogOffUser = null; - + private GetLandData handlerGetLandData = null; + #region IRegionCommsListener Members public event ExpectUserDelegate OnExpectUser; @@ -61,6 +62,7 @@ namespace OpenSim.Framework public event RegionUp OnRegionUp; public event ChildAgentUpdate OnChildAgentUpdate; public event LogOffUser OnLogOffUser; + public event GetLandData OnGetLandData; #endregion @@ -226,5 +228,14 @@ namespace OpenSim.Framework return false; } + + public LandData TriggerGetLandData(uint x, uint y) + { + handlerGetLandData = OnGetLandData; + if (handlerGetLandData != null) + return handlerGetLandData(x, y); + + return null; + } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index d72e03e..bc35fa6 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -716,5 +716,24 @@ namespace OpenSim.Framework XmlRpcRequest client = new XmlRpcRequest(methodName, args); return client.Send(url, 6000); } + + // used for RemoteParcelRequest (for "About Landmark") + public static LLUUID BuildFakeParcelID(ulong regionHandle, uint x, uint y) { + byte[] bytes = { + (byte)(regionHandle >> 56), (byte)(regionHandle >> 48), (byte)(regionHandle >> 40), (byte)(regionHandle >> 32), + (byte)(regionHandle >> 24), (byte)(regionHandle >> 16), (byte)(regionHandle >> 8), (byte)regionHandle, + (byte)(x >> 24), (byte)(x >> 16), (byte)(x >> 8), (byte)x, + (byte)(y >> 24), (byte)(y >> 16), (byte)(y >> 8), (byte)y }; + return new LLUUID(bytes, 0); + } + + public static void ParseFakeParcelID(LLUUID parcelID, out ulong regionHandle, out uint x, out uint y) { + byte[] bytes = parcelID.GetBytes(); + regionHandle = Helpers.BytesToUInt64(bytes); + x = Helpers.BytesToUInt(bytes, 8); + // grrr. I'd like to use that code in the next line, but libsl has an off-by-one bug here and returns 0. + //uint y = Helpers.BytesToUInt(bytes, 12); + y = (uint)((bytes[12] << 24) | (bytes[13] << 16) | (bytes[14] << 8) | bytes[15]); + } } } -- cgit v1.1