From 5cf6d6fa79dada85bd56530551409809d338b7d2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 10 Jan 2010 20:17:37 -0800 Subject: All grid servers deleted, including user server. They served us well. --- .../OGS1/OGS1InterServiceInventoryService.cs | 87 -- OpenSim/Grid/Framework/IGridServiceCore.cs | 40 - OpenSim/Grid/Framework/IGridServiceModule.cs | 40 - OpenSim/Grid/Framework/IInterServiceUserService.cs | 35 - OpenSim/Grid/Framework/IMessageRegionLookup.cs | 38 - .../Grid/Framework/IMessagingServerDiscovery.cs | 40 - OpenSim/Grid/Framework/XMPPHTTPService.cs | 110 --- OpenSim/Grid/GridServer.Modules/GridDBService.cs | 284 ------- .../Grid/GridServer.Modules/GridMessagingModule.cs | 164 ---- OpenSim/Grid/GridServer.Modules/GridRestModule.cs | 282 ------- .../Grid/GridServer.Modules/GridServerPlugin.cs | 176 ---- .../Grid/GridServer.Modules/GridXmlRpcModule.cs | 900 --------------------- .../Resources/GridServer.Modules.addin.xml | 11 - OpenSim/Grid/GridServer/GridServerBase.cs | 170 ---- OpenSim/Grid/GridServer/IGridPlugin.cs | 49 -- OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs | 63 -- OpenSim/Grid/Manager/OpenGridServices.Manager.mds | 16 - .../Manager/OpenGridServices.Manager.userprefs | 39 - .../Manager/OpenGridServices.Manager.usertasks | 2 - .../OpenGridServices.Manager/AssemblyInfo.cs | 59 -- .../OpenGridServices.Manager/BlockingQueue.cs | 60 -- .../ConnectToGridServer.cs | 39 - .../ConnectToGridServerDialog.cs | 54 -- .../GridServerConnectionManager.cs | 146 ---- .../Grid/Manager/OpenGridServices.Manager/Main.cs | 132 --- .../Manager/OpenGridServices.Manager/MainWindow.cs | 106 --- .../OpenGridServices.Manager/RegionBlock.cs | 62 -- .../Grid/Manager/OpenGridServices.Manager/Util.cs | 160 ---- ...idServices.Manager.ConnectToGridServerDialog.cs | 242 ------ .../gtk-gui/OpenGridServices.Manager.MainWindow.cs | 250 ------ .../OpenGridServices.Manager/gtk-gui/generated.cs | 62 -- .../OpenGridServices.Manager/gtk-gui/gui.stetic | 502 ------------ .../InterMessageUserServerModule.cs | 187 ----- .../MessagingServer.Modules/MessageRegionModule.cs | 200 ----- .../Grid/MessagingServer.Modules/MessageService.cs | 503 ------------ .../PresenceBackreferenceEntry.cs | 96 --- .../MessagingServer.Modules/PresenceInformer.cs | 135 ---- .../MessagingServer.Modules/PresenceService.cs | 33 - .../MessagingServer.Modules/UserDataBaseService.cs | 75 -- .../MessagingServer.Modules/UserPresenceData.cs | 50 -- .../Grid/MessagingServer.Modules/WorkUnitBase.cs | 33 - .../WorkUnitPresenceUpdate.cs | 33 - OpenSim/Grid/MessagingServer/Main.cs | 293 ------- OpenSim/Grid/UserServer.Config/AssemblyInfo.cs | 56 -- OpenSim/Grid/UserServer.Config/DbUserConfig.cs | 106 --- .../UserServer.Modules/AvatarCreationModule.cs | 550 ------------- .../UserServer.Modules/MessageServersConnector.cs | 514 ------------ .../Grid/UserServer.Modules/UserDataBaseService.cs | 100 --- .../Grid/UserServer.Modules/UserLoginService.cs | 416 ---------- OpenSim/Grid/UserServer.Modules/UserManager.cs | 718 ---------------- .../UserServerAvatarAppearanceModule.cs | 132 --- .../UserServer.Modules/UserServerFriendsModule.cs | 176 ---- OpenSim/Grid/UserServer/Main.cs | 316 -------- OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs | 63 -- OpenSim/Grid/UserServer/UserServerCommandModule.cs | 375 --------- OpenSim/Grid/UserServer/UserServerCommsManager.cs | 39 - .../UserServer/UserServerEventDispatchModule.cs | 142 ---- OpenSim/Services/LLLoginService/LLLoginService.cs | 60 ++ prebuild.xml | 287 +------ 59 files changed, 61 insertions(+), 10047 deletions(-) delete mode 100644 OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs delete mode 100644 OpenSim/Grid/Framework/IGridServiceCore.cs delete mode 100644 OpenSim/Grid/Framework/IGridServiceModule.cs delete mode 100644 OpenSim/Grid/Framework/IInterServiceUserService.cs delete mode 100644 OpenSim/Grid/Framework/IMessageRegionLookup.cs delete mode 100644 OpenSim/Grid/Framework/IMessagingServerDiscovery.cs delete mode 100644 OpenSim/Grid/Framework/XMPPHTTPService.cs delete mode 100644 OpenSim/Grid/GridServer.Modules/GridDBService.cs delete mode 100644 OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs delete mode 100644 OpenSim/Grid/GridServer.Modules/GridRestModule.cs delete mode 100644 OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs delete mode 100644 OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs delete mode 100644 OpenSim/Grid/GridServer.Modules/Resources/GridServer.Modules.addin.xml delete mode 100644 OpenSim/Grid/GridServer/GridServerBase.cs delete mode 100644 OpenSim/Grid/GridServer/IGridPlugin.cs delete mode 100644 OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager.mds delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager.userprefs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager.usertasks delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/AssemblyInfo.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServer.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/MainWindow.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/RegionBlock.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/generated.cs delete mode 100644 OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/gui.stetic delete mode 100644 OpenSim/Grid/MessagingServer.Modules/InterMessageUserServerModule.cs delete mode 100644 OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs delete mode 100644 OpenSim/Grid/MessagingServer.Modules/MessageService.cs delete mode 100644 OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs delete mode 100644 OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs delete mode 100644 OpenSim/Grid/MessagingServer.Modules/PresenceService.cs delete mode 100644 OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs delete mode 100644 OpenSim/Grid/MessagingServer.Modules/UserPresenceData.cs delete mode 100644 OpenSim/Grid/MessagingServer.Modules/WorkUnitBase.cs delete mode 100644 OpenSim/Grid/MessagingServer.Modules/WorkUnitPresenceUpdate.cs delete mode 100644 OpenSim/Grid/MessagingServer/Main.cs delete mode 100644 OpenSim/Grid/UserServer.Config/AssemblyInfo.cs delete mode 100644 OpenSim/Grid/UserServer.Config/DbUserConfig.cs delete mode 100644 OpenSim/Grid/UserServer.Modules/AvatarCreationModule.cs delete mode 100644 OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs delete mode 100644 OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs delete mode 100644 OpenSim/Grid/UserServer.Modules/UserLoginService.cs delete mode 100644 OpenSim/Grid/UserServer.Modules/UserManager.cs delete mode 100644 OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs delete mode 100644 OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs delete mode 100644 OpenSim/Grid/UserServer/Main.cs delete mode 100644 OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs delete mode 100644 OpenSim/Grid/UserServer/UserServerCommandModule.cs delete mode 100644 OpenSim/Grid/UserServer/UserServerCommsManager.cs delete mode 100644 OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs diff --git a/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs b/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs deleted file mode 100644 index 1425260..0000000 --- a/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 OpenSimulator 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 OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers.HttpServer; - -namespace OpenSim.Grid.Communications.OGS1 -{ - /// - /// OGS1 implementation of the inter-service inventory service - /// - public class OGS1InterServiceInventoryService : IInterServiceInventoryServices - { - protected Uri m_inventoryServerUrl; - - public OGS1InterServiceInventoryService(Uri inventoryServerUrl) - { - m_inventoryServerUrl = inventoryServerUrl; - } - - /// - /// - /// - /// - /// - public bool CreateNewUserInventory(UUID userId) - { - return SynchronousRestObjectPoster.BeginPostObject( - "POST", m_inventoryServerUrl + "CreateInventory/", userId.Guid); - } - - /// - /// - /// - /// - /// - public List GetInventorySkeleton(UUID userId) - { - return SynchronousRestObjectPoster.BeginPostObject>( - "POST", m_inventoryServerUrl + "RootFolders/", userId.Guid); - } - - /// - /// Returns a list of all the active gestures in a user's inventory. - /// - /// - /// The of the user - /// - /// - /// A flat list of the gesture items. - /// - public List GetActiveGestures(UUID userId) - { - return SynchronousRestObjectPoster.BeginPostObject>( - "POST", m_inventoryServerUrl + "ActiveGestures/", userId.Guid); - } - - } -} diff --git a/OpenSim/Grid/Framework/IGridServiceCore.cs b/OpenSim/Grid/Framework/IGridServiceCore.cs deleted file mode 100644 index da83ade..0000000 --- a/OpenSim/Grid/Framework/IGridServiceCore.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 OpenSimulator 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 OpenSim.Framework.Servers.HttpServer; - -namespace OpenSim.Grid.Framework -{ - public interface IGridServiceCore - { - T Get(); - void RegisterInterface(T iface); - bool TryGet(out T iface); - BaseHttpServer GetHttpServer(); - } -} diff --git a/OpenSim/Grid/Framework/IGridServiceModule.cs b/OpenSim/Grid/Framework/IGridServiceModule.cs deleted file mode 100644 index 2fdf1e4..0000000 --- a/OpenSim/Grid/Framework/IGridServiceModule.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 OpenSimulator 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 OpenSim.Framework.Servers.HttpServer; - -namespace OpenSim.Grid.Framework -{ - public interface IGridServiceModule - { - void Close(); - void Initialise(IGridServiceCore core); - void PostInitialise(); - void RegisterHandlers(BaseHttpServer httpServer); - } -} diff --git a/OpenSim/Grid/Framework/IInterServiceUserService.cs b/OpenSim/Grid/Framework/IInterServiceUserService.cs deleted file mode 100644 index ee7365a..0000000 --- a/OpenSim/Grid/Framework/IInterServiceUserService.cs +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 OpenSimulator 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; -namespace OpenSim.Grid.Framework -{ - public interface IInterServiceUserService - { - bool SendToUserServer(System.Collections.Hashtable request, string method); - } -} diff --git a/OpenSim/Grid/Framework/IMessageRegionLookup.cs b/OpenSim/Grid/Framework/IMessageRegionLookup.cs deleted file mode 100644 index 461fe73..0000000 --- a/OpenSim/Grid/Framework/IMessageRegionLookup.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 OpenSimulator 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 OpenSim.Data; - -namespace OpenSim.Grid.Framework -{ - public interface IMessageRegionLookup - { - int ClearRegionCache(); - RegionProfileData GetRegionInfo(ulong regionhandle); - } -} diff --git a/OpenSim/Grid/Framework/IMessagingServerDiscovery.cs b/OpenSim/Grid/Framework/IMessagingServerDiscovery.cs deleted file mode 100644 index c996f4f..0000000 --- a/OpenSim/Grid/Framework/IMessagingServerDiscovery.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 OpenSimulator 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 OpenSim.Framework.Servers; - -namespace OpenSim.Grid.Framework -{ - public interface IMessagingServerDiscovery - { - List GetMessageServersList(); - void RegisterMessageServer(MessageServerInfo m); - void DeRegisterMessageServer(MessageServerInfo m); - } -} diff --git a/OpenSim/Grid/Framework/XMPPHTTPService.cs b/OpenSim/Grid/Framework/XMPPHTTPService.cs deleted file mode 100644 index 9d27409..0000000 --- a/OpenSim/Grid/Framework/XMPPHTTPService.cs +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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 OpenSimulator 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.IO; -using System.Reflection; -using log4net; -using OpenMetaverse; -using OpenSim.Framework.Servers.HttpServer; - -namespace OpenSim.Grid.Framework -{ - public class XMPPHTTPStreamHandler : BaseStreamHandler - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - - /// - /// Constructor. - /// - /// - /// - public XMPPHTTPStreamHandler() - : base("GET", "/presence") - { - m_log.Info("[REST]: In Get Request"); - - } - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - string param = GetParam(path); - byte[] result = new byte[] {}; - try - { - string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); - - if (p.Length > 0) - { - UUID assetID = UUID.Zero; - - if (!UUID.TryParse(p[0], out assetID)) - { - m_log.InfoFormat( - "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]); - return result; - } - - } - } - catch (Exception e) - { - m_log.Error(e.ToString()); - } - return result; - } - } - - public class PostXMPPStreamHandler : BaseStreamHandler - { - // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - string param = GetParam(path); - - UUID assetId; - if (param.Length > 0) - UUID.TryParse(param, out assetId); - // byte[] txBuffer = new byte[4096]; - - // TODO: Read POST serialize XMPP stanzas - - return new byte[] {}; - } - - public PostXMPPStreamHandler() - : base("POST", "/presence") - { - - } - - } -} diff --git a/OpenSim/Grid/GridServer.Modules/GridDBService.cs b/OpenSim/Grid/GridServer.Modules/GridDBService.cs deleted file mode 100644 index fd5a09a..0000000 --- a/OpenSim/Grid/GridServer.Modules/GridDBService.cs +++ /dev/null @@ -1,284 +0,0 @@ -/* - * 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 OpenSimulator 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.IO; -using System.Reflection; -using System.Xml; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers; - - -namespace OpenSim.Grid.GridServer.Modules -{ - public class GridDBService : IRegionProfileService - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private List _plugins = new List(); - private List _logplugins = new List(); - - /// - /// Adds a list of grid and log data plugins, as described by - /// `provider' and `connect', to `_plugins' and `_logplugins', - /// respectively. - /// - /// - /// The filename of the inventory server plugin DLL. - /// - /// - /// The connection string for the storage backend. - /// - public void AddPlugin(string provider, string connect) - { - _plugins = DataPluginFactory.LoadDataPlugins(provider, connect); - _logplugins = DataPluginFactory.LoadDataPlugins(provider, connect); - } - - public int GetNumberOfPlugins() - { - return _plugins.Count; - } - - /// - /// Logs a piece of information to the database - /// - /// What you were operating on (in grid server, this will likely be the region UUIDs) - /// Which method is being called? - /// What arguments are being passed? - /// How high priority is this? 1 = Max, 6 = Verbose - /// The message to log - private void logToDB(string target, string method, string args, int priority, string message) - { - foreach (ILogDataPlugin plugin in _logplugins) - { - try - { - plugin.saveLog("Gridserver", target, method, args, priority, message); - } - catch (Exception) - { - m_log.Warn("[storage]: Unable to write log via " + plugin.Name); - } - } - } - - /// - /// Returns a region by argument - /// - /// A UUID key of the region to return - /// A SimProfileData for the region - public RegionProfileData GetRegion(UUID uuid) - { - foreach (IGridDataPlugin plugin in _plugins) - { - try - { - return plugin.GetProfileByUUID(uuid); - } - catch (Exception e) - { - m_log.Warn("[storage]: GetRegion - " + e.Message); - } - } - return null; - } - - /// - /// Returns a region by argument - /// - /// A regionHandle of the region to return - /// A SimProfileData for the region - public RegionProfileData GetRegion(ulong handle) - { - foreach (IGridDataPlugin plugin in _plugins) - { - try - { - return plugin.GetProfileByHandle(handle); - } - catch (Exception ex) - { - m_log.Debug("[storage]: " + ex.Message); - m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + plugin.Name); - } - } - return null; - } - - /// - /// Returns a region by argument - /// - /// A partial regionName of the region to return - /// A SimProfileData for the region - public RegionProfileData GetRegion(string regionName) - { - foreach (IGridDataPlugin plugin in _plugins) - { - try - { - return plugin.GetProfileByString(regionName); - } - catch - { - m_log.Warn("[storage]: Unable to find region " + regionName + " via " + plugin.Name); - } - } - return null; - } - - public List GetRegions(uint xmin, uint ymin, uint xmax, uint ymax) - { - List regions = new List(); - - foreach (IGridDataPlugin plugin in _plugins) - { - try - { - regions.AddRange(plugin.GetProfilesInRange(xmin, ymin, xmax, ymax)); - } - catch - { - m_log.Warn("[storage]: Unable to query regionblock via " + plugin.Name); - } - } - - return regions; - } - - public List GetRegions(string name, int maxNum) - { - List regions = new List(); - foreach (IGridDataPlugin plugin in _plugins) - { - try - { - int num = maxNum - regions.Count; - List profiles = plugin.GetRegionsByName(name, (uint)num); - if (profiles != null) regions.AddRange(profiles); - } - catch - { - m_log.Warn("[storage]: Unable to query regionblock via " + plugin.Name); - } - } - - return regions; - } - - public DataResponse AddUpdateRegion(RegionProfileData sim, RegionProfileData existingSim) - { - DataResponse insertResponse = DataResponse.RESPONSE_ERROR; - foreach (IGridDataPlugin plugin in _plugins) - { - try - { - if (existingSim == null) - { - insertResponse = plugin.StoreProfile(sim); - } - else - { - insertResponse = plugin.StoreProfile(sim); - } - } - catch (Exception e) - { - m_log.Warn("[LOGIN END]: " + - "Unable to login region " + sim.ToString() + " via " + plugin.Name); - m_log.Warn("[LOGIN END]: " + e.ToString()); - } - } - return insertResponse; - } - - public DataResponse DeleteRegion(string uuid) - { - DataResponse insertResponse = DataResponse.RESPONSE_ERROR; - foreach (IGridDataPlugin plugin in _plugins) - { - //OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData(); - try - { - //Nice are we not using multiple databases? - //MySQLGridData mysqldata = (MySQLGridData)(plugin); - - //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim); - insertResponse = plugin.DeleteProfile(uuid); - } - catch (Exception) - { - m_log.Error("storage Unable to delete region " + uuid + " via " + plugin.Name); - //MainLog.Instance.Warn("storage", e.ToString()); - insertResponse = DataResponse.RESPONSE_ERROR; - } - } - return insertResponse; - } - - public string CheckReservations(RegionProfileData theSim, XmlNode authkeynode) - { - foreach (IGridDataPlugin plugin in _plugins) - { - try - { - //Check reservations - ReservationData reserveData = - plugin.GetReservationAtPoint(theSim.regionLocX, theSim.regionLocY); - if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) || - (reserveData == null && authkeynode.InnerText != theSim.regionRecvKey)) - { - plugin.StoreProfile(theSim); - m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")"); - logToDB(theSim.ToString(), "RestSetSimMethod", String.Empty, 5, - "Region successfully updated and connected to grid."); - } - else - { - m_log.Warn("[grid]: " + - "Unable to update region (RestSetSimMethod): Incorrect reservation auth key."); - // Wanted: " + reserveData.gridRecvKey + ", Got: " + theSim.regionRecvKey + "."); - return "Unable to update region (RestSetSimMethod): Incorrect auth key."; - } - } - catch (Exception e) - { - m_log.Warn("[GRID]: GetRegionPlugin Handle " + plugin.Name + " unable to add new sim: " + - e.ToString()); - } - } - return "OK"; - } - } -} diff --git a/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs b/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs deleted file mode 100644 index 796c2e3..0000000 --- a/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs +++ /dev/null @@ -1,164 +0,0 @@ -/* - * 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 OpenSimulator 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.Net; -using System.Reflection; -using System.Text; -using Nwc.XmlRpc; -using log4net; -using OpenSim.Data; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Framework; -using OpenSim.Grid.Framework; - -namespace OpenSim.Grid.GridServer.Modules -{ - public class GridMessagingModule : IMessagingServerDiscovery - { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected IRegionProfileService m_gridDBService; - protected IGridServiceCore m_gridCore; - - protected GridConfig m_config; - - /// - /// Used to notify old regions as to which OpenSim version to upgrade to - /// - //private string m_opensimVersion; - - protected BaseHttpServer m_httpServer; - - // This is here so that the grid server can hand out MessageServer settings to regions on registration - private List m_messageServers = new List(); - - public GridMessagingModule() - { - } - - public void Initialise(string opensimVersion, IRegionProfileService gridDBService, IGridServiceCore gridCore, GridConfig config) - { - //m_opensimVersion = opensimVersion; - m_gridDBService = gridDBService; - m_gridCore = gridCore; - m_config = config; - - m_gridCore.RegisterInterface(this); - - RegisterHandlers(); - } - - public void PostInitialise() - { - - } - - public void RegisterHandlers() - { - //have these in separate method as some servers restart the http server and reregister all the handlers. - m_httpServer = m_gridCore.GetHttpServer(); - - // Message Server ---> Grid Server - m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer); - m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer); - } - - public List GetMessageServersList() - { - lock (m_messageServers) - { - return new List(m_messageServers); - } - } - - public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - - if (requestData.Contains("uri")) - { - string URI = (string)requestData["URI"]; - string sendkey = (string)requestData["sendkey"]; - string recvkey = (string)requestData["recvkey"]; - MessageServerInfo m = new MessageServerInfo(); - m.URI = URI; - m.sendkey = sendkey; - m.recvkey = recvkey; - RegisterMessageServer(m); - responseData["responsestring"] = "TRUE"; - response.Value = responseData; - } - return response; - } - - public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - - if (requestData.Contains("uri")) - { - string URI = (string)requestData["uri"]; - string sendkey = (string)requestData["sendkey"]; - string recvkey = (string)requestData["recvkey"]; - MessageServerInfo m = new MessageServerInfo(); - m.URI = URI; - m.sendkey = sendkey; - m.recvkey = recvkey; - DeRegisterMessageServer(m); - responseData["responsestring"] = "TRUE"; - response.Value = responseData; - } - return response; - } - - public void RegisterMessageServer(MessageServerInfo m) - { - lock (m_messageServers) - { - if (!m_messageServers.Contains(m)) - m_messageServers.Add(m); - } - } - - public void DeRegisterMessageServer(MessageServerInfo m) - { - lock (m_messageServers) - { - if (m_messageServers.Contains(m)) - m_messageServers.Remove(m); - } - } - } -} diff --git a/OpenSim/Grid/GridServer.Modules/GridRestModule.cs b/OpenSim/Grid/GridServer.Modules/GridRestModule.cs deleted file mode 100644 index e4c19ca..0000000 --- a/OpenSim/Grid/GridServer.Modules/GridRestModule.cs +++ /dev/null @@ -1,282 +0,0 @@ -/* - * 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 OpenSimulator 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.IO; -using System.Reflection; -using System.Xml; -using log4net; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Grid.Framework; - -namespace OpenSim.Grid.GridServer.Modules -{ - public class GridRestModule - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private GridDBService m_gridDBService; - private IGridServiceCore m_gridCore; - - protected GridConfig m_config; - - /// - /// Used to notify old regions as to which OpenSim version to upgrade to - /// - //private string m_opensimVersion; - - protected BaseHttpServer m_httpServer; - - /// - /// Constructor - /// - /// - /// Used to notify old regions as to which OpenSim version to upgrade to - /// - public GridRestModule() - { - } - - public void Initialise(string opensimVersion, GridDBService gridDBService, IGridServiceCore gridCore, GridConfig config) - { - //m_opensimVersion = opensimVersion; - m_gridDBService = gridDBService; - m_gridCore = gridCore; - m_config = config; - RegisterHandlers(); - } - - public void PostInitialise() - { - - } - - public void RegisterHandlers() - { - //have these in separate method as some servers restart the http server and reregister all the handlers. - m_httpServer = m_gridCore.GetHttpServer(); - - m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", RestGetSimMethod)); - m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", RestSetSimMethod)); - - m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/regions/", RestGetRegionMethod)); - m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", RestSetRegionMethod)); - } - - /// - /// Performs a REST Get Operation - /// - /// - /// - /// - /// HTTP request header object - /// HTTP response header object - /// - public string RestGetRegionMethod(string request, string path, string param, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - return RestGetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse); - } - - /// - /// Performs a REST Set Operation - /// - /// - /// - /// - /// HTTP request header object - /// HTTP response header object - /// - public string RestSetRegionMethod(string request, string path, string param, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - return RestSetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse); - } - - /// - /// Returns information about a sim via a REST Request - /// - /// - /// - /// A string representing the sim's UUID - /// HTTP request header object - /// HTTP response header object - /// Information about the sim in XML - public string RestGetSimMethod(string request, string path, string param, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - string respstring = String.Empty; - - RegionProfileData TheSim; - - UUID UUID; - if (UUID.TryParse(param, out UUID)) - { - TheSim = m_gridDBService.GetRegion(UUID); - - if (!(TheSim == null)) - { - respstring = ""; - respstring += "" + TheSim.regionSendKey + ""; - respstring += ""; - respstring += "" + TheSim.UUID.ToString() + ""; - respstring += "" + TheSim.regionName + ""; - respstring += "" + TheSim.serverIP + ""; - respstring += "" + TheSim.serverPort.ToString() + ""; - respstring += "" + TheSim.regionLocX.ToString() + ""; - respstring += "" + TheSim.regionLocY.ToString() + ""; - respstring += "1"; - respstring += ""; - respstring += ""; - } - } - else - { - respstring = ""; - respstring += "Param must be a UUID"; - respstring += ""; - } - - return respstring; - } - - /// - /// Creates or updates a sim via a REST Method Request - /// BROKEN with SQL Update - /// - /// - /// - /// - /// HTTP request header object - /// HTTP response header object - /// "OK" or an error - public string RestSetSimMethod(string request, string path, string param, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - m_log.Info("Processing region update via REST method"); - RegionProfileData theSim; - theSim = m_gridDBService.GetRegion(new UUID(param)); - if (theSim == null) - { - theSim = new RegionProfileData(); - UUID UUID = new UUID(param); - theSim.UUID = UUID; - theSim.regionRecvKey = m_config.SimRecvKey; - } - - XmlDocument doc = new XmlDocument(); - doc.LoadXml(request); - XmlNode rootnode = doc.FirstChild; - XmlNode authkeynode = rootnode.ChildNodes[0]; - if (authkeynode.Name != "authkey") - { - return "ERROR! bad XML - expected authkey tag"; - } - - XmlNode simnode = rootnode.ChildNodes[1]; - if (simnode.Name != "sim") - { - return "ERROR! bad XML - expected sim tag"; - } - - //theSim.regionSendKey = Cfg; - theSim.regionRecvKey = m_config.SimRecvKey; - theSim.regionSendKey = m_config.SimSendKey; - theSim.regionSecret = m_config.SimRecvKey; - theSim.regionDataURI = String.Empty; - theSim.regionAssetURI = m_config.DefaultAssetServer; - theSim.regionAssetRecvKey = m_config.AssetRecvKey; - theSim.regionAssetSendKey = m_config.AssetSendKey; - theSim.regionUserURI = m_config.DefaultUserServer; - theSim.regionUserSendKey = m_config.UserSendKey; - theSim.regionUserRecvKey = m_config.UserRecvKey; - - for (int i = 0; i < simnode.ChildNodes.Count; i++) - { - switch (simnode.ChildNodes[i].Name) - { - case "regionname": - theSim.regionName = simnode.ChildNodes[i].InnerText; - break; - - case "sim_ip": - theSim.serverIP = simnode.ChildNodes[i].InnerText; - break; - - case "sim_port": - theSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); - break; - - case "region_locx": - theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); - theSim.regionHandle = Utils.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); - break; - - case "region_locy": - theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); - theSim.regionHandle = Utils.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); - break; - } - } - - theSim.serverURI = "http://" + theSim.serverIP + ":" + theSim.serverPort + "/"; - bool requirePublic = false; - bool requireValid = true; - - if (requirePublic && - (theSim.serverIP.StartsWith("172.16") || theSim.serverIP.StartsWith("192.168") || - theSim.serverIP.StartsWith("10.") || theSim.serverIP.StartsWith("0.") || - theSim.serverIP.StartsWith("255."))) - { - return "ERROR! Servers must register with public addresses."; - } - - if (requireValid && (theSim.serverIP.StartsWith("0.") || theSim.serverIP.StartsWith("255."))) - { - return "ERROR! 0.*.*.* / 255.*.*.* Addresses are invalid, please check your server config and try again"; - } - - try - { - m_log.Info("[DATA]: " + - "Updating / adding via " + m_gridDBService.GetNumberOfPlugins() + " storage provider(s) registered."); - - return m_gridDBService.CheckReservations(theSim, authkeynode); - } - catch (Exception e) - { - return "ERROR! Could not save to database! (" + e.ToString() + ")"; - } - } - } -} diff --git a/OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs b/OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs deleted file mode 100644 index f1acaf9..0000000 --- a/OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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 OpenSimulator 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.Reflection; -using System.Text; -using log4net; -using OpenSim.Framework; -using OpenSim.Framework.Console; -using OpenSim.Grid.Framework; -using OpenSim.Grid; - -namespace OpenSim.Grid.GridServer.Modules -{ - public class GridServerPlugin : IGridPlugin - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected GridXmlRpcModule m_gridXmlRpcModule; - protected GridMessagingModule m_gridMessageModule; - protected GridRestModule m_gridRestModule; - - protected GridDBService m_gridDBService; - - protected string m_version; - - protected GridConfig m_config; - - protected IGridServiceCore m_core; - - protected CommandConsole m_console; - - #region IGridPlugin Members - - public void Initialise(GridServerBase gridServer) - { - m_core = gridServer; - m_config = gridServer.Config; - m_version = gridServer.Version; - m_console = MainConsole.Instance; - - AddConsoleCommands(); - - SetupGridServices(); - } - - public void PostInitialise() - { - - } - - #endregion - - #region IPlugin Members - - public string Version - { - get { return "0.0"; } - } - - public string Name - { - get { return "GridServerPlugin"; } - } - - public void Initialise() - { - } - - #endregion - - protected virtual void SetupGridServices() - { - // m_log.Info("[DATA]: Connecting to Storage Server"); - m_gridDBService = new GridDBService(); - m_gridDBService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect); - - //Register the database access service so modules can fetch it - // RegisterInterface(m_gridDBService); - - m_gridMessageModule = new GridMessagingModule(); - m_gridMessageModule.Initialise(m_version, m_gridDBService, m_core, m_config); - - m_gridXmlRpcModule = new GridXmlRpcModule(); - m_gridXmlRpcModule.Initialise(m_version, m_gridDBService, m_core, m_config); - - m_gridRestModule = new GridRestModule(); - m_gridRestModule.Initialise(m_version, m_gridDBService, m_core, m_config); - - m_gridMessageModule.PostInitialise(); - m_gridXmlRpcModule.PostInitialise(); - m_gridRestModule.PostInitialise(); - } - - #region Console Command Handlers - - protected virtual void AddConsoleCommands() - { - m_console.Commands.AddCommand("gridserver", false, - "enable registration", - "enable registration", - "Enable new regions to register", HandleRegistration); - - m_console.Commands.AddCommand("gridserver", false, - "disable registration", - "disable registration", - "Disable registering new regions", HandleRegistration); - - m_console.Commands.AddCommand("gridserver", false, "show status", - "show status", - "Show registration status", HandleShowStatus); - } - - private void HandleRegistration(string module, string[] cmd) - { - switch (cmd[0]) - { - case "enable": - m_config.AllowRegionRegistration = true; - m_log.Info("Region registration enabled"); - break; - case "disable": - m_config.AllowRegionRegistration = false; - m_log.Info("Region registration disabled"); - break; - } - } - - private void HandleShowStatus(string module, string[] cmd) - { - if (m_config.AllowRegionRegistration) - { - m_log.Info("Region registration enabled."); - } - else - { - m_log.Info("Region registration disabled."); - } - } - - #endregion - - #region IDisposable Members - - public void Dispose() - { - } - - #endregion - } -} diff --git a/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs b/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs deleted file mode 100644 index 854e66a..0000000 --- a/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs +++ /dev/null @@ -1,900 +0,0 @@ -/* - * 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 OpenSimulator 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.IO; -using System.Net; -using System.Reflection; -using System.Xml; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Grid.Framework; - -namespace OpenSim.Grid.GridServer.Modules -{ - public class GridXmlRpcModule - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private IRegionProfileService m_gridDBService; - private IGridServiceCore m_gridCore; - - protected GridConfig m_config; - - protected IMessagingServerDiscovery m_messagingServerMapper; - /// - /// Used to notify old regions as to which OpenSim version to upgrade to - /// - private string m_opensimVersion; - - protected BaseHttpServer m_httpServer; - - /// - /// Constructor - /// - /// - /// Used to notify old regions as to which OpenSim version to upgrade to - /// - public GridXmlRpcModule() - { - } - - public void Initialise(string opensimVersion, IRegionProfileService gridDBService, IGridServiceCore gridCore, GridConfig config) - { - m_opensimVersion = opensimVersion; - m_gridDBService = gridDBService; - m_gridCore = gridCore; - m_config = config; - RegisterHandlers(); - } - - public void PostInitialise() - { - IMessagingServerDiscovery messagingModule; - if (m_gridCore.TryGet(out messagingModule)) - { - m_messagingServerMapper = messagingModule; - } - } - - public void RegisterHandlers() - { - //have these in separate method as some servers restart the http server and reregister all the handlers. - m_httpServer = m_gridCore.GetHttpServer(); - - m_httpServer.AddXmlRPCHandler("simulator_login", XmlRpcSimulatorLoginMethod); - m_httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod); - m_httpServer.AddXmlRPCHandler("simulator_after_region_moved", XmlRpcDeleteRegionMethod); - m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod); - m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod); - } - - /// - /// Returns a XML String containing a list of the neighbouring regions - /// - /// The regionhandle for the center sim - /// An XML string containing neighbour entities - public string GetXMLNeighbours(ulong reqhandle) - { - string response = String.Empty; - RegionProfileData central_region = m_gridDBService.GetRegion(reqhandle); - RegionProfileData neighbour; - for (int x = -1; x < 2; x++) - { - for (int y = -1; y < 2; y++) - { - if ( - m_gridDBService.GetRegion( - Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), - (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null) - { - neighbour = - m_gridDBService.GetRegion( - Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), - (uint)(central_region.regionLocY + y) * Constants.RegionSize)); - - response += ""; - response += "" + neighbour.serverIP + ""; - response += "" + neighbour.serverPort.ToString() + ""; - response += "" + neighbour.regionLocX.ToString() + ""; - response += "" + neighbour.regionLocY.ToString() + ""; - response += "" + neighbour.regionHandle.ToString() + ""; - response += ""; - } - } - } - return response; - } - - /// - /// Checks that it's valid to replace the existing region data with new data - /// - /// Currently, this means ensure that the keys passed in by the new region - /// match those in the original region. (XXX Is this correct? Shouldn't we simply check - /// against the keys in the current configuration?) - /// - /// - /// - protected virtual void ValidateOverwriteKeys(RegionProfileData sim, RegionProfileData existingSim) - { - if (!(existingSim.regionRecvKey == sim.regionRecvKey && existingSim.regionSendKey == sim.regionSendKey)) - { - throw new LoginException( - String.Format( - "Authentication failed when trying to login existing region {0} at location {1} {2} currently occupied by {3}" - + " with the region's send key {4} (expected {5}) and the region's receive key {6} (expected {7})", - sim.regionName, sim.regionLocX, sim.regionLocY, existingSim.regionName, - sim.regionSendKey, existingSim.regionSendKey, sim.regionRecvKey, existingSim.regionRecvKey), - "The keys required to login your region did not match the grid server keys. Please check your grid send and receive keys."); - } - } - - /// - /// Checks that the new region data is valid. - /// - /// Currently, this means checking that the keys passed in by the new region - /// match those in the grid server's configuration. - /// - /// - /// - /// Thrown if region login failed - protected virtual void ValidateNewRegionKeys(RegionProfileData sim) - { - if (!(sim.regionRecvKey == m_config.SimSendKey && sim.regionSendKey == m_config.SimRecvKey)) - { - throw new LoginException( - String.Format( - "Authentication failed when trying to login new region {0} at location {1} {2}" - + " with the region's send key {3} (expected {4}) and the region's receive key {5} (expected {6})", - sim.regionName, sim.regionLocX, sim.regionLocY, - sim.regionSendKey, m_config.SimRecvKey, sim.regionRecvKey, m_config.SimSendKey), - "The keys required to login your region did not match your existing region keys. Please check your grid send and receive keys."); - } - } - - /// - /// Check that a region's http uri is externally contactable. - /// - /// - /// Thrown if the region is not contactable - protected virtual void ValidateRegionContactable(RegionProfileData sim) - { - string regionStatusUrl = String.Format("{0}{1}", sim.httpServerURI, "simstatus/"); - string regionStatusResponse; - - RestClient rc = new RestClient(regionStatusUrl); - rc.RequestMethod = "GET"; - - m_log.DebugFormat("[LOGIN]: Contacting {0} for status of region {1}", regionStatusUrl, sim.regionName); - - try - { - Stream rs = rc.Request(); - StreamReader sr = new StreamReader(rs); - regionStatusResponse = sr.ReadToEnd(); - sr.Close(); - } - catch (Exception e) - { - throw new LoginException( - String.Format("Region status request to {0} failed", regionStatusUrl), - String.Format( - "The grid service could not contact the http url {0} at your region. Please make sure this url is reachable by the grid service", - regionStatusUrl), - e); - } - - if (!regionStatusResponse.Equals("OK")) - { - throw new LoginException( - String.Format( - "Region {0} at {1} returned status response {2} rather than {3}", - sim.regionName, regionStatusUrl, regionStatusResponse, "OK"), - String.Format( - "When the grid service asked for the status of your region, it received the response {0} rather than {1}. Please check your status", - regionStatusResponse, "OK")); - } - } - - /// - /// Construct an XMLRPC error response - /// - /// - /// - public static XmlRpcResponse ErrorResponse(string error) - { - XmlRpcResponse errorResponse = new XmlRpcResponse(); - Hashtable errorResponseData = new Hashtable(); - errorResponse.Value = errorResponseData; - errorResponseData["error"] = error; - return errorResponse; - } - - /// - /// Performed when a region connects to the grid server initially. - /// - /// The XML RPC Request - /// Startup parameters - public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request, IPEndPoint remoteClient) - { - RegionProfileData sim; - RegionProfileData existingSim; - - Hashtable requestData = (Hashtable)request.Params[0]; - UUID uuid; - - if (!requestData.ContainsKey("UUID") || !UUID.TryParse((string)requestData["UUID"], out uuid)) - { - m_log.Debug("[LOGIN PRELUDE]: Region connected without a UUID, sending back error response."); - return ErrorResponse("No UUID passed to grid server - unable to connect you"); - } - - try - { - sim = RegionFromRequest(requestData); - } - catch (FormatException e) - { - m_log.Debug("[LOGIN PRELUDE]: Invalid login parameters, sending back error response."); - return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString()); - } - - m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName); - - if (!m_config.AllowRegionRegistration) - { - m_log.DebugFormat( - "[LOGIN END]: Disabled region registration blocked login request from simulator: {0}", - sim.regionName); - - return ErrorResponse("This grid is currently not accepting region registrations."); - } - - int majorInterfaceVersion = 0; - if (requestData.ContainsKey("major_interface_version")) - int.TryParse((string)requestData["major_interface_version"], out majorInterfaceVersion); - - if (majorInterfaceVersion != VersionInfo.MajorInterfaceVersion) - { - return ErrorResponse( - String.Format( - "Your region service implements OGS1 interface version {0}" - + " but this grid requires that the region implement OGS1 interface version {1} to connect." - + " Try changing to OpenSimulator {2}", - majorInterfaceVersion, VersionInfo.MajorInterfaceVersion, m_opensimVersion)); - } - - existingSim = m_gridDBService.GetRegion(sim.regionHandle); - - if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID) - { - try - { - if (existingSim == null) - { - ValidateNewRegionKeys(sim); - } - else - { - ValidateOverwriteKeys(sim, existingSim); - } - - ValidateRegionContactable(sim); - } - catch (LoginException e) - { - string logMsg = e.Message; - if (e.InnerException != null) - logMsg += ", " + e.InnerException.Message; - - m_log.WarnFormat("[LOGIN END]: {0}", logMsg); - - return e.XmlRpcErrorResponse; - } - - DataResponse insertResponse = m_gridDBService.AddUpdateRegion(sim, existingSim); - - switch (insertResponse) - { - case DataResponse.RESPONSE_OK: - m_log.Info("[LOGIN END]: " + (existingSim == null ? "New" : "Existing") + " sim login successful: " + sim.regionName); - break; - case DataResponse.RESPONSE_ERROR: - m_log.Warn("[LOGIN END]: Sim login failed (Error): " + sim.regionName); - break; - case DataResponse.RESPONSE_INVALIDCREDENTIALS: - m_log.Warn("[LOGIN END]: " + - "Sim login failed (Invalid Credentials): " + sim.regionName); - break; - case DataResponse.RESPONSE_AUTHREQUIRED: - m_log.Warn("[LOGIN END]: " + - "Sim login failed (Authentication Required): " + - sim.regionName); - break; - } - - XmlRpcResponse response = CreateLoginResponse(sim); - - return response; - } - else - { - m_log.Warn("[LOGIN END]: Failed to login region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName); - return ErrorResponse("Another region already exists at that location. Please try another."); - } - } - - /// - /// Construct a successful response to a simulator's login attempt. - /// - /// - /// - private XmlRpcResponse CreateLoginResponse(RegionProfileData sim) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable responseData = new Hashtable(); - response.Value = responseData; - - ArrayList SimNeighboursData = GetSimNeighboursData(sim); - - responseData["UUID"] = sim.UUID.ToString(); - responseData["region_locx"] = sim.regionLocX.ToString(); - responseData["region_locy"] = sim.regionLocY.ToString(); - responseData["regionname"] = sim.regionName; - responseData["estate_id"] = "1"; - responseData["neighbours"] = SimNeighboursData; - - responseData["sim_ip"] = sim.serverIP; - responseData["sim_port"] = sim.serverPort.ToString(); - responseData["asset_url"] = sim.regionAssetURI; - responseData["asset_sendkey"] = sim.regionAssetSendKey; - responseData["asset_recvkey"] = sim.regionAssetRecvKey; - responseData["user_url"] = sim.regionUserURI; - responseData["user_sendkey"] = sim.regionUserSendKey; - responseData["user_recvkey"] = sim.regionUserRecvKey; - responseData["authkey"] = sim.regionSecret; - - // New! If set, use as URL to local sim storage (ie http://remotehost/region.Yap) - responseData["data_uri"] = sim.regionDataURI; - - responseData["allow_forceful_banlines"] = m_config.AllowForcefulBanlines; - - // Instead of sending a multitude of message servers to the registering sim - // we should probably be sending a single one and parhaps it's backup - // that has responsibility over routing it's messages. - - // The Sim won't be contacting us again about any of the message server stuff during it's time up. - - responseData["messageserver_count"] = 0; - - // IGridMessagingModule messagingModule; - // if (m_gridCore.TryGet(out messagingModule)) - //{ - if (m_messagingServerMapper != null) - { - List messageServers = m_messagingServerMapper.GetMessageServersList(); - responseData["messageserver_count"] = messageServers.Count; - - for (int i = 0; i < messageServers.Count; i++) - { - responseData["messageserver_uri" + i] = messageServers[i].URI; - responseData["messageserver_sendkey" + i] = messageServers[i].sendkey; - responseData["messageserver_recvkey" + i] = messageServers[i].recvkey; - } - } - return response; - } - - private ArrayList GetSimNeighboursData(RegionProfileData sim) - { - ArrayList SimNeighboursData = new ArrayList(); - - RegionProfileData neighbour; - Hashtable NeighbourBlock; - - //First use the fast method. (not implemented in SQLLite) - List neighbours = m_gridDBService.GetRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1, sim.regionLocY + 1); - - if (neighbours.Count > 0) - { - foreach (RegionProfileData aSim in neighbours) - { - NeighbourBlock = new Hashtable(); - NeighbourBlock["sim_ip"] = aSim.serverIP; - NeighbourBlock["sim_port"] = aSim.serverPort.ToString(); - NeighbourBlock["region_locx"] = aSim.regionLocX.ToString(); - NeighbourBlock["region_locy"] = aSim.regionLocY.ToString(); - NeighbourBlock["UUID"] = aSim.ToString(); - NeighbourBlock["regionHandle"] = aSim.regionHandle.ToString(); - - if (aSim.UUID != sim.UUID) - { - SimNeighboursData.Add(NeighbourBlock); - } - } - } - else - { - for (int x = -1; x < 2; x++) - { - for (int y = -1; y < 2; y++) - { - if ( - m_gridDBService.GetRegion( - Utils.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), - (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null) - { - neighbour = - m_gridDBService.GetRegion( - Utils.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), - (uint)(sim.regionLocY + y) * Constants.RegionSize)); - - NeighbourBlock = new Hashtable(); - NeighbourBlock["sim_ip"] = neighbour.serverIP; - NeighbourBlock["sim_port"] = neighbour.serverPort.ToString(); - NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString(); - NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString(); - NeighbourBlock["UUID"] = neighbour.UUID.ToString(); - NeighbourBlock["regionHandle"] = neighbour.regionHandle.ToString(); - - if (neighbour.UUID != sim.UUID) SimNeighboursData.Add(NeighbourBlock); - } - } - } - } - return SimNeighboursData; - } - - /// - /// Loads the grid's own RegionProfileData object with data from the XMLRPC simulator_login request from a region - /// - /// - /// - private RegionProfileData RegionFromRequest(Hashtable requestData) - { - RegionProfileData sim; - sim = new RegionProfileData(); - - sim.UUID = new UUID((string)requestData["UUID"]); - sim.originUUID = new UUID((string)requestData["originUUID"]); - - sim.regionRecvKey = String.Empty; - sim.regionSendKey = String.Empty; - - if (requestData.ContainsKey("region_secret")) - { - string regionsecret = (string)requestData["region_secret"]; - if (regionsecret.Length > 0) - sim.regionSecret = regionsecret; - else - sim.regionSecret = m_config.SimRecvKey; - - } - else - { - sim.regionSecret = m_config.SimRecvKey; - } - - sim.regionDataURI = String.Empty; - sim.regionAssetURI = m_config.DefaultAssetServer; - sim.regionAssetRecvKey = m_config.AssetRecvKey; - sim.regionAssetSendKey = m_config.AssetSendKey; - sim.regionUserURI = m_config.DefaultUserServer; - sim.regionUserSendKey = m_config.UserSendKey; - sim.regionUserRecvKey = m_config.UserRecvKey; - - sim.serverIP = (string)requestData["sim_ip"]; - sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); - sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); - sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); - sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); - sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); - sim.regionLocZ = 0; - - UUID textureID; - if (UUID.TryParse((string)requestData["map-image-id"], out textureID)) - { - sim.regionMapTextureID = textureID; - } - - // part of an initial brutish effort to provide accurate information (as per the xml region spec) - // wrt the ownership of a given region - // the (very bad) assumption is that this value is being read and handled inconsistently or - // not at all. Current strategy is to put the code in place to support the validity of this information - // and to roll forward debugging any issues from that point - // - // this particular section of the mod attempts to receive a value from the region's xml file by way of - // OSG1GridServices for the region's owner - sim.owner_uuid = (UUID)(string)requestData["master_avatar_uuid"]; - - try - { - sim.regionRecvKey = (string)requestData["recvkey"]; - sim.regionSendKey = (string)requestData["authkey"]; - } - catch (KeyNotFoundException) { } - - sim.regionHandle = Utils.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize)); - sim.serverURI = (string)requestData["server_uri"]; - - sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/"; - - sim.regionName = (string)requestData["sim_name"]; - - - try - { - - sim.maturity = Convert.ToUInt32((string)requestData["maturity"]); - } - catch (KeyNotFoundException) - { - //older region not providing this key - so default to Mature - sim.maturity = 1; - } - - return sim; - } - - /// - /// Returns an XML RPC response to a simulator profile request - /// Performed after moving a region. - /// - /// - /// - /// The XMLRPC Request - /// Processing parameters - public XmlRpcResponse XmlRpcDeleteRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable responseData = new Hashtable(); - response.Value = responseData; - - //RegionProfileData TheSim = null; - string uuid; - Hashtable requestData = (Hashtable)request.Params[0]; - - if (requestData.ContainsKey("UUID")) - { - //TheSim = GetRegion(new UUID((string) requestData["UUID"])); - uuid = requestData["UUID"].ToString(); - m_log.InfoFormat("[LOGOUT]: Logging out region: {0}", uuid); - // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID."); - } - else - { - responseData["error"] = "No UUID or region_handle passed to grid server - unable to delete"; - return response; - } - - DataResponse insertResponse = m_gridDBService.DeleteRegion(uuid); - - string insertResp = ""; - switch (insertResponse) - { - case DataResponse.RESPONSE_OK: - //MainLog.Instance.Verbose("grid", "Deleting region successful: " + uuid); - insertResp = "Deleting region successful: " + uuid; - break; - case DataResponse.RESPONSE_ERROR: - //MainLog.Instance.Warn("storage", "Deleting region failed (Error): " + uuid); - insertResp = "Deleting region failed (Error): " + uuid; - break; - case DataResponse.RESPONSE_INVALIDCREDENTIALS: - //MainLog.Instance.Warn("storage", "Deleting region failed (Invalid Credentials): " + uuid); - insertResp = "Deleting region (Invalid Credentials): " + uuid; - break; - case DataResponse.RESPONSE_AUTHREQUIRED: - //MainLog.Instance.Warn("storage", "Deleting region failed (Authentication Required): " + uuid); - insertResp = "Deleting region (Authentication Required): " + uuid; - break; - } - - responseData["status"] = insertResp; - - return response; - } - - /// - /// Returns an XML RPC response to a simulator profile request - /// - /// - /// - public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request, IPEndPoint remoteClient) - { - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - RegionProfileData simData = null; - if (requestData.ContainsKey("region_UUID")) - { - UUID regionID = new UUID((string)requestData["region_UUID"]); - simData = m_gridDBService.GetRegion(regionID); - if (simData == null) - { - m_log.WarnFormat("[DATA] didn't find region for regionID {0} from {1}", - regionID, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); - } - } - else if (requestData.ContainsKey("region_handle")) - { - //CFK: The if/else below this makes this message redundant. - //CFK: m_log.Info("requesting data for region " + (string) requestData["region_handle"]); - ulong regionHandle = Convert.ToUInt64((string)requestData["region_handle"]); - simData = m_gridDBService.GetRegion(regionHandle); - if (simData == null) - { - m_log.WarnFormat("[DATA] didn't find region for regionHandle {0} from {1}", - regionHandle, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); - } - } - else if (requestData.ContainsKey("region_name_search")) - { - string regionName = (string)requestData["region_name_search"]; - simData = m_gridDBService.GetRegion(regionName); - if (simData == null) - { - m_log.WarnFormat("[DATA] didn't find region for regionName {0} from {1}", - regionName, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); - } - } - else m_log.Warn("[DATA] regionlookup without regionID, regionHandle or regionHame"); - - if (simData == null) - { - //Sim does not exist - responseData["error"] = "Sim does not exist"; - } - else - { - m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " + - (string)requestData["region_handle"]); - responseData["sim_ip"] = simData.serverIP; - responseData["sim_port"] = simData.serverPort.ToString(); - responseData["server_uri"] = simData.serverURI; - responseData["http_port"] = simData.httpPort.ToString(); - responseData["remoting_port"] = simData.remotingPort.ToString(); - responseData["region_locx"] = simData.regionLocX.ToString(); - responseData["region_locy"] = simData.regionLocY.ToString(); - responseData["region_UUID"] = simData.UUID.Guid.ToString(); - responseData["region_name"] = simData.regionName; - responseData["regionHandle"] = simData.regionHandle.ToString(); - } - - XmlRpcResponse response = new XmlRpcResponse(); - response.Value = responseData; - return response; - } - - public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request, IPEndPoint remoteClient) - { - int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020; - - Hashtable requestData = (Hashtable)request.Params[0]; - if (requestData.ContainsKey("xmin")) - { - xmin = (Int32)requestData["xmin"]; - } - if (requestData.ContainsKey("ymin")) - { - ymin = (Int32)requestData["ymin"]; - } - if (requestData.ContainsKey("xmax")) - { - xmax = (Int32)requestData["xmax"]; - } - if (requestData.ContainsKey("ymax")) - { - ymax = (Int32)requestData["ymax"]; - } - //CFK: The second log is more meaningful and either standard or fast generally occurs. - //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); - - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable responseData = new Hashtable(); - response.Value = responseData; - IList simProfileList = new ArrayList(); - - bool fastMode = (m_config.DatabaseProvider == "OpenSim.Data.MySQL.dll" || m_config.DatabaseProvider == "OpenSim.Data.MSSQL.dll"); - - if (fastMode) - { - List neighbours = m_gridDBService.GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); - - foreach (RegionProfileData aSim in neighbours) - { - Hashtable simProfileBlock = new Hashtable(); - simProfileBlock["x"] = aSim.regionLocX.ToString(); - simProfileBlock["y"] = aSim.regionLocY.ToString(); - //m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.regionLocX, aSim.regionLocY); - simProfileBlock["name"] = aSim.regionName; - simProfileBlock["access"] = aSim.AccessLevel.ToString(); - simProfileBlock["region-flags"] = 512; - simProfileBlock["water-height"] = 0; - simProfileBlock["agents"] = 1; - simProfileBlock["map-image-id"] = aSim.regionMapTextureID.ToString(); - - // For Sugilite compatibility - simProfileBlock["regionhandle"] = aSim.regionHandle.ToString(); - simProfileBlock["sim_ip"] = aSim.serverIP; - simProfileBlock["sim_port"] = aSim.serverPort.ToString(); - simProfileBlock["sim_uri"] = aSim.serverURI.ToString(); - simProfileBlock["uuid"] = aSim.UUID.ToString(); - simProfileBlock["remoting_port"] = aSim.remotingPort.ToString(); - simProfileBlock["http_port"] = aSim.httpPort.ToString(); - - simProfileList.Add(simProfileBlock); - } - m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() + - " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); - } - else - { - RegionProfileData simProfile; - for (int x = xmin; x < xmax + 1; x++) - { - for (int y = ymin; y < ymax + 1; y++) - { - ulong regHandle = Utils.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize)); - simProfile = m_gridDBService.GetRegion(regHandle); - if (simProfile != null) - { - Hashtable simProfileBlock = new Hashtable(); - simProfileBlock["x"] = x; - simProfileBlock["y"] = y; - simProfileBlock["name"] = simProfile.regionName; - simProfileBlock["access"] = simProfile.AccessLevel.ToString(); - simProfileBlock["region-flags"] = 0; - simProfileBlock["water-height"] = 20; - simProfileBlock["agents"] = 1; - simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString(); - - // For Sugilite compatibility - simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); - simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); - simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); - simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); - simProfileBlock["uuid"] = simProfile.UUID.ToString(); - simProfileBlock["remoting_port"] = simProfile.remotingPort.ToString(); - simProfileBlock["http_port"] = simProfile.httpPort; - - simProfileList.Add(simProfileBlock); - } - } - } - m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() + - " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); - } - - responseData["sim-profiles"] = simProfileList; - - return response; - } - - /// - /// Returns up to maxNumber profiles of regions that have a name starting with name - /// - /// - /// - public XmlRpcResponse XmlRpcSearchForRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient) - { - Hashtable requestData = (Hashtable)request.Params[0]; - - if (!requestData.ContainsKey("name") || !requestData.Contains("maxNumber")) - { - m_log.Warn("[DATA] Invalid region-search request; missing name or maxNumber"); - return new XmlRpcResponse(500, "Missing name or maxNumber in region search request"); - } - - Hashtable responseData = new Hashtable(); - - string name = (string)requestData["name"]; - int maxNumber = Convert.ToInt32((string)requestData["maxNumber"]); - if (maxNumber == 0 || name.Length < 3) - { - // either we didn't want any, or we were too unspecific - responseData["numFound"] = 0; - } - else - { - List sims = m_gridDBService.GetRegions(name, maxNumber); - - responseData["numFound"] = sims.Count; - for (int i = 0; i < sims.Count; ++i) - { - RegionProfileData sim = sims[i]; - string prefix = "region" + i + "."; - responseData[prefix + "region_name"] = sim.regionName; - responseData[prefix + "region_UUID"] = sim.UUID.ToString(); - responseData[prefix + "region_locx"] = sim.regionLocX.ToString(); - responseData[prefix + "region_locy"] = sim.regionLocY.ToString(); - responseData[prefix + "sim_ip"] = sim.serverIP.ToString(); - responseData[prefix + "sim_port"] = sim.serverPort.ToString(); - responseData[prefix + "remoting_port"] = sim.remotingPort.ToString(); - responseData[prefix + "http_port"] = sim.httpPort.ToString(); - responseData[prefix + "map_UUID"] = sim.regionMapTextureID.ToString(); - } - } - - XmlRpcResponse response = new XmlRpcResponse(); - response.Value = responseData; - return response; - } - - /// - /// Construct an XMLRPC registration disabled response - /// - /// - /// - public static XmlRpcResponse XmlRPCRegionRegistrationDisabledResponse(string error) - { - XmlRpcResponse errorResponse = new XmlRpcResponse(); - Hashtable errorResponseData = new Hashtable(); - errorResponse.Value = errorResponseData; - errorResponseData["restricted"] = error; - return errorResponse; - } - } - - /// - /// Exception generated when a simulator fails to login to the grid - /// - public class LoginException : Exception - { - /// - /// Return an XmlRpcResponse version of the exception message suitable for sending to a client - /// - /// - /// - public XmlRpcResponse XmlRpcErrorResponse - { - get { return m_xmlRpcErrorResponse; } - } - private XmlRpcResponse m_xmlRpcErrorResponse; - - public LoginException(string message, string xmlRpcMessage) - : base(message) - { - // FIXME: Might be neater to refactor and put the method inside here - m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage); - } - - public LoginException(string message, string xmlRpcMessage, Exception e) - : base(message, e) - { - // FIXME: Might be neater to refactor and put the method inside here - m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage); - } - } -} diff --git a/OpenSim/Grid/GridServer.Modules/Resources/GridServer.Modules.addin.xml b/OpenSim/Grid/GridServer.Modules/Resources/GridServer.Modules.addin.xml deleted file mode 100644 index c2c5ac3..0000000 --- a/OpenSim/Grid/GridServer.Modules/Resources/GridServer.Modules.addin.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs deleted file mode 100644 index 9b0d7ea..0000000 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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 OpenSimulator 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.IO; -using System.Reflection; -using log4net; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Grid.Framework; - -namespace OpenSim.Grid.GridServer -{ - /// - /// - public class GridServerBase : BaseOpenSimServer, IGridServiceCore - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected GridConfig m_config; - public string m_consoleType = "local"; - public IConfigSource m_configSource = null; - public string m_configFile = "GridServer_Config.xml"; - - public GridConfig Config - { - get { return m_config; } - } - - public string Version - { - get { return m_version; } - } - - protected List m_plugins = new List(); - - public void Work() - { - m_console.Output("Enter help for a list of commands\n"); - - while (true) - { - m_console.Prompt(); - } - } - - public GridServerBase() - { - } - - protected override void StartupSpecific() - { - switch (m_consoleType) - { - case "rest": - m_console = new RemoteConsole("Grid"); - break; - case "basic": - m_console = new CommandConsole("Grid"); - break; - default: - m_console = new LocalConsole("Grid"); - break; - } - MainConsole.Instance = m_console; - m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), m_configFile))); - - m_log.Info("[GRID]: Starting HTTP process"); - m_httpServer = new BaseHttpServer(m_config.HttpPort); - if (m_console is RemoteConsole) - { - RemoteConsole c = (RemoteConsole)m_console; - c.SetServer(m_httpServer); - IConfig netConfig = m_configSource.AddConfig("Network"); - netConfig.Set("ConsoleUser", m_config.ConsoleUser); - netConfig.Set("ConsolePass", m_config.ConsolePass); - c.ReadConfig(m_configSource); - } - - LoadPlugins(); - - m_httpServer.Start(); - - base.StartupSpecific(); - } - - protected virtual void LoadPlugins() - { - using (PluginLoader loader = new PluginLoader(new GridPluginInitialiser(this))) - { - loader.Load("/OpenSim/GridServer"); - m_plugins = loader.Plugins; - } - } - - public override void ShutdownSpecific() - { - foreach (IGridPlugin plugin in m_plugins) plugin.Dispose(); - } - - #region IServiceCore - protected Dictionary m_moduleInterfaces = new Dictionary(); - - /// - /// Register an Module interface. - /// - /// - /// - public void RegisterInterface(T iface) - { - lock (m_moduleInterfaces) - { - if (!m_moduleInterfaces.ContainsKey(typeof(T))) - { - m_moduleInterfaces.Add(typeof(T), iface); - } - } - } - - public bool TryGet(out T iface) - { - if (m_moduleInterfaces.ContainsKey(typeof(T))) - { - iface = (T)m_moduleInterfaces[typeof(T)]; - return true; - } - iface = default(T); - return false; - } - - public T Get() - { - return (T)m_moduleInterfaces[typeof(T)]; - } - - public BaseHttpServer GetHttpServer() - { - return m_httpServer; - } - #endregion - } -} diff --git a/OpenSim/Grid/GridServer/IGridPlugin.cs b/OpenSim/Grid/GridServer/IGridPlugin.cs deleted file mode 100644 index bd0feb6..0000000 --- a/OpenSim/Grid/GridServer/IGridPlugin.cs +++ /dev/null @@ -1,49 +0,0 @@ -/* -* 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 OpenSimulator 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 OpenSim.Framework; - -namespace OpenSim.Grid.GridServer -{ - public interface IGridPlugin : IPlugin - { - void Initialise(GridServerBase gridServer); - void PostInitialise(); - } - - public class GridPluginInitialiser : PluginInitialiserBase - { - private GridServerBase server; - public GridPluginInitialiser (GridServerBase s) { server = s; } - public override void Initialise (IPlugin plugin) - { - IGridPlugin p = plugin as IGridPlugin; - p.Initialise (server); - } - } -} diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs deleted file mode 100644 index 24c4bd7..0000000 --- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 OpenSimulator 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.Reflection; -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("OGS-GridServer")] -[assembly : AssemblyDescription("")] -[assembly : AssemblyConfiguration("")] -[assembly : AssemblyCompany("http://opensimulator.org")] -[assembly : AssemblyProduct("OGS-GridServer")] -[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] -[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("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// - -[assembly : AssemblyVersion("0.6.5.*")] -[assembly : AssemblyFileVersion("0.6.5.0")] diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager.mds b/OpenSim/Grid/Manager/OpenGridServices.Manager.mds deleted file mode 100644 index ed7bc24..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager.mds +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager.userprefs b/OpenSim/Grid/Manager/OpenGridServices.Manager.userprefs deleted file mode 100644 index f221509..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager.userprefs +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager.usertasks b/OpenSim/Grid/Manager/OpenGridServices.Manager.usertasks deleted file mode 100644 index d887d0e..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager.usertasks +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/AssemblyInfo.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/AssemblyInfo.cs deleted file mode 100644 index 49d1818..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/AssemblyInfo.cs +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 OpenSimulator 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.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://opensimulator.org")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("0.6.3.*")] - -// The following attributes specify the key for the sign of your assembly. See the -// .NET Framework documentation for more information about signing. -// This is not required, if you don't want signing let these attributes like they're. -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs deleted file mode 100644 index 2e39cd0..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 OpenSimulator 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.Threading; -using System.Collections.Generic; -using System.Text; - -namespace OpenGridServices.Manager -{ - public class BlockingQueue - { - private Queue _queue = new Queue(); - private object _queueSync = new object(); - - public void Enqueue(T value) - { - lock (_queueSync) - { - _queue.Enqueue(value); - Monitor.Pulse(_queueSync); - } - } - - public T Dequeue() - { - lock (_queueSync) - { - if (_queue.Count < 1) - Monitor.Wait(_queueSync); - - return _queue.Dequeue(); - } - } - } -} diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServer.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServer.cs deleted file mode 100644 index 25f25a7..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServer.cs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 OpenSimulator 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; - -namespace OpenGridServices.Manager -{ - public partial class Connect to grid server : Gtk.Dialog - { - public Connect to grid server() - { - this.Build(); - } - } -} diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs deleted file mode 100644 index fd4d211..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 OpenSimulator 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 Gtk; -using System; - -namespace OpenGridServices.Manager -{ - public partial class ConnectToGridServerDialog : Gtk.Dialog - { - public ConnectToGridServerDialog() - { - this.Build(); - } - - protected virtual void OnResponse(object o, Gtk.ResponseArgs args) - { - switch (args.ResponseId) - { - case Gtk.ResponseType.Ok: - MainClass.PendingOperations.Enqueue("connect_to_gridserver " + this.entry1.Text + " " + this.entry2.Text + " " + this.entry3.Text); - break; - - case Gtk.ResponseType.Cancel: - break; - } - this.Hide(); - } - } -} diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs deleted file mode 100644 index 425a20e..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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 OpenSimulator 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 Nwc.XmlRpc; -using System; -using System.Net; -using System.IO; -using System.Xml; -using System.Collections; -using System.Collections.Generic; -using libsecondlife; - -namespace OpenGridServices.Manager -{ - public class GridServerConnectionManager - { - private string ServerURL; - public LLUUID SessionID; - public bool connected=false; - - public RegionBlock[][] WorldMap; - - public bool Connect(string GridServerURL, string username, string password) - { - try - { - this.ServerURL=GridServerURL; - Hashtable LoginParamsHT = new Hashtable(); - LoginParamsHT["username"]=username; - LoginParamsHT["password"]=password; - ArrayList LoginParams = new ArrayList(); - LoginParams.Add(LoginParamsHT); - XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams); - XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000); - if (GridResp.IsFault) - { - connected=false; - return false; - } - else - { - Hashtable gridrespData = (Hashtable)GridResp.Value; - this.SessionID = new LLUUID((string)gridrespData["session_id"]); - connected=true; - return true; - } - } - catch(Exception e) - { - Console.WriteLine(e.ToString()); - connected=false; - return false; - } - } - - public void DownloadMap() - { - System.Net.WebClient mapdownloader = new WebClient(); - Stream regionliststream = mapdownloader.OpenRead(ServerURL + "/regionlist"); - - RegionBlock TempRegionData; - - XmlDocument doc = new XmlDocument(); - doc.Load(regionliststream); - regionliststream.Close(); - XmlNode rootnode = doc.FirstChild; - if (rootnode.Name != "regions") - { - // TODO - ERROR! - } - - for (int i = 0; i <= rootnode.ChildNodes.Count; i++) - { - if (rootnode.ChildNodes.Item(i).Name != "region") - { - // TODO - ERROR! - } - else - { - TempRegionData = new RegionBlock(); - } - } - } - - public bool RestartServer() - { - return true; - } - - public bool ShutdownServer() - { - try - { - Hashtable ShutdownParamsHT = new Hashtable(); - ArrayList ShutdownParams = new ArrayList(); - ShutdownParamsHT["session_id"]=this.SessionID.ToString(); - ShutdownParams.Add(ShutdownParamsHT); - XmlRpcRequest GridShutdownReq = new XmlRpcRequest("shutdown",ShutdownParams); - XmlRpcResponse GridResp = GridShutdownReq.Send(this.ServerURL, 3000); - if (GridResp.IsFault) - { - return false; - } - else - { - connected=false; - return true; - } - } - catch(Exception e) - { - Console.WriteLine(e.ToString()); - return false; - } - } - - public void DisconnectServer() - { - this.connected=false; - } - } -} diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs deleted file mode 100644 index 63954d5..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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 OpenSimulator 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.Threading; -using Gtk; - -namespace OpenGridServices.Manager -{ - class MainClass - { - - public static bool QuitReq=false; - public static BlockingQueue PendingOperations = new BlockingQueue(); - - private static Thread OperationsRunner; - - private static GridServerConnectionManager gridserverConn; - - private static MainWindow win; - - public static void DoMainLoop() - { - while (!QuitReq) - { - Application.RunIteration(); - } - } - - public static void RunOperations() - { - string operation; - string cmd; - char[] sep = new char[1]; - sep[0]=' '; - while (!QuitReq) - { - operation=PendingOperations.Dequeue(); - Console.WriteLine(operation); - cmd = operation.Split(sep)[0]; - switch (cmd) - { - case "connect_to_gridserver": - win.SetStatus("Connecting to grid server..."); - if (gridserverConn.Connect(operation.Split(sep)[1], operation.Split(sep)[2], operation.Split(sep)[3])) - { - win.SetStatus("Connected OK with session ID:" + gridserverConn.SessionID); - win.SetGridServerConnected(true); - Thread.Sleep(3000); - win.SetStatus("Downloading region maps..."); - gridserverConn.DownloadMap(); - } - else - { - win.SetStatus("Could not connect"); - } - break; - - case "restart_gridserver": - win.SetStatus("Restarting grid server..."); - if (gridserverConn.RestartServer()) - { - win.SetStatus("Restarted server OK"); - Thread.Sleep(3000); - win.SetStatus(""); - } - else - { - win.SetStatus("Error restarting grid server!!!"); - } - break; - - case "shutdown_gridserver": - win.SetStatus("Shutting down grid server..."); - if (gridserverConn.ShutdownServer()) - { - win.SetStatus("Grid server shutdown"); - win.SetGridServerConnected(false); - Thread.Sleep(3000); - win.SetStatus(""); - } - else - { - win.SetStatus("Could not shutdown grid server!!!"); - } - break; - - case "disconnect_gridserver": - gridserverConn.DisconnectServer(); - win.SetGridServerConnected(false); - break; - } - } - } - - public static void Main (string[] args) - { - gridserverConn = new GridServerConnectionManager(); - Application.Init (); - win = new MainWindow (); - win.Show (); - OperationsRunner = new Thread(new ThreadStart(RunOperations)); - OperationsRunner.IsBackground=true; - OperationsRunner.Start(); - DoMainLoop(); - } - } -} diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/MainWindow.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/MainWindow.cs deleted file mode 100644 index c6fa800..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/MainWindow.cs +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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 OpenSimulator 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 Gtk; - -namespace OpenGridServices.Manager -{ - public partial class MainWindow: Gtk.Window - { - public MainWindow() : base (Gtk.WindowType.Toplevel) - { - Build(); - } - - public void SetStatus(string statustext) - { - this.statusbar1.Pop(0); - this.statusbar1.Push(0, statustext); - } - - public void DrawGrid(RegionBlock[][] regions) - { - for (int x=0; x<=regions.GetUpperBound(0); x++) - { - for (int y=0; y<=regions.GetUpperBound(1); y++) - { - Gdk.Image themap = new Gdk.Image(Gdk.ImageType.Fastest,Gdk.Visual.System,256,256); - this.drawingarea1.GdkWindow.DrawImage(new Gdk.GC(this.drawingarea1.GdkWindow),themap,0,0,x*256,y*256,256,256); - } - } - } - - public void SetGridServerConnected(bool connected) - { - if (connected) - { - this.ConnectToGridserver.Visible=false; - this.DisconnectFromGridServer.Visible=true; - } - else - { - this.ConnectToGridserver.Visible=true; - this.DisconnectFromGridServer.Visible=false; - } - } - - protected void OnDeleteEvent (object sender, DeleteEventArgs a) - { - Application.Quit (); - MainClass.QuitReq=true; - a.RetVal = true; - } - - protected virtual void QuitMenu(object sender, System.EventArgs e) - { - MainClass.QuitReq=true; - Application.Quit(); - } - - protected virtual void ConnectToGridServerMenu(object sender, System.EventArgs e) - { - ConnectToGridServerDialog griddialog = new ConnectToGridServerDialog (); - griddialog.Show(); - } - - protected virtual void RestartGridserverMenu(object sender, System.EventArgs e) - { - MainClass.PendingOperations.Enqueue("restart_gridserver"); - } - - protected virtual void ShutdownGridserverMenu(object sender, System.EventArgs e) - { - MainClass.PendingOperations.Enqueue("shutdown_gridserver"); - } - - protected virtual void DisconnectGridServerMenu(object sender, System.EventArgs e) - { - MainClass.PendingOperations.Enqueue("disconnect_gridserver"); - } - } -} diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/RegionBlock.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/RegionBlock.cs deleted file mode 100644 index 6c8b0bd..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/RegionBlock.cs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 OpenSimulator 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.Xml; -using libsecondlife; -using OpenSim.Framework.Utilities; - -namespace OpenGridServices.Manager -{ - public class RegionBlock - { - public uint regloc_x; - public uint regloc_y; - - public string httpd_url; - - public string region_name; - - public ulong regionhandle { - get { return Util.UIntsToLong(regloc_x*256,regloc_y*256); } - } - - public Gdk.Pixbuf MiniMap; - - public RegionBlock() - { - } - - public void LoadFromXmlNode(XmlNode sourcenode) - { - this.regloc_x=Convert.ToUInt32(sourcenode.Attributes.GetNamedItem("loc_x").Value); - this.regloc_y=Convert.ToUInt32(sourcenode.Attributes.GetNamedItem("loc_y").Value); - this.region_name=sourcenode.Attributes.GetNamedItem("region_name").Value; - this.httpd_url=sourcenode.Attributes.GetNamedItem("httpd_url").Value; - } - } -} diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs deleted file mode 100644 index f2383bc..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs +++ /dev/null @@ -1,160 +0,0 @@ -/* - * 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 OpenSimulator 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 libsecondlife.Packets; - -namespace OpenSim.Framework.Utilities -{ - public class Util - { - private static Random randomClass = new Random(); - private static uint nextXferID = 5000; - private static object XferLock = new object(); - - public static ulong UIntsToLong(uint X, uint Y) - { - return Helpers.UIntsToLong(X, Y); - } - - public static Random RandomClass - { - get - { - return randomClass; - } - } - - public static uint GetNextXferID() - { - uint id = 0; - lock (XferLock) - { - id = nextXferID; - nextXferID++; - } - return id; - } - - //public static int fast_distance2d(int x, int y) - //{ - // x = System.Math.Abs(x); - // y = System.Math.Abs(y); - - // int min = System.Math.Min(x, y); - - // return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); - //} - - public static string FieldToString(byte[] bytes) - { - return FieldToString(bytes, String.Empty); - } - - /// - /// Convert a variable length field (byte array) to a string, with a - /// field name prepended to each line of the output - /// - /// If the byte array has unprintable characters in it, a - /// hex dump will be put in the string instead - /// The byte array to convert to a string - /// A field name to prepend to each line of output - /// An ASCII string or a string containing a hex dump, minus - /// the null terminator - public static string FieldToString(byte[] bytes, string fieldName) - { - // Check for a common case - if (bytes.Length == 0) return String.Empty; - - StringBuilder output = new StringBuilder(); - bool printable = true; - - for (int i = 0; i < bytes.Length; ++i) - { - // Check if there are any unprintable characters in the array - if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09 - && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00) - { - printable = false; - break; - } - } - - if (printable) - { - if (fieldName.Length > 0) - { - output.Append(fieldName); - output.Append(": "); - } - - if (bytes[bytes.Length - 1] == 0x00) - output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1)); - else - output.Append(UTF8Encoding.UTF8.GetString(bytes)); - } - else - { - for (int i = 0; i < bytes.Length; i += 16) - { - if (i != 0) - output.Append(Environment.NewLine); - if (fieldName.Length > 0) - { - output.Append(fieldName); - output.Append(": "); - } - - for (int j = 0; j < 16; j++) - { - if ((i + j) < bytes.Length) - output.Append(String.Format("{0:X2} ", bytes[i + j])); - else - output.Append(" "); - } - - for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) - { - if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) - output.Append((char)bytes[i + j]); - else - output.Append("."); - } - } - } - - return output.ToString(); - } - - public Util() - { - } - } -} diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs deleted file mode 100644 index d80499c..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs +++ /dev/null @@ -1,242 +0,0 @@ -/* - * 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 OpenSimulator 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. - */ - -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -namespace OpenGridServices.Manager -{ - public partial class ConnectToGridServerDialog - { - private Gtk.VBox vbox2; - private Gtk.VBox vbox3; - private Gtk.HBox hbox1; - private Gtk.Label label1; - private Gtk.Entry entry1; - private Gtk.HBox hbox2; - private Gtk.Label label2; - private Gtk.Entry entry2; - private Gtk.HBox hbox3; - private Gtk.Label label3; - private Gtk.Entry entry3; - private Gtk.Button button2; - private Gtk.Button button8; - - protected virtual void Build() - { - Stetic.Gui.Initialize(); - // Widget OpenGridServices.Manager.ConnectToGridServerDialog - this.Events = ((Gdk.EventMask)(256)); - this.Name = "OpenGridServices.Manager.ConnectToGridServerDialog"; - this.Title = Mono.Unix.Catalog.GetString("Connect to Grid server"); - this.WindowPosition = ((Gtk.WindowPosition)(4)); - this.HasSeparator = false; - // Internal child OpenGridServices.Manager.ConnectToGridServerDialog.VBox - Gtk.VBox w1 = this.VBox; - w1.Events = ((Gdk.EventMask)(256)); - w1.Name = "dialog_VBox"; - w1.BorderWidth = ((uint)(2)); - // Container child dialog_VBox.Gtk.Box+BoxChild - this.vbox2 = new Gtk.VBox(); - this.vbox2.Name = "vbox2"; - // Container child vbox2.Gtk.Box+BoxChild - this.vbox3 = new Gtk.VBox(); - this.vbox3.Name = "vbox3"; - // Container child vbox3.Gtk.Box+BoxChild - this.hbox1 = new Gtk.HBox(); - this.hbox1.Name = "hbox1"; - // Container child hbox1.Gtk.Box+BoxChild - this.label1 = new Gtk.Label(); - this.label1.Name = "label1"; - this.label1.Xalign = 1F; - this.label1.LabelProp = Mono.Unix.Catalog.GetString("Grid server URL: "); - this.label1.Justify = ((Gtk.Justification)(1)); - this.hbox1.Add(this.label1); - Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox1[this.label1])); - w2.Position = 0; - // Container child hbox1.Gtk.Box+BoxChild - this.entry1 = new Gtk.Entry(); - this.entry1.CanFocus = true; - this.entry1.Name = "entry1"; - this.entry1.Text = Mono.Unix.Catalog.GetString("http://gridserver:8001"); - this.entry1.IsEditable = true; - this.entry1.MaxLength = 255; - this.entry1.InvisibleChar = '•'; - this.hbox1.Add(this.entry1); - Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.hbox1[this.entry1])); - w3.Position = 1; - this.vbox3.Add(this.hbox1); - Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox1])); - w4.Position = 0; - w4.Expand = false; - w4.Fill = false; - // Container child vbox3.Gtk.Box+BoxChild - this.hbox2 = new Gtk.HBox(); - this.hbox2.Name = "hbox2"; - // Container child hbox2.Gtk.Box+BoxChild - this.label2 = new Gtk.Label(); - this.label2.Name = "label2"; - this.label2.Xalign = 1F; - this.label2.LabelProp = Mono.Unix.Catalog.GetString("Username:"); - this.label2.Justify = ((Gtk.Justification)(1)); - this.hbox2.Add(this.label2); - Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.hbox2[this.label2])); - w5.Position = 0; - // Container child hbox2.Gtk.Box+BoxChild - this.entry2 = new Gtk.Entry(); - this.entry2.CanFocus = true; - this.entry2.Name = "entry2"; - this.entry2.IsEditable = true; - this.entry2.InvisibleChar = '•'; - this.hbox2.Add(this.entry2); - Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.hbox2[this.entry2])); - w6.Position = 1; - this.vbox3.Add(this.hbox2); - Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox2])); - w7.Position = 1; - w7.Expand = false; - w7.Fill = false; - // Container child vbox3.Gtk.Box+BoxChild - this.hbox3 = new Gtk.HBox(); - this.hbox3.Name = "hbox3"; - // Container child hbox3.Gtk.Box+BoxChild - this.label3 = new Gtk.Label(); - this.label3.Name = "label3"; - this.label3.Xalign = 1F; - this.label3.LabelProp = Mono.Unix.Catalog.GetString("Password:"); - this.label3.Justify = ((Gtk.Justification)(1)); - this.hbox3.Add(this.label3); - Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox3[this.label3])); - w8.Position = 0; - // Container child hbox3.Gtk.Box+BoxChild - this.entry3 = new Gtk.Entry(); - this.entry3.CanFocus = true; - this.entry3.Name = "entry3"; - this.entry3.IsEditable = true; - this.entry3.InvisibleChar = '•'; - this.hbox3.Add(this.entry3); - Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.hbox3[this.entry3])); - w9.Position = 1; - this.vbox3.Add(this.hbox3); - Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox3])); - w10.Position = 2; - w10.Expand = false; - w10.Fill = false; - this.vbox2.Add(this.vbox3); - Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.vbox2[this.vbox3])); - w11.Position = 2; - w11.Expand = false; - w11.Fill = false; - w1.Add(this.vbox2); - Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(w1[this.vbox2])); - w12.Position = 0; - // Internal child OpenGridServices.Manager.ConnectToGridServerDialog.ActionArea - Gtk.HButtonBox w13 = this.ActionArea; - w13.Events = ((Gdk.EventMask)(256)); - w13.Name = "OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea"; - w13.Spacing = 6; - w13.BorderWidth = ((uint)(5)); - w13.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); - // Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild - this.button2 = new Gtk.Button(); - this.button2.CanDefault = true; - this.button2.CanFocus = true; - this.button2.Name = "button2"; - this.button2.UseUnderline = true; - // Container child button2.Gtk.Container+ContainerChild - Gtk.Alignment w14 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F); - w14.Name = "GtkAlignment"; - // Container child GtkAlignment.Gtk.Container+ContainerChild - Gtk.HBox w15 = new Gtk.HBox(); - w15.Name = "GtkHBox"; - w15.Spacing = 2; - // Container child GtkHBox.Gtk.Container+ContainerChild - Gtk.Image w16 = new Gtk.Image(); - w16.Name = "image1"; - w16.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-apply", 16, 0); - w15.Add(w16); - // Container child GtkHBox.Gtk.Container+ContainerChild - Gtk.Label w18 = new Gtk.Label(); - w18.Name = "GtkLabel"; - w18.LabelProp = Mono.Unix.Catalog.GetString("Connect"); - w18.UseUnderline = true; - w15.Add(w18); - w14.Add(w15); - this.button2.Add(w14); - this.AddActionWidget(this.button2, -5); - Gtk.ButtonBox.ButtonBoxChild w22 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.button2])); - w22.Expand = false; - w22.Fill = false; - // Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild - this.button8 = new Gtk.Button(); - this.button8.CanDefault = true; - this.button8.CanFocus = true; - this.button8.Name = "button8"; - this.button8.UseUnderline = true; - // Container child button8.Gtk.Container+ContainerChild - Gtk.Alignment w23 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F); - w23.Name = "GtkAlignment1"; - // Container child GtkAlignment1.Gtk.Container+ContainerChild - Gtk.HBox w24 = new Gtk.HBox(); - w24.Name = "GtkHBox1"; - w24.Spacing = 2; - // Container child GtkHBox1.Gtk.Container+ContainerChild - Gtk.Image w25 = new Gtk.Image(); - w25.Name = "image2"; - w25.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-cancel", 16, 0); - w24.Add(w25); - // Container child GtkHBox1.Gtk.Container+ContainerChild - Gtk.Label w27 = new Gtk.Label(); - w27.Name = "GtkLabel1"; - w27.LabelProp = Mono.Unix.Catalog.GetString("Cancel"); - w27.UseUnderline = true; - w24.Add(w27); - w23.Add(w24); - this.button8.Add(w23); - this.AddActionWidget(this.button8, -6); - Gtk.ButtonBox.ButtonBoxChild w31 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.button8])); - w31.Position = 1; - w31.Expand = false; - w31.Fill = false; - if (this.Child != null) - { - this.Child.ShowAll(); - } - this.DefaultWidth = 476; - this.DefaultHeight = 137; - this.Show(); - this.Response += new Gtk.ResponseHandler(this.OnResponse); - } - } -} diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs deleted file mode 100644 index 0476081..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs +++ /dev/null @@ -1,250 +0,0 @@ -/* - * 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 OpenSimulator 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. - */ - -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -namespace OpenGridServices.Manager -{ - public partial class MainWindow - { - private Gtk.Action Grid; - private Gtk.Action User; - private Gtk.Action Asset; - private Gtk.Action Region; - private Gtk.Action Services; - private Gtk.Action ConnectToGridserver; - private Gtk.Action RestartWholeGrid; - private Gtk.Action ShutdownWholeGrid; - private Gtk.Action ExitGridManager; - private Gtk.Action ConnectToUserserver; - private Gtk.Action AccountManagment; - private Gtk.Action GlobalNotice; - private Gtk.Action DisableAllLogins; - private Gtk.Action DisableNonGodUsersOnly; - private Gtk.Action ShutdownUserServer; - private Gtk.Action ShutdownGridserverOnly; - private Gtk.Action RestartGridserverOnly; - private Gtk.Action DefaultLocalGridUserserver; - private Gtk.Action CustomUserserver; - private Gtk.Action RemoteGridDefaultUserserver; - private Gtk.Action DisconnectFromGridServer; - private Gtk.Action UploadAsset; - private Gtk.Action AssetManagement; - private Gtk.Action ConnectToAssetServer; - private Gtk.Action ConnectToDefaultAssetServerForGrid; - private Gtk.Action DefaultForLocalGrid; - private Gtk.Action DefaultForRemoteGrid; - private Gtk.Action CustomAssetServer; - private Gtk.VBox vbox1; - private Gtk.MenuBar menubar2; - private Gtk.HBox hbox1; - private Gtk.ScrolledWindow scrolledwindow1; - private Gtk.DrawingArea drawingarea1; - private Gtk.TreeView treeview1; - private Gtk.Statusbar statusbar1; - - protected virtual void Build() - { - Stetic.Gui.Initialize(); - // Widget OpenGridServices.Manager.MainWindow - Gtk.UIManager w1 = new Gtk.UIManager(); - Gtk.ActionGroup w2 = new Gtk.ActionGroup("Default"); - this.Grid = new Gtk.Action("Grid", Mono.Unix.Catalog.GetString("Grid"), null, null); - this.Grid.HideIfEmpty = false; - this.Grid.ShortLabel = Mono.Unix.Catalog.GetString("Grid"); - w2.Add(this.Grid, "g"); - this.User = new Gtk.Action("User", Mono.Unix.Catalog.GetString("User"), null, null); - this.User.HideIfEmpty = false; - this.User.ShortLabel = Mono.Unix.Catalog.GetString("User"); - w2.Add(this.User, null); - this.Asset = new Gtk.Action("Asset", Mono.Unix.Catalog.GetString("Asset"), null, null); - this.Asset.HideIfEmpty = false; - this.Asset.ShortLabel = Mono.Unix.Catalog.GetString("Asset"); - w2.Add(this.Asset, null); - this.Region = new Gtk.Action("Region", Mono.Unix.Catalog.GetString("Region"), null, null); - this.Region.ShortLabel = Mono.Unix.Catalog.GetString("Region"); - w2.Add(this.Region, null); - this.Services = new Gtk.Action("Services", Mono.Unix.Catalog.GetString("Services"), null, null); - this.Services.ShortLabel = Mono.Unix.Catalog.GetString("Services"); - w2.Add(this.Services, null); - this.ConnectToGridserver = new Gtk.Action("ConnectToGridserver", Mono.Unix.Catalog.GetString("Connect to gridserver..."), null, "gtk-connect"); - this.ConnectToGridserver.HideIfEmpty = false; - this.ConnectToGridserver.ShortLabel = Mono.Unix.Catalog.GetString("Connect to gridserver"); - w2.Add(this.ConnectToGridserver, null); - this.RestartWholeGrid = new Gtk.Action("RestartWholeGrid", Mono.Unix.Catalog.GetString("Restart whole grid"), null, "gtk-refresh"); - this.RestartWholeGrid.ShortLabel = Mono.Unix.Catalog.GetString("Restart whole grid"); - w2.Add(this.RestartWholeGrid, null); - this.ShutdownWholeGrid = new Gtk.Action("ShutdownWholeGrid", Mono.Unix.Catalog.GetString("Shutdown whole grid"), null, "gtk-stop"); - this.ShutdownWholeGrid.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown whole grid"); - w2.Add(this.ShutdownWholeGrid, null); - this.ExitGridManager = new Gtk.Action("ExitGridManager", Mono.Unix.Catalog.GetString("Exit grid manager"), null, "gtk-close"); - this.ExitGridManager.ShortLabel = Mono.Unix.Catalog.GetString("Exit grid manager"); - w2.Add(this.ExitGridManager, null); - this.ConnectToUserserver = new Gtk.Action("ConnectToUserserver", Mono.Unix.Catalog.GetString("Connect to userserver"), null, "gtk-connect"); - this.ConnectToUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Connect to userserver"); - w2.Add(this.ConnectToUserserver, null); - this.AccountManagment = new Gtk.Action("AccountManagment", Mono.Unix.Catalog.GetString("Account managment"), null, "gtk-properties"); - this.AccountManagment.ShortLabel = Mono.Unix.Catalog.GetString("Account managment"); - w2.Add(this.AccountManagment, null); - this.GlobalNotice = new Gtk.Action("GlobalNotice", Mono.Unix.Catalog.GetString("Global notice"), null, "gtk-network"); - this.GlobalNotice.ShortLabel = Mono.Unix.Catalog.GetString("Global notice"); - w2.Add(this.GlobalNotice, null); - this.DisableAllLogins = new Gtk.Action("DisableAllLogins", Mono.Unix.Catalog.GetString("Disable all logins"), null, "gtk-no"); - this.DisableAllLogins.ShortLabel = Mono.Unix.Catalog.GetString("Disable all logins"); - w2.Add(this.DisableAllLogins, null); - this.DisableNonGodUsersOnly = new Gtk.Action("DisableNonGodUsersOnly", Mono.Unix.Catalog.GetString("Disable non-god users only"), null, "gtk-no"); - this.DisableNonGodUsersOnly.ShortLabel = Mono.Unix.Catalog.GetString("Disable non-god users only"); - w2.Add(this.DisableNonGodUsersOnly, null); - this.ShutdownUserServer = new Gtk.Action("ShutdownUserServer", Mono.Unix.Catalog.GetString("Shutdown user server"), null, "gtk-stop"); - this.ShutdownUserServer.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown user server"); - w2.Add(this.ShutdownUserServer, null); - this.ShutdownGridserverOnly = new Gtk.Action("ShutdownGridserverOnly", Mono.Unix.Catalog.GetString("Shutdown gridserver only"), null, "gtk-stop"); - this.ShutdownGridserverOnly.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown gridserver only"); - w2.Add(this.ShutdownGridserverOnly, null); - this.RestartGridserverOnly = new Gtk.Action("RestartGridserverOnly", Mono.Unix.Catalog.GetString("Restart gridserver only"), null, "gtk-refresh"); - this.RestartGridserverOnly.ShortLabel = Mono.Unix.Catalog.GetString("Restart gridserver only"); - w2.Add(this.RestartGridserverOnly, null); - this.DefaultLocalGridUserserver = new Gtk.Action("DefaultLocalGridUserserver", Mono.Unix.Catalog.GetString("Default local grid userserver"), null, null); - this.DefaultLocalGridUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Default local grid userserver"); - w2.Add(this.DefaultLocalGridUserserver, null); - this.CustomUserserver = new Gtk.Action("CustomUserserver", Mono.Unix.Catalog.GetString("Custom userserver..."), null, null); - this.CustomUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Custom userserver"); - w2.Add(this.CustomUserserver, null); - this.RemoteGridDefaultUserserver = new Gtk.Action("RemoteGridDefaultUserserver", Mono.Unix.Catalog.GetString("Remote grid default userserver..."), null, null); - this.RemoteGridDefaultUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Remote grid default userserver"); - w2.Add(this.RemoteGridDefaultUserserver, null); - this.DisconnectFromGridServer = new Gtk.Action("DisconnectFromGridServer", Mono.Unix.Catalog.GetString("Disconnect from grid server"), null, "gtk-disconnect"); - this.DisconnectFromGridServer.ShortLabel = Mono.Unix.Catalog.GetString("Disconnect from grid server"); - this.DisconnectFromGridServer.Visible = false; - w2.Add(this.DisconnectFromGridServer, null); - this.UploadAsset = new Gtk.Action("UploadAsset", Mono.Unix.Catalog.GetString("Upload asset"), null, null); - this.UploadAsset.ShortLabel = Mono.Unix.Catalog.GetString("Upload asset"); - w2.Add(this.UploadAsset, null); - this.AssetManagement = new Gtk.Action("AssetManagement", Mono.Unix.Catalog.GetString("Asset management"), null, null); - this.AssetManagement.ShortLabel = Mono.Unix.Catalog.GetString("Asset management"); - w2.Add(this.AssetManagement, null); - this.ConnectToAssetServer = new Gtk.Action("ConnectToAssetServer", Mono.Unix.Catalog.GetString("Connect to asset server"), null, null); - this.ConnectToAssetServer.ShortLabel = Mono.Unix.Catalog.GetString("Connect to asset server"); - w2.Add(this.ConnectToAssetServer, null); - this.ConnectToDefaultAssetServerForGrid = new Gtk.Action("ConnectToDefaultAssetServerForGrid", Mono.Unix.Catalog.GetString("Connect to default asset server for grid"), null, null); - this.ConnectToDefaultAssetServerForGrid.ShortLabel = Mono.Unix.Catalog.GetString("Connect to default asset server for grid"); - w2.Add(this.ConnectToDefaultAssetServerForGrid, null); - this.DefaultForLocalGrid = new Gtk.Action("DefaultForLocalGrid", Mono.Unix.Catalog.GetString("Default for local grid"), null, null); - this.DefaultForLocalGrid.ShortLabel = Mono.Unix.Catalog.GetString("Default for local grid"); - w2.Add(this.DefaultForLocalGrid, null); - this.DefaultForRemoteGrid = new Gtk.Action("DefaultForRemoteGrid", Mono.Unix.Catalog.GetString("Default for remote grid..."), null, null); - this.DefaultForRemoteGrid.ShortLabel = Mono.Unix.Catalog.GetString("Default for remote grid..."); - w2.Add(this.DefaultForRemoteGrid, null); - this.CustomAssetServer = new Gtk.Action("CustomAssetServer", Mono.Unix.Catalog.GetString("Custom asset server..."), null, null); - this.CustomAssetServer.ShortLabel = Mono.Unix.Catalog.GetString("Custom asset server..."); - w2.Add(this.CustomAssetServer, null); - w1.InsertActionGroup(w2, 0); - this.AddAccelGroup(w1.AccelGroup); - this.WidthRequest = 800; - this.HeightRequest = 600; - this.Name = "OpenGridServices.Manager.MainWindow"; - this.Title = Mono.Unix.Catalog.GetString("Open Grid Services Manager"); - this.Icon = Gtk.IconTheme.Default.LoadIcon("gtk-network", 48, 0); - // Container child OpenGridServices.Manager.MainWindow.Gtk.Container+ContainerChild - this.vbox1 = new Gtk.VBox(); - this.vbox1.Name = "vbox1"; - // Container child vbox1.Gtk.Box+BoxChild - w1.AddUiFromString(""); - this.menubar2 = ((Gtk.MenuBar)(w1.GetWidget("/menubar2"))); - this.menubar2.HeightRequest = 25; - this.menubar2.Name = "menubar2"; - this.vbox1.Add(this.menubar2); - Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox1[this.menubar2])); - w3.Position = 0; - w3.Expand = false; - w3.Fill = false; - // Container child vbox1.Gtk.Box+BoxChild - this.hbox1 = new Gtk.HBox(); - this.hbox1.Name = "hbox1"; - // Container child hbox1.Gtk.Box+BoxChild - this.scrolledwindow1 = new Gtk.ScrolledWindow(); - this.scrolledwindow1.CanFocus = true; - this.scrolledwindow1.Name = "scrolledwindow1"; - this.scrolledwindow1.VscrollbarPolicy = ((Gtk.PolicyType)(1)); - this.scrolledwindow1.HscrollbarPolicy = ((Gtk.PolicyType)(1)); - // Container child scrolledwindow1.Gtk.Container+ContainerChild - Gtk.Viewport w4 = new Gtk.Viewport(); - w4.Name = "GtkViewport"; - w4.ShadowType = ((Gtk.ShadowType)(0)); - // Container child GtkViewport.Gtk.Container+ContainerChild - this.drawingarea1 = new Gtk.DrawingArea(); - this.drawingarea1.Name = "drawingarea1"; - w4.Add(this.drawingarea1); - this.scrolledwindow1.Add(w4); - this.hbox1.Add(this.scrolledwindow1); - Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.hbox1[this.scrolledwindow1])); - w7.Position = 1; - // Container child hbox1.Gtk.Box+BoxChild - this.treeview1 = new Gtk.TreeView(); - this.treeview1.CanFocus = true; - this.treeview1.Name = "treeview1"; - this.hbox1.Add(this.treeview1); - Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox1[this.treeview1])); - w8.Position = 2; - this.vbox1.Add(this.hbox1); - Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.vbox1[this.hbox1])); - w9.Position = 1; - // Container child vbox1.Gtk.Box+BoxChild - this.statusbar1 = new Gtk.Statusbar(); - this.statusbar1.Name = "statusbar1"; - this.statusbar1.Spacing = 5; - this.vbox1.Add(this.statusbar1); - Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar1])); - w10.PackType = ((Gtk.PackType)(1)); - w10.Position = 2; - w10.Expand = false; - w10.Fill = false; - this.Add(this.vbox1); - if (this.Child != null) - { - this.Child.ShowAll(); - } - this.DefaultWidth = 800; - this.DefaultHeight = 800; - this.Show(); - this.DeleteEvent += new Gtk.DeleteEventHandler(this.OnDeleteEvent); - this.ConnectToGridserver.Activated += new System.EventHandler(this.ConnectToGridServerMenu); - this.ExitGridManager.Activated += new System.EventHandler(this.QuitMenu); - this.ShutdownGridserverOnly.Activated += new System.EventHandler(this.ShutdownGridserverMenu); - this.RestartGridserverOnly.Activated += new System.EventHandler(this.RestartGridserverMenu); - this.DisconnectFromGridServer.Activated += new System.EventHandler(this.DisconnectGridServerMenu); - } - } -} diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/generated.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/generated.cs deleted file mode 100644 index 9fb84d2..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/generated.cs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 OpenSimulator 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. - */ - -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -namespace Stetic -{ - internal class Gui - { - private static bool initialized; - - internal static void Initialize() - { - Stetic.Gui.initialized = true; - } - } - - internal class ActionGroups - { - public static Gtk.ActionGroup GetActionGroup(System.Type type) - { - return Stetic.ActionGroups.GetActionGroup(type.FullName); - } - - public static Gtk.ActionGroup GetActionGroup(string name) - { - return null; - } - } -} diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/gui.stetic b/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/gui.stetic deleted file mode 100644 index c883f08..0000000 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/gui.stetic +++ /dev/null @@ -1,502 +0,0 @@ - - - - - - Action - <Alt><Mod2>g - False - Grid - Grid - - - Action - False - User - User - - - Action - False - Asset - Asset - - - Action - Region - Region - - - Action - Services - Services - - - Action - False - Connect to gridserver... - Connect to gridserver - gtk-connect - - - - Action - Restart whole grid - Restart whole grid - gtk-refresh - - - Action - Shutdown whole grid - Shutdown whole grid - gtk-stop - - - Action - Exit grid manager - Exit grid manager - gtk-close - - - - Action - Connect to userserver - Connect to userserver - gtk-connect - - - Action - Account managment - Account managment - gtk-properties - - - Action - Global notice - Global notice - gtk-network - - - Action - Disable all logins - Disable all logins - gtk-no - - - Action - Disable non-god users only - Disable non-god users only - gtk-no - - - Action - Shutdown user server - Shutdown user server - gtk-stop - - - Action - Shutdown gridserver only - Shutdown gridserver only - gtk-stop - - - - Action - Restart gridserver only - Restart gridserver only - gtk-refresh - - - - Action - Default local grid userserver - Default local grid userserver - - - Action - Custom userserver... - Custom userserver - - - Action - Remote grid default userserver... - Remote grid default userserver - - - Action - Disconnect from grid server - Disconnect from grid server - gtk-disconnect - False - - - - Action - Upload asset - Upload asset - - - Action - Asset management - Asset management - - - Action - Connect to asset server - Connect to asset server - - - Action - Connect to default asset server for grid - Connect to default asset server for grid - - - Action - Default for local grid - Default for local grid - - - Action - Default for remote grid... - Default for remote grid... - - - Action - Custom asset server... - Custom asset server... - - - - 800 - 600 - Open Grid Services Manager - stock:gtk-network Dialog - - - - - - - - 25 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - False - False - False - - - - - - - - - - - - True - Automatic - Automatic - - - - None - - - - - - - - - - 1 - True - - - - - - True - - - 2 - True - - - - - 1 - True - - - - - statusBar1 - 5 - - - - - - - - - End - 2 - False - False - False - - - - - - - - ButtonPressMask - Connect to Grid server - CenterOnParent - 2 - False - False - - - - - ButtonPressMask - 2 - - - - - - - - - - - - - - - - - - - 1 - Grid server URL: - Right - - - 0 - False - - - - - - True - http://gridserver:8001 - True - 255 - - - - 1 - False - - - - - - - - 0 - True - False - False - - - - - - - - - 1 - Username: - Right - - - 0 - False - - - - - - True - True - - - - 1 - True - - - - - - - - 1 - False - False - False - - - - - - - - - 1 - Password: - Right - - - 0 - False - - - - - - True - True - - - - 1 - True - - - - - - - - 2 - True - False - False - - - - - 2 - True - False - False - - - - - 0 - True - - - - - - - - ButtonPressMask - 6 - 5 - 2 - End - - - - True - True - TextAndIcon - stock:gtk-apply Menu - Connect - True - True - -5 - - - False - False - - - - - - True - True - TextAndIcon - stock:gtk-cancel Menu - Cancel - True - True - -6 - - - 1 - False - False - - - - - - \ No newline at end of file diff --git a/OpenSim/Grid/MessagingServer.Modules/InterMessageUserServerModule.cs b/OpenSim/Grid/MessagingServer.Modules/InterMessageUserServerModule.cs deleted file mode 100644 index ae04535..0000000 --- a/OpenSim/Grid/MessagingServer.Modules/InterMessageUserServerModule.cs +++ /dev/null @@ -1,187 +0,0 @@ -/* - * 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 OpenSimulator 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.Net; -using System.Reflection; -using System.Threading; -using System.Timers; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Grid.Framework; -using Timer = System.Timers.Timer; - -namespace OpenSim.Grid.MessagingServer.Modules -{ - public class InterMessageUserServerModule : IInterServiceUserService - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private MessageServerConfig m_cfg; - - private IGridServiceCore m_messageCore; - - private Timer reconnectTimer = new Timer(300000); // 5 mins - - public InterMessageUserServerModule(MessageServerConfig config, IGridServiceCore messageCore) - { - m_cfg = config; - m_messageCore = messageCore; - - reconnectTimer.Elapsed += registerWithUserServer; - lock (reconnectTimer) - reconnectTimer.Start(); - } - - public void Initialise() - { - m_messageCore.RegisterInterface(this); - } - - public void PostInitialise() - { - - } - - public void RegisterHandlers() - { - //have these in separate method as some servers restart the http server and reregister all the handlers. - - } - - public void registerWithUserServer(object sender, ElapsedEventArgs e) - { - registerWithUserServer(); - } - - public bool registerWithUserServer() - { - Hashtable UserParams = new Hashtable(); - // Login / Authentication - - if (m_cfg.HttpSSL) - { - UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; - } - else - { - UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; - } - - UserParams["recvkey"] = m_cfg.UserRecvKey; - UserParams["sendkey"] = m_cfg.UserRecvKey; - - // Package into an XMLRPC Request - ArrayList SendParams = new ArrayList(); - SendParams.Add(UserParams); - - bool success = true; - string[] servers = m_cfg.UserServerURL.Split(' '); - - foreach (string srv in servers) - { - // Send Request - try - { - XmlRpcRequest UserReq = new XmlRpcRequest("register_messageserver", SendParams); - XmlRpcResponse UserResp = UserReq.Send(srv, 16000); - - // Process Response - Hashtable GridRespData = (Hashtable)UserResp.Value; - // if we got a response, we were successful - if (!GridRespData.ContainsKey("responsestring")) - success = false; - else - m_log.InfoFormat("[SERVER] Registered with {0}", srv); - } - catch - { - m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv); - success = false; - } - } - return success; - } - - public bool deregisterWithUserServer() - { - Hashtable request = new Hashtable(); - - return SendToUserServer(request, "deregister_messageserver"); - } - - public bool SendToUserServer(Hashtable request, string method) - { - // Login / Authentication - - if (m_cfg.HttpSSL) - { - request["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; - } - else - { - request["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; - } - - request["recvkey"] = m_cfg.UserRecvKey; - request["sendkey"] = m_cfg.UserRecvKey; - - // Package into an XMLRPC Request - ArrayList SendParams = new ArrayList(); - SendParams.Add(request); - - bool success = true; - string[] servers = m_cfg.UserServerURL.Split(' '); - - // Send Request - foreach (string srv in servers) - { - try - { - XmlRpcRequest UserReq = new XmlRpcRequest(method, SendParams); - XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); - // Process Response - Hashtable UserRespData = (Hashtable)UserResp.Value; - // if we got a response, we were successful - if (!UserRespData.ContainsKey("responsestring")) - success = false; - } - catch - { - m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv); - success = false; - } - } - return success; - } - } -} diff --git a/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs b/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs deleted file mode 100644 index b9d3f22..0000000 --- a/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 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 OpenSimulator 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.Net; -using System.Reflection; -using System.Threading; -using System.Timers; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Grid.Framework; -using Timer = System.Timers.Timer; -using OpenSim.Services.Interfaces; -using OpenSim.Services.Connectors; -using GridRegion = OpenSim.Services.Interfaces.GridRegion; - - -namespace OpenSim.Grid.MessagingServer.Modules -{ - public class MessageRegionModule : IMessageRegionLookup - { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private MessageServerConfig m_cfg; - - private IInterServiceUserService m_userServerModule; - - private IGridServiceCore m_messageCore; - - private IGridService m_GridService; - - // a dictionary of all current regions this server knows about - private Dictionary m_regionInfoCache = new Dictionary(); - - public MessageRegionModule(MessageServerConfig config, IGridServiceCore messageCore) - { - m_cfg = config; - m_messageCore = messageCore; - - m_GridService = new GridServicesConnector(m_cfg.GridServerURL); - } - - public void Initialise() - { - m_messageCore.RegisterInterface(this); - } - - public void PostInitialise() - { - IInterServiceUserService messageUserServer; - if (m_messageCore.TryGet(out messageUserServer)) - { - m_userServerModule = messageUserServer; - } - } - - public void RegisterHandlers() - { - //have these in separate method as some servers restart the http server and reregister all the handlers. - - } - - /// - /// Gets and caches a RegionInfo object from the gridserver based on regionhandle - /// if the regionhandle is already cached, use the cached values - /// Gets called by lots of threads!!!!! - /// - /// handle to the XY of the region we're looking for - /// A RegionInfo object to stick in the presence info - public RegionProfileData GetRegionInfo(ulong regionhandle) - { - RegionProfileData regionInfo = null; - - lock (m_regionInfoCache) - { - m_regionInfoCache.TryGetValue(regionhandle, out regionInfo); - } - - if (regionInfo == null) // not found in cache - { - regionInfo = RequestRegionInfo(regionhandle); - - if (regionInfo != null) // lookup was successful - { - lock (m_regionInfoCache) - { - m_regionInfoCache[regionhandle] = regionInfo; - } - } - } - - return regionInfo; - } - - public int ClearRegionCache() - { - int cachecount = 0; - - lock (m_regionInfoCache) - { - cachecount = m_regionInfoCache.Count; - m_regionInfoCache.Clear(); - } - - return cachecount; - } - - /// - /// Get RegionProfileData from the GridServer. - /// We'll cache this information in GetRegionInfo and use it for presence updates - /// - /// - /// - public RegionProfileData RequestRegionInfo(ulong regionHandle) - { - uint x = 0, y = 0; - Utils.LongToUInts(regionHandle, out x, out y); - GridRegion region = m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); - - if (region != null) - return GridRegionToRegionProfile(region); - - else - return null; - } - - private RegionProfileData GridRegionToRegionProfile(GridRegion region) - { - RegionProfileData rprofile = new RegionProfileData(); - rprofile.httpPort = region.HttpPort; - rprofile.httpServerURI = region.ServerURI; - rprofile.regionLocX = (uint)(region.RegionLocX / Constants.RegionSize); - rprofile.regionLocY = (uint)(region.RegionLocY / Constants.RegionSize); - rprofile.RegionName = region.RegionName; - rprofile.ServerHttpPort = region.HttpPort; - rprofile.ServerIP = region.ExternalHostName; - rprofile.ServerPort = (uint)region.ExternalEndPoint.Port; - rprofile.Uuid = region.RegionID; - return rprofile; - } - - public XmlRpcResponse RegionStartup(XmlRpcRequest request, IPEndPoint remoteClient) - { - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable result = new Hashtable(); - result["success"] = "FALSE"; - - if (m_userServerModule.SendToUserServer(requestData, "region_startup")) - result["success"] = "TRUE"; - - XmlRpcResponse response = new XmlRpcResponse(); - response.Value = result; - return response; - } - - public XmlRpcResponse RegionShutdown(XmlRpcRequest request, IPEndPoint remoteClient) - { - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable result = new Hashtable(); - result["success"] = "FALSE"; - - if (m_userServerModule.SendToUserServer(requestData, "region_shutdown")) - result["success"] = "TRUE"; - - XmlRpcResponse response = new XmlRpcResponse(); - response.Value = result; - return response; - } - - } -} \ No newline at end of file diff --git a/OpenSim/Grid/MessagingServer.Modules/MessageService.cs b/OpenSim/Grid/MessagingServer.Modules/MessageService.cs deleted file mode 100644 index 8ad1e9c..0000000 --- a/OpenSim/Grid/MessagingServer.Modules/MessageService.cs +++ /dev/null @@ -1,503 +0,0 @@ -/* - * 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 OpenSimulator 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.Net; -using System.Reflection; -using System.Threading; -using System.Timers; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Grid.Framework; -using Timer=System.Timers.Timer; - -namespace OpenSim.Grid.MessagingServer.Modules -{ - public class MessageService - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private MessageServerConfig m_cfg; - private UserDataBaseService m_userDataBaseService; - - private IGridServiceCore m_messageCore; - - private IInterServiceUserService m_userServerModule; - private IMessageRegionLookup m_regionModule; - - // a dictionary of all current presences this server knows about - private Dictionary m_presences = new Dictionary(); - - public MessageService(MessageServerConfig cfg, IGridServiceCore messageCore, UserDataBaseService userDataBaseService) - { - m_cfg = cfg; - m_messageCore = messageCore; - - m_userDataBaseService = userDataBaseService; - - //??? - UserConfig uc = new UserConfig(); - uc.DatabaseConnect = cfg.DatabaseConnect; - uc.DatabaseProvider = cfg.DatabaseProvider; - } - - public void Initialise() - { - } - - public void PostInitialise() - { - IInterServiceUserService messageUserServer; - if (m_messageCore.TryGet(out messageUserServer)) - { - m_userServerModule = messageUserServer; - } - - IMessageRegionLookup messageRegion; - if (m_messageCore.TryGet(out messageRegion)) - { - m_regionModule = messageRegion; - } - } - - public void RegisterHandlers() - { - //have these in separate method as some servers restart the http server and reregister all the handlers. - - } - - #region FriendList Methods - - /// - /// Process Friendlist subscriptions for a user - /// The login method calls this for a User - /// - /// The Agent we're processing the friendlist subscriptions for - private void ProcessFriendListSubscriptions(UserPresenceData userpresence) - { - lock (m_presences) - { - m_presences[userpresence.agentData.AgentID] = userpresence; - } - - Dictionary uFriendList = userpresence.friendData; - foreach (KeyValuePair pair in uFriendList) - { - UserPresenceData friendup = null; - lock (m_presences) - { - m_presences.TryGetValue(pair.Key, out friendup); - } - if (friendup != null) - { - SubscribeToPresenceUpdates(userpresence, friendup, pair.Value); - } - } - } - - /// - /// Enqueues a presence update, sending info about user 'talkingAbout' to user 'receiver'. - /// - /// We are sending presence information about this user. - /// We are sending the presence update to this user - private void enqueuePresenceUpdate(UserPresenceData talkingAbout, UserPresenceData receiver) - { - UserAgentData p2Handle = m_userDataBaseService.GetUserAgentData(receiver.agentData.AgentID); - if (p2Handle != null) - { - if (receiver.lookupUserRegionYN) - { - receiver.regionData.regionHandle = p2Handle.Handle; - } - else - { - receiver.lookupUserRegionYN = true; // TODO Huh? - } - - PresenceInformer friendlistupdater = new PresenceInformer(); - friendlistupdater.presence1 = talkingAbout; - friendlistupdater.presence2 = receiver; - friendlistupdater.OnGetRegionData += m_regionModule.GetRegionInfo; - friendlistupdater.OnDone += PresenceUpdateDone; - Util.FireAndForget(friendlistupdater.go); - } - else - { - m_log.WarnFormat("no data found for user {0}", receiver.agentData.AgentID); - // Skip because we can't find any data on the user - } - } - - /// - /// Does the necessary work to subscribe one agent to another's presence notifications - /// Gets called by ProcessFriendListSubscriptions. You shouldn't call this directly - /// unless you know what you're doing - /// - /// P1 - /// P2 - /// - private void SubscribeToPresenceUpdates(UserPresenceData userpresence, - UserPresenceData friendpresence, - FriendListItem uFriendListItem) - { - // Can the friend see me online? - if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0) - { - // tell user to update friend about user's presence changes - if (!userpresence.subscriptionData.Contains(friendpresence.agentData.AgentID)) - { - userpresence.subscriptionData.Add(friendpresence.agentData.AgentID); - } - - // send an update about user's presence to the friend - enqueuePresenceUpdate(userpresence, friendpresence); - } - - // Can I see the friend online? - if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0) - { - // tell friend to update user about friend's presence changes - if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID)) - { - friendpresence.subscriptionData.Add(userpresence.agentData.AgentID); - } - - // send an update about friend's presence to user. - enqueuePresenceUpdate(friendpresence, userpresence); - } - } - - /// - /// Logoff Processor. Call this to clean up agent presence data and send logoff presence notifications - /// - /// - private void ProcessLogOff(UUID AgentID) - { - m_log.Info("[LOGOFF]: Processing Logoff"); - - UserPresenceData userPresence = null; - lock (m_presences) - { - m_presences.TryGetValue(AgentID, out userPresence); - } - - if (userPresence != null) // found the user - { - List AgentsNeedingNotification = userPresence.subscriptionData; - userPresence.OnlineYN = false; - - for (int i = 0; i < AgentsNeedingNotification.Count; i++) - { - UserPresenceData friendPresence = null; - lock (m_presences) - { - m_presences.TryGetValue(AgentsNeedingNotification[i], out friendPresence); - } - - // This might need to be enumerated and checked before we try to remove it. - if (friendPresence != null) - { - lock (friendPresence) - { - // no updates for this user anymore - friendPresence.subscriptionData.Remove(AgentID); - - // set user's entry in the friend's list to offline (if it exists) - if (friendPresence.friendData.ContainsKey(AgentID)) - { - friendPresence.friendData[AgentID].onlinestatus = false; - } - } - - enqueuePresenceUpdate(userPresence, friendPresence); - } - } - } - } - - #endregion - - private void PresenceUpdateDone(PresenceInformer obj) - { - obj.OnGetRegionData -= m_regionModule.GetRegionInfo; - obj.OnDone -= PresenceUpdateDone; - } - - #region UserServer Comms - - /// - /// Returns a list of FriendsListItems that describe the friends and permissions in the friend - /// relationship for UUID friendslistowner. For faster lookup, we index by friend's UUID. - /// - /// The agent that we're retreiving the friends Data for. - private Dictionary GetUserFriendList(UUID friendlistowner) - { - Dictionary buddies = new Dictionary(); - - try - { - Hashtable param = new Hashtable(); - param["ownerID"] = friendlistowner.ToString(); - - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); - XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - - if (respData.Contains("avcount")) - { - buddies = ConvertXMLRPCDataToFriendListItemList(respData); - } - - } - catch (WebException e) - { - m_log.Warn("Error when trying to fetch Avatar's friends list: " + - e.Message); - // Return Empty list (no friends) - } - return buddies; - } - - /// - /// Converts XMLRPC Friend List to FriendListItem Object - /// - /// XMLRPC response data Hashtable - /// - public Dictionary ConvertXMLRPCDataToFriendListItemList(Hashtable data) - { - Dictionary buddies = new Dictionary(); - int buddycount = Convert.ToInt32((string)data["avcount"]); - - for (int i = 0; i < buddycount; i++) - { - FriendListItem buddylistitem = new FriendListItem(); - - buddylistitem.FriendListOwner = new UUID((string)data["ownerID" + i.ToString()]); - buddylistitem.Friend = new UUID((string)data["friendID" + i.ToString()]); - buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); - buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); - - buddies.Add(buddylistitem.Friend, buddylistitem); - } - - return buddies; - } - - /// - /// UserServer sends an expect_user method - /// this handles the method and provisions the - /// necessary info for presence to work - /// - /// UserServer Data - /// - public XmlRpcResponse UserLoggedOn(XmlRpcRequest request, IPEndPoint remoteClient) - { - try - { - Hashtable requestData = (Hashtable)request.Params[0]; - - AgentCircuitData agentData = new AgentCircuitData(); - agentData.SessionID = new UUID((string)requestData["sessionid"]); - agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]); - agentData.firstname = (string)requestData["firstname"]; - agentData.lastname = (string)requestData["lastname"]; - agentData.AgentID = new UUID((string)requestData["agentid"]); - agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); - agentData.CapsPath = (string)requestData["caps_path"]; - - if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) - { - agentData.child = true; - } - else - { - agentData.startpos = - new Vector3(Convert.ToSingle(requestData["positionx"]), - Convert.ToSingle(requestData["positiony"]), - Convert.ToSingle(requestData["positionz"])); - agentData.child = false; - } - - ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); - - m_log.InfoFormat("[LOGON]: User {0} {1} logged into region {2} as {3} agent, building indexes for user", - agentData.firstname, agentData.lastname, regionHandle, agentData.child ? "child" : "root"); - - UserPresenceData up = new UserPresenceData(); - up.agentData = agentData; - up.friendData = GetUserFriendList(agentData.AgentID); - up.regionData = m_regionModule.GetRegionInfo(regionHandle); - up.OnlineYN = true; - up.lookupUserRegionYN = false; - ProcessFriendListSubscriptions(up); - - } - catch (Exception e) - { - m_log.WarnFormat("[LOGIN]: Exception on UserLoggedOn: {0}", e); - } - - return new XmlRpcResponse(); - - } - - /// - /// The UserServer got a Logoff message - /// Cleanup time for that user. Send out presence notifications - /// - /// - /// - public XmlRpcResponse UserLoggedOff(XmlRpcRequest request, IPEndPoint remoteClient) - { - try - { - m_log.Info("[USERLOGOFF]: User logged off called"); - Hashtable requestData = (Hashtable)request.Params[0]; - - UUID AgentID = new UUID((string)requestData["agentid"]); - ProcessLogOff(AgentID); - } - catch (Exception e) - { - m_log.WarnFormat("[USERLOGOFF]: Exception on UserLoggedOff: {0}", e); - } - - return new XmlRpcResponse(); - } - - #endregion - - public XmlRpcResponse GetPresenceInfoBulk(XmlRpcRequest request, IPEndPoint remoteClient) - { - Hashtable paramHash = (Hashtable)request.Params[0]; - Hashtable result = new Hashtable(); - - // TODO check access (recv_key/send_key) - - IList list = (IList)paramHash["uuids"]; - - // convert into List - List uuids = new List(); - for (int i = 0; i < list.Count; ++i) - { - UUID uuid; - if (UUID.TryParse((string)list[i], out uuid)) - { - uuids.Add(uuid); - } - } - - try { - Dictionary infos = m_userDataBaseService.GetFriendRegionInfos(uuids); - m_log.DebugFormat("[FRIEND]: Got {0} region entries back.", infos.Count); - int count = 0; - foreach (KeyValuePair pair in infos) - { - result["uuid_" + count] = pair.Key.ToString(); - result["isOnline_" + count] = pair.Value.isOnline; - result["regionHandle_" + count] = pair.Value.regionHandle.ToString(); // XML-RPC doesn't know ulongs - ++count; - } - result["count"] = count; - - XmlRpcResponse response = new XmlRpcResponse(); - response.Value = result; - return response; - } - catch(Exception e) { - m_log.Error("Got exception:", e); - throw e; - } - } - - public XmlRpcResponse AgentLocation(XmlRpcRequest request, IPEndPoint remoteClient) - { - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable result = new Hashtable(); - result["success"] = "FALSE"; - - if (m_userServerModule.SendToUserServer(requestData, "agent_location")) - result["success"] = "TRUE"; - - - XmlRpcResponse response = new XmlRpcResponse(); - response.Value = result; - return response; - } - - public XmlRpcResponse AgentLeaving(XmlRpcRequest request, IPEndPoint remoteClient) - { - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable result = new Hashtable(); - result["success"] = "FALSE"; - - if (m_userServerModule.SendToUserServer(requestData, "agent_leaving")) - result["success"] = "TRUE"; - - XmlRpcResponse response = new XmlRpcResponse(); - response.Value = result; - return response; - } - - public XmlRpcResponse ProcessRegionShutdown(XmlRpcRequest request, IPEndPoint remoteClient) - { - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable result = new Hashtable(); - result["success"] = "FALSE"; - - UUID regionID; - if (UUID.TryParse((string)requestData["regionid"], out regionID)) - { - m_log.DebugFormat("[PRESENCE] Processing region restart for {0}", regionID); - result["success"] = "TRUE"; - - foreach (UserPresenceData up in m_presences.Values) - { - if (up.regionData.UUID == regionID) - { - if (up.OnlineYN) - { - m_log.DebugFormat("[PRESENCE] Logging off {0} because the region they were in has gone", up.agentData.AgentID); - ProcessLogOff(up.agentData.AgentID); - } - } - } - } - - XmlRpcResponse response = new XmlRpcResponse(); - response.Value = result; - return response; - } - } -} \ No newline at end of file diff --git a/OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs b/OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs deleted file mode 100644 index 67dde6d..0000000 --- a/OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 OpenSimulator 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.Collections.Generic; -using OpenMetaverse; - -namespace OpenSim.Grid.MessagingServer.Modules -{ - // This is a wrapper for a List so it can be happily stored in a hashtable. - public class PresenceBackreferenceEntry - { - List AgentList = new List(); - - public PresenceBackreferenceEntry() - { - - } - - public void Add(UUID item) - { - lock (AgentList) - { - AgentList.Add(item); - } - } - - public UUID getitem(int index) - { - UUID result = UUID.Zero; - lock (AgentList) - { - if (index > 0 && index < AgentList.Count) - { - result = AgentList[index]; - } - } - return result; - } - - public int Count - { - get - { - int count = 0; - lock (AgentList) - { - count = AgentList.Count; - } - return count; - } - } - - public void Remove(UUID item) - { - lock (AgentList) - { - if (AgentList.Contains(item)) - AgentList.Remove(item); - } - } - - public bool contains(UUID item) - { - bool result = false; - lock (AgentList) - { - result = AgentList.Contains(item); - } - return result; - } - } -} diff --git a/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs b/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs deleted file mode 100644 index 97126f7..0000000 --- a/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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 OpenSimulator 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.Collections; -using System.Net; -using System.Reflection; -using log4net; -using Nwc.XmlRpc; -using OpenSim.Data; - -namespace OpenSim.Grid.MessagingServer.Modules -{ - public delegate RegionProfileData GetRegionData(ulong region_handle); - public delegate void Done(PresenceInformer obj); - - - public class PresenceInformer - { - public event GetRegionData OnGetRegionData; - public event Done OnDone; - - private GetRegionData handlerGetRegionData = null; - private Done handlerDone = null; - - public UserPresenceData presence1 = null; - public UserPresenceData presence2 = null; - public string gridserverurl, gridserversendkey, gridserverrecvkey; - public bool lookupRegion = true; - //public methodGroup - - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public PresenceInformer() - { - - } - public void go(object o) - { - if (presence1 != null && presence2 != null) - { - SendRegionPresenceUpdate(presence1, presence2); - } - - } - - /// - /// Informs a region about an Agent - /// - /// User to talk about - /// User we're sending this too (contains the region) - public void SendRegionPresenceUpdate(UserPresenceData TalkingAbout, UserPresenceData UserToUpdate) - { - // TODO: Fill in pertenant Presence Data from 'TalkingAbout' - RegionProfileData whichRegion = new RegionProfileData(); - if (lookupRegion) - { - handlerGetRegionData = OnGetRegionData; - if (handlerGetRegionData != null) - { - whichRegion = handlerGetRegionData(UserToUpdate.regionData.regionHandle); - } - //RegionProfileData rp = RegionProfileData.RequestSimProfileData(UserToUpdate.regionData.regionHandle, gridserverurl, gridserversendkey, gridserverrecvkey); - - //whichRegion = rp; - } - else - { - whichRegion = UserToUpdate.regionData; - } - //whichRegion.httpServerURI - - if (whichRegion != null) - { - Hashtable PresenceParams = new Hashtable(); - PresenceParams.Add("agent_id",TalkingAbout.agentData.AgentID.ToString()); - PresenceParams.Add("notify_id",UserToUpdate.agentData.AgentID.ToString()); - if (TalkingAbout.OnlineYN) - PresenceParams.Add("status","TRUE"); - else - PresenceParams.Add("status","FALSE"); - - ArrayList SendParams = new ArrayList(); - SendParams.Add(PresenceParams); - - m_log.InfoFormat("[PRESENCE]: Informing {0}@{1} at {2} about {3}", TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname, whichRegion.regionName, whichRegion.httpServerURI, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname); - // Send - XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams); - try - { - // XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); - RegionReq.Send(whichRegion.httpServerURI, 6000); - } - catch (WebException) - { - m_log.WarnFormat("[INFORM]: failed notifying region {0} containing user {1} about {2}", whichRegion.regionName, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname, TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname); - } - } - else - { - m_log.Info("[PRESENCEUPDATER]: Region data was null skipping"); - - } - - handlerDone = OnDone; - if (handlerDone != null) - { - handlerDone(this); - } - } - } -} diff --git a/OpenSim/Grid/MessagingServer.Modules/PresenceService.cs b/OpenSim/Grid/MessagingServer.Modules/PresenceService.cs deleted file mode 100644 index 7487a21..0000000 --- a/OpenSim/Grid/MessagingServer.Modules/PresenceService.cs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 OpenSimulator 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. - */ - -namespace OpenSim.Grid.MessagingServer.Modules -{ - class PresenceService - { - } -} diff --git a/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs b/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs deleted file mode 100644 index 76c4899..0000000 --- a/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 OpenSimulator 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 OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; - -namespace OpenSim.Grid.MessagingServer.Modules -{ - public class UserDataBaseService : UserManagerBase - { - /// - /// Constructor. - /// - /// Passing null to parent because we never use any function that requires an interservice inventory call. - public UserDataBaseService() - : base(null) - { - } - - public UserAgentData GetUserAgentData(UUID AgentID) - { - UserProfileData userProfile = GetUserProfile(AgentID); - - if (userProfile != null) - { - return userProfile.CurrentAgent; - } - - return null; - } - - public override UserProfileData SetupMasterUser(string firstName, string lastName) - { - //throw new Exception("The method or operation is not implemented."); - return null; - } - - public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) - { - //throw new Exception("The method or operation is not implemented."); - return null; - } - - public override UserProfileData SetupMasterUser(UUID uuid) - { - //throw new Exception("The method or operation is not implemented."); - return null; - } - } -} diff --git a/OpenSim/Grid/MessagingServer.Modules/UserPresenceData.cs b/OpenSim/Grid/MessagingServer.Modules/UserPresenceData.cs deleted file mode 100644 index 7d4e45c..0000000 --- a/OpenSim/Grid/MessagingServer.Modules/UserPresenceData.cs +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 OpenSimulator 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 OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; - -namespace OpenSim.Grid.MessagingServer -{ - public class UserPresenceData - { - public AgentCircuitData agentData = new AgentCircuitData(); - public RegionProfileData regionData = new RegionProfileData(); - public string httpURI = String.Empty; - public Dictionary friendData = new Dictionary(); - public List subscriptionData = new List(); - public bool OnlineYN = true; - public bool lookupUserRegionYN = true; - - public UserPresenceData() - { - } - } -} diff --git a/OpenSim/Grid/MessagingServer.Modules/WorkUnitBase.cs b/OpenSim/Grid/MessagingServer.Modules/WorkUnitBase.cs deleted file mode 100644 index f740339..0000000 --- a/OpenSim/Grid/MessagingServer.Modules/WorkUnitBase.cs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 OpenSimulator 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. - */ - -namespace OpenSim.Grid.MessagingServer.Modules -{ - public class WorkUnitBase - { - } -} diff --git a/OpenSim/Grid/MessagingServer.Modules/WorkUnitPresenceUpdate.cs b/OpenSim/Grid/MessagingServer.Modules/WorkUnitPresenceUpdate.cs deleted file mode 100644 index 7f11e66..0000000 --- a/OpenSim/Grid/MessagingServer.Modules/WorkUnitPresenceUpdate.cs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 OpenSimulator 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. - */ - -namespace OpenSim.Grid.MessagingServer.Modules -{ - public class WorkUnitPresenceUpdate : WorkUnitBase - { - } -} diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs deleted file mode 100644 index f2631a7..0000000 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ /dev/null @@ -1,293 +0,0 @@ -/* - * 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 OpenSimulator 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.IO; -using System.Reflection; -using log4net; -using Nini.Config; -using log4net.Config; -using OpenSim.Framework; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Grid.Framework; -using OpenSim.Grid.MessagingServer.Modules; - -namespace OpenSim.Grid.MessagingServer -{ - /// - /// - public class OpenMessage_Main : BaseOpenSimServer , IGridServiceCore - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private MessageServerConfig Cfg; - private MessageService msgsvc; - - private MessageRegionModule m_regionModule; - private InterMessageUserServerModule m_userServerModule; - - private UserDataBaseService m_userDataBaseService; - - // private UUID m_lastCreatedUser = UUID.Random(); - - protected static string m_consoleType = "local"; - protected static IConfigSource m_config = null; - protected static string m_configFile = "MessagingServer_Config.xml"; - - public static void Main(string[] args) - { - ArgvConfigSource argvSource = new ArgvConfigSource(args); - argvSource.AddSwitch("Startup", "console", "c"); - argvSource.AddSwitch("Startup", "xmlfile", "x"); - - IConfig startupConfig = argvSource.Configs["Startup"]; - if (startupConfig != null) - { - m_consoleType = startupConfig.GetString("console", "local"); - m_configFile = startupConfig.GetString("xmlfile", "MessagingServer_Config.xml"); - } - - m_config = argvSource; - - XmlConfigurator.Configure(); - - m_log.Info("[SERVER]: Launching MessagingServer..."); - - OpenMessage_Main messageserver = new OpenMessage_Main(); - - messageserver.Startup(); - messageserver.Work(); - } - - public OpenMessage_Main() - { - switch (m_consoleType) - { - case "rest": - m_console = new RemoteConsole("Messaging"); - break; - case "basic": - m_console = new CommandConsole("Messaging"); - break; - default: - m_console = new LocalConsole("Messaging"); - break; - } - MainConsole.Instance = m_console; - } - - private void Work() - { - m_console.Output("Enter help for a list of commands\n"); - - while (true) - { - m_console.Prompt(); - } - } - - private void registerWithUserServer() - { - if (m_userServerModule.registerWithUserServer()) - { - if (m_httpServer == null) - { - m_log.Info("[SERVER]: Starting HTTP process"); - m_httpServer = new BaseHttpServer(Cfg.HttpPort); - - if (m_console is RemoteConsole) - { - RemoteConsole c = (RemoteConsole)m_console; - c.SetServer(m_httpServer); - IConfig netConfig = m_config.AddConfig("Network"); - netConfig.Set("ConsoleUser", Cfg.ConsoleUser); - netConfig.Set("ConsolePass", Cfg.ConsolePass); - c.ReadConfig(m_config); - } - - m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn); - m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff); - m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk); - m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown); - m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation); - m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving); - - m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup); - m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown); - - m_httpServer.Start(); - } - m_log.Info("[SERVER]: Userserver registration was successful"); - } - else - { - m_log.Error("[STARTUP]: Unable to connect to User Server"); - } - - } - - private void deregisterFromUserServer() - { - m_userServerModule.deregisterWithUserServer(); -// if (m_httpServer != null) -// { - // try a completely fresh registration, with fresh handlers, too -// m_httpServer.Stop(); -// m_httpServer = null; -// } - m_console.Output("[SERVER]: Deregistered from userserver."); - } - - protected override void StartupSpecific() - { - Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), m_configFile))); - - m_userDataBaseService = new UserDataBaseService(); - m_userDataBaseService.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect); - - //Register the database access service so modules can fetch it - // RegisterInterface(m_userDataBaseService); - - m_userServerModule = new InterMessageUserServerModule(Cfg, this); - m_userServerModule.Initialise(); - - msgsvc = new MessageService(Cfg, this, m_userDataBaseService); - msgsvc.Initialise(); - - m_regionModule = new MessageRegionModule(Cfg, this); - m_regionModule.Initialise(); - - registerWithUserServer(); - - m_userServerModule.PostInitialise(); - msgsvc.PostInitialise(); - m_regionModule.PostInitialise(); - - m_log.Info("[SERVER]: Messageserver 0.5 - Startup complete"); - - base.StartupSpecific(); - - m_console.Commands.AddCommand("messageserver", false, "clear cache", - "clear cache", - "Clear presence cache", HandleClearCache); - - m_console.Commands.AddCommand("messageserver", false, "register", - "register", - "Re-register with user server(s)", HandleRegister); - } - - public void do_create(string what) - { - //switch (what) - //{ - // case "user": - // try - // { - // //userID = - // //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); - // } catch (Exception ex) - // { - // m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString()); - // } - - // try - // { - // //RestObjectPoster.BeginPostObject(m_userManager._config.InventoryUrl + "CreateInventory/", - // //userID.Guid); - // } - // catch (Exception ex) - // { - // m_console.Error("[SERVER]: Error creating inventory for user: {0}", ex.ToString()); - // } - // // m_lastCreatedUser = userID; - // break; - //} - } - - private void HandleClearCache(string module, string[] cmd) - { - int entries = m_regionModule.ClearRegionCache(); - m_console.Output("Region cache cleared! Cleared " + - entries.ToString() + " entries"); - } - - private void HandleRegister(string module, string[] cmd) - { - deregisterFromUserServer(); - registerWithUserServer(); - } - - public override void ShutdownSpecific() - { - m_userServerModule.deregisterWithUserServer(); - } - - #region IUGAIMCore - protected Dictionary m_moduleInterfaces = new Dictionary(); - - /// - /// Register an Module interface. - /// - /// - /// - public void RegisterInterface(T iface) - { - lock (m_moduleInterfaces) - { - if (!m_moduleInterfaces.ContainsKey(typeof(T))) - { - m_moduleInterfaces.Add(typeof(T), iface); - } - } - } - - public bool TryGet(out T iface) - { - if (m_moduleInterfaces.ContainsKey(typeof(T))) - { - iface = (T)m_moduleInterfaces[typeof(T)]; - return true; - } - iface = default(T); - return false; - } - - public T Get() - { - return (T)m_moduleInterfaces[typeof(T)]; - } - - public BaseHttpServer GetHttpServer() - { - return m_httpServer; - } - #endregion - } -} diff --git a/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs b/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs deleted file mode 100644 index bd6b551..0000000 --- a/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 OpenSimulator 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.Reflection; -using System.Runtime.InteropServices; -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("UserConfig")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://opensimulator.org")] -[assembly: AssemblyProduct("UserConfig")] -[assembly: AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("0.6.3.*")] diff --git a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs deleted file mode 100644 index cbd0f0d..0000000 --- a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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 OpenSimulator 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 Db4objects.Db4o; -using OpenSim.Framework.Configuration; -using OpenSim.Framework.Console; -using OpenSim.Framework.Interfaces; - -namespace OpenUser.Config.UserConfigDb4o -{ - public class Db4oConfigPlugin: IUserConfig - { - private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - public UserConfig GetConfigObject() - { - m_log.Info("[DBUSERCONFIG]: Loading Db40Config dll"); - return new DbUserConfig(); - } - } - - public class DbUserConfig : UserConfig - { - private IObjectContainer db; - - public void LoadDefaults() - { - m_log.Info("DbUserConfig.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); - - this.DefaultStartupMsg = m_log.CmdPrompt("Default startup message", "Welcome to OGS"); - - this.GridServerURL = m_log.CmdPrompt("Grid server URL","http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/"); - this.GridSendKey = m_log.CmdPrompt("Key to send to grid server","null"); - this.GridRecvKey = m_log.CmdPrompt("Key to expect from grid server","null"); - } - - public override void InitConfig() - { - try - { - db = Db4oFactory.OpenFile("openuser.yap"); - IObjectSet result = db.Get(typeof(DbUserConfig)); - if (result.Count == 1) - { - m_log.Info("[DBUSERCONFIG]: DbUserConfig.cs:InitConfig() - Found a UserConfig object in the local database, loading"); - foreach (DbUserConfig cfg in result) - { - this.GridServerURL=cfg.GridServerURL; - this.GridSendKey=cfg.GridSendKey; - this.GridRecvKey=cfg.GridRecvKey; - this.DefaultStartupMsg=cfg.DefaultStartupMsg; - } - } - else - { - m_log.Info("[DBUSERCONFIG]: DbUserConfig.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); - LoadDefaults(); - m_log.Info("[DBUSERCONFIG]: Writing out default settings to local database"); - db.Set(this); - db.Close(); - } - } - catch(Exception e) - { - m_log.Warn("DbUserConfig.cs:InitConfig() - Exception occured"); - m_log.Warn(e.ToString()); - } - - m_log.Info("[DBUSERCONFIG]: User settings loaded:"); - m_log.Info("[DBUSERCONFIG]: Default startup message: " + this.DefaultStartupMsg); - m_log.Info("[DBUSERCONFIG]: Grid server URL: " + this.GridServerURL); - m_log.Info("[DBUSERCONFIG]: Key to send to grid: " + this.GridSendKey); - m_log.Info("[DBUSERCONFIG]: Key to expect from grid: " + this.GridRecvKey); - } - - public void Shutdown() - { - db.Close(); - } - } -} diff --git a/OpenSim/Grid/UserServer.Modules/AvatarCreationModule.cs b/OpenSim/Grid/UserServer.Modules/AvatarCreationModule.cs deleted file mode 100644 index 923b06c..0000000 --- a/OpenSim/Grid/UserServer.Modules/AvatarCreationModule.cs +++ /dev/null @@ -1,550 +0,0 @@ -/* - * 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 OpenSimulator 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.Reflection; -using System.Threading; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Console; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Grid.Framework; - - -namespace OpenSim.Grid.UserServer.Modules -{ - public class AvatarCreationModule - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private UserDataBaseService m_userDataBaseService; - // private BaseHttpServer m_httpServer; - // TODO: unused: private UserConfig m_config; - - private string m_inventoryServerUrl; - private IInterServiceInventoryServices m_inventoryService; - - public AvatarCreationModule(UserDataBaseService userDataBaseService, UserConfig config, IInterServiceInventoryServices inventoryService) - { - // TODO: unused: m_config = config; - m_userDataBaseService = userDataBaseService; - m_inventoryService = inventoryService; - m_inventoryServerUrl = config.InventoryUrl.OriginalString; - } - - public void Initialise(IGridServiceCore core) - { - CommandConsole console; - if (core.TryGet(out console)) - { - console.Commands.AddCommand("userserver", false, "clone avatar", - "clone avatar ", - "Clone the template avatar's inventory into a target avatar", RunCommand); - } - } - - public void PostInitialise() - { - - } - - public void RegisterHandlers(BaseHttpServer httpServer) - { - } - - public void RunCommand(string module, string[] cmd) - { - if ((cmd.Length == 6) && (cmd[0] == "clone") && (cmd[1] == "avatar")) - { - try - { - string tFirst = cmd[2]; - string tLast = cmd[3]; - - string nFirst = cmd[4]; - string nLast = cmd[5]; - - UserProfileData templateAvatar = m_userDataBaseService.GetUserProfile(tFirst, tLast); - UserProfileData newAvatar = m_userDataBaseService.GetUserProfile(nFirst, nLast); - - if (templateAvatar == null) - { - m_log.ErrorFormat("[AvatarAppearance] Clone Avatar: Could not find template avatar {0} , {1}", tFirst, tLast); - return; - } - - if (newAvatar == null) - { - m_log.ErrorFormat("[AvatarAppearance] Clone Avatar: Could not find target avatar {0} , {1}", nFirst, nLast); - return; - } - Guid avatar = newAvatar.ID.Guid; - Guid template = templateAvatar.ID.Guid; - CloneAvatar(avatar, template, true, true); - - } - catch (Exception e) - { - m_log.Error("Error: " + e.ToString()); - } - } - } - #region Avatar Appearance Creation - - public bool CloneAvatar(Guid avatarID, Guid templateID, bool modifyPermissions, bool removeTargetsClothes) - { - m_log.InfoFormat("[AvatarAppearance] Starting to clone avatar {0} inventory to avatar {1}", templateID.ToString(), avatarID.ToString()); - // TODO: unused: Guid bodyFolder = Guid.Empty; - // TODO: unused: Guid clothesFolder = Guid.Empty; - bool success = false; - - UUID avID = new UUID(avatarID); - List avatarInventory = m_inventoryService.GetInventorySkeleton(avID); - if ((avatarInventory == null) || (avatarInventory.Count == 0)) - { - m_log.InfoFormat("[AvatarAppearance] No inventory found for user {0} , so creating it", avID.ToString()); - m_inventoryService.CreateNewUserInventory(avID); - Thread.Sleep(5000); - avatarInventory = m_inventoryService.GetInventorySkeleton(avID); - } - - if ((avatarInventory != null) && (avatarInventory.Count > 0)) - { - UUID tempOwnID = new UUID(templateID); - AvatarAppearance appearance = m_userDataBaseService.GetUserAppearance(tempOwnID); - - if (removeTargetsClothes) - { - //remove clothes and attachments from target avatar so that the end result isn't a merger of its existing clothes - // and the clothes from the template avatar. - RemoveClothesAndAttachments(avID); - } - - List templateInventory = m_inventoryService.GetInventorySkeleton(tempOwnID); - if ((templateInventory != null) && (templateInventory.Count != 0)) - { - for (int i = 0; i < templateInventory.Count; i++) - { - if (templateInventory[i].ParentID == UUID.Zero) - { - success = CloneFolder(avatarInventory, avID, UUID.Zero, appearance, templateInventory[i], templateInventory, modifyPermissions); - break; - } - } - } - else - { - m_log.InfoFormat("[AvatarAppearance] Failed to find the template owner's {0} inventory", tempOwnID); - } - } - m_log.InfoFormat("[AvatarAppearance] finished cloning avatar with result: {0}", success); - return success; - } - - private bool CloneFolder(List avatarInventory, UUID avID, UUID parentFolder, AvatarAppearance appearance, InventoryFolderBase templateFolder, List templateFolders, bool modifyPermissions) - { - bool success = false; - UUID templateFolderId = templateFolder.ID; - if (templateFolderId != UUID.Zero) - { - InventoryFolderBase toFolder = FindFolder(templateFolder.Name, parentFolder.Guid, avatarInventory); - if (toFolder == null) - { - //create new folder - toFolder = new InventoryFolderBase(); - toFolder.ID = UUID.Random(); - toFolder.Name = templateFolder.Name; - toFolder.Owner = avID; - toFolder.Type = templateFolder.Type; - toFolder.Version = 1; - toFolder.ParentID = parentFolder; - if (!SynchronousRestObjectRequester.MakeRequest( - "POST", m_inventoryServerUrl + "CreateFolder/", toFolder)) - { - m_log.InfoFormat("[AvatarApperance] Couldn't make new folder {0} in users inventory", toFolder.Name); - return false; - } - else - { - // m_log.InfoFormat("made new folder {0} in users inventory", toFolder.Name); - } - } - - List templateItems = SynchronousRestObjectRequester.MakeRequest>( - "POST", m_inventoryServerUrl + "GetItems/", templateFolderId.Guid); - if ((templateItems != null) && (templateItems.Count > 0)) - { - List wornClothes = new List(); - List attachedItems = new List(); - - foreach (InventoryItemBase item in templateItems) - { - - UUID clonedItemId = CloneInventoryItem(avID, toFolder.ID, item, modifyPermissions); - if (clonedItemId != UUID.Zero) - { - int appearanceType = ItemIsPartOfAppearance(item, appearance); - if (appearanceType >= 0) - { - // UpdateAvatarAppearance(avID, appearanceType, clonedItemId, item.AssetID); - wornClothes.Add(new ClothesAttachment(appearanceType, clonedItemId, item.AssetID)); - } - - if (appearance != null) - { - int attachment = appearance.GetAttachpoint(item.ID); - if (attachment > 0) - { - //UpdateAvatarAttachment(avID, attachment, clonedItemId, item.AssetID); - attachedItems.Add(new ClothesAttachment(attachment, clonedItemId, item.AssetID)); - } - } - success = true; - } - } - - if ((wornClothes.Count > 0) || (attachedItems.Count > 0)) - { - //Update the worn clothes and attachments - AvatarAppearance targetAppearance = GetAppearance(avID); - if (targetAppearance != null) - { - foreach (ClothesAttachment wornItem in wornClothes) - { - targetAppearance.Wearables[wornItem.Type].AssetID = wornItem.AssetID; - targetAppearance.Wearables[wornItem.Type].ItemID = wornItem.ItemID; - } - - foreach (ClothesAttachment wornItem in attachedItems) - { - targetAppearance.SetAttachment(wornItem.Type, wornItem.ItemID, wornItem.AssetID); - } - - m_userDataBaseService.UpdateUserAppearance(avID, targetAppearance); - wornClothes.Clear(); - attachedItems.Clear(); - } - } - } - else if ((templateItems != null) && (templateItems.Count == 0)) - { - // m_log.Info("[AvatarAppearance]Folder being cloned was empty"); - success = true; - } - - List subFolders = FindSubFolders(templateFolder.ID.Guid, templateFolders); - foreach (InventoryFolderBase subFolder in subFolders) - { - if (subFolder.Name.ToLower() != "trash") - { - success = CloneFolder(avatarInventory, avID, toFolder.ID, appearance, subFolder, templateFolders, modifyPermissions); - } - } - } - else - { - m_log.Info("[AvatarAppearance] Failed to find the template folder"); - } - return success; - } - - private UUID CloneInventoryItem(UUID avatarID, UUID avatarFolder, InventoryItemBase item, bool modifyPerms) - { - if (avatarFolder != UUID.Zero) - { - InventoryItemBase clonedItem = new InventoryItemBase(); - clonedItem.Owner = avatarID; - clonedItem.AssetID = item.AssetID; - clonedItem.AssetType = item.AssetType; - clonedItem.BasePermissions = item.BasePermissions; - clonedItem.CreationDate = item.CreationDate; - clonedItem.CreatorId = item.CreatorId; - clonedItem.CreatorIdAsUuid = item.CreatorIdAsUuid; - clonedItem.CurrentPermissions = item.CurrentPermissions; - clonedItem.Description = item.Description; - clonedItem.EveryOnePermissions = item.EveryOnePermissions; - clonedItem.Flags = item.Flags; - clonedItem.Folder = avatarFolder; - clonedItem.GroupID = item.GroupID; - clonedItem.GroupOwned = item.GroupOwned; - clonedItem.GroupPermissions = item.GroupPermissions; - clonedItem.ID = UUID.Random(); - clonedItem.InvType = item.InvType; - clonedItem.Name = item.Name; - clonedItem.NextPermissions = item.NextPermissions; - clonedItem.SalePrice = item.SalePrice; - clonedItem.SaleType = item.SaleType; - - if (modifyPerms) - { - ModifyPermissions(ref clonedItem); - } - - SynchronousRestObjectRequester.MakeRequest( - "POST", m_inventoryServerUrl + "AddNewItem/", clonedItem); - - return clonedItem.ID; - } - - return UUID.Zero; - } - - // TODO: unused - // private void UpdateAvatarAppearance(UUID avatarID, int wearableType, UUID itemID, UUID assetID) - // { - // AvatarAppearance appearance = GetAppearance(avatarID); - // appearance.Wearables[wearableType].AssetID = assetID; - // appearance.Wearables[wearableType].ItemID = itemID; - // m_userDataBaseService.UpdateUserAppearance(avatarID, appearance); - // } - - // TODO: unused - // private void UpdateAvatarAttachment(UUID avatarID, int attachmentPoint, UUID itemID, UUID assetID) - // { - // AvatarAppearance appearance = GetAppearance(avatarID); - // appearance.SetAttachment(attachmentPoint, itemID, assetID); - // m_userDataBaseService.UpdateUserAppearance(avatarID, appearance); - // } - - private void RemoveClothesAndAttachments(UUID avatarID) - { - AvatarAppearance appearance = GetAppearance(avatarID); - - appearance.ClearWearables(); - appearance.ClearAttachments(); - m_userDataBaseService.UpdateUserAppearance(avatarID, appearance); - - } - - private AvatarAppearance GetAppearance(UUID avatarID) - { - AvatarAppearance appearance = m_userDataBaseService.GetUserAppearance(avatarID); - if (appearance == null) - { - appearance = CreateDefaultAppearance(avatarID); - } - return appearance; - } - - // TODO: unused - // private UUID FindFolderID(string name, List folders) - // { - // foreach (InventoryFolderBase folder in folders) - // { - // if (folder.Name == name) - // { - // return folder.ID; - // } - // } - // return UUID.Zero; - // } - - // TODO: unused - // private InventoryFolderBase FindFolder(string name, List folders) - // { - // foreach (InventoryFolderBase folder in folders) - // { - // if (folder.Name == name) - // { - // return folder; - // } - // } - // return null; - // } - - private InventoryFolderBase FindFolder(string name, Guid parentFolderID, List folders) - { - foreach (InventoryFolderBase folder in folders) - { - if ((folder.Name == name) && (folder.ParentID.Guid == parentFolderID)) - { - return folder; - } - } - return null; - } - - // TODO: unused - // private InventoryItemBase GetItem(string itemName, List items) - // { - // foreach (InventoryItemBase item in items) - // { - // if (item.Name.ToLower() == itemName.ToLower()) - // { - // return item; - // } - // } - // return null; - // } - - private List FindSubFolders(Guid parentFolderID, List folders) - { - List subFolders = new List(); - foreach (InventoryFolderBase folder in folders) - { - if (folder.ParentID.Guid == parentFolderID) - { - subFolders.Add(folder); - } - } - return subFolders; - } - - protected virtual void ModifyPermissions(ref InventoryItemBase item) - { - // Propagate Permissions - item.BasePermissions = item.BasePermissions & item.NextPermissions; - item.CurrentPermissions = item.BasePermissions; - item.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions; - item.GroupPermissions = item.GroupPermissions & item.NextPermissions; - - } - - private AvatarAppearance CreateDefaultAppearance(UUID avatarId) - { - AvatarAppearance appearance = null; - AvatarWearable[] wearables; - byte[] visualParams; - GetDefaultAvatarAppearance(out wearables, out visualParams); - appearance = new AvatarAppearance(avatarId, wearables, visualParams); - - return appearance; - } - - private static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) - { - visualParams = GetDefaultVisualParams(); - wearables = AvatarWearable.DefaultWearables; - } - - private static byte[] GetDefaultVisualParams() - { - byte[] visualParams; - visualParams = new byte[218]; - for (int i = 0; i < 218; i++) - { - visualParams[i] = 100; - } - return visualParams; - } - - private int ItemIsPartOfAppearance(InventoryItemBase item, AvatarAppearance appearance) - { - if (appearance != null) - { - if (appearance.BodyItem == item.ID) - return (int)WearableType.Shape; - - if (appearance.EyesItem == item.ID) - return (int)WearableType.Eyes; - - if (appearance.GlovesItem == item.ID) - return (int)WearableType.Gloves; - - if (appearance.HairItem == item.ID) - return (int)WearableType.Hair; - - if (appearance.JacketItem == item.ID) - return (int)WearableType.Jacket; - - if (appearance.PantsItem == item.ID) - return (int)WearableType.Pants; - - if (appearance.ShirtItem == item.ID) - return (int)WearableType.Shirt; - - if (appearance.ShoesItem == item.ID) - return (int)WearableType.Shoes; - - if (appearance.SkinItem == item.ID) - return (int)WearableType.Skin; - - if (appearance.SkirtItem == item.ID) - return (int)WearableType.Skirt; - - if (appearance.SocksItem == item.ID) - return (int)WearableType.Socks; - - if (appearance.UnderPantsItem == item.ID) - return (int)WearableType.Underpants; - - if (appearance.UnderShirtItem == item.ID) - return (int)WearableType.Undershirt; - } - return -1; - } - #endregion - - public enum PermissionMask - { - None = 0, - Transfer = 8192, - Modify = 16384, - Copy = 32768, - Move = 524288, - Damage = 1048576, - All = 2147483647, - } - - public enum WearableType - { - Shape = 0, - Skin = 1, - Hair = 2, - Eyes = 3, - Shirt = 4, - Pants = 5, - Shoes = 6, - Socks = 7, - Jacket = 8, - Gloves = 9, - Undershirt = 10, - Underpants = 11, - Skirt = 12, - } - - public class ClothesAttachment - { - public int Type; - public UUID ItemID; - public UUID AssetID; - - public ClothesAttachment(int type, UUID itemID, UUID assetID) - { - Type = type; - ItemID = itemID; - AssetID = assetID; - } - } - } -} \ No newline at end of file diff --git a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs deleted file mode 100644 index 3384952..0000000 --- a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs +++ /dev/null @@ -1,514 +0,0 @@ -/* - * 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 OpenSimulator 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.Collections; -using System.Collections.Generic; -using System.Net; -using System.Reflection; -using System.Threading; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Grid.Framework; - -namespace OpenSim.Grid.UserServer.Modules -{ - public enum NotificationRequest : int - { - Login = 0, - Logout = 1, - Shutdown = 2 - } - - public struct PresenceNotification - { - public NotificationRequest request; - public UUID agentID; - public UUID sessionID; - public UUID RegionID; - public ulong regionhandle; - public float positionX; - public float positionY; - public float positionZ; - public string firstname; - public string lastname; - } - - public delegate void AgentLocationDelegate(UUID agentID, UUID regionID, ulong regionHandle); - public delegate void AgentLeavingDelegate(UUID agentID, UUID regionID, ulong regionHandle); - public delegate void RegionStartupDelegate(UUID regionID); - public delegate void RegionShutdownDelegate(UUID regionID); - - - public class MessageServersConnector - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public Dictionary MessageServers; - - private BaseHttpServer m_httpServer; - - private OpenSim.Framework.BlockingQueue m_NotifyQueue = - new OpenSim.Framework.BlockingQueue(); - - private IGridServiceCore m_core; - - public event AgentLocationDelegate OnAgentLocation; - public event AgentLeavingDelegate OnAgentLeaving; - public event RegionStartupDelegate OnRegionStartup; - public event RegionShutdownDelegate OnRegionShutdown; - - public MessageServersConnector() - { - MessageServers = new Dictionary(); - } - - public void Initialise(IGridServiceCore core) - { - m_core = core; - m_core.RegisterInterface(this); - - Watchdog.StartThread(NotifyQueueRunner, "NotifyQueueRunner", ThreadPriority.Normal, true); - } - - public void PostInitialise() - { - } - - public void RegisterHandlers(BaseHttpServer httpServer) - { - m_httpServer = httpServer; - - m_httpServer.AddXmlRPCHandler("region_startup", RegionStartup); - m_httpServer.AddXmlRPCHandler("region_shutdown", RegionShutdown); - m_httpServer.AddXmlRPCHandler("agent_location", AgentLocation); - m_httpServer.AddXmlRPCHandler("agent_leaving", AgentLeaving); - // Message Server ---> User Server - m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer); - m_httpServer.AddXmlRPCHandler("agent_change_region", XmlRPCUserMovedtoRegion); - m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer); - } - - public void RegisterMessageServer(string URI, MessageServerInfo serverData) - { - lock (MessageServers) - { - if (!MessageServers.ContainsKey(URI)) - MessageServers.Add(URI, serverData); - } - } - - public void DeRegisterMessageServer(string URI) - { - lock (MessageServers) - { - if (MessageServers.ContainsKey(URI)) - MessageServers.Remove(URI); - } - } - - public void AddResponsibleRegion(string URI, ulong regionhandle) - { - if (!MessageServers.ContainsKey(URI)) - { - m_log.Warn("[MSGSERVER]: Got addResponsibleRegion Request for a MessageServer that isn't registered"); - } - else - { - MessageServerInfo msginfo = MessageServers["URI"]; - msginfo.responsibleForRegions.Add(regionhandle); - MessageServers["URI"] = msginfo; - } - } - public void RemoveResponsibleRegion(string URI, ulong regionhandle) - { - if (!MessageServers.ContainsKey(URI)) - { - m_log.Warn("[MSGSERVER]: Got RemoveResponsibleRegion Request for a MessageServer that isn't registered"); - } - else - { - MessageServerInfo msginfo = MessageServers["URI"]; - if (msginfo.responsibleForRegions.Contains(regionhandle)) - { - msginfo.responsibleForRegions.Remove(regionhandle); - MessageServers["URI"] = msginfo; - } - } - - } - public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - - if (requestData.Contains("uri")) - { - string URI = (string)requestData["uri"]; - string sendkey=(string)requestData["sendkey"]; - string recvkey=(string)requestData["recvkey"]; - MessageServerInfo m = new MessageServerInfo(); - m.URI = URI; - m.sendkey = sendkey; - m.recvkey = recvkey; - RegisterMessageServer(URI, m); - responseData["responsestring"] = "TRUE"; - response.Value = responseData; - } - return response; - } - public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - - if (requestData.Contains("uri")) - { - string URI = (string)requestData["uri"]; - - DeRegisterMessageServer(URI); - responseData["responsestring"] = "TRUE"; - response.Value = responseData; - } - return response; - } - - public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - - if (requestData.Contains("fromuri")) - { - // string sURI = (string)requestData["fromuri"]; - // string sagentID = (string)requestData["agentid"]; - // string ssessionID = (string)requestData["sessionid"]; - // string scurrentRegionID = (string)requestData["regionid"]; - // string sregionhandle = (string)requestData["regionhandle"]; - // string scurrentpos = (string)requestData["currentpos"]; - //Vector3.TryParse((string)reader["currentPos"], out retval.currentPos); - // TODO: Okay now raise event so the user server can pass this data to the Usermanager - - responseData["responsestring"] = "TRUE"; - response.Value = responseData; - } - return response; - } - - public void TellMessageServersAboutUser(UUID agentID, UUID sessionID, UUID RegionID, - ulong regionhandle, float positionX, float positionY, - float positionZ, string firstname, string lastname) - { - PresenceNotification notification = new PresenceNotification(); - - notification.request = NotificationRequest.Login; - notification.agentID = agentID; - notification.sessionID = sessionID; - notification.RegionID = RegionID; - notification.regionhandle = regionhandle; - notification.positionX = positionX; - notification.positionY = positionY; - notification.positionZ = positionZ; - notification.firstname = firstname; - notification.lastname = lastname; - - m_NotifyQueue.Enqueue(notification); - } - - private void TellMessageServersAboutUserInternal(UUID agentID, UUID sessionID, UUID RegionID, - ulong regionhandle, float positionX, float positionY, - float positionZ, string firstname, string lastname) - { - // Loop over registered Message Servers (AND THERE WILL BE MORE THEN ONE :D) - lock (MessageServers) - { - if (MessageServers.Count > 0) - { - m_log.Info("[MSGCONNECTOR]: Sending login notice to registered message servers"); - } -// else -// { -// m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); -// } - foreach (MessageServerInfo serv in MessageServers.Values) - { - NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, - regionhandle, positionX, positionY, positionZ, - firstname, lastname); - } - } - } - - private void TellMessageServersAboutUserLogoffInternal(UUID agentID) - { - lock (MessageServers) - { - if (MessageServers.Count > 0) - { - m_log.Info("[MSGCONNECTOR]: Sending logoff notice to registered message servers"); - } - else - { -// m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); - } - foreach (MessageServerInfo serv in MessageServers.Values) - { - NotifyMessageServerAboutUserLogoff(serv,agentID); - } - } - } - - private void TellMessageServersAboutRegionShutdownInternal(UUID regionID) - { - lock (MessageServers) - { - if (MessageServers.Count > 0) - { - m_log.Info("[MSGCONNECTOR]: Sending region down notice to registered message servers"); - } - else - { -// m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); - } - foreach (MessageServerInfo serv in MessageServers.Values) - { - NotifyMessageServerAboutRegionShutdown(serv,regionID); - } - } - } - - public void TellMessageServersAboutUserLogoff(UUID agentID) - { - PresenceNotification notification = new PresenceNotification(); - - notification.request = NotificationRequest.Logout; - notification.agentID = agentID; - - m_NotifyQueue.Enqueue(notification); - } - - public void TellMessageServersAboutRegionShutdown(UUID regionID) - { - PresenceNotification notification = new PresenceNotification(); - - notification.request = NotificationRequest.Shutdown; - notification.RegionID = regionID; - - m_NotifyQueue.Enqueue(notification); - } - - private void NotifyMessageServerAboutUserLogoff(MessageServerInfo serv, UUID agentID) - { - Hashtable reqparams = new Hashtable(); - reqparams["sendkey"] = serv.sendkey; - reqparams["agentid"] = agentID.ToString(); - ArrayList SendParams = new ArrayList(); - SendParams.Add(reqparams); - - XmlRpcRequest GridReq = new XmlRpcRequest("logout_of_simulator", SendParams); - try - { - GridReq.Send(serv.URI, 6000); - } - catch (WebException) - { - m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about log out. Other users might still think this user is online"); - } - m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout"); - } - - private void NotifyMessageServerAboutRegionShutdown(MessageServerInfo serv, UUID regionID) - { - Hashtable reqparams = new Hashtable(); - reqparams["sendkey"] = serv.sendkey; - reqparams["regionid"] = regionID.ToString(); - ArrayList SendParams = new ArrayList(); - SendParams.Add(reqparams); - - XmlRpcRequest GridReq = new XmlRpcRequest("process_region_shutdown", SendParams); - try - { - GridReq.Send(serv.URI, 6000); - } - catch (WebException) - { - m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about region shutdown."); - } - m_log.Info("[REGION UPDOWN]: Notified : " + serv.URI + " about region state change"); - } - - private void NotifyMessageServerAboutUser(MessageServerInfo serv, - UUID agentID, UUID sessionID, UUID RegionID, - ulong regionhandle, float positionX, float positionY, float positionZ, - string firstname, string lastname) - { - Hashtable reqparams = new Hashtable(); - reqparams["sendkey"] = serv.sendkey; - reqparams["agentid"] = agentID.ToString(); - reqparams["sessionid"] = sessionID.ToString(); - reqparams["regionid"] = RegionID.ToString(); - reqparams["regionhandle"] = regionhandle.ToString(); - reqparams["positionx"] = positionX.ToString(); - reqparams["positiony"] = positionY.ToString(); - reqparams["positionz"] = positionZ.ToString(); - reqparams["firstname"] = firstname; - reqparams["lastname"] = lastname; - - //reqparams["position"] = Position.ToString(); - - ArrayList SendParams = new ArrayList(); - SendParams.Add(reqparams); - - XmlRpcRequest GridReq = new XmlRpcRequest("login_to_simulator", SendParams); - try - { - GridReq.Send(serv.URI, 6000); - m_log.Info("[LOGIN]: Notified : " + serv.URI + " about user login"); - } - catch (WebException) - { - m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user"); - } - - } - - private void NotifyQueueRunner() - { - while (true) - { - PresenceNotification presence = m_NotifyQueue.Dequeue(); - - if (presence.request == NotificationRequest.Shutdown) - { - TellMessageServersAboutRegionShutdownInternal(presence.RegionID); - } - - if (presence.request == NotificationRequest.Login) - { - TellMessageServersAboutUserInternal(presence.agentID, - presence.sessionID, presence.RegionID, - presence.regionhandle, presence.positionX, - presence.positionY, presence.positionZ, - presence.firstname, presence.lastname); - } - - if (presence.request == NotificationRequest.Logout) - { - TellMessageServersAboutUserLogoffInternal(presence.agentID); - } - - Watchdog.UpdateThread(); - } - } - - public XmlRpcResponse RegionStartup(XmlRpcRequest request, IPEndPoint remoteClient) - { - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable result = new Hashtable(); - - UUID regionID; - if (UUID.TryParse((string)requestData["RegionUUID"], out regionID)) - { - if (OnRegionStartup != null) - OnRegionStartup(regionID); - - result["responsestring"] = "TRUE"; - } - - XmlRpcResponse response = new XmlRpcResponse(); - response.Value = result; - return response; - } - - public XmlRpcResponse RegionShutdown(XmlRpcRequest request, IPEndPoint remoteClient) - { - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable result = new Hashtable(); - - UUID regionID; - if (UUID.TryParse((string)requestData["RegionUUID"], out regionID)) - { - if (OnRegionShutdown != null) - OnRegionShutdown(regionID); - - result["responsestring"] = "TRUE"; - } - - XmlRpcResponse response = new XmlRpcResponse(); - response.Value = result; - return response; - } - - public XmlRpcResponse AgentLocation(XmlRpcRequest request, IPEndPoint remoteClient) - { - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable result = new Hashtable(); - - UUID agentID; - UUID regionID; - ulong regionHandle; - if (UUID.TryParse((string)requestData["AgentID"], out agentID) && UUID.TryParse((string)requestData["RegionUUID"], out regionID) && ulong.TryParse((string)requestData["RegionHandle"], out regionHandle)) - { - if (OnAgentLocation != null) - OnAgentLocation(agentID, regionID, regionHandle); - - result["responsestring"] = "TRUE"; - } - - XmlRpcResponse response = new XmlRpcResponse(); - response.Value = result; - return response; - } - - public XmlRpcResponse AgentLeaving(XmlRpcRequest request, IPEndPoint remoteClient) - { - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable result = new Hashtable(); - - UUID agentID; - UUID regionID; - ulong regionHandle; - if (UUID.TryParse((string)requestData["AgentID"], out agentID) && UUID.TryParse((string)requestData["RegionUUID"], out regionID) && ulong.TryParse((string)requestData["RegionHandle"], out regionHandle)) - { - if (OnAgentLeaving != null) - OnAgentLeaving(agentID, regionID, regionHandle); - - result["responsestring"] = "TRUE"; - } - - XmlRpcResponse response = new XmlRpcResponse(); - response.Value = result; - return response; - } - } -} diff --git a/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs b/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs deleted file mode 100644 index 10d6f80..0000000 --- a/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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 OpenSimulator 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.Reflection; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Grid.Framework; - -namespace OpenSim.Grid.UserServer.Modules -{ - public class UserDataBaseService : UserManagerBase - { - protected IGridServiceCore m_core; - - public UserDataBaseService(CommunicationsManager commsManager) - : base(commsManager) - { - } - - public void Initialise(IGridServiceCore core) - { - m_core = core; - - UserConfig cfg; - if (m_core.TryGet(out cfg)) - { - AddPlugin(cfg.DatabaseProvider, cfg.DatabaseConnect); - } - - m_core.RegisterInterface(this); - } - - public void PostInitialise() - { - } - - public void RegisterHandlers(BaseHttpServer httpServer) - { - } - - public UserAgentData GetUserAgentData(UUID AgentID) - { - UserProfileData userProfile = GetUserProfile(AgentID); - - if (userProfile != null) - { - return userProfile.CurrentAgent; - } - - return null; - } - - public override UserProfileData SetupMasterUser(string firstName, string lastName) - { - throw new Exception("The method or operation is not implemented."); - } - - public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) - { - throw new Exception("The method or operation is not implemented."); - } - - public override UserProfileData SetupMasterUser(UUID uuid) - { - throw new Exception("The method or operation is not implemented."); - } - } -} diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs deleted file mode 100644 index 97a919f..0000000 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ /dev/null @@ -1,416 +0,0 @@ -/* - * 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 OpenSimulator 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.Net; -using System.Reflection; -using System.Text.RegularExpressions; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using Nini.Config; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Communications.Services; -using LoginResponse = OpenSim.Framework.Communications.Services.LoginResponse; -using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Capabilities; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Services.Interfaces; -using OpenSim.Services.Connectors; -using GridRegion = OpenSim.Services.Interfaces.GridRegion; - -namespace OpenSim.Grid.UserServer.Modules -{ - public delegate void UserLoggedInAtLocation(UUID agentID, UUID sessionID, UUID RegionID, - ulong regionhandle, float positionX, float positionY, float positionZ, - string firstname, string lastname); - - /// - /// Login service used in grid mode. - /// - public class UserLoginService : LoginService - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public event UserLoggedInAtLocation OnUserLoggedInAtLocation; - - private UserLoggedInAtLocation handlerUserLoggedInAtLocation; - - public UserConfig m_config; - private readonly IRegionProfileRouter m_regionProfileService; - - private IGridService m_GridService; - - protected BaseHttpServer m_httpServer; - - public UserLoginService( - UserManagerBase userManager, IInterServiceInventoryServices inventoryService, - LibraryRootFolder libraryRootFolder, - UserConfig config, string welcomeMess, IRegionProfileRouter regionProfileService) - : base(userManager, libraryRootFolder, welcomeMess) - { - m_config = config; - m_defaultHomeX = m_config.DefaultX; - m_defaultHomeY = m_config.DefaultY; - m_interInventoryService = inventoryService; - m_regionProfileService = regionProfileService; - - m_GridService = new GridServicesConnector(config.GridServerURL.ToString()); - } - - public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) - { - m_httpServer = httpServer; - - m_httpServer.AddXmlRPCHandler("login_to_simulator", XmlRpcLoginMethod); - m_httpServer.AddHTTPHandler("login", ProcessHTMLLogin); - m_httpServer.AddXmlRPCHandler("set_login_params", XmlRPCSetLoginParams); - m_httpServer.AddXmlRPCHandler("check_auth_session", XmlRPCCheckAuthSession, false); - - if (registerLLSDHandler) - { - m_httpServer.SetDefaultLLSDHandler(LLSDLoginMethod); - } - - } - - public void setloginlevel(int level) - { - m_minLoginLevel = level; - m_log.InfoFormat("[GRID]: Login Level set to {0} ", level); - } - public void setwelcometext(string text) - { - m_welcomeMessage = text; - m_log.InfoFormat("[GRID]: Login text set to {0} ", text); - } - - public override void LogOffUser(UserProfileData theUser, string message) - { - RegionProfileData SimInfo; - try - { - SimInfo = m_regionProfileService.RequestSimProfileData( - theUser.CurrentAgent.Handle, m_config.GridServerURL, - m_config.GridSendKey, m_config.GridRecvKey); - - if (SimInfo == null) - { - m_log.Error("[GRID]: Region user was in isn't currently logged in"); - return; - } - } - catch (Exception) - { - m_log.Error("[GRID]: Unable to look up region to log user off"); - return; - } - - // Prepare notification - Hashtable SimParams = new Hashtable(); - SimParams["agent_id"] = theUser.ID.ToString(); - SimParams["region_secret"] = theUser.CurrentAgent.SecureSessionID.ToString(); - SimParams["region_secret2"] = SimInfo.regionSecret; - //m_log.Info(SimInfo.regionSecret); - SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); - SimParams["message"] = message; - ArrayList SendParams = new ArrayList(); - SendParams.Add(SimParams); - - m_log.InfoFormat( - "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", - SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, - theUser.FirstName + " " + theUser.SurName); - - try - { - XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); - XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); - - if (GridResp.IsFault) - { - m_log.ErrorFormat( - "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.", - SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); - } - } - catch (Exception) - { - m_log.Error("[LOGIN]: Error telling region to logout user!"); - } - - // Prepare notification - SimParams = new Hashtable(); - SimParams["agent_id"] = theUser.ID.ToString(); - SimParams["region_secret"] = SimInfo.regionSecret; - //m_log.Info(SimInfo.regionSecret); - SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); - SimParams["message"] = message; - SendParams = new ArrayList(); - SendParams.Add(SimParams); - - m_log.InfoFormat( - "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", - SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, - theUser.FirstName + " " + theUser.SurName); - - try - { - XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); - XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); - - if (GridResp.IsFault) - { - m_log.ErrorFormat( - "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.", - SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); - } - } - catch (Exception) - { - m_log.Error("[LOGIN]: Error telling region to logout user!"); - } - //base.LogOffUser(theUser); - } - - protected override RegionInfo RequestClosestRegion(string region) - { - return GridRegionToRegionInfo(m_GridService.GetRegionByName(UUID.Zero, region)); - } - - protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) - { - uint x = 0, y = 0; - Utils.LongToUInts(homeRegionHandle, out x, out y); - return GridRegionToRegionInfo(m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y)); - } - - protected override RegionInfo GetRegionInfo(UUID homeRegionId) - { - return GridRegionToRegionInfo(m_GridService.GetRegionByUUID(UUID.Zero, homeRegionId)); - } - - private RegionInfo GridRegionToRegionInfo(GridRegion gregion) - { - if (gregion == null) - return null; - - RegionInfo rinfo = new RegionInfo(); - rinfo.ExternalHostName = gregion.ExternalHostName; - rinfo.HttpPort = gregion.HttpPort; - rinfo.InternalEndPoint = gregion.InternalEndPoint; - rinfo.RegionID = gregion.RegionID; - rinfo.RegionLocX = (uint)(gregion.RegionLocX / Constants.RegionSize); - rinfo.RegionLocY = (uint)(gregion.RegionLocY / Constants.RegionSize); - rinfo.RegionName = gregion.RegionName; - rinfo.ScopeID = gregion.ScopeID; - rinfo.ServerURI = gregion.ServerURI; - - return rinfo; - } - - protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient) - { - return PrepareLoginToRegion(RegionProfileData.FromRegionInfo(regionInfo), user, response, remoteClient); - } - - /// - /// Prepare a login to the given region. This involves both telling the region to expect a connection - /// and appropriately customising the response to the user. - /// - /// - /// - /// - /// true if the region was successfully contacted, false otherwise - private bool PrepareLoginToRegion(RegionProfileData regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient) - { - try - { - response.SimAddress = Util.GetHostFromURL(regionInfo.serverURI).ToString(); - response.SimPort = uint.Parse(regionInfo.serverURI.Split(new char[] { '/', ':' })[4]); - response.RegionX = regionInfo.regionLocX; - response.RegionY = regionInfo.regionLocY; - - string capsPath = CapsUtil.GetRandomCapsObjectPath(); - - // Adam's working code commented for now -- Diva 5/25/2009 - //// For NAT - ////string host = NetworkUtil.GetHostFor(remoteClient.Address, regionInfo.ServerIP); - //string host = response.SimAddress; - //// TODO: This doesnt support SSL. -Adam - //string serverURI = "http://" + host + ":" + regionInfo.ServerPort; - - //response.SeedCapability = serverURI + CapsUtil.GetCapsSeedPath(capsPath); - - // Take off trailing / so that the caps path isn't //CAPS/someUUID - string uri = regionInfo.httpServerURI.Trim(new char[] { '/' }); - response.SeedCapability = uri + CapsUtil.GetCapsSeedPath(capsPath); - - - // Notify the target of an incoming user - m_log.InfoFormat( - "[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection", - regionInfo.regionName, response.RegionX, response.RegionY, regionInfo.httpServerURI); - - // Update agent with target sim - user.CurrentAgent.Region = regionInfo.UUID; - user.CurrentAgent.Handle = regionInfo.regionHandle; - - // Prepare notification - Hashtable loginParams = new Hashtable(); - loginParams["session_id"] = user.CurrentAgent.SessionID.ToString(); - loginParams["secure_session_id"] = user.CurrentAgent.SecureSessionID.ToString(); - loginParams["firstname"] = user.FirstName; - loginParams["lastname"] = user.SurName; - loginParams["agent_id"] = user.ID.ToString(); - loginParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); - loginParams["startpos_x"] = user.CurrentAgent.Position.X.ToString(); - loginParams["startpos_y"] = user.CurrentAgent.Position.Y.ToString(); - loginParams["startpos_z"] = user.CurrentAgent.Position.Z.ToString(); - loginParams["regionhandle"] = user.CurrentAgent.Handle.ToString(); - loginParams["caps_path"] = capsPath; - - // Get appearance - AvatarAppearance appearance = m_userManager.GetUserAppearance(user.ID); - if (appearance != null) - { - loginParams["appearance"] = appearance.ToHashTable(); - m_log.DebugFormat("[LOGIN]: Found appearance for {0} {1}", user.FirstName, user.SurName); - } - else - { - m_log.DebugFormat("[LOGIN]: Appearance not for {0} {1}. Creating default.", user.FirstName, user.SurName); - appearance = new AvatarAppearance(user.ID); - loginParams["appearance"] = appearance.ToHashTable(); - } - - ArrayList SendParams = new ArrayList(); - SendParams.Add(loginParams); - - // Send - XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); - XmlRpcResponse GridResp = GridReq.Send(regionInfo.httpServerURI, 6000); - - if (!GridResp.IsFault) - { - bool responseSuccess = true; - - if (GridResp.Value != null) - { - Hashtable resp = (Hashtable)GridResp.Value; - if (resp.ContainsKey("success")) - { - if ((string)resp["success"] == "FALSE") - { - responseSuccess = false; - } - } - } - - if (responseSuccess) - { - handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; - if (handlerUserLoggedInAtLocation != null) - { - handlerUserLoggedInAtLocation(user.ID, user.CurrentAgent.SessionID, - user.CurrentAgent.Region, - user.CurrentAgent.Handle, - user.CurrentAgent.Position.X, - user.CurrentAgent.Position.Y, - user.CurrentAgent.Position.Z, - user.FirstName, user.SurName); - } - } - else - { - m_log.ErrorFormat("[LOGIN]: Region responded that it is not available to receive clients"); - return false; - } - } - else - { - m_log.ErrorFormat("[LOGIN]: XmlRpc request to region failed with message {0}, code {1} ", GridResp.FaultString, GridResp.FaultCode); - return false; - } - } - catch (Exception e) - { - m_log.ErrorFormat("[LOGIN]: Region not available for login, {0}", e); - return false; - } - - return true; - } - - public XmlRpcResponse XmlRPCSetLoginParams(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - UserProfileData userProfile; - Hashtable responseData = new Hashtable(); - - UUID uid; - string pass = requestData["password"].ToString(); - - if (!UUID.TryParse((string)requestData["avatar_uuid"], out uid)) - { - responseData["error"] = "No authorization"; - response.Value = responseData; - return response; - } - - userProfile = m_userManager.GetUserProfile(uid); - - if (userProfile == null || - (!AuthenticateUser(userProfile, pass)) || - userProfile.GodLevel < 200) - { - responseData["error"] = "No authorization"; - response.Value = responseData; - return response; - } - - if (requestData.ContainsKey("login_level")) - { - m_minLoginLevel = Convert.ToInt32(requestData["login_level"]); - } - - if (requestData.ContainsKey("login_motd")) - { - m_welcomeMessage = requestData["login_motd"].ToString(); - } - - response.Value = responseData; - return response; - } - } -} diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs deleted file mode 100644 index 36c6297..0000000 --- a/OpenSim/Grid/UserServer.Modules/UserManager.cs +++ /dev/null @@ -1,718 +0,0 @@ -/* - * 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 OpenSimulator 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.Net; -using System.Reflection; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Grid.Framework; - -namespace OpenSim.Grid.UserServer.Modules -{ - public delegate void logOffUser(UUID AgentID); - - public class UserManager - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public event logOffUser OnLogOffUser; - private logOffUser handlerLogOffUser; - - private UserDataBaseService m_userDataBaseService; - private BaseHttpServer m_httpServer; - - /// - /// - /// - /// - public UserManager(UserDataBaseService userDataBaseService) - { - m_userDataBaseService = userDataBaseService; - } - - public void Initialise(IGridServiceCore core) - { - - } - - public void PostInitialise() - { - - } - - private string RESTGetUserProfile(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - UUID id; - UserProfileData userProfile; - - try - { - id = new UUID(param); - } - catch (Exception) - { - httpResponse.StatusCode = 500; - return "Malformed Param [" + param + "]"; - } - - userProfile = m_userDataBaseService.GetUserProfile(id); - - if (userProfile == null) - { - httpResponse.StatusCode = 404; - return "Not Found."; - } - - return ProfileToXmlRPCResponse(userProfile).ToString(); - } - - public void RegisterHandlers(BaseHttpServer httpServer) - { - m_httpServer = httpServer; - - m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/users/", RESTGetUserProfile)); - - m_httpServer.AddXmlRPCHandler("get_user_by_name", XmlRPCGetUserMethodName); - m_httpServer.AddXmlRPCHandler("get_user_by_uuid", XmlRPCGetUserMethodUUID); - m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar); - - // Used by IAR module to do password checks - m_httpServer.AddXmlRPCHandler("authenticate_user_by_password", XmlRPCAuthenticateUserMethodPassword); - - m_httpServer.AddXmlRPCHandler("update_user_current_region", XmlRPCAtRegion); - m_httpServer.AddXmlRPCHandler("logout_of_simulator", XmlRPCLogOffUserMethodUUID); - m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", XmlRPCGetAgentMethodUUID); - - m_httpServer.AddXmlRPCHandler("update_user_profile", XmlRpcResponseXmlRPCUpdateUserProfile); - - m_httpServer.AddStreamHandler(new RestStreamHandler("DELETE", "/usersessions/", RestDeleteUserSessionMethod)); - } - - /// - /// Deletes an active agent session - /// - /// The request - /// The path (eg /bork/narf/test) - /// Parameters sent - /// HTTP request header object - /// HTTP response header object - /// Success "OK" else error - public string RestDeleteUserSessionMethod(string request, string path, string param, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - // TODO! Important! - - return "OK"; - } - - public XmlRpcResponse AvatarPickerListtoXmlRPCResponse(UUID queryID, List returnUsers) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable responseData = new Hashtable(); - // Query Result Information - responseData["queryid"] = queryID.ToString(); - responseData["avcount"] = returnUsers.Count.ToString(); - - for (int i = 0; i < returnUsers.Count; i++) - { - responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString(); - responseData["firstname" + i] = returnUsers[i].firstName; - responseData["lastname" + i] = returnUsers[i].lastName; - } - response.Value = responseData; - - return response; - } - - /// - /// Converts a user profile to an XML element which can be returned - /// - /// The user profile - /// A string containing an XML Document of the user profile - public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable responseData = new Hashtable(); - - // Account information - responseData["firstname"] = profile.FirstName; - responseData["lastname"] = profile.SurName; - responseData["email"] = profile.Email; - responseData["uuid"] = profile.ID.ToString(); - // Server Information - responseData["server_inventory"] = profile.UserInventoryURI; - responseData["server_asset"] = profile.UserAssetURI; - // Profile Information - responseData["profile_about"] = profile.AboutText; - responseData["profile_firstlife_about"] = profile.FirstLifeAboutText; - responseData["profile_firstlife_image"] = profile.FirstLifeImage.ToString(); - responseData["profile_can_do"] = profile.CanDoMask.ToString(); - responseData["profile_want_do"] = profile.WantDoMask.ToString(); - responseData["profile_image"] = profile.Image.ToString(); - responseData["profile_created"] = profile.Created.ToString(); - responseData["profile_lastlogin"] = profile.LastLogin.ToString(); - // Home region information - responseData["home_coordinates_x"] = profile.HomeLocation.X.ToString(); - responseData["home_coordinates_y"] = profile.HomeLocation.Y.ToString(); - responseData["home_coordinates_z"] = profile.HomeLocation.Z.ToString(); - - responseData["home_region"] = profile.HomeRegion.ToString(); - responseData["home_region_id"] = profile.HomeRegionID.ToString(); - - responseData["home_look_x"] = profile.HomeLookAt.X.ToString(); - responseData["home_look_y"] = profile.HomeLookAt.Y.ToString(); - responseData["home_look_z"] = profile.HomeLookAt.Z.ToString(); - - responseData["user_flags"] = profile.UserFlags.ToString(); - responseData["god_level"] = profile.GodLevel.ToString(); - responseData["custom_type"] = profile.CustomType; - responseData["partner"] = profile.Partner.ToString(); - response.Value = responseData; - - return response; - } - - #region XMLRPC User Methods - - /// - /// Authenticate a user using their password - /// - /// Must contain values for "user_uuid" and "password" keys - /// - /// - public XmlRpcResponse XmlRPCAuthenticateUserMethodPassword(XmlRpcRequest request, IPEndPoint remoteClient) - { -// m_log.DebugFormat("[USER MANAGER]: Received authenticated user by password request from {0}", remoteClient); - - Hashtable requestData = (Hashtable)request.Params[0]; - string userUuidRaw = (string)requestData["user_uuid"]; - string password = (string)requestData["password"]; - - if (null == userUuidRaw) - return Util.CreateUnknownUserErrorResponse(); - - UUID userUuid; - if (!UUID.TryParse(userUuidRaw, out userUuid)) - return Util.CreateUnknownUserErrorResponse(); - - UserProfileData userProfile = m_userDataBaseService.GetUserProfile(userUuid); - if (null == userProfile) - return Util.CreateUnknownUserErrorResponse(); - - string authed; - - if (null == password) - { - authed = "FALSE"; - } - else - { - if (m_userDataBaseService.AuthenticateUserByPassword(userUuid, password)) - authed = "TRUE"; - else - authed = "FALSE"; - } - -// m_log.DebugFormat( -// "[USER MANAGER]: Authentication by password result from {0} for {1} is {2}", -// remoteClient, userUuid, authed); - - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable responseData = new Hashtable(); - responseData["auth_user"] = authed; - response.Value = responseData; - - return response; - } - - public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request, IPEndPoint remoteClient) - { - // XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - List returnAvatar = new List(); - UUID queryID = new UUID(UUID.Zero.ToString()); - - if (requestData.Contains("avquery") && requestData.Contains("queryid")) - { - queryID = new UUID((string)requestData["queryid"]); - returnAvatar = m_userDataBaseService.GenerateAgentPickerRequestResponse(queryID, (string)requestData["avquery"]); - } - - m_log.InfoFormat("[AVATARINFO]: Servicing Avatar Query: " + (string)requestData["avquery"]); - return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar); - } - - public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - string returnstring = "FALSE"; - - if (requestData.Contains("avatar_id") && requestData.Contains("region_handle") && - requestData.Contains("region_uuid")) - { - // ulong cregionhandle = 0; - UUID regionUUID; - UUID avatarUUID; - - UUID.TryParse((string)requestData["avatar_id"], out avatarUUID); - UUID.TryParse((string)requestData["region_uuid"], out regionUUID); - - if (avatarUUID != UUID.Zero) - { - UserProfileData userProfile = m_userDataBaseService.GetUserProfile(avatarUUID); - userProfile.CurrentAgent.Region = regionUUID; - userProfile.CurrentAgent.Handle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); - //userProfile.CurrentAgent. - m_userDataBaseService.CommitAgent(ref userProfile); - //setUserProfile(userProfile); - - returnstring = "TRUE"; - } - } - - responseData.Add("returnString", returnstring); - response.Value = responseData; - return response; - } - - public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request, IPEndPoint remoteClient) - { - // XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - UserProfileData userProfile; - if (requestData.Contains("avatar_name")) - { - string query = (string)requestData["avatar_name"]; - - if (null == query) - return Util.CreateUnknownUserErrorResponse(); - - // Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); - - string[] querysplit = query.Split(' '); - - if (querysplit.Length == 2) - { - userProfile = m_userDataBaseService.GetUserProfile(querysplit[0], querysplit[1]); - if (userProfile == null) - { - return Util.CreateUnknownUserErrorResponse(); - } - } - else - { - return Util.CreateUnknownUserErrorResponse(); - } - } - else - { - return Util.CreateUnknownUserErrorResponse(); - } - - return ProfileToXmlRPCResponse(userProfile); - } - - public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request, IPEndPoint remoteClient) - { - // XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - UserProfileData userProfile; - //CFK: this clogs the UserServer log and is not necessary at this time. - //CFK: m_log.Debug("METHOD BY UUID CALLED"); - if (requestData.Contains("avatar_uuid")) - { - try - { - UUID guess = new UUID((string)requestData["avatar_uuid"]); - - userProfile = m_userDataBaseService.GetUserProfile(guess); - } - catch (FormatException) - { - return Util.CreateUnknownUserErrorResponse(); - } - - if (userProfile == null) - { - return Util.CreateUnknownUserErrorResponse(); - } - } - else - { - return Util.CreateUnknownUserErrorResponse(); - } - - return ProfileToXmlRPCResponse(userProfile); - } - - public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - UserProfileData userProfile; - //CFK: this clogs the UserServer log and is not necessary at this time. - //CFK: m_log.Debug("METHOD BY UUID CALLED"); - if (requestData.Contains("avatar_uuid")) - { - UUID guess; - - UUID.TryParse((string)requestData["avatar_uuid"], out guess); - - if (guess == UUID.Zero) - { - return Util.CreateUnknownUserErrorResponse(); - } - - userProfile = m_userDataBaseService.GetUserProfile(guess); - - if (userProfile == null) - { - return Util.CreateUnknownUserErrorResponse(); - } - - // no agent??? - if (userProfile.CurrentAgent == null) - { - return Util.CreateUnknownUserErrorResponse(); - } - Hashtable responseData = new Hashtable(); - - responseData["handle"] = userProfile.CurrentAgent.Handle.ToString(); - responseData["session"] = userProfile.CurrentAgent.SessionID.ToString(); - if (userProfile.CurrentAgent.AgentOnline) - responseData["agent_online"] = "TRUE"; - else - responseData["agent_online"] = "FALSE"; - - response.Value = responseData; - } - else - { - return Util.CreateUnknownUserErrorResponse(); - } - - return response; - } - - public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserProfile(XmlRpcRequest request, IPEndPoint remoteClient) - { - m_log.Debug("[UserManager]: Got request to update user profile"); - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - - if (!requestData.Contains("avatar_uuid")) - { - return Util.CreateUnknownUserErrorResponse(); - } - - UUID UserUUID = new UUID((string)requestData["avatar_uuid"]); - UserProfileData userProfile = m_userDataBaseService.GetUserProfile(UserUUID); - if (null == userProfile) - { - return Util.CreateUnknownUserErrorResponse(); - } - // don't know how yet. - if (requestData.Contains("AllowPublish")) - { - } - if (requestData.Contains("FLImageID")) - { - userProfile.FirstLifeImage = new UUID((string)requestData["FLImageID"]); - } - if (requestData.Contains("ImageID")) - { - userProfile.Image = new UUID((string)requestData["ImageID"]); - } - // dont' know how yet - if (requestData.Contains("MaturePublish")) - { - } - if (requestData.Contains("AboutText")) - { - userProfile.AboutText = (string)requestData["AboutText"]; - } - if (requestData.Contains("FLAboutText")) - { - userProfile.FirstLifeAboutText = (string)requestData["FLAboutText"]; - } - // not in DB yet. - if (requestData.Contains("ProfileURL")) - { - } - if (requestData.Contains("home_region")) - { - try - { - userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]); - } - catch (ArgumentException) - { - m_log.Error("[PROFILE]:Failed to set home region, Invalid Argument"); - } - catch (FormatException) - { - m_log.Error("[PROFILE]:Failed to set home region, Invalid Format"); - } - catch (OverflowException) - { - m_log.Error("[PROFILE]:Failed to set home region, Value was too large"); - } - } - if (requestData.Contains("home_region_id")) - { - UUID regionID; - UUID.TryParse((string)requestData["home_region_id"], out regionID); - userProfile.HomeRegionID = regionID; - } - if (requestData.Contains("home_pos_x")) - { - try - { - userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]); - } - catch (InvalidCastException) - { - m_log.Error("[PROFILE]:Failed to set home postion x"); - } - } - if (requestData.Contains("home_pos_y")) - { - try - { - userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]); - } - catch (InvalidCastException) - { - m_log.Error("[PROFILE]:Failed to set home postion y"); - } - } - if (requestData.Contains("home_pos_z")) - { - try - { - userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]); - } - catch (InvalidCastException) - { - m_log.Error("[PROFILE]:Failed to set home postion z"); - } - } - if (requestData.Contains("home_look_x")) - { - try - { - userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]); - } - catch (InvalidCastException) - { - m_log.Error("[PROFILE]:Failed to set home lookat x"); - } - } - if (requestData.Contains("home_look_y")) - { - try - { - userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]); - } - catch (InvalidCastException) - { - m_log.Error("[PROFILE]:Failed to set home lookat y"); - } - } - if (requestData.Contains("home_look_z")) - { - try - { - userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]); - } - catch (InvalidCastException) - { - m_log.Error("[PROFILE]:Failed to set home lookat z"); - } - } - if (requestData.Contains("user_flags")) - { - try - { - userProfile.UserFlags = Convert.ToInt32((string)requestData["user_flags"]); - } - catch (InvalidCastException) - { - m_log.Error("[PROFILE]:Failed to set user flags"); - } - } - if (requestData.Contains("god_level")) - { - try - { - userProfile.GodLevel = Convert.ToInt32((string)requestData["god_level"]); - } - catch (InvalidCastException) - { - m_log.Error("[PROFILE]:Failed to set god level"); - } - } - if (requestData.Contains("custom_type")) - { - try - { - userProfile.CustomType = (string)requestData["custom_type"]; - } - catch (InvalidCastException) - { - m_log.Error("[PROFILE]:Failed to set custom type"); - } - } - if (requestData.Contains("partner")) - { - try - { - userProfile.Partner = new UUID((string)requestData["partner"]); - } - catch (InvalidCastException) - { - m_log.Error("[PROFILE]:Failed to set partner"); - } - } - else - { - userProfile.Partner = UUID.Zero; - } - - // call plugin! - bool ret = m_userDataBaseService.UpdateUserProfile(userProfile); - responseData["returnString"] = ret.ToString(); - response.Value = responseData; - return response; - } - - public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - - if (requestData.Contains("avatar_uuid")) - { - try - { - UUID userUUID = new UUID((string)requestData["avatar_uuid"]); - UUID RegionID = new UUID((string)requestData["region_uuid"]); - ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); - Vector3 position = new Vector3( - (float)Convert.ToDecimal((string)requestData["region_pos_x"]), - (float)Convert.ToDecimal((string)requestData["region_pos_y"]), - (float)Convert.ToDecimal((string)requestData["region_pos_z"])); - Vector3 lookat = new Vector3( - (float)Convert.ToDecimal((string)requestData["lookat_x"]), - (float)Convert.ToDecimal((string)requestData["lookat_y"]), - (float)Convert.ToDecimal((string)requestData["lookat_z"])); - - handlerLogOffUser = OnLogOffUser; - if (handlerLogOffUser != null) - handlerLogOffUser(userUUID); - - m_userDataBaseService.LogOffUser(userUUID, RegionID, regionhandle, position, lookat); - } - catch (FormatException) - { - m_log.Warn("[LOGOUT]: Error in Logout XMLRPC Params"); - return response; - } - } - else - { - return Util.CreateUnknownUserErrorResponse(); - } - - return response; - } - - #endregion - - - public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle) - { - UserProfileData userProfile = m_userDataBaseService.GetUserProfile(agentID); - if (userProfile != null) - { - userProfile.CurrentAgent.Region = regionID; - userProfile.CurrentAgent.Handle = regionHandle; - m_userDataBaseService.CommitAgent(ref userProfile); - } - } - - public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle) - { - UserProfileData userProfile = m_userDataBaseService.GetUserProfile(agentID); - if (userProfile != null) - { - if (userProfile.CurrentAgent.Region == regionID) - { - UserAgentData userAgent = userProfile.CurrentAgent; - if (userAgent != null && userAgent.AgentOnline) - { - userAgent.AgentOnline = false; - userAgent.LogoutTime = Util.UnixTimeSinceEpoch(); - if (regionID != UUID.Zero) - { - userAgent.Region = regionID; - } - userAgent.Handle = regionHandle; - userProfile.LastLogin = userAgent.LogoutTime; - - m_userDataBaseService.CommitAgent(ref userProfile); - - handlerLogOffUser = OnLogOffUser; - if (handlerLogOffUser != null) - handlerLogOffUser(agentID); - } - } - } - } - - public void HandleRegionStartup(UUID regionID) - { - m_userDataBaseService.LogoutUsers(regionID); - } - - public void HandleRegionShutdown(UUID regionID) - { - m_userDataBaseService.LogoutUsers(regionID); - } - } -} diff --git a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs deleted file mode 100644 index 88918d1..0000000 --- a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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 OpenSimulator 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.Net; -using System.Reflection; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Grid.Framework; - -namespace OpenSim.Grid.UserServer.Modules -{ - public class UserServerAvatarAppearanceModule - { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private UserDataBaseService m_userDataBaseService; - private BaseHttpServer m_httpServer; - - public UserServerAvatarAppearanceModule(UserDataBaseService userDataBaseService) - { - m_userDataBaseService = userDataBaseService; - } - - public void Initialise(IGridServiceCore core) - { - - } - - public void PostInitialise() - { - - } - - public void RegisterHandlers(BaseHttpServer httpServer) - { - m_httpServer = httpServer; - - m_httpServer.AddXmlRPCHandler("get_avatar_appearance", XmlRPCGetAvatarAppearance); - m_httpServer.AddXmlRPCHandler("update_avatar_appearance", XmlRPCUpdateAvatarAppearance); - } - - public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - AvatarAppearance appearance; - Hashtable responseData; - if (requestData.Contains("owner")) - { - appearance = m_userDataBaseService.GetUserAppearance(new UUID((string)requestData["owner"])); - if (appearance == null) - { - responseData = new Hashtable(); - responseData["error_type"] = "no appearance"; - responseData["error_desc"] = "There was no appearance found for this avatar"; - } - else - { - responseData = appearance.ToHashTable(); - } - } - else - { - responseData = new Hashtable(); - responseData["error_type"] = "unknown_avatar"; - responseData["error_desc"] = "The avatar appearance requested is not in the database"; - } - - response.Value = responseData; - return response; - } - - public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData; - if (requestData.Contains("owner")) - { - AvatarAppearance appearance = new AvatarAppearance(requestData); - - // TODO: Sometime in the future we may have a database layer that is capable of updating appearance when - // the TextureEntry is null. When that happens, this check can be removed - if (appearance.Texture != null) - m_userDataBaseService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); - - responseData = new Hashtable(); - responseData["returnString"] = "TRUE"; - } - else - { - responseData = new Hashtable(); - responseData["error_type"] = "unknown_avatar"; - responseData["error_desc"] = "The avatar appearance requested is not in the database"; - } - response.Value = responseData; - return response; - } - } -} diff --git a/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs b/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs deleted file mode 100644 index 56e52a0..0000000 --- a/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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 OpenSimulator 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.Net; -using System.Reflection; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Grid.Framework; - -namespace OpenSim.Grid.UserServer.Modules -{ - public class UserServerFriendsModule - { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private UserDataBaseService m_userDataBaseService; - - private BaseHttpServer m_httpServer; - - public UserServerFriendsModule(UserDataBaseService userDataBaseService) - { - m_userDataBaseService = userDataBaseService; - } - - public void Initialise(IGridServiceCore core) - { - - } - - public void PostInitialise() - { - - } - - public void RegisterHandlers(BaseHttpServer httpServer) - { - m_httpServer = httpServer; - - m_httpServer.AddXmlRPCHandler("add_new_user_friend", XmlRpcResponseXmlRPCAddUserFriend); - m_httpServer.AddXmlRPCHandler("remove_user_friend", XmlRpcResponseXmlRPCRemoveUserFriend); - m_httpServer.AddXmlRPCHandler("update_user_friend_perms", XmlRpcResponseXmlRPCUpdateUserFriendPerms); - m_httpServer.AddXmlRPCHandler("get_user_friend_list", XmlRpcResponseXmlRPCGetUserFriendList); - } - - public XmlRpcResponse FriendListItemListtoXmlRPCResponse(List returnUsers) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable responseData = new Hashtable(); - // Query Result Information - - responseData["avcount"] = returnUsers.Count.ToString(); - - for (int i = 0; i < returnUsers.Count; i++) - { - responseData["ownerID" + i] = returnUsers[i].FriendListOwner.ToString(); - responseData["friendID" + i] = returnUsers[i].Friend.ToString(); - responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString(); - responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString(); - } - response.Value = responseData; - - return response; - } - - public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - string returnString = "FALSE"; - // Query Result Information - - if (requestData.Contains("ownerID") && requestData.Contains("friendID") && - requestData.Contains("friendPerms")) - { - // UserManagerBase.AddNewuserFriend - m_userDataBaseService.AddNewUserFriend(new UUID((string)requestData["ownerID"]), - new UUID((string)requestData["friendID"]), - (uint)Convert.ToInt32((string)requestData["friendPerms"])); - returnString = "TRUE"; - } - responseData["returnString"] = returnString; - response.Value = responseData; - return response; - } - - public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - string returnString = "FALSE"; - // Query Result Information - - if (requestData.Contains("ownerID") && requestData.Contains("friendID")) - { - // UserManagerBase.AddNewuserFriend - m_userDataBaseService.RemoveUserFriend(new UUID((string)requestData["ownerID"]), - new UUID((string)requestData["friendID"])); - returnString = "TRUE"; - } - responseData["returnString"] = returnString; - response.Value = responseData; - return response; - } - - public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - string returnString = "FALSE"; - - if (requestData.Contains("ownerID") && requestData.Contains("friendID") && - requestData.Contains("friendPerms")) - { - m_userDataBaseService.UpdateUserFriendPerms(new UUID((string)requestData["ownerID"]), - new UUID((string)requestData["friendID"]), - (uint)Convert.ToInt32((string)requestData["friendPerms"])); - // UserManagerBase. - returnString = "TRUE"; - } - responseData["returnString"] = returnString; - response.Value = responseData; - return response; - } - - public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request, IPEndPoint remoteClient) - { - // XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - // Hashtable responseData = new Hashtable(); - - List returndata = new List(); - - if (requestData.Contains("ownerID")) - { - returndata = m_userDataBaseService.GetUserFriendList(new UUID((string)requestData["ownerID"])); - } - - return FriendListItemListtoXmlRPCResponse(returndata); - } - } -} diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs deleted file mode 100644 index d598728..0000000 --- a/OpenSim/Grid/UserServer/Main.cs +++ /dev/null @@ -1,316 +0,0 @@ -/* - * 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 OpenSimulator 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.IO; -using System.Reflection; -using log4net; -using log4net.Config; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Framework.Statistics; -using OpenSim.Grid.Communications.OGS1; -using OpenSim.Grid.Framework; -using OpenSim.Grid.UserServer.Modules; -using Nini.Config; - -namespace OpenSim.Grid.UserServer -{ - /// - /// Grid user server main class - /// - public class OpenUser_Main : BaseOpenSimServer, IGridServiceCore - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected UserConfig Cfg; - - protected UserDataBaseService m_userDataBaseService; - - public UserManager m_userManager; - - protected UserServerAvatarAppearanceModule m_avatarAppearanceModule; - protected UserServerFriendsModule m_friendsModule; - - public UserLoginService m_loginService; - public MessageServersConnector m_messagesService; - - protected UserServerCommandModule m_consoleCommandModule; - protected UserServerEventDispatchModule m_eventDispatcher; - - protected AvatarCreationModule m_appearanceModule; - - protected static string m_consoleType = "local"; - protected static IConfigSource m_config = null; - protected static string m_configFile = "UserServer_Config.xml"; - - public static void Main(string[] args) - { - ArgvConfigSource argvSource = new ArgvConfigSource(args); - argvSource.AddSwitch("Startup", "console", "c"); - argvSource.AddSwitch("Startup", "xmlfile", "x"); - - IConfig startupConfig = argvSource.Configs["Startup"]; - if (startupConfig != null) - { - m_consoleType = startupConfig.GetString("console", "local"); - m_configFile = startupConfig.GetString("xmlfile", "UserServer_Config.xml"); - } - - m_config = argvSource; - - XmlConfigurator.Configure(); - - m_log.Info("Launching UserServer..."); - - OpenUser_Main userserver = new OpenUser_Main(); - - userserver.Startup(); - userserver.Work(); - } - - public OpenUser_Main() - { - switch (m_consoleType) - { - case "rest": - m_console = new RemoteConsole("User"); - break; - case "basic": - m_console = new CommandConsole("User"); - break; - default: - m_console = new LocalConsole("User"); - break; - } - MainConsole.Instance = m_console; - } - - public void Work() - { - m_console.Output("Enter help for a list of commands\n"); - - while (true) - { - m_console.Prompt(); - } - } - - protected override void StartupSpecific() - { - IInterServiceInventoryServices inventoryService = StartupCoreComponents(); - - m_stats = StatsManager.StartCollectingUserStats(); - - //setup services/modules - StartupUserServerModules(); - - StartOtherComponents(inventoryService); - - //PostInitialise the modules - PostInitialiseModules(); - - //register http handlers and start http server - m_log.Info("[STARTUP]: Starting HTTP process"); - RegisterHttpHandlers(); - m_httpServer.Start(); - - base.StartupSpecific(); - } - - protected virtual IInterServiceInventoryServices StartupCoreComponents() - { - Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), m_configFile))); - - m_httpServer = new BaseHttpServer(Cfg.HttpPort); - - if (m_console is RemoteConsole) - { - RemoteConsole c = (RemoteConsole)m_console; - c.SetServer(m_httpServer); - IConfig netConfig = m_config.AddConfig("Network"); - netConfig.Set("ConsoleUser", Cfg.ConsoleUser); - netConfig.Set("ConsolePass", Cfg.ConsolePass); - c.ReadConfig(m_config); - } - - RegisterInterface(m_console); - RegisterInterface(Cfg); - - //Should be in modules? - IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl); - // IRegionProfileRouter regionProfileService = new RegionProfileServiceProxy(); - - RegisterInterface(inventoryService); - // RegisterInterface(regionProfileService); - - return inventoryService; - } - - /// - /// Start up the user manager - /// - /// - protected virtual void StartupUserServerModules() - { - m_log.Info("[STARTUP]: Establishing data connection"); - - //we only need core components so we can request them from here - IInterServiceInventoryServices inventoryService; - TryGet(out inventoryService); - - CommunicationsManager commsManager = new UserServerCommsManager(inventoryService); - - //setup database access service, for now this has to be created before the other modules. - m_userDataBaseService = new UserDataBaseService(commsManager); - m_userDataBaseService.Initialise(this); - - //TODO: change these modules so they fetch the databaseService class in the PostInitialise method - m_userManager = new UserManager(m_userDataBaseService); - m_userManager.Initialise(this); - - m_avatarAppearanceModule = new UserServerAvatarAppearanceModule(m_userDataBaseService); - m_avatarAppearanceModule.Initialise(this); - - m_friendsModule = new UserServerFriendsModule(m_userDataBaseService); - m_friendsModule.Initialise(this); - - m_consoleCommandModule = new UserServerCommandModule(); - m_consoleCommandModule.Initialise(this); - - m_messagesService = new MessageServersConnector(); - m_messagesService.Initialise(this); - } - - protected virtual void StartOtherComponents(IInterServiceInventoryServices inventoryService) - { - m_appearanceModule = new AvatarCreationModule(m_userDataBaseService, Cfg, inventoryService); - m_appearanceModule.Initialise(this); - - StartupLoginService(inventoryService); - // - // Get the minimum defaultLevel to access to the grid - // - m_loginService.setloginlevel((int)Cfg.DefaultUserLevel); - - RegisterInterface(m_loginService); //TODO: should be done in the login service - - m_eventDispatcher = new UserServerEventDispatchModule(m_userManager, m_messagesService, m_loginService); - m_eventDispatcher.Initialise(this); - } - - /// - /// Start up the login service - /// - /// - protected virtual void StartupLoginService(IInterServiceInventoryServices inventoryService) - { - m_loginService = new UserLoginService( - m_userDataBaseService, inventoryService, new LibraryRootFolder(Cfg.LibraryXmlfile), Cfg, Cfg.DefaultStartupMsg, new RegionProfileServiceProxy()); - - } - - protected virtual void PostInitialiseModules() - { - m_consoleCommandModule.PostInitialise(); //it will register its Console command handlers in here - m_userDataBaseService.PostInitialise(); - m_messagesService.PostInitialise(); - m_eventDispatcher.PostInitialise(); //it will register event handlers in here - m_userManager.PostInitialise(); - m_avatarAppearanceModule.PostInitialise(); - m_friendsModule.PostInitialise(); - } - - protected virtual void RegisterHttpHandlers() - { - m_loginService.RegisterHandlers(m_httpServer, Cfg.EnableLLSDLogin, true); - - m_userManager.RegisterHandlers(m_httpServer); - m_friendsModule.RegisterHandlers(m_httpServer); - m_avatarAppearanceModule.RegisterHandlers(m_httpServer); - m_messagesService.RegisterHandlers(m_httpServer); - } - - public override void ShutdownSpecific() - { - m_eventDispatcher.Close(); - } - - #region IUGAIMCore - protected Dictionary m_moduleInterfaces = new Dictionary(); - - /// - /// Register an Module interface. - /// - /// - /// - public void RegisterInterface(T iface) - { - lock (m_moduleInterfaces) - { - if (!m_moduleInterfaces.ContainsKey(typeof(T))) - { - m_moduleInterfaces.Add(typeof(T), iface); - } - } - } - - public bool TryGet(out T iface) - { - if (m_moduleInterfaces.ContainsKey(typeof(T))) - { - iface = (T)m_moduleInterfaces[typeof(T)]; - return true; - } - iface = default(T); - return false; - } - - public T Get() - { - return (T)m_moduleInterfaces[typeof(T)]; - } - - public BaseHttpServer GetHttpServer() - { - return m_httpServer; - } - #endregion - - public void TestResponse(List resp) - { - m_console.Output("response got"); - } - } -} diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs deleted file mode 100644 index ba79a55..0000000 --- a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 OpenSimulator 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.Reflection; -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("OGS-UserServer")] -[assembly : AssemblyDescription("")] -[assembly : AssemblyConfiguration("")] -[assembly : AssemblyCompany("http://opensimulator.org")] -[assembly : AssemblyProduct("OGS-UserServer")] -[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] -[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("e266513a-090b-4d38-80f6-8599eef68c8c")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// - -[assembly : AssemblyVersion("0.6.5.*")] -[assembly : AssemblyFileVersion("0.6.5.0")] diff --git a/OpenSim/Grid/UserServer/UserServerCommandModule.cs b/OpenSim/Grid/UserServer/UserServerCommandModule.cs deleted file mode 100644 index cca410e..0000000 --- a/OpenSim/Grid/UserServer/UserServerCommandModule.cs +++ /dev/null @@ -1,375 +0,0 @@ -/* - * 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 OpenSimulator 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.IO; -using System.Reflection; -using log4net; -using log4net.Config; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Framework.Statistics; -using OpenSim.Grid.Communications.OGS1; -using OpenSim.Grid.Framework; -using OpenSim.Grid.UserServer.Modules; - -namespace OpenSim.Grid.UserServer -{ - public class UserServerCommandModule - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected CommandConsole m_console; - protected UserConfig m_cfg; - - protected UserDataBaseService m_userDataBaseService; - protected UserLoginService m_loginService; - - protected UUID m_lastCreatedUser = UUID.Random(); - - protected IGridServiceCore m_core; - - public UserServerCommandModule() - { - } - - public void Initialise(IGridServiceCore core) - { - m_core = core; - } - - public void PostInitialise() - { - UserConfig cfg; - if (m_core.TryGet(out cfg)) - { - m_cfg = cfg; - } - - UserDataBaseService userDBservice; - if (m_core.TryGet(out userDBservice)) - { - m_userDataBaseService = userDBservice; - } - - UserLoginService loginService; - if (m_core.TryGet(out loginService)) - { - m_loginService = loginService; - } - - CommandConsole console; - if ((m_core.TryGet(out console)) && (m_cfg != null) - && (m_userDataBaseService != null) && (m_loginService != null)) - { - RegisterConsoleCommands(console); - } - } - - public void RegisterHandlers(BaseHttpServer httpServer) - { - - } - - private void RegisterConsoleCommands(CommandConsole console) - { - m_console = console; - m_console.Commands.AddCommand("userserver", false, "create user", - "create user [ [ [ [email]]]]", - "Create a new user account", RunCommand); - - m_console.Commands.AddCommand("userserver", false, "reset user password", - "reset user password [ [ []]]", - "Reset a user's password", RunCommand); - - m_console.Commands.AddCommand("userserver", false, "login level", - "login level ", - "Set the minimum user level to log in", HandleLoginCommand); - - m_console.Commands.AddCommand("userserver", false, "login reset", - "login reset", - "Reset the login level to allow all users", - HandleLoginCommand); - - m_console.Commands.AddCommand("userserver", false, "login text", - "login text ", - "Set the text users will see on login", HandleLoginCommand); - - m_console.Commands.AddCommand("userserver", false, "test-inventory", - "test-inventory", - "Perform a test inventory transaction", RunCommand); - - m_console.Commands.AddCommand("userserver", false, "logoff-user", - "logoff-user ", - "Log off a named user", RunCommand); - } - - #region Console Command Handlers - public void do_create(string[] args) - { - switch (args[0]) - { - case "user": - CreateUser(args); - break; - } - } - - /// - /// Execute switch for some of the reset commands - /// - /// - protected void Reset(string[] args) - { - if (args.Length == 0) - return; - - switch (args[0]) - { - case "user": - - switch (args[1]) - { - case "password": - ResetUserPassword(args); - break; - } - - break; - } - } - - /// - /// Create a new user - /// - /// string array with parameters: firstname, lastname, password, locationX, locationY, email - protected void CreateUser(string[] cmdparams) - { - string firstName; - string lastName; - string password; - string email; - uint regX = 1000; - uint regY = 1000; - - if (cmdparams.Length < 2) - firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); - else firstName = cmdparams[1]; - - if (cmdparams.Length < 3) - lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); - else lastName = cmdparams[2]; - - if (cmdparams.Length < 4) - password = MainConsole.Instance.PasswdPrompt("Password"); - else password = cmdparams[3]; - - if (cmdparams.Length < 5) - regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString())); - else regX = Convert.ToUInt32(cmdparams[4]); - - if (cmdparams.Length < 6) - regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString())); - else regY = Convert.ToUInt32(cmdparams[5]); - - if (cmdparams.Length < 7) - email = MainConsole.Instance.CmdPrompt("Email", ""); - else email = cmdparams[6]; - - if (null == m_userDataBaseService.GetUserProfile(firstName, lastName)) - { - m_lastCreatedUser = m_userDataBaseService.AddUser(firstName, lastName, password, email, regX, regY); - } - else - { - m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", firstName, lastName); - } - } - - /// - /// Reset a user password. - /// - /// - private void ResetUserPassword(string[] cmdparams) - { - string firstName; - string lastName; - string newPassword; - - if (cmdparams.Length < 3) - firstName = MainConsole.Instance.CmdPrompt("First name"); - else firstName = cmdparams[2]; - - if (cmdparams.Length < 4) - lastName = MainConsole.Instance.CmdPrompt("Last name"); - else lastName = cmdparams[3]; - - if (cmdparams.Length < 5) - newPassword = MainConsole.Instance.PasswdPrompt("New password"); - else newPassword = cmdparams[4]; - - m_userDataBaseService.ResetUserPassword(firstName, lastName, newPassword); - } - - /* - private void HandleTestCommand(string module, string[] cmd) - { - m_log.Info("test command received"); - } - */ - - private void HandleLoginCommand(string module, string[] cmd) - { - string subcommand = cmd[1]; - - switch (subcommand) - { - case "level": - // Set the minimal level to allow login - // Useful to allow grid update without worrying about users. - // or fixing critical issues - // - if (cmd.Length > 2) - { - int level = Convert.ToInt32(cmd[2]); - m_loginService.setloginlevel(level); - } - break; - case "reset": - m_loginService.setloginlevel(0); - break; - case "text": - if (cmd.Length > 2) - { - m_loginService.setwelcometext(cmd[2]); - } - break; - } - } - - public void RunCommand(string module, string[] cmd) - { - List args = new List(cmd); - string command = cmd[0]; - - args.RemoveAt(0); - - string[] cmdparams = args.ToArray(); - - switch (command) - { - case "create": - do_create(cmdparams); - break; - - case "reset": - Reset(cmdparams); - break; - - - case "test-inventory": - // RestObjectPosterResponse> requester = new RestObjectPosterResponse>(); - // requester.ReturnResponseVal = TestResponse; - // requester.BeginPostObject(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); - SynchronousRestObjectPoster.BeginPostObject>( - "POST", m_cfg.InventoryUrl + "RootFolders/", m_lastCreatedUser); - break; - - case "logoff-user": - if (cmdparams.Length >= 3) - { - string firstname = cmdparams[0]; - string lastname = cmdparams[1]; - string message = ""; - - for (int i = 2; i < cmdparams.Length; i++) - message += " " + cmdparams[i]; - - UserProfileData theUser = null; - try - { - theUser = m_loginService.GetTheUser(firstname, lastname); - } - catch (Exception) - { - m_log.Error("[LOGOFF]: Error getting user data from the database."); - } - - if (theUser != null) - { - if (theUser.CurrentAgent != null) - { - if (theUser.CurrentAgent.AgentOnline) - { - m_log.Info("[LOGOFF]: Logging off requested user!"); - m_loginService.LogOffUser(theUser, message); - - theUser.CurrentAgent.AgentOnline = false; - - m_loginService.CommitAgent(ref theUser); - } - else - { - m_log.Info( - "[LOGOFF]: User Doesn't appear to be online, sending the logoff message anyway."); - m_loginService.LogOffUser(theUser, message); - - theUser.CurrentAgent.AgentOnline = false; - - m_loginService.CommitAgent(ref theUser); - } - } - else - { - m_log.Error( - "[LOGOFF]: Unable to logoff-user. User doesn't have an agent record so I can't find the simulator to notify"); - } - } - else - { - m_log.Info("[LOGOFF]: User doesn't exist in the database"); - } - } - else - { - m_log.Error( - "[LOGOFF]: Invalid amount of parameters. logoff-user takes at least three. Firstname, Lastname, and message"); - } - - break; - } - } - } - #endregion -} diff --git a/OpenSim/Grid/UserServer/UserServerCommsManager.cs b/OpenSim/Grid/UserServer/UserServerCommsManager.cs deleted file mode 100644 index 7dc514c..0000000 --- a/OpenSim/Grid/UserServer/UserServerCommsManager.cs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 OpenSimulator 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 OpenSim.Framework.Communications; - -namespace OpenSim.Grid.UserServer -{ - public class UserServerCommsManager : CommunicationsManager - { - public UserServerCommsManager(IInterServiceInventoryServices interServiceInventoryService) - : base(null, null) - { - } - } -} diff --git a/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs b/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs deleted file mode 100644 index 0ad2f02..0000000 --- a/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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 OpenSimulator 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.IO; -using System.Reflection; -using log4net; -using log4net.Config; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Framework.Statistics; -using OpenSim.Grid.Communications.OGS1; -using OpenSim.Grid.Framework; -using OpenSim.Grid.UserServer.Modules; - -namespace OpenSim.Grid.UserServer -{ - //Do we actually need these event dispatchers? - //shouldn't the other modules just directly register event handlers to each other? - public class UserServerEventDispatchModule - { - protected UserManager m_userManager; - protected MessageServersConnector m_messagesService; - protected UserLoginService m_loginService; - - public UserServerEventDispatchModule(UserManager userManager, MessageServersConnector messagesService, UserLoginService loginService) - { - m_userManager = userManager; - m_messagesService = messagesService; - m_loginService = loginService; - } - - public void Initialise(IGridServiceCore core) - { - } - - public void PostInitialise() - { - m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation; - m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff; - - m_messagesService.OnAgentLocation += HandleAgentLocation; - m_messagesService.OnAgentLeaving += HandleAgentLeaving; - m_messagesService.OnRegionStartup += HandleRegionStartup; - m_messagesService.OnRegionShutdown += HandleRegionShutdown; - } - - public void RegisterHandlers(BaseHttpServer httpServer) - { - - } - - public void Close() - { - m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; - } - - #region Event Handlers - public void NotifyMessageServersUserLoggOff(UUID agentID) - { - m_messagesService.TellMessageServersAboutUserLogoff(agentID); - } - - public void NotifyMessageServersUserLoggedInToLocation(UUID agentID, UUID sessionID, UUID RegionID, - ulong regionhandle, float positionX, float positionY, - float positionZ, string firstname, string lastname) - { - m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX, - positionY, positionZ, firstname, lastname); - } - - public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle) - { - m_userManager.HandleAgentLocation(agentID, regionID, regionHandle); - } - - public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle) - { - m_userManager.HandleAgentLeaving(agentID, regionID, regionHandle); - } - - public void HandleRegionStartup(UUID regionID) - { - // This might seem strange, that we send this back to the - // server it came from. But there is method to the madness. - // There can be multiple user servers on the same database, - // and each can have multiple messaging servers. So, we send - // it to all known user servers, who send it to all known - // message servers. That way, we should be able to finally - // update presence to all regions and thereby all friends - // - m_userManager.HandleRegionStartup(regionID); - m_messagesService.TellMessageServersAboutRegionShutdown(regionID); - } - - public void HandleRegionShutdown(UUID regionID) - { - // This might seem strange, that we send this back to the - // server it came from. But there is method to the madness. - // There can be multiple user servers on the same database, - // and each can have multiple messaging servers. So, we send - // it to all known user servers, who send it to all known - // message servers. That way, we should be able to finally - // update presence to all regions and thereby all friends - // - m_userManager.HandleRegionShutdown(regionID); - m_messagesService.TellMessageServersAboutRegionShutdown(regionID); - } - #endregion - } -} diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 47d1b16..32df16d 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -10,6 +10,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Capabilities; +using OpenSim.Framework.Console; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; @@ -19,6 +20,7 @@ namespace OpenSim.Services.LLLoginService public class LLLoginService : ILoginService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static bool Initialized = false; private IUserAccountService m_UserAccountService; private IAuthenticationService m_AuthenticationService; @@ -33,6 +35,7 @@ namespace OpenSim.Services.LLLoginService private string m_DefaultRegionName; private string m_WelcomeMessage; private bool m_RequireInventory; + private int m_MinLoginLevel; public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService) { @@ -84,6 +87,12 @@ namespace OpenSim.Services.LLLoginService m_LibraryService = ServerUtils.LoadPlugin(libService, args); } + if (!Initialized) + { + Initialized = true; + RegisterCommands(); + } + m_log.DebugFormat("[LLOGIN SERVICE]: Starting..."); } @@ -107,6 +116,12 @@ namespace OpenSim.Services.LLLoginService return LLFailedLoginResponse.UserProblem; } + if (account.UserLevel < m_MinLoginLevel) + { + m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: login is blocked for user level {0}", account.UserLevel); + return LLFailedLoginResponse.LoginBlockedProblem; + } + // Authenticate this user if (!passwd.StartsWith("$1$")) passwd = "$1$" + Util.Md5Hash(passwd); @@ -379,5 +394,50 @@ namespace OpenSim.Services.LLLoginService return null; } + + #region Console Commands + private void RegisterCommands() + { + //MainConsole.Instance.Commands.AddCommand + MainConsole.Instance.Commands.AddCommand("loginservice", false, "login level", + "login level ", + "Set the minimum user level to log in", HandleLoginCommand); + + MainConsole.Instance.Commands.AddCommand("loginservice", false, "login reset", + "login reset", + "Reset the login level to allow all users", + HandleLoginCommand); + + MainConsole.Instance.Commands.AddCommand("loginservice", false, "login text", + "login text ", + "Set the text users will see on login", HandleLoginCommand); + + } + + private void HandleLoginCommand(string module, string[] cmd) + { + string subcommand = cmd[1]; + + switch (subcommand) + { + case "level": + // Set the minimum level to allow login + // Useful to allow grid update without worrying about users. + // or fixing critical issues + // + if (cmd.Length > 2) + Int32.TryParse(cmd[2], out m_MinLoginLevel); + break; + case "reset": + m_MinLoginLevel = 0; + break; + case "text": + if (cmd.Length > 2) + m_WelcomeMessage = cmd[2]; + break; + } + } } + + #endregion } diff --git a/prebuild.xml b/prebuild.xml index 2abb6fa..33af554 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -787,136 +787,6 @@ - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - @@ -1039,162 +909,6 @@ - - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - @@ -1462,6 +1176,7 @@ + -- cgit v1.1