diff --git a/Common/OpenGrid.Framework.Communications.OGS1/GridCommsManager.cs b/Common/OpenGrid.Framework.Communications.OGS1/GridCommsManager.cs index 308e00ffd6..563eaf76c2 100644 --- a/Common/OpenGrid.Framework.Communications.OGS1/GridCommsManager.cs +++ b/Common/OpenGrid.Framework.Communications.OGS1/GridCommsManager.cs @@ -7,10 +7,11 @@ namespace OpenGrid.Framework.Communications.OGS1 { public class GridCommsManager : CommunicationsManager { + private OGS1GridServices gridInterComms = new OGS1GridServices(); public GridCommsManager(NetworkServersInfo serversInfo) :base(serversInfo) { - GridServer = new OGS1GridServices(); - InterRegion = new OGSInterSimComms(); + GridServer = gridInterComms; + InterRegion = gridInterComms; UserServer = new OGSUserServices(); } } diff --git a/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs b/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs index a67f55d526..db64f0c8c1 100644 --- a/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs +++ b/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs @@ -2,9 +2,11 @@ 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.Servers; - using OpenSim.Framework; using OpenSim.Framework.Types; using OpenGrid.Framework.Communications; @@ -14,7 +16,7 @@ using libsecondlife; namespace OpenGrid.Framework.Communications.OGS1 { - public class OGS1GridServices : IGridServices + public class OGS1GridServices : IGridServices, IInterRegionCommunications { public Dictionary listeners = new Dictionary(); public GridInfo grid; @@ -49,19 +51,19 @@ namespace OpenGrid.Framework.Communications.OGS1 string errorstring = (string)GridRespData["error"]; OpenSim.Framework.Console.MainLog.Instance.Error("Unable to connect to grid: " + errorstring); return null; - } - - // Initialise the background listeners - listeners[regionInfo.RegionHandle] = new RegionCommsListener(); + } - if (!initialised) + if (!this.listeners.ContainsKey(regionInfo.RegionHandle)) { - initialised = true; + // 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]; } @@ -182,6 +184,65 @@ namespace OpenGrid.Framework.Communications.OGS1 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/Common/OpenGrid.Framework.Communications.OGS1/OGSInterSimComms.cs b/Common/OpenGrid.Framework.Communications.OGS1/OGSInterSimComms.cs index 0024d1491b..3d74e2ffbb 100644 --- a/Common/OpenGrid.Framework.Communications.OGS1/OGSInterSimComms.cs +++ b/Common/OpenGrid.Framework.Communications.OGS1/OGSInterSimComms.cs @@ -5,15 +5,66 @@ using OpenSim.Framework.Types; using OpenGrid.Framework.Communications; namespace OpenGrid.Framework.Communications.OGS1 { - public class OGSInterSimComms : IInterRegionCommunications + 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/Common/OpenGrid.Framework.Communications.OGS1/OpenGrid.Framework.Communications.OGS1.csproj b/Common/OpenGrid.Framework.Communications.OGS1/OpenGrid.Framework.Communications.OGS1.csproj index 3f4f22dc76..00246e139d 100644 --- a/Common/OpenGrid.Framework.Communications.OGS1/OpenGrid.Framework.Communications.OGS1.csproj +++ b/Common/OpenGrid.Framework.Communications.OGS1/OpenGrid.Framework.Communications.OGS1.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {17442AF1-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenGrid.Framework.Communications.OGS1 @@ -15,9 +16,11 @@ IE50 false Library - + + OpenGrid.Framework.Communications.OGS1 - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,22 +61,24 @@ False False 4 - + + - + ..\..\bin\libsecondlife.dll False - + System.dll False - + System.Data.dll False - + + System.Xml.dll False @@ -80,37 +88,37 @@ OpenGrid.Framework.Communications {683344D5-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenGrid.Framework.Data {62CDF671-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Servers {8BB20F0A-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False XMLRPC {8E81D43C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -137,4 +145,4 @@ - + \ No newline at end of file diff --git a/Common/OpenSim.Framework/LLSDHelpers.cs b/Common/OpenSim.Framework/LLSDHelpers.cs index 3b044a3e82..051520c62d 100644 --- a/Common/OpenSim.Framework/LLSDHelpers.cs +++ b/Common/OpenSim.Framework/LLSDHelpers.cs @@ -89,7 +89,23 @@ namespace OpenSim.Framework System.Reflection.FieldInfo field = myType.GetField((string)enumerator.Key); if (field != null) { - field.SetValue(obj, enumerator.Value); + if (enumerator.Value is Hashtable) + { + object fieldValue = field.GetValue(obj); + DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue); + } + else if (enumerator.Value is ArrayList) + { + object fieldValue = field.GetValue(obj); + fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value); + //TODO + // the LLSD map/array types in the array need to be deserialised + // but first we need to know the right class to deserialise them into. + } + else + { + field.SetValue(obj, enumerator.Value); + } } } break; @@ -161,6 +177,39 @@ namespace OpenSim.Framework } } + [LLSDType("MAP")] + public class LLSDUploadReply + { + public string new_asset = ""; + public LLUUID new_inventory_item = LLUUID.Zero; + public string state = ""; + + public LLSDUploadReply() + { + + } + } + + [LLSDType("MAP")] + public class LLSDCapEvent + { + public int id = 0; + public LLSDArray events = new LLSDArray(); + + public LLSDCapEvent() + { + + } + } + + [LLSDType("MAP")] + public class LLSDEmpty + { + public LLSDEmpty() + { + + } + } [LLSDType("MAP")] public class LLSDTest diff --git a/Common/OpenSim.Framework/OpenSim.Framework.csproj b/Common/OpenSim.Framework/OpenSim.Framework.csproj index f12ffcb7c3..ac0b1953bf 100644 --- a/Common/OpenSim.Framework/OpenSim.Framework.csproj +++ b/Common/OpenSim.Framework/OpenSim.Framework.csproj @@ -126,15 +126,7 @@ Code - - Code - - - Code - - - Code - + Code diff --git a/Common/OpenSim.Framework/Types/NetworkServersInfo.cs b/Common/OpenSim.Framework/Types/NetworkServersInfo.cs index 9c2e7a62f4..73d781169d 100644 --- a/Common/OpenSim.Framework/Types/NetworkServersInfo.cs +++ b/Common/OpenSim.Framework/Types/NetworkServersInfo.cs @@ -49,6 +49,7 @@ namespace OpenSim.Framework.Types public uint DefaultHomeLocY = 0; public int HttpListenerPort = 9000; + public int RemotingListenerPort = 8895; public void InitConfig(bool sandboxMode, IGenericConfig configData) { @@ -71,6 +72,19 @@ namespace OpenSim.Framework.Types this.HttpListenerPort = Convert.ToInt32(attri); } + attri = ""; + attri = configData.GetAttribute("RemotingListenerPort"); + if (attri == "") + { + string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Remoting Listener Port", "8895"); + configData.SetAttribute("RemotingListenerPort", location); + this.RemotingListenerPort = Convert.ToInt32(location); + } + else + { + this.RemotingListenerPort = Convert.ToInt32(attri); + } + if (sandboxMode) { // default home location X diff --git a/Common/OpenSim.Servers/OpenSim.Servers.csproj b/Common/OpenSim.Servers/OpenSim.Servers.csproj index e9be796507..6e8eba7604 100644 --- a/Common/OpenSim.Servers/OpenSim.Servers.csproj +++ b/Common/OpenSim.Servers/OpenSim.Servers.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {8BB20F0A-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim.Servers @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.Servers - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,18 +61,19 @@ False False 4 - + + - + ..\..\bin\libsecondlife.dll False - + System.dll False - + System.Xml.dll False @@ -76,19 +83,19 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False XMLRPC {8E81D43C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -101,15 +108,6 @@ Code - - Code - - - Code - - - Code - Code @@ -124,4 +122,4 @@ - + \ No newline at end of file diff --git a/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs b/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs index d665ab4670..e276556f78 100644 --- a/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs +++ b/OpenGridServices/OpenGrid.Framework.Manager/GridServerManager.cs @@ -24,71 +24,71 @@ * (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 Nwc.XmlRpc; -using System.Threading; -using libsecondlife; - -namespace OpenGrid.Framework.Manager { - +*/ + +using System; +using System.Collections; +using System.Collections.Generic; +using Nwc.XmlRpc; +using System.Threading; +using libsecondlife; + +namespace OpenGrid.Framework.Manager { + /// /// A remote management system for the grid server - /// - public class GridServerManager - { + /// + public class GridServerManager + { /// /// Triggers events from the grid manager - /// - public static GridManagerCallback thecallback; - + /// + public static GridManagerCallback thecallback; + /// /// Security keys - /// - public static string sendkey; - public static string recvkey; - + /// + public static string sendkey; + public static string recvkey; + /// /// Disconnects the grid server and shuts it down /// /// XmlRpc Request - /// An XmlRpc response containing either a "msg" or an "error" - public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - - if(requestData.ContainsKey("session_id")) { - if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { - responseData["msg"]="Shutdown command accepted"; - (new Thread(new ThreadStart(ShutdownServer))).Start(); - } else { - response.IsFault=true; - responseData["error"]="bad session ID"; - } - } else { - response.IsFault=true; - responseData["error"]="no session ID"; - } - - response.Value = responseData; - return response; - } - + /// An XmlRpc response containing either a "msg" or an "error" + public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable responseData = new Hashtable(); + + if(requestData.ContainsKey("session_id")) { + if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { + responseData["msg"]="Shutdown command accepted"; + (new Thread(new ThreadStart(ShutdownServer))).Start(); + } else { + response.IsFault=true; + responseData["error"]="bad session ID"; + } + } else { + response.IsFault=true; + responseData["error"]="no session ID"; + } + + response.Value = responseData; + return response; + } + /// /// Shuts down the grid server - /// - public static void ShutdownServer() - { + /// + public static void ShutdownServer() + { Console.WriteLine("Shutting down the grid server - recieved a grid manager request"); - Console.WriteLine("Terminating in three seconds..."); - Thread.Sleep(3000); - thecallback("shutdown"); - } - } -} - + Console.WriteLine("Terminating in three seconds..."); + Thread.Sleep(3000); + thecallback("shutdown"); + } + } +} + diff --git a/OpenSim/Examples/SimpleApp/Program.cs b/OpenSim/Examples/SimpleApp/Program.cs index 378a09c294..e1465d198c 100644 --- a/OpenSim/Examples/SimpleApp/Program.cs +++ b/OpenSim/Examples/SimpleApp/Program.cs @@ -8,7 +8,6 @@ using OpenSim.Framework.Types; using OpenSim.Framework.Console; using OpenSim.Assets; using libsecondlife; -using OpenSim.UserServer; using OpenSim.Servers; using OpenSim.Framework; using OpenSim.Caches; @@ -32,10 +31,10 @@ namespace SimpleApp string simAddr = "127.0.0.1"; int simPort = 9000; - + /* LoginServer loginServer = new LoginServer( simAddr, simPort, 0, 0, false ); loginServer.Startup(); - loginServer.SetSessionHandler( AddNewSessionHandler ); + loginServer.SetSessionHandler( AddNewSessionHandler );*/ m_circuitManager = new AuthenticateSessionsBase(); @@ -64,7 +63,7 @@ namespace SimpleApp // world.PhysicsScene = physicsScene; // udpServer.LocalWorld = world; - httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod ); + // httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod ); httpServer.Start(); m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit."); diff --git a/OpenSim/OpenSim.Region/Caps.cs b/OpenSim/OpenSim.Region/Caps.cs index 27d4828e23..13a351d892 100644 --- a/OpenSim/OpenSim.Region/Caps.cs +++ b/OpenSim/OpenSim.Region/Caps.cs @@ -17,7 +17,6 @@ namespace OpenSim.Region public class Caps { - private string httpListenerAddress; private uint httpListenPort; private string capsObjectPath = "00001-"; diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs b/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs index ffec3e5728..45d3fed212 100644 --- a/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs +++ b/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs @@ -99,7 +99,7 @@ namespace OpenSim.Region.Scenes m_regionInfo = reginfo; m_regionHandle = reginfo.RegionHandle; - OpenSim.Framework.Console.MainLog.Instance.Verbose( "Avatar.cs - Loading details from grid (DUMMY)"); + OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs "); ControllingClient = theClient; this.firstname = ControllingClient.FirstName; this.lastname = ControllingClient.LastName; @@ -216,8 +216,7 @@ namespace OpenSim.Region.Scenes /// /// public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) - { - + { if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0) { Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); diff --git a/OpenSim/OpenSim.RegionServer/RegionApplicationBase.cs b/OpenSim/OpenSim.RegionServer/RegionApplicationBase.cs index fd16e93c01..68a140bf68 100644 --- a/OpenSim/OpenSim.RegionServer/RegionApplicationBase.cs +++ b/OpenSim/OpenSim.RegionServer/RegionApplicationBase.cs @@ -41,7 +41,6 @@ using OpenSim.Terrain; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework; -using OpenSim.UserServer; using OpenSim.Assets; using OpenSim.Caches; using OpenSim.Framework.Console; diff --git a/OpenSim/OpenSim.RegionServer/UDPServer.cs b/OpenSim/OpenSim.RegionServer/UDPServer.cs index 002e664b2d..f2a02d9306 100644 --- a/OpenSim/OpenSim.RegionServer/UDPServer.cs +++ b/OpenSim/OpenSim.RegionServer/UDPServer.cs @@ -40,7 +40,6 @@ using libsecondlife.Packets; using OpenSim.Terrain; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using OpenSim.UserServer; using OpenSim.Assets; using OpenSim.Caches; using OpenSim.Framework.Console; diff --git a/OpenSim/OpenSim/Application.cs b/OpenSim/OpenSim/Application.cs index 7254560af8..40701b04a1 100644 --- a/OpenSim/OpenSim/Application.cs +++ b/OpenSim/OpenSim/Application.cs @@ -28,7 +28,6 @@ using System; using System.Collections.Generic; using System.Text; -using OpenSim.UserServer; using OpenSim.Framework.Console; namespace OpenSim diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index a6ad15db34..7da22630a2 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs @@ -44,7 +44,6 @@ using OpenSim.Terrain; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework; -using OpenSim.UserServer; using OpenSim.Assets; using OpenSim.Caches; using OpenSim.Framework.Console; @@ -129,21 +128,11 @@ namespace OpenSim m_log.Verbose( "Main.cs:Startup() - Initialising HTTP server"); - //Login server setup - LoginServer loginServer = null; - LoginServer adminLoginServer = null; + if (m_sandbox) { httpServer.AddXmlRPCHandler("login_to_simulator", sandboxCommunications.UserServices.XmlRpcLoginMethod); - - /* - loginServer = new LoginServer(regionData[0].IPListenAddr, regionData[0].IPListenPort, regionData[0].RegionLocX, regionData[0].RegionLocY, false); - loginServer.Startup(); - loginServer.SetSessionHandler(sandboxCommunications.SandBoxServices.AddNewSession); - //sandbox mode with loginserver not using accounts - httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); - */ } //Start http server diff --git a/prebuild.xml b/prebuild.xml index d67ca4a371..b380815c61 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -530,6 +530,7 @@ +