From e392e222a83ee04ee25c00e26dfad5f47ffa69b8 Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 27 Jun 2007 16:55:27 +0000 Subject: *Added some missing files I forgot to add...OpenSim.sln should compile now --- .../Communications/Local/CommunicationsLocal.cs | 61 +++++ .../Communications/Local/LocalBackEndServices.cs | 209 +++++++++++++++++ .../Communications/Local/LocalUserServices.cs | 118 ++++++++++ .../OpenSim.Region.Communications.Local.csproj | 128 +++++++++++ .../Local/Properties/AssemblyInfo.cs | 35 +++ .../Region/Communications/OGS1/GridCommsManager.cs | 18 ++ .../Region/Communications/OGS1/OGS1GridServices.cs | 248 +++++++++++++++++++++ .../Region/Communications/OGS1/OGSInterSimComms.cs | 70 ++++++ .../Region/Communications/OGS1/OGSUserServices.cs | 25 +++ .../OGS1/OpenSim.Region.Communications.OGS1.csproj | 149 +++++++++++++ .../Communications/OGS1/Properties/AssemblyInfo.cs | 35 +++ 11 files changed, 1096 insertions(+) create mode 100644 OpenSim/Region/Communications/Local/CommunicationsLocal.cs create mode 100644 OpenSim/Region/Communications/Local/LocalBackEndServices.cs create mode 100644 OpenSim/Region/Communications/Local/LocalUserServices.cs create mode 100644 OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj create mode 100644 OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/Communications/OGS1/GridCommsManager.cs create mode 100644 OpenSim/Region/Communications/OGS1/OGS1GridServices.cs create mode 100644 OpenSim/Region/Communications/OGS1/OGSInterSimComms.cs create mode 100644 OpenSim/Region/Communications/OGS1/OGSUserServices.cs create mode 100644 OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj create mode 100644 OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs new file mode 100644 index 0000000..c98cd11 --- /dev/null +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -0,0 +1,61 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.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 System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Framework; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Communications; + + +namespace OpenSim.Region.Communications.Local +{ + public class CommunicationsLocal : CommunicationsManager + { + public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); + public LocalUserServices UserServices; + + public CommunicationsLocal(NetworkServersInfo serversInfo) + : base(serversInfo) + { + UserServices = new LocalUserServices(this , serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY); + UserServices.AddPlugin("OpenGrid.Framework.Data.DB4o.dll"); + UserServer = UserServices; + GridServer = SandBoxServices; + InterRegion = SandBoxServices; + } + + internal void InformRegionOfLogin(ulong regionHandle, Login login) + { + this.SandBoxServices.AddNewSession(regionHandle, login); + } + } +} diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs new file mode 100644 index 0000000..ae47890 --- /dev/null +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -0,0 +1,209 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.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 System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Framework.Types; +using OpenSim.Framework; +using OpenSim.Framework.Communications; + +namespace OpenSim.Region.Communications.Local +{ + + public class LocalBackEndServices : IGridServices, IInterRegionCommunications + { + protected Dictionary regions = new Dictionary(); + protected Dictionary regionHosts = new Dictionary(); + + public LocalBackEndServices() + { + + } + + /// + /// Register a region method with the BackEnd Services. + /// + /// + /// + public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) + { + //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); + if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) + { + //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); + this.regions.Add(regionInfo.RegionHandle, regionInfo); + RegionCommsListener regionHost = new RegionCommsListener(); + this.regionHosts.Add(regionInfo.RegionHandle, regionHost); + + return regionHost; + } + + //already in our list of regions so for now lets return null + return null; + } + + /// + /// + /// + /// + public List RequestNeighbours(RegionInfo regionInfo) + { + // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); + List neighbours = new List(); + + foreach (RegionInfo reg in this.regions.Values) + { + // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); + if (reg.RegionHandle != regionInfo.RegionHandle) + { + //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); + if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) + { + if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) + { + neighbours.Add(reg); + } + } + } + } + return neighbours; + } + + /// + /// + /// + /// + /// + public RegionInfo RequestNeighbourInfo(ulong regionHandle) + { + if (this.regions.ContainsKey(regionHandle)) + { + return this.regions[regionHandle]; + } + return null; + } + + /// + /// + /// + /// + /// + /// + /// + /// + public List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) + { + List mapBlocks = new List(); + foreach(RegionInfo regInfo in this.regions.Values) + { + if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) + { + MapBlockData map = new MapBlockData(); + map.Name = regInfo.RegionName; + map.X = (ushort)regInfo.RegionLocX; + map.Y = (ushort)regInfo.RegionLocY; + map.WaterHeight =(byte) regInfo.estateSettings.waterHeight; + map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007"); + map.Agents = 1; + map.RegionFlags = 72458694; + map.Access = 13; + mapBlocks.Add(map); + } + } + return mapBlocks; + } + + /// + /// + /// + /// + /// + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData + { + //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); + if (this.regionHosts.ContainsKey(regionHandle)) + { + // Console.WriteLine("CommsManager- Informing a region to expect child agent"); + this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); + return true; + } + return false; + } + + /// + /// + /// + /// + /// + /// + /// + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (this.regionHosts.ContainsKey(regionHandle)) + { + // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); + this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); + return true; + } + return false; + } + + /// + /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session + /// + /// + /// + /// + public bool AddNewSession(ulong regionHandle, Login loginData) + { + //Console.WriteLine(" comms manager been told to expect new user"); + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = loginData.Agent; + agent.firstname = loginData.First; + agent.lastname = loginData.Last; + agent.SessionID = loginData.Session; + agent.SecureSessionID = loginData.SecureSession; + agent.circuitcode = loginData.CircuitCode; + agent.BaseFolder = loginData.BaseFolder; + agent.InventoryFolder = loginData.InventoryFolder; + agent.startpos = new LLVector3(128, 128, 70); + agent.CapsPath = loginData.CapsPath; + + if (this.regionHosts.ContainsKey(regionHandle)) + { + this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); + return true; + } + + // region not found + return false; + } + } +} + diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs new file mode 100644 index 0000000..1eb574c --- /dev/null +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Framework.Communications; +//using OpenSim.Framework.User; +using OpenSim.Framework.UserManagement; +using OpenSim.Framework.Data; +using OpenSim.Framework.Types; +using OpenSim.Framework.Utilities; + +using libsecondlife; + +namespace OpenSim.Region.Communications.Local +{ + public class LocalUserServices : UserManagerBase, IUserServices + { + private CommunicationsLocal m_Parent; + + private uint defaultHomeX ; + private uint defaultHomeY; + public LocalUserServices(CommunicationsLocal parent, uint defHomeX, uint defHomeY) + { + m_Parent = parent; + defaultHomeX = defHomeX; + defaultHomeY = defHomeY; + } + + public UserProfileData GetUserProfile(string firstName, string lastName) + { + return GetUserProfile(firstName + " " + lastName); + } + + public UserProfileData GetUserProfile(string name) + { + return this.getUserProfile(name); + } + public UserProfileData GetUserProfile(LLUUID avatarID) + { + return this.getUserProfile(avatarID); + } + + /// + /// + /// + /// + public override string GetMessage() + { + return "Welcome to OpenSim"; + } + + public override UserProfileData GetTheUser(string firstname, string lastname) + { + UserProfileData profile = getUserProfile(firstname, lastname); + if (profile != null) + { + + return profile; + } + + //no current user account so make one + Console.WriteLine("No User account found so creating a new one "); + this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); + + profile = getUserProfile(firstname, lastname); + + return profile; + } + + public override bool AuthenticateUser(ref UserProfileData profile, string password) + { + //for now we will accept any password in sandbox mode + Console.WriteLine("authorising user"); + return true; + } + + public override void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser) + { + ulong currentRegion = theUser.currentAgent.currentHandle; + RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); + + + if (reg != null) + { + response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + + "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + + "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; + string capsPath = Util.GetRandomCapsPath(); + response.SimAddress = reg.CommsIPListenAddr; + response.SimPort = (Int32)reg.CommsIPListenPort; + response.RegionX = reg.RegionLocX ; + response.RegionY = reg.RegionLocY ; + response.SeedCapability = "http://" + reg.CommsIPListenAddr + ":" + "9000" + "/CAPS/" + capsPath + "0000/"; + theUser.currentAgent.currentRegion = reg.SimUUID; + theUser.currentAgent.currentHandle = reg.RegionHandle; + + Login _login = new Login(); + //copy data to login object + _login.First = response.Firstname; + _login.Last = response.Lastname; + _login.Agent = response.AgentID; + _login.Session = response.SessionID; + _login.SecureSession = response.SecureSessionID; + _login.CircuitCode = (uint)response.CircuitCode; + _login.CapsPath = capsPath; + + m_Parent.InformRegionOfLogin(currentRegion, _login); + } + else + { + Console.WriteLine("not found region " + currentRegion); + } + + } + + } +} diff --git a/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj new file mode 100644 index 0000000..1a20965 --- /dev/null +++ b/OpenSim/Region/Communications/Local/OpenSim.Region.Communications.Local.csproj @@ -0,0 +1,128 @@ + + + Local + 8.0.50727 + 2.0 + {EB3A1BA8-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + + OpenSim.Region.Communications.Local + JScript + Grid + IE50 + false + Library + + + OpenSim.Region.Communications.Local + + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + + False + 285212672 + False + + + TRACE + + + False + 4096 + True + ..\..\..\..\bin\ + False + False + False + 4 + + + + + + ..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Communications + {CB52B7E7-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Data + {36B72A9B-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.UserManagement + {586E2916-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + \ No newline at end of file diff --git a/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1eb7107 --- /dev/null +++ b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.Region.Communications.Local")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenSim.Region.Communications.Local")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Region/Communications/OGS1/GridCommsManager.cs b/OpenSim/Region/Communications/OGS1/GridCommsManager.cs new file mode 100644 index 0000000..77848fa --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/GridCommsManager.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Types; +using OpenSim.Framework.Communications; +namespace OpenSim.Region.Communications.OGS1 +{ + public class GridCommsManager : CommunicationsManager + { + private OGS1GridServices gridInterComms = new OGS1GridServices(); + public GridCommsManager(NetworkServersInfo serversInfo) :base(serversInfo) + { + GridServer = gridInterComms; + InterRegion = gridInterComms; + UserServer = new OGSUserServices(); + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs new file mode 100644 index 0000000..5f0c80c --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -0,0 +1,248 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; +using System.Runtime.Remoting; +using System.Runtime.Remoting.Channels; +using System.Runtime.Remoting.Channels.Tcp; + +using OpenSim.Framework.Servers; +using OpenSim.Framework; +using OpenSim.Framework.Types; +using OpenSim.Framework.Communications; + +using Nwc.XmlRpc; +using libsecondlife; + +namespace OpenSim.Region.Communications.OGS1 +{ + public class OGS1GridServices : IGridServices, IInterRegionCommunications + { + public Dictionary listeners = new Dictionary(); + public GridInfo grid; + public BaseHttpServer httpListener; + private bool initialised = false; + + public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) + { + Hashtable GridParams = new Hashtable(); + + grid = gridInfo; + + // Login / Authentication + GridParams["authkey"] = gridInfo.GridServerSendKey; + GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated(); + GridParams["sim_ip"] = regionInfo.CommsExternalAddress; + GridParams["sim_port"] = regionInfo.CommsIPListenPort.ToString(); + + // Package into an XMLRPC Request + ArrayList SendParams = new ArrayList(); + SendParams.Add(GridParams); + + // Send Request + XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); + XmlRpcResponse GridResp = GridReq.Send(gridInfo.GridServerURI, 3000); + Hashtable GridRespData = (Hashtable)GridResp.Value; + Hashtable griddatahash = GridRespData; + + // Process Response + if (GridRespData.ContainsKey("error")) + { + string errorstring = (string)GridRespData["error"]; + OpenSim.Framework.Console.MainLog.Instance.Error("Unable to connect to grid: " + errorstring); + return null; + } + + if (!this.listeners.ContainsKey(regionInfo.RegionHandle)) + { + // initialised = true; + httpListener = new BaseHttpServer(regionInfo.CommsIPListenPort); + httpListener.AddXmlRPCHandler("expect_user", this.ExpectUser); + httpListener.Start(); + } + + // Initialise the background listeners + listeners[regionInfo.RegionHandle] = new RegionCommsListener(); + + return listeners[regionInfo.RegionHandle]; + } + + public List RequestNeighbours(RegionInfo regionInfo) + { + Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1); + + List neighbours = new List(); + + foreach (Hashtable n in (Hashtable)respData.Values) + { + RegionInfo neighbour = new RegionInfo(); + + //OGS1 + neighbour.RegionHandle = (ulong)n["regionhandle"]; + neighbour.RegionLocX = (uint)n["x"]; + neighbour.RegionLocY = (uint)n["y"]; + neighbour.RegionName = (string)n["name"]; + + //OGS1+ + neighbour.CommsIPListenAddr = (string)n["sim_ip"]; + neighbour.CommsIPListenPort = (int)n["sim_port"]; + neighbour.CommsExternalAddress = (string)n["sim_uri"]; + neighbour.SimUUID = (string)n["uuid"]; + + neighbours.Add(neighbour); + } + + return neighbours; + } + + public RegionInfo RequestNeighbourInfo(ulong regionHandle) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()"); + return null; + } + + public List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) + { + Hashtable respData = MapBlockQuery(minX, minY, maxX, maxY); + + List neighbours = new List(); + + foreach (Hashtable n in (Hashtable)respData.Values) + { + MapBlockData neighbour = new MapBlockData(); + + neighbour.X = (ushort)n["x"]; + neighbour.Y = (ushort)n["y"]; + + neighbour.Name = (string)n["name"]; + neighbour.Access = (byte)n["access"]; + neighbour.RegionFlags = (uint)n["region-flags"]; + neighbour.WaterHeight = (byte)n["water-height"]; + neighbour.MapImageId = (string)n["map-image-id"]; + + neighbours.Add(neighbour); + } + + return neighbours; + } + + /// + /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates + /// + /// REDUNDANT - OGS1 is to be phased out in favour of OGS2 + /// Minimum X value + /// Minimum Y value + /// Maximum X value + /// Maximum Y value + /// Hashtable of hashtables containing map data elements + private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY) + { + Hashtable param = new Hashtable(); + param["xmin"] = minX; + param["ymin"] = minY; + param["xmax"] = maxX; + param["ymax"] = maxY; + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); + XmlRpcResponse resp = req.Send(grid.GridServerURI, 3000); + Hashtable respData = (Hashtable)resp.Value; + return respData; + } + + // Grid Request Processing + public XmlRpcResponse ExpectUser(XmlRpcRequest request) + { + Hashtable requestData = (Hashtable)request.Params[0]; + AgentCircuitData agentData = new AgentCircuitData(); + agentData.SessionID = new LLUUID((string)requestData["session_id"]); + agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); + agentData.firstname = (string)requestData["firstname"]; + agentData.lastname = (string)requestData["lastname"]; + agentData.AgentID = new LLUUID((string)requestData["agent_id"]); + agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); + if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) + { + agentData.child = true; + } + else + { + agentData.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"])); + agentData.child = false; + + } + + if (listeners.ContainsKey((ulong)requestData["regionhandle"])) + { + this.listeners[(ulong)requestData["regionhandle"]].TriggerExpectUser((ulong)requestData["regionhandle"], agentData); + } + else + { + OpenSim.Framework.Console.MainLog.Instance.Error("ExpectUser() - Unknown region " + ((ulong)requestData["regionhandle"]).ToString()); + } + + return new XmlRpcResponse(); + } + + #region InterRegion Comms + private void StartRemoting() + { + TcpChannel ch = new TcpChannel(8895); + ChannelServices.RegisterChannel(ch); + + WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry( Type.GetType("OGS1InterRegionRemoting"), "InterRegions", WellKnownObjectMode.Singleton); + RemotingConfiguration.RegisterWellKnownServiceType(wellType); + InterRegionSingleton.Instance.OnArrival += this.IncomingArrival; + InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent; + } + + #region Methods called by regions in this instance + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + if (this.listeners.ContainsKey(regionHandle)) + { + this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData); + return true; + } + //TODO need to see if we know about where this region is and use .net remoting + // to inform it. + return false; + } + + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (this.listeners.ContainsKey(regionHandle)) + { + this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); + return true; + } + //TODO need to see if we know about where this region is and use .net remoting + // to inform it. + return false; + } + #endregion + + #region Methods triggered by calls from external instances + public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + if (this.listeners.ContainsKey(regionHandle)) + { + this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData); + return true; + } + return false; + } + + public bool IncomingArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (this.listeners.ContainsKey(regionHandle)) + { + this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); + return true; + } + return false; + } + #endregion + #endregion + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGSInterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGSInterSimComms.cs new file mode 100644 index 0000000..51b33e9 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OGSInterSimComms.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Types; +using OpenSim.Framework.Communications; +namespace OpenSim.Region.Communications.OGS1 +{ + public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); + public delegate bool ExpectArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position); + + public sealed class InterRegionSingleton + { + static readonly InterRegionSingleton instance = new InterRegionSingleton(); + + public event InformRegionChild OnChildAgent; + public event ExpectArrival OnArrival; + + static InterRegionSingleton() + { + } + + InterRegionSingleton() + { + } + + public static InterRegionSingleton Instance + { + get + { + return instance; + } + } + + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + if (OnChildAgent != null) + { + return OnChildAgent(regionHandle, agentData); + } + return false; + } + + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (OnArrival != null) + { + return OnArrival(regionHandle, agentID, position); + } + return false; + } + } + + public class OGS1InterRegionRemoting : MarshalByRefObject + { + + public OGS1InterRegionRemoting() + { + } + + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData); + } + + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position); + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGSUserServices.cs b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs new file mode 100644 index 0000000..012774d --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OGSUserServices.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Data; +using libsecondlife; + +namespace OpenSim.Region.Communications.OGS1 +{ + public class OGSUserServices :IUserServices + { + public UserProfileData GetUserProfile(string firstName, string lastName) + { + return null; + } + public UserProfileData GetUserProfile(string name) + { + return null; + } + public UserProfileData GetUserProfile(LLUUID avatarID) + { + return null; + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj new file mode 100644 index 0000000..4bda6c9 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OpenSim.Region.Communications.OGS1.csproj @@ -0,0 +1,149 @@ + + + Local + 8.0.50727 + 2.0 + {6109024D-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + + OpenSim.Region.Communications.OGS1 + JScript + Grid + IE50 + false + Library + + + OpenSim.Region.Communications.OGS1 + + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + + False + 285212672 + False + + + TRACE + + + False + 4096 + True + ..\..\..\..\bin\ + False + False + False + 4 + + + + + + False + ..\..\..\..\bin\libsecondlife.dll + + + System.dll + False + + + System.Data.dll + False + + + System.Runtime.Remoting.dll + False + + + System.Xml.dll + False + + + False + ..\..\..\..\bin\XMLRPC.dll + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Communications + {CB52B7E7-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Data + {36B72A9B-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Servers + {2CC71860-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + \ No newline at end of file diff --git a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0c6f965 --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenGrid.Framework.Communications.OGS1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenGrid.Framework.Communications.OGS1")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] -- cgit v1.1