aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r--OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs87
-rw-r--r--OpenSim/Grid/Framework/IGridServiceCore.cs40
-rw-r--r--OpenSim/Grid/Framework/IGridServiceModule.cs40
-rw-r--r--OpenSim/Grid/Framework/IInterServiceUserService.cs35
-rw-r--r--OpenSim/Grid/Framework/IMessageRegionLookup.cs38
-rw-r--r--OpenSim/Grid/Framework/IMessagingServerDiscovery.cs40
-rw-r--r--OpenSim/Grid/Framework/XMPPHTTPService.cs110
-rw-r--r--OpenSim/Grid/GridServer.Modules/GridDBService.cs284
-rw-r--r--OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs164
-rw-r--r--OpenSim/Grid/GridServer.Modules/GridRestModule.cs282
-rw-r--r--OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs176
-rw-r--r--OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs900
-rw-r--r--OpenSim/Grid/GridServer.Modules/Resources/GridServer.Modules.addin.xml11
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs170
-rw-r--r--OpenSim/Grid/GridServer/IGridPlugin.cs49
-rw-r--r--OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs63
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager.mds16
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager.userprefs39
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager.usertasks2
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/AssemblyInfo.cs59
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs60
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServer.cs39
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs54
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs146
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs132
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/MainWindow.cs106
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/RegionBlock.cs62
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs160
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs242
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs250
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/generated.cs62
-rw-r--r--OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/gui.stetic502
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/InterMessageUserServerModule.cs187
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs200
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/MessageService.cs503
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs96
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs135
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/PresenceService.cs33
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs75
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/UserPresenceData.cs50
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/WorkUnitBase.cs33
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/WorkUnitPresenceUpdate.cs33
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs293
-rw-r--r--OpenSim/Grid/UserServer.Config/AssemblyInfo.cs56
-rw-r--r--OpenSim/Grid/UserServer.Config/DbUserConfig.cs106
-rw-r--r--OpenSim/Grid/UserServer.Modules/AvatarCreationModule.cs550
-rw-r--r--OpenSim/Grid/UserServer.Modules/GridInfoServiceModule.cs79
-rw-r--r--OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs514
-rw-r--r--OpenSim/Grid/UserServer.Modules/OpenIdService.cs338
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs100
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs225
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserLoginService.cs423
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserManager.cs718
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs132
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs176
-rw-r--r--OpenSim/Grid/UserServer/Main.cs330
-rw-r--r--OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs63
-rw-r--r--OpenSim/Grid/UserServer/UserServerCommandModule.cs375
-rw-r--r--OpenSim/Grid/UserServer/UserServerCommsManager.cs40
-rw-r--r--OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs142
60 files changed, 0 insertions, 10425 deletions
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Framework.Communications;
33using OpenSim.Framework.Servers.HttpServer;
34
35namespace OpenSim.Grid.Communications.OGS1
36{
37 /// <summary>
38 /// OGS1 implementation of the inter-service inventory service
39 /// </summary>
40 public class OGS1InterServiceInventoryService : IInterServiceInventoryServices
41 {
42 protected Uri m_inventoryServerUrl;
43
44 public OGS1InterServiceInventoryService(Uri inventoryServerUrl)
45 {
46 m_inventoryServerUrl = inventoryServerUrl;
47 }
48
49 /// <summary>
50 /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
51 /// </summary>
52 /// <param name="userId"></param>
53 /// <returns></returns>
54 public bool CreateNewUserInventory(UUID userId)
55 {
56 return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
57 "POST", m_inventoryServerUrl + "CreateInventory/", userId.Guid);
58 }
59
60 /// <summary>
61 /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
62 /// </summary>
63 /// <param name="userId"></param>
64 /// <returns></returns>
65 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
66 {
67 return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
68 "POST", m_inventoryServerUrl + "RootFolders/", userId.Guid);
69 }
70
71 /// <summary>
72 /// Returns a list of all the active gestures in a user's inventory.
73 /// </summary>
74 /// <param name="userId">
75 /// The <see cref="UUID"/> of the user
76 /// </param>
77 /// <returns>
78 /// A flat list of the gesture items.
79 /// </returns>
80 public List<InventoryItemBase> GetActiveGestures(UUID userId)
81 {
82 return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryItemBase>>(
83 "POST", m_inventoryServerUrl + "ActiveGestures/", userId.Guid);
84 }
85
86 }
87}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenSim.Framework.Servers.HttpServer;
30
31namespace OpenSim.Grid.Framework
32{
33 public interface IGridServiceCore
34 {
35 T Get<T>();
36 void RegisterInterface<T>(T iface);
37 bool TryGet<T>(out T iface);
38 BaseHttpServer GetHttpServer();
39 }
40}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenSim.Framework.Servers.HttpServer;
30
31namespace OpenSim.Grid.Framework
32{
33 public interface IGridServiceModule
34 {
35 void Close();
36 void Initialise(IGridServiceCore core);
37 void PostInitialise();
38 void RegisterHandlers(BaseHttpServer httpServer);
39 }
40}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29namespace OpenSim.Grid.Framework
30{
31 public interface IInterServiceUserService
32 {
33 bool SendToUserServer(System.Collections.Hashtable request, string method);
34 }
35}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenSim.Data;
30
31namespace OpenSim.Grid.Framework
32{
33 public interface IMessageRegionLookup
34 {
35 int ClearRegionCache();
36 RegionProfileData GetRegionInfo(ulong regionhandle);
37 }
38}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenSim.Framework.Servers;
31
32namespace OpenSim.Grid.Framework
33{
34 public interface IMessagingServerDiscovery
35 {
36 List<MessageServerInfo> GetMessageServersList();
37 void RegisterMessageServer(MessageServerInfo m);
38 void DeRegisterMessageServer(MessageServerInfo m);
39 }
40}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.IO;
30using System.Reflection;
31using log4net;
32using OpenMetaverse;
33using OpenSim.Framework.Servers.HttpServer;
34
35namespace OpenSim.Grid.Framework
36{
37 public class XMPPHTTPStreamHandler : BaseStreamHandler
38 {
39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40
41
42 /// <summary>
43 /// Constructor.
44 /// </summary>
45 /// <param name="assetManager"></param>
46 /// <param name="assetProvider"></param>
47 public XMPPHTTPStreamHandler()
48 : base("GET", "/presence")
49 {
50 m_log.Info("[REST]: In Get Request");
51
52 }
53
54 public override byte[] Handle(string path, Stream request,
55 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
56 {
57 string param = GetParam(path);
58 byte[] result = new byte[] {};
59 try
60 {
61 string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
62
63 if (p.Length > 0)
64 {
65 UUID assetID = UUID.Zero;
66
67 if (!UUID.TryParse(p[0], out assetID))
68 {
69 m_log.InfoFormat(
70 "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]);
71 return result;
72 }
73
74 }
75 }
76 catch (Exception e)
77 {
78 m_log.Error(e.ToString());
79 }
80 return result;
81 }
82 }
83
84 public class PostXMPPStreamHandler : BaseStreamHandler
85 {
86 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
87
88 public override byte[] Handle(string path, Stream request,
89 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
90 {
91 string param = GetParam(path);
92
93 UUID assetId;
94 if (param.Length > 0)
95 UUID.TryParse(param, out assetId);
96 // byte[] txBuffer = new byte[4096];
97
98 // TODO: Read POST serialize XMPP stanzas
99
100 return new byte[] {};
101 }
102
103 public PostXMPPStreamHandler()
104 : base("POST", "/presence")
105 {
106
107 }
108
109 }
110}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.IO;
32using System.Reflection;
33using System.Xml;
34using log4net;
35using Nwc.XmlRpc;
36using OpenMetaverse;
37using OpenSim.Data;
38using OpenSim.Framework;
39using OpenSim.Framework.Communications;
40using OpenSim.Framework.Servers;
41
42
43namespace OpenSim.Grid.GridServer.Modules
44{
45 public class GridDBService : IRegionProfileService
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 private List<IGridDataPlugin> _plugins = new List<IGridDataPlugin>();
50 private List<ILogDataPlugin> _logplugins = new List<ILogDataPlugin>();
51
52 /// <summary>
53 /// Adds a list of grid and log data plugins, as described by
54 /// `provider' and `connect', to `_plugins' and `_logplugins',
55 /// respectively.
56 /// </summary>
57 /// <param name="provider">
58 /// The filename of the inventory server plugin DLL.
59 /// </param>
60 /// <param name="connect">
61 /// The connection string for the storage backend.
62 /// </param>
63 public void AddPlugin(string provider, string connect)
64 {
65 _plugins = DataPluginFactory.LoadDataPlugins<IGridDataPlugin>(provider, connect);
66 _logplugins = DataPluginFactory.LoadDataPlugins<ILogDataPlugin>(provider, connect);
67 }
68
69 public int GetNumberOfPlugins()
70 {
71 return _plugins.Count;
72 }
73
74 /// <summary>
75 /// Logs a piece of information to the database
76 /// </summary>
77 /// <param name="target">What you were operating on (in grid server, this will likely be the region UUIDs)</param>
78 /// <param name="method">Which method is being called?</param>
79 /// <param name="args">What arguments are being passed?</param>
80 /// <param name="priority">How high priority is this? 1 = Max, 6 = Verbose</param>
81 /// <param name="message">The message to log</param>
82 private void logToDB(string target, string method, string args, int priority, string message)
83 {
84 foreach (ILogDataPlugin plugin in _logplugins)
85 {
86 try
87 {
88 plugin.saveLog("Gridserver", target, method, args, priority, message);
89 }
90 catch (Exception)
91 {
92 m_log.Warn("[storage]: Unable to write log via " + plugin.Name);
93 }
94 }
95 }
96
97 /// <summary>
98 /// Returns a region by argument
99 /// </summary>
100 /// <param name="uuid">A UUID key of the region to return</param>
101 /// <returns>A SimProfileData for the region</returns>
102 public RegionProfileData GetRegion(UUID uuid)
103 {
104 foreach (IGridDataPlugin plugin in _plugins)
105 {
106 try
107 {
108 return plugin.GetProfileByUUID(uuid);
109 }
110 catch (Exception e)
111 {
112 m_log.Warn("[storage]: GetRegion - " + e.Message);
113 }
114 }
115 return null;
116 }
117
118 /// <summary>
119 /// Returns a region by argument
120 /// </summary>
121 /// <param name="uuid">A regionHandle of the region to return</param>
122 /// <returns>A SimProfileData for the region</returns>
123 public RegionProfileData GetRegion(ulong handle)
124 {
125 foreach (IGridDataPlugin plugin in _plugins)
126 {
127 try
128 {
129 return plugin.GetProfileByHandle(handle);
130 }
131 catch (Exception ex)
132 {
133 m_log.Debug("[storage]: " + ex.Message);
134 m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + plugin.Name);
135 }
136 }
137 return null;
138 }
139
140 /// <summary>
141 /// Returns a region by argument
142 /// </summary>
143 /// <param name="regionName">A partial regionName of the region to return</param>
144 /// <returns>A SimProfileData for the region</returns>
145 public RegionProfileData GetRegion(string regionName)
146 {
147 foreach (IGridDataPlugin plugin in _plugins)
148 {
149 try
150 {
151 return plugin.GetProfileByString(regionName);
152 }
153 catch
154 {
155 m_log.Warn("[storage]: Unable to find region " + regionName + " via " + plugin.Name);
156 }
157 }
158 return null;
159 }
160
161 public List<RegionProfileData> GetRegions(uint xmin, uint ymin, uint xmax, uint ymax)
162 {
163 List<RegionProfileData> regions = new List<RegionProfileData>();
164
165 foreach (IGridDataPlugin plugin in _plugins)
166 {
167 try
168 {
169 regions.AddRange(plugin.GetProfilesInRange(xmin, ymin, xmax, ymax));
170 }
171 catch
172 {
173 m_log.Warn("[storage]: Unable to query regionblock via " + plugin.Name);
174 }
175 }
176
177 return regions;
178 }
179
180 public List<RegionProfileData> GetRegions(string name, int maxNum)
181 {
182 List<RegionProfileData> regions = new List<RegionProfileData>();
183 foreach (IGridDataPlugin plugin in _plugins)
184 {
185 try
186 {
187 int num = maxNum - regions.Count;
188 List<RegionProfileData> profiles = plugin.GetRegionsByName(name, (uint)num);
189 if (profiles != null) regions.AddRange(profiles);
190 }
191 catch
192 {
193 m_log.Warn("[storage]: Unable to query regionblock via " + plugin.Name);
194 }
195 }
196
197 return regions;
198 }
199
200 public DataResponse AddUpdateRegion(RegionProfileData sim, RegionProfileData existingSim)
201 {
202 DataResponse insertResponse = DataResponse.RESPONSE_ERROR;
203 foreach (IGridDataPlugin plugin in _plugins)
204 {
205 try
206 {
207 if (existingSim == null)
208 {
209 insertResponse = plugin.StoreProfile(sim);
210 }
211 else
212 {
213 insertResponse = plugin.StoreProfile(sim);
214 }
215 }
216 catch (Exception e)
217 {
218 m_log.Warn("[LOGIN END]: " +
219 "Unable to login region " + sim.ToString() + " via " + plugin.Name);
220 m_log.Warn("[LOGIN END]: " + e.ToString());
221 }
222 }
223 return insertResponse;
224 }
225
226 public DataResponse DeleteRegion(string uuid)
227 {
228 DataResponse insertResponse = DataResponse.RESPONSE_ERROR;
229 foreach (IGridDataPlugin plugin in _plugins)
230 {
231 //OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData();
232 try
233 {
234 //Nice are we not using multiple databases?
235 //MySQLGridData mysqldata = (MySQLGridData)(plugin);
236
237 //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim);
238 insertResponse = plugin.DeleteProfile(uuid);
239 }
240 catch (Exception)
241 {
242 m_log.Error("storage Unable to delete region " + uuid + " via " + plugin.Name);
243 //MainLog.Instance.Warn("storage", e.ToString());
244 insertResponse = DataResponse.RESPONSE_ERROR;
245 }
246 }
247 return insertResponse;
248 }
249
250 public string CheckReservations(RegionProfileData theSim, XmlNode authkeynode)
251 {
252 foreach (IGridDataPlugin plugin in _plugins)
253 {
254 try
255 {
256 //Check reservations
257 ReservationData reserveData =
258 plugin.GetReservationAtPoint(theSim.regionLocX, theSim.regionLocY);
259 if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) ||
260 (reserveData == null && authkeynode.InnerText != theSim.regionRecvKey))
261 {
262 plugin.StoreProfile(theSim);
263 m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")");
264 logToDB(theSim.ToString(), "RestSetSimMethod", String.Empty, 5,
265 "Region successfully updated and connected to grid.");
266 }
267 else
268 {
269 m_log.Warn("[grid]: " +
270 "Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");
271 // Wanted: " + reserveData.gridRecvKey + ", Got: " + theSim.regionRecvKey + ".");
272 return "Unable to update region (RestSetSimMethod): Incorrect auth key.";
273 }
274 }
275 catch (Exception e)
276 {
277 m_log.Warn("[GRID]: GetRegionPlugin Handle " + plugin.Name + " unable to add new sim: " +
278 e.ToString());
279 }
280 }
281 return "OK";
282 }
283 }
284}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using System.Text;
34using Nwc.XmlRpc;
35using log4net;
36using OpenSim.Data;
37using OpenSim.Framework.Servers;
38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Framework;
40using OpenSim.Grid.Framework;
41
42namespace OpenSim.Grid.GridServer.Modules
43{
44 public class GridMessagingModule : IMessagingServerDiscovery
45 {
46 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 protected IRegionProfileService m_gridDBService;
49 protected IGridServiceCore m_gridCore;
50
51 protected GridConfig m_config;
52
53 /// <value>
54 /// Used to notify old regions as to which OpenSim version to upgrade to
55 /// </value>
56 //private string m_opensimVersion;
57
58 protected BaseHttpServer m_httpServer;
59
60 // This is here so that the grid server can hand out MessageServer settings to regions on registration
61 private List<MessageServerInfo> m_messageServers = new List<MessageServerInfo>();
62
63 public GridMessagingModule()
64 {
65 }
66
67 public void Initialise(string opensimVersion, IRegionProfileService gridDBService, IGridServiceCore gridCore, GridConfig config)
68 {
69 //m_opensimVersion = opensimVersion;
70 m_gridDBService = gridDBService;
71 m_gridCore = gridCore;
72 m_config = config;
73
74 m_gridCore.RegisterInterface<IMessagingServerDiscovery>(this);
75
76 RegisterHandlers();
77 }
78
79 public void PostInitialise()
80 {
81
82 }
83
84 public void RegisterHandlers()
85 {
86 //have these in separate method as some servers restart the http server and reregister all the handlers.
87 m_httpServer = m_gridCore.GetHttpServer();
88
89 // Message Server ---> Grid Server
90 m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer);
91 m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer);
92 }
93
94 public List<MessageServerInfo> GetMessageServersList()
95 {
96 lock (m_messageServers)
97 {
98 return new List<MessageServerInfo>(m_messageServers);
99 }
100 }
101
102 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request, IPEndPoint remoteClient)
103 {
104 XmlRpcResponse response = new XmlRpcResponse();
105 Hashtable requestData = (Hashtable)request.Params[0];
106 Hashtable responseData = new Hashtable();
107
108 if (requestData.Contains("uri"))
109 {
110 string URI = (string)requestData["URI"];
111 string sendkey = (string)requestData["sendkey"];
112 string recvkey = (string)requestData["recvkey"];
113 MessageServerInfo m = new MessageServerInfo();
114 m.URI = URI;
115 m.sendkey = sendkey;
116 m.recvkey = recvkey;
117 RegisterMessageServer(m);
118 responseData["responsestring"] = "TRUE";
119 response.Value = responseData;
120 }
121 return response;
122 }
123
124 public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request, IPEndPoint remoteClient)
125 {
126 XmlRpcResponse response = new XmlRpcResponse();
127 Hashtable requestData = (Hashtable)request.Params[0];
128 Hashtable responseData = new Hashtable();
129
130 if (requestData.Contains("uri"))
131 {
132 string URI = (string)requestData["uri"];
133 string sendkey = (string)requestData["sendkey"];
134 string recvkey = (string)requestData["recvkey"];
135 MessageServerInfo m = new MessageServerInfo();
136 m.URI = URI;
137 m.sendkey = sendkey;
138 m.recvkey = recvkey;
139 DeRegisterMessageServer(m);
140 responseData["responsestring"] = "TRUE";
141 response.Value = responseData;
142 }
143 return response;
144 }
145
146 public void RegisterMessageServer(MessageServerInfo m)
147 {
148 lock (m_messageServers)
149 {
150 if (!m_messageServers.Contains(m))
151 m_messageServers.Add(m);
152 }
153 }
154
155 public void DeRegisterMessageServer(MessageServerInfo m)
156 {
157 lock (m_messageServers)
158 {
159 if (m_messageServers.Contains(m))
160 m_messageServers.Remove(m);
161 }
162 }
163 }
164}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.IO;
32using System.Reflection;
33using System.Xml;
34using log4net;
35using OpenMetaverse;
36using OpenSim.Data;
37using OpenSim.Framework;
38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Grid.Framework;
41
42namespace OpenSim.Grid.GridServer.Modules
43{
44 public class GridRestModule
45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 private GridDBService m_gridDBService;
49 private IGridServiceCore m_gridCore;
50
51 protected GridConfig m_config;
52
53 /// <value>
54 /// Used to notify old regions as to which OpenSim version to upgrade to
55 /// </value>
56 //private string m_opensimVersion;
57
58 protected BaseHttpServer m_httpServer;
59
60 /// <summary>
61 /// Constructor
62 /// </summary>
63 /// <param name="opensimVersion">
64 /// Used to notify old regions as to which OpenSim version to upgrade to
65 /// </param>
66 public GridRestModule()
67 {
68 }
69
70 public void Initialise(string opensimVersion, GridDBService gridDBService, IGridServiceCore gridCore, GridConfig config)
71 {
72 //m_opensimVersion = opensimVersion;
73 m_gridDBService = gridDBService;
74 m_gridCore = gridCore;
75 m_config = config;
76 RegisterHandlers();
77 }
78
79 public void PostInitialise()
80 {
81
82 }
83
84 public void RegisterHandlers()
85 {
86 //have these in separate method as some servers restart the http server and reregister all the handlers.
87 m_httpServer = m_gridCore.GetHttpServer();
88
89 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", RestGetSimMethod));
90 m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", RestSetSimMethod));
91
92 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/regions/", RestGetRegionMethod));
93 m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", RestSetRegionMethod));
94 }
95
96 /// <summary>
97 /// Performs a REST Get Operation
98 /// </summary>
99 /// <param name="request"></param>
100 /// <param name="path"></param>
101 /// <param name="param"></param>
102 /// <param name="httpRequest">HTTP request header object</param>
103 /// <param name="httpResponse">HTTP response header object</param>
104 /// <returns></returns>
105 public string RestGetRegionMethod(string request, string path, string param,
106 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
107 {
108 return RestGetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse);
109 }
110
111 /// <summary>
112 /// Performs a REST Set Operation
113 /// </summary>
114 /// <param name="request"></param>
115 /// <param name="path"></param>
116 /// <param name="param"></param>
117 /// <param name="httpRequest">HTTP request header object</param>
118 /// <param name="httpResponse">HTTP response header object</param>
119 /// <returns></returns>
120 public string RestSetRegionMethod(string request, string path, string param,
121 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
122 {
123 return RestSetSimMethod(String.Empty, "/sims/", param, httpRequest, httpResponse);
124 }
125
126 /// <summary>
127 /// Returns information about a sim via a REST Request
128 /// </summary>
129 /// <param name="request"></param>
130 /// <param name="path"></param>
131 /// <param name="param">A string representing the sim's UUID</param>
132 /// <param name="httpRequest">HTTP request header object</param>
133 /// <param name="httpResponse">HTTP response header object</param>
134 /// <returns>Information about the sim in XML</returns>
135 public string RestGetSimMethod(string request, string path, string param,
136 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
137 {
138 string respstring = String.Empty;
139
140 RegionProfileData TheSim;
141
142 UUID UUID;
143 if (UUID.TryParse(param, out UUID))
144 {
145 TheSim = m_gridDBService.GetRegion(UUID);
146
147 if (!(TheSim == null))
148 {
149 respstring = "<Root>";
150 respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>";
151 respstring += "<sim>";
152 respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>";
153 respstring += "<regionname>" + TheSim.regionName + "</regionname>";
154 respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>";
155 respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>";
156 respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>";
157 respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>";
158 respstring += "<estate_id>1</estate_id>";
159 respstring += "</sim>";
160 respstring += "</Root>";
161 }
162 }
163 else
164 {
165 respstring = "<Root>";
166 respstring += "<error>Param must be a UUID</error>";
167 respstring += "</Root>";
168 }
169
170 return respstring;
171 }
172
173 /// <summary>
174 /// Creates or updates a sim via a REST Method Request
175 /// BROKEN with SQL Update
176 /// </summary>
177 /// <param name="request"></param>
178 /// <param name="path"></param>
179 /// <param name="param"></param>
180 /// <param name="httpRequest">HTTP request header object</param>
181 /// <param name="httpResponse">HTTP response header object</param>
182 /// <returns>"OK" or an error</returns>
183 public string RestSetSimMethod(string request, string path, string param,
184 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
185 {
186 m_log.Info("Processing region update via REST method");
187 RegionProfileData theSim;
188 theSim = m_gridDBService.GetRegion(new UUID(param));
189 if (theSim == null)
190 {
191 theSim = new RegionProfileData();
192 UUID UUID = new UUID(param);
193 theSim.UUID = UUID;
194 theSim.regionRecvKey = m_config.SimRecvKey;
195 }
196
197 XmlDocument doc = new XmlDocument();
198 doc.LoadXml(request);
199 XmlNode rootnode = doc.FirstChild;
200 XmlNode authkeynode = rootnode.ChildNodes[0];
201 if (authkeynode.Name != "authkey")
202 {
203 return "ERROR! bad XML - expected authkey tag";
204 }
205
206 XmlNode simnode = rootnode.ChildNodes[1];
207 if (simnode.Name != "sim")
208 {
209 return "ERROR! bad XML - expected sim tag";
210 }
211
212 //theSim.regionSendKey = Cfg;
213 theSim.regionRecvKey = m_config.SimRecvKey;
214 theSim.regionSendKey = m_config.SimSendKey;
215 theSim.regionSecret = m_config.SimRecvKey;
216 theSim.regionDataURI = String.Empty;
217 theSim.regionAssetURI = m_config.DefaultAssetServer;
218 theSim.regionAssetRecvKey = m_config.AssetRecvKey;
219 theSim.regionAssetSendKey = m_config.AssetSendKey;
220 theSim.regionUserURI = m_config.DefaultUserServer;
221 theSim.regionUserSendKey = m_config.UserSendKey;
222 theSim.regionUserRecvKey = m_config.UserRecvKey;
223
224 for (int i = 0; i < simnode.ChildNodes.Count; i++)
225 {
226 switch (simnode.ChildNodes[i].Name)
227 {
228 case "regionname":
229 theSim.regionName = simnode.ChildNodes[i].InnerText;
230 break;
231
232 case "sim_ip":
233 theSim.serverIP = simnode.ChildNodes[i].InnerText;
234 break;
235
236 case "sim_port":
237 theSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
238 break;
239
240 case "region_locx":
241 theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
242 theSim.regionHandle = Utils.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize));
243 break;
244
245 case "region_locy":
246 theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
247 theSim.regionHandle = Utils.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize));
248 break;
249 }
250 }
251
252 theSim.serverURI = "http://" + theSim.serverIP + ":" + theSim.serverPort + "/";
253 bool requirePublic = false;
254 bool requireValid = true;
255
256 if (requirePublic &&
257 (theSim.serverIP.StartsWith("172.16") || theSim.serverIP.StartsWith("192.168") ||
258 theSim.serverIP.StartsWith("10.") || theSim.serverIP.StartsWith("0.") ||
259 theSim.serverIP.StartsWith("255.")))
260 {
261 return "ERROR! Servers must register with public addresses.";
262 }
263
264 if (requireValid && (theSim.serverIP.StartsWith("0.") || theSim.serverIP.StartsWith("255.")))
265 {
266 return "ERROR! 0.*.*.* / 255.*.*.* Addresses are invalid, please check your server config and try again";
267 }
268
269 try
270 {
271 m_log.Info("[DATA]: " +
272 "Updating / adding via " + m_gridDBService.GetNumberOfPlugins() + " storage provider(s) registered.");
273
274 return m_gridDBService.CheckReservations(theSim, authkeynode);
275 }
276 catch (Exception e)
277 {
278 return "ERROR! Could not save to database! (" + e.ToString() + ")";
279 }
280 }
281 }
282}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using log4net;
33using OpenSim.Framework;
34using OpenSim.Framework.Console;
35using OpenSim.Grid.Framework;
36using OpenSim.Grid;
37
38namespace OpenSim.Grid.GridServer.Modules
39{
40 public class GridServerPlugin : IGridPlugin
41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
44 protected GridXmlRpcModule m_gridXmlRpcModule;
45 protected GridMessagingModule m_gridMessageModule;
46 protected GridRestModule m_gridRestModule;
47
48 protected GridDBService m_gridDBService;
49
50 protected string m_version;
51
52 protected GridConfig m_config;
53
54 protected IGridServiceCore m_core;
55
56 protected CommandConsole m_console;
57
58 #region IGridPlugin Members
59
60 public void Initialise(GridServerBase gridServer)
61 {
62 m_core = gridServer;
63 m_config = gridServer.Config;
64 m_version = gridServer.Version;
65 m_console = MainConsole.Instance;
66
67 AddConsoleCommands();
68
69 SetupGridServices();
70 }
71
72 public void PostInitialise()
73 {
74
75 }
76
77 #endregion
78
79 #region IPlugin Members
80
81 public string Version
82 {
83 get { return "0.0"; }
84 }
85
86 public string Name
87 {
88 get { return "GridServerPlugin"; }
89 }
90
91 public void Initialise()
92 {
93 }
94
95 #endregion
96
97 protected virtual void SetupGridServices()
98 {
99 // m_log.Info("[DATA]: Connecting to Storage Server");
100 m_gridDBService = new GridDBService();
101 m_gridDBService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
102
103 //Register the database access service so modules can fetch it
104 // RegisterInterface<GridDBService>(m_gridDBService);
105
106 m_gridMessageModule = new GridMessagingModule();
107 m_gridMessageModule.Initialise(m_version, m_gridDBService, m_core, m_config);
108
109 m_gridXmlRpcModule = new GridXmlRpcModule();
110 m_gridXmlRpcModule.Initialise(m_version, m_gridDBService, m_core, m_config);
111
112 m_gridRestModule = new GridRestModule();
113 m_gridRestModule.Initialise(m_version, m_gridDBService, m_core, m_config);
114
115 m_gridMessageModule.PostInitialise();
116 m_gridXmlRpcModule.PostInitialise();
117 m_gridRestModule.PostInitialise();
118 }
119
120 #region Console Command Handlers
121
122 protected virtual void AddConsoleCommands()
123 {
124 m_console.Commands.AddCommand("gridserver", false,
125 "enable registration",
126 "enable registration",
127 "Enable new regions to register", HandleRegistration);
128
129 m_console.Commands.AddCommand("gridserver", false,
130 "disable registration",
131 "disable registration",
132 "Disable registering new regions", HandleRegistration);
133
134 m_console.Commands.AddCommand("gridserver", false, "show status",
135 "show status",
136 "Show registration status", HandleShowStatus);
137 }
138
139 private void HandleRegistration(string module, string[] cmd)
140 {
141 switch (cmd[0])
142 {
143 case "enable":
144 m_config.AllowRegionRegistration = true;
145 m_log.Info("Region registration enabled");
146 break;
147 case "disable":
148 m_config.AllowRegionRegistration = false;
149 m_log.Info("Region registration disabled");
150 break;
151 }
152 }
153
154 private void HandleShowStatus(string module, string[] cmd)
155 {
156 if (m_config.AllowRegionRegistration)
157 {
158 m_log.Info("Region registration enabled.");
159 }
160 else
161 {
162 m_log.Info("Region registration disabled.");
163 }
164 }
165
166 #endregion
167
168 #region IDisposable Members
169
170 public void Dispose()
171 {
172 }
173
174 #endregion
175 }
176}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.IO;
32using System.Net;
33using System.Reflection;
34using System.Xml;
35using log4net;
36using Nwc.XmlRpc;
37using OpenMetaverse;
38using OpenSim.Data;
39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41using OpenSim.Framework.Servers;
42using OpenSim.Framework.Servers.HttpServer;
43using OpenSim.Grid.Framework;
44
45namespace OpenSim.Grid.GridServer.Modules
46{
47 public class GridXmlRpcModule
48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 private IRegionProfileService m_gridDBService;
52 private IGridServiceCore m_gridCore;
53
54 protected GridConfig m_config;
55
56 protected IMessagingServerDiscovery m_messagingServerMapper;
57 /// <value>
58 /// Used to notify old regions as to which OpenSim version to upgrade to
59 /// </value>
60 private string m_opensimVersion;
61
62 protected BaseHttpServer m_httpServer;
63
64 /// <summary>
65 /// Constructor
66 /// </summary>
67 /// <param name="opensimVersion">
68 /// Used to notify old regions as to which OpenSim version to upgrade to
69 /// </param>
70 public GridXmlRpcModule()
71 {
72 }
73
74 public void Initialise(string opensimVersion, IRegionProfileService gridDBService, IGridServiceCore gridCore, GridConfig config)
75 {
76 m_opensimVersion = opensimVersion;
77 m_gridDBService = gridDBService;
78 m_gridCore = gridCore;
79 m_config = config;
80 RegisterHandlers();
81 }
82
83 public void PostInitialise()
84 {
85 IMessagingServerDiscovery messagingModule;
86 if (m_gridCore.TryGet<IMessagingServerDiscovery>(out messagingModule))
87 {
88 m_messagingServerMapper = messagingModule;
89 }
90 }
91
92 public void RegisterHandlers()
93 {
94 //have these in separate method as some servers restart the http server and reregister all the handlers.
95 m_httpServer = m_gridCore.GetHttpServer();
96
97 m_httpServer.AddXmlRPCHandler("simulator_login", XmlRpcSimulatorLoginMethod);
98 m_httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod);
99 m_httpServer.AddXmlRPCHandler("simulator_after_region_moved", XmlRpcDeleteRegionMethod);
100 m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod);
101 m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod);
102 }
103
104 /// <summary>
105 /// Returns a XML String containing a list of the neighbouring regions
106 /// </summary>
107 /// <param name="reqhandle">The regionhandle for the center sim</param>
108 /// <returns>An XML string containing neighbour entities</returns>
109 public string GetXMLNeighbours(ulong reqhandle)
110 {
111 string response = String.Empty;
112 RegionProfileData central_region = m_gridDBService.GetRegion(reqhandle);
113 RegionProfileData neighbour;
114 for (int x = -1; x < 2; x++)
115 {
116 for (int y = -1; y < 2; y++)
117 {
118 if (
119 m_gridDBService.GetRegion(
120 Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize),
121 (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null)
122 {
123 neighbour =
124 m_gridDBService.GetRegion(
125 Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize),
126 (uint)(central_region.regionLocY + y) * Constants.RegionSize));
127
128 response += "<neighbour>";
129 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
130 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
131 response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>";
132 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>";
133 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>";
134 response += "</neighbour>";
135 }
136 }
137 }
138 return response;
139 }
140
141 /// <summary>
142 /// Checks that it's valid to replace the existing region data with new data
143 ///
144 /// Currently, this means ensure that the keys passed in by the new region
145 /// match those in the original region. (XXX Is this correct? Shouldn't we simply check
146 /// against the keys in the current configuration?)
147 /// </summary>
148 /// <param name="sim"></param>
149 /// <returns></returns>
150 protected virtual void ValidateOverwriteKeys(RegionProfileData sim, RegionProfileData existingSim)
151 {
152 if (!(existingSim.regionRecvKey == sim.regionRecvKey && existingSim.regionSendKey == sim.regionSendKey))
153 {
154 throw new LoginException(
155 String.Format(
156 "Authentication failed when trying to login existing region {0} at location {1} {2} currently occupied by {3}"
157 + " with the region's send key {4} (expected {5}) and the region's receive key {6} (expected {7})",
158 sim.regionName, sim.regionLocX, sim.regionLocY, existingSim.regionName,
159 sim.regionSendKey, existingSim.regionSendKey, sim.regionRecvKey, existingSim.regionRecvKey),
160 "The keys required to login your region did not match the grid server keys. Please check your grid send and receive keys.");
161 }
162 }
163
164 /// <summary>
165 /// Checks that the new region data is valid.
166 ///
167 /// Currently, this means checking that the keys passed in by the new region
168 /// match those in the grid server's configuration.
169 /// </summary>
170 ///
171 /// <param name="sim"></param>
172 /// <exception cref="LoginException">Thrown if region login failed</exception>
173 protected virtual void ValidateNewRegionKeys(RegionProfileData sim)
174 {
175 if (!(sim.regionRecvKey == m_config.SimSendKey && sim.regionSendKey == m_config.SimRecvKey))
176 {
177 throw new LoginException(
178 String.Format(
179 "Authentication failed when trying to login new region {0} at location {1} {2}"
180 + " with the region's send key {3} (expected {4}) and the region's receive key {5} (expected {6})",
181 sim.regionName, sim.regionLocX, sim.regionLocY,
182 sim.regionSendKey, m_config.SimRecvKey, sim.regionRecvKey, m_config.SimSendKey),
183 "The keys required to login your region did not match your existing region keys. Please check your grid send and receive keys.");
184 }
185 }
186
187 /// <summary>
188 /// Check that a region's http uri is externally contactable.
189 /// </summary>
190 /// <param name="sim"></param>
191 /// <exception cref="LoginException">Thrown if the region is not contactable</exception>
192 protected virtual void ValidateRegionContactable(RegionProfileData sim)
193 {
194 string regionStatusUrl = String.Format("{0}{1}", sim.httpServerURI, "simstatus/");
195 string regionStatusResponse;
196
197 RestClient rc = new RestClient(regionStatusUrl);
198 rc.RequestMethod = "GET";
199
200 m_log.DebugFormat("[LOGIN]: Contacting {0} for status of region {1}", regionStatusUrl, sim.regionName);
201
202 try
203 {
204 Stream rs = rc.Request();
205 StreamReader sr = new StreamReader(rs);
206 regionStatusResponse = sr.ReadToEnd();
207 sr.Close();
208 }
209 catch (Exception e)
210 {
211 throw new LoginException(
212 String.Format("Region status request to {0} failed", regionStatusUrl),
213 String.Format(
214 "The grid service could not contact the http url {0} at your region. Please make sure this url is reachable by the grid service",
215 regionStatusUrl),
216 e);
217 }
218
219 if (!regionStatusResponse.Equals("OK"))
220 {
221 throw new LoginException(
222 String.Format(
223 "Region {0} at {1} returned status response {2} rather than {3}",
224 sim.regionName, regionStatusUrl, regionStatusResponse, "OK"),
225 String.Format(
226 "When the grid service asked for the status of your region, it received the response {0} rather than {1}. Please check your status",
227 regionStatusResponse, "OK"));
228 }
229 }
230
231 /// <summary>
232 /// Construct an XMLRPC error response
233 /// </summary>
234 /// <param name="error"></param>
235 /// <returns></returns>
236 public static XmlRpcResponse ErrorResponse(string error)
237 {
238 XmlRpcResponse errorResponse = new XmlRpcResponse();
239 Hashtable errorResponseData = new Hashtable();
240 errorResponse.Value = errorResponseData;
241 errorResponseData["error"] = error;
242 return errorResponse;
243 }
244
245 /// <summary>
246 /// Performed when a region connects to the grid server initially.
247 /// </summary>
248 /// <param name="request">The XML RPC Request</param>
249 /// <returns>Startup parameters</returns>
250 public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request, IPEndPoint remoteClient)
251 {
252 RegionProfileData sim;
253 RegionProfileData existingSim;
254
255 Hashtable requestData = (Hashtable)request.Params[0];
256 UUID uuid;
257
258 if (!requestData.ContainsKey("UUID") || !UUID.TryParse((string)requestData["UUID"], out uuid))
259 {
260 m_log.Debug("[LOGIN PRELUDE]: Region connected without a UUID, sending back error response.");
261 return ErrorResponse("No UUID passed to grid server - unable to connect you");
262 }
263
264 try
265 {
266 sim = RegionFromRequest(requestData);
267 }
268 catch (FormatException e)
269 {
270 m_log.Debug("[LOGIN PRELUDE]: Invalid login parameters, sending back error response.");
271 return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString());
272 }
273
274 m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName);
275
276 if (!m_config.AllowRegionRegistration)
277 {
278 m_log.DebugFormat(
279 "[LOGIN END]: Disabled region registration blocked login request from simulator: {0}",
280 sim.regionName);
281
282 return ErrorResponse("This grid is currently not accepting region registrations.");
283 }
284
285 int majorInterfaceVersion = 0;
286 if (requestData.ContainsKey("major_interface_version"))
287 int.TryParse((string)requestData["major_interface_version"], out majorInterfaceVersion);
288
289 if (majorInterfaceVersion != VersionInfo.MajorInterfaceVersion)
290 {
291 return ErrorResponse(
292 String.Format(
293 "Your region service implements OGS1 interface version {0}"
294 + " but this grid requires that the region implement OGS1 interface version {1} to connect."
295 + " Try changing to OpenSimulator {2}",
296 majorInterfaceVersion, VersionInfo.MajorInterfaceVersion, m_opensimVersion));
297 }
298
299 existingSim = m_gridDBService.GetRegion(sim.regionHandle);
300
301 if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID)
302 {
303 try
304 {
305 if (existingSim == null)
306 {
307 ValidateNewRegionKeys(sim);
308 }
309 else
310 {
311 ValidateOverwriteKeys(sim, existingSim);
312 }
313
314 ValidateRegionContactable(sim);
315 }
316 catch (LoginException e)
317 {
318 string logMsg = e.Message;
319 if (e.InnerException != null)
320 logMsg += ", " + e.InnerException.Message;
321
322 m_log.WarnFormat("[LOGIN END]: {0}", logMsg);
323
324 return e.XmlRpcErrorResponse;
325 }
326
327 DataResponse insertResponse = m_gridDBService.AddUpdateRegion(sim, existingSim);
328
329 switch (insertResponse)
330 {
331 case DataResponse.RESPONSE_OK:
332 m_log.Info("[LOGIN END]: " + (existingSim == null ? "New" : "Existing") + " sim login successful: " + sim.regionName);
333 break;
334 case DataResponse.RESPONSE_ERROR:
335 m_log.Warn("[LOGIN END]: Sim login failed (Error): " + sim.regionName);
336 break;
337 case DataResponse.RESPONSE_INVALIDCREDENTIALS:
338 m_log.Warn("[LOGIN END]: " +
339 "Sim login failed (Invalid Credentials): " + sim.regionName);
340 break;
341 case DataResponse.RESPONSE_AUTHREQUIRED:
342 m_log.Warn("[LOGIN END]: " +
343 "Sim login failed (Authentication Required): " +
344 sim.regionName);
345 break;
346 }
347
348 XmlRpcResponse response = CreateLoginResponse(sim);
349
350 return response;
351 }
352 else
353 {
354 m_log.Warn("[LOGIN END]: Failed to login region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName);
355 return ErrorResponse("Another region already exists at that location. Please try another.");
356 }
357 }
358
359 /// <summary>
360 /// Construct a successful response to a simulator's login attempt.
361 /// </summary>
362 /// <param name="sim"></param>
363 /// <returns></returns>
364 private XmlRpcResponse CreateLoginResponse(RegionProfileData sim)
365 {
366 XmlRpcResponse response = new XmlRpcResponse();
367 Hashtable responseData = new Hashtable();
368 response.Value = responseData;
369
370 ArrayList SimNeighboursData = GetSimNeighboursData(sim);
371
372 responseData["UUID"] = sim.UUID.ToString();
373 responseData["region_locx"] = sim.regionLocX.ToString();
374 responseData["region_locy"] = sim.regionLocY.ToString();
375 responseData["regionname"] = sim.regionName;
376 responseData["estate_id"] = "1";
377 responseData["neighbours"] = SimNeighboursData;
378
379 responseData["sim_ip"] = sim.serverIP;
380 responseData["sim_port"] = sim.serverPort.ToString();
381 responseData["asset_url"] = sim.regionAssetURI;
382 responseData["asset_sendkey"] = sim.regionAssetSendKey;
383 responseData["asset_recvkey"] = sim.regionAssetRecvKey;
384 responseData["user_url"] = sim.regionUserURI;
385 responseData["user_sendkey"] = sim.regionUserSendKey;
386 responseData["user_recvkey"] = sim.regionUserRecvKey;
387 responseData["authkey"] = sim.regionSecret;
388
389 // New! If set, use as URL to local sim storage (ie http://remotehost/region.Yap)
390 responseData["data_uri"] = sim.regionDataURI;
391
392 responseData["allow_forceful_banlines"] = m_config.AllowForcefulBanlines;
393
394 // Instead of sending a multitude of message servers to the registering sim
395 // we should probably be sending a single one and parhaps it's backup
396 // that has responsibility over routing it's messages.
397
398 // The Sim won't be contacting us again about any of the message server stuff during it's time up.
399
400 responseData["messageserver_count"] = 0;
401
402 // IGridMessagingModule messagingModule;
403 // if (m_gridCore.TryGet<IGridMessagingModule>(out messagingModule))
404 //{
405 if (m_messagingServerMapper != null)
406 {
407 List<MessageServerInfo> messageServers = m_messagingServerMapper.GetMessageServersList();
408 responseData["messageserver_count"] = messageServers.Count;
409
410 for (int i = 0; i < messageServers.Count; i++)
411 {
412 responseData["messageserver_uri" + i] = messageServers[i].URI;
413 responseData["messageserver_sendkey" + i] = messageServers[i].sendkey;
414 responseData["messageserver_recvkey" + i] = messageServers[i].recvkey;
415 }
416 }
417 return response;
418 }
419
420 private ArrayList GetSimNeighboursData(RegionProfileData sim)
421 {
422 ArrayList SimNeighboursData = new ArrayList();
423
424 RegionProfileData neighbour;
425 Hashtable NeighbourBlock;
426
427 //First use the fast method. (not implemented in SQLLite)
428 List<RegionProfileData> neighbours = m_gridDBService.GetRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1, sim.regionLocY + 1);
429
430 if (neighbours.Count > 0)
431 {
432 foreach (RegionProfileData aSim in neighbours)
433 {
434 NeighbourBlock = new Hashtable();
435 NeighbourBlock["sim_ip"] = aSim.serverIP;
436 NeighbourBlock["sim_port"] = aSim.serverPort.ToString();
437 NeighbourBlock["region_locx"] = aSim.regionLocX.ToString();
438 NeighbourBlock["region_locy"] = aSim.regionLocY.ToString();
439 NeighbourBlock["UUID"] = aSim.ToString();
440 NeighbourBlock["regionHandle"] = aSim.regionHandle.ToString();
441
442 if (aSim.UUID != sim.UUID)
443 {
444 SimNeighboursData.Add(NeighbourBlock);
445 }
446 }
447 }
448 else
449 {
450 for (int x = -1; x < 2; x++)
451 {
452 for (int y = -1; y < 2; y++)
453 {
454 if (
455 m_gridDBService.GetRegion(
456 Utils.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize),
457 (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null)
458 {
459 neighbour =
460 m_gridDBService.GetRegion(
461 Utils.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize),
462 (uint)(sim.regionLocY + y) * Constants.RegionSize));
463
464 NeighbourBlock = new Hashtable();
465 NeighbourBlock["sim_ip"] = neighbour.serverIP;
466 NeighbourBlock["sim_port"] = neighbour.serverPort.ToString();
467 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString();
468 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString();
469 NeighbourBlock["UUID"] = neighbour.UUID.ToString();
470 NeighbourBlock["regionHandle"] = neighbour.regionHandle.ToString();
471
472 if (neighbour.UUID != sim.UUID) SimNeighboursData.Add(NeighbourBlock);
473 }
474 }
475 }
476 }
477 return SimNeighboursData;
478 }
479
480 /// <summary>
481 /// Loads the grid's own RegionProfileData object with data from the XMLRPC simulator_login request from a region
482 /// </summary>
483 /// <param name="requestData"></param>
484 /// <returns></returns>
485 private RegionProfileData RegionFromRequest(Hashtable requestData)
486 {
487 RegionProfileData sim;
488 sim = new RegionProfileData();
489
490 sim.UUID = new UUID((string)requestData["UUID"]);
491 sim.originUUID = new UUID((string)requestData["originUUID"]);
492
493 sim.regionRecvKey = String.Empty;
494 sim.regionSendKey = String.Empty;
495
496 if (requestData.ContainsKey("region_secret"))
497 {
498 string regionsecret = (string)requestData["region_secret"];
499 if (regionsecret.Length > 0)
500 sim.regionSecret = regionsecret;
501 else
502 sim.regionSecret = m_config.SimRecvKey;
503
504 }
505 else
506 {
507 sim.regionSecret = m_config.SimRecvKey;
508 }
509
510 sim.regionDataURI = String.Empty;
511 sim.regionAssetURI = m_config.DefaultAssetServer;
512 sim.regionAssetRecvKey = m_config.AssetRecvKey;
513 sim.regionAssetSendKey = m_config.AssetSendKey;
514 sim.regionUserURI = m_config.DefaultUserServer;
515 sim.regionUserSendKey = m_config.UserSendKey;
516 sim.regionUserRecvKey = m_config.UserRecvKey;
517
518 sim.serverIP = (string)requestData["sim_ip"];
519 sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
520 sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
521 sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
522 sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
523 sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
524 sim.regionLocZ = 0;
525
526 UUID textureID;
527 if (UUID.TryParse((string)requestData["map-image-id"], out textureID))
528 {
529 sim.regionMapTextureID = textureID;
530 }
531
532 // part of an initial brutish effort to provide accurate information (as per the xml region spec)
533 // wrt the ownership of a given region
534 // the (very bad) assumption is that this value is being read and handled inconsistently or
535 // not at all. Current strategy is to put the code in place to support the validity of this information
536 // and to roll forward debugging any issues from that point
537 //
538 // this particular section of the mod attempts to receive a value from the region's xml file by way of
539 // OSG1GridServices for the region's owner
540 sim.owner_uuid = (UUID)(string)requestData["master_avatar_uuid"];
541
542 try
543 {
544 sim.regionRecvKey = (string)requestData["recvkey"];
545 sim.regionSendKey = (string)requestData["authkey"];
546 }
547 catch (KeyNotFoundException) { }
548
549 sim.regionHandle = Utils.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize));
550 sim.serverURI = (string)requestData["server_uri"];
551
552 sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/";
553
554 sim.regionName = (string)requestData["sim_name"];
555
556
557 try
558 {
559
560 sim.maturity = Convert.ToUInt32((string)requestData["maturity"]);
561 }
562 catch (KeyNotFoundException)
563 {
564 //older region not providing this key - so default to Mature
565 sim.maturity = 1;
566 }
567
568 return sim;
569 }
570
571 /// <summary>
572 /// Returns an XML RPC response to a simulator profile request
573 /// Performed after moving a region.
574 /// </summary>
575 /// <param name="request"></param>
576 /// <returns></returns>
577 /// <param name="request">The XMLRPC Request</param>
578 /// <returns>Processing parameters</returns>
579 public XmlRpcResponse XmlRpcDeleteRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient)
580 {
581 XmlRpcResponse response = new XmlRpcResponse();
582 Hashtable responseData = new Hashtable();
583 response.Value = responseData;
584
585 //RegionProfileData TheSim = null;
586 string uuid;
587 Hashtable requestData = (Hashtable)request.Params[0];
588
589 if (requestData.ContainsKey("UUID"))
590 {
591 //TheSim = GetRegion(new UUID((string) requestData["UUID"]));
592 uuid = requestData["UUID"].ToString();
593 m_log.InfoFormat("[LOGOUT]: Logging out region: {0}", uuid);
594 // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID.");
595 }
596 else
597 {
598 responseData["error"] = "No UUID or region_handle passed to grid server - unable to delete";
599 return response;
600 }
601
602 DataResponse insertResponse = m_gridDBService.DeleteRegion(uuid);
603
604 string insertResp = "";
605 switch (insertResponse)
606 {
607 case DataResponse.RESPONSE_OK:
608 //MainLog.Instance.Verbose("grid", "Deleting region successful: " + uuid);
609 insertResp = "Deleting region successful: " + uuid;
610 break;
611 case DataResponse.RESPONSE_ERROR:
612 //MainLog.Instance.Warn("storage", "Deleting region failed (Error): " + uuid);
613 insertResp = "Deleting region failed (Error): " + uuid;
614 break;
615 case DataResponse.RESPONSE_INVALIDCREDENTIALS:
616 //MainLog.Instance.Warn("storage", "Deleting region failed (Invalid Credentials): " + uuid);
617 insertResp = "Deleting region (Invalid Credentials): " + uuid;
618 break;
619 case DataResponse.RESPONSE_AUTHREQUIRED:
620 //MainLog.Instance.Warn("storage", "Deleting region failed (Authentication Required): " + uuid);
621 insertResp = "Deleting region (Authentication Required): " + uuid;
622 break;
623 }
624
625 responseData["status"] = insertResp;
626
627 return response;
628 }
629
630 /// <summary>
631 /// Returns an XML RPC response to a simulator profile request
632 /// </summary>
633 /// <param name="request"></param>
634 /// <returns></returns>
635 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request, IPEndPoint remoteClient)
636 {
637 Hashtable requestData = (Hashtable)request.Params[0];
638 Hashtable responseData = new Hashtable();
639 RegionProfileData simData = null;
640 if (requestData.ContainsKey("region_UUID"))
641 {
642 UUID regionID = new UUID((string)requestData["region_UUID"]);
643 simData = m_gridDBService.GetRegion(regionID);
644 if (simData == null)
645 {
646 m_log.WarnFormat("[DATA] didn't find region for regionID {0} from {1}",
647 regionID, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
648 }
649 }
650 else if (requestData.ContainsKey("region_handle"))
651 {
652 //CFK: The if/else below this makes this message redundant.
653 //CFK: m_log.Info("requesting data for region " + (string) requestData["region_handle"]);
654 ulong regionHandle = Convert.ToUInt64((string)requestData["region_handle"]);
655 simData = m_gridDBService.GetRegion(regionHandle);
656 if (simData == null)
657 {
658 m_log.WarnFormat("[DATA] didn't find region for regionHandle {0} from {1}",
659 regionHandle, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
660 }
661 }
662 else if (requestData.ContainsKey("region_name_search"))
663 {
664 string regionName = (string)requestData["region_name_search"];
665 simData = m_gridDBService.GetRegion(regionName);
666 if (simData == null)
667 {
668 m_log.WarnFormat("[DATA] didn't find region for regionName {0} from {1}",
669 regionName, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
670 }
671 }
672 else m_log.Warn("[DATA] regionlookup without regionID, regionHandle or regionHame");
673
674 if (simData == null)
675 {
676 //Sim does not exist
677 responseData["error"] = "Sim does not exist";
678 }
679 else
680 {
681 m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " +
682 (string)requestData["region_handle"]);
683 responseData["sim_ip"] = simData.serverIP;
684 responseData["sim_port"] = simData.serverPort.ToString();
685 responseData["server_uri"] = simData.serverURI;
686 responseData["http_port"] = simData.httpPort.ToString();
687 responseData["remoting_port"] = simData.remotingPort.ToString();
688 responseData["region_locx"] = simData.regionLocX.ToString();
689 responseData["region_locy"] = simData.regionLocY.ToString();
690 responseData["region_UUID"] = simData.UUID.Guid.ToString();
691 responseData["region_name"] = simData.regionName;
692 responseData["regionHandle"] = simData.regionHandle.ToString();
693 }
694
695 XmlRpcResponse response = new XmlRpcResponse();
696 response.Value = responseData;
697 return response;
698 }
699
700 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request, IPEndPoint remoteClient)
701 {
702 int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020;
703
704 Hashtable requestData = (Hashtable)request.Params[0];
705 if (requestData.ContainsKey("xmin"))
706 {
707 xmin = (Int32)requestData["xmin"];
708 }
709 if (requestData.ContainsKey("ymin"))
710 {
711 ymin = (Int32)requestData["ymin"];
712 }
713 if (requestData.ContainsKey("xmax"))
714 {
715 xmax = (Int32)requestData["xmax"];
716 }
717 if (requestData.ContainsKey("ymax"))
718 {
719 ymax = (Int32)requestData["ymax"];
720 }
721 //CFK: The second log is more meaningful and either standard or fast generally occurs.
722 //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
723
724 XmlRpcResponse response = new XmlRpcResponse();
725 Hashtable responseData = new Hashtable();
726 response.Value = responseData;
727 IList simProfileList = new ArrayList();
728
729 bool fastMode = (m_config.DatabaseProvider == "OpenSim.Data.MySQL.dll" || m_config.DatabaseProvider == "OpenSim.Data.MSSQL.dll");
730
731 if (fastMode)
732 {
733 List<RegionProfileData> neighbours = m_gridDBService.GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
734
735 foreach (RegionProfileData aSim in neighbours)
736 {
737 Hashtable simProfileBlock = new Hashtable();
738 simProfileBlock["x"] = aSim.regionLocX.ToString();
739 simProfileBlock["y"] = aSim.regionLocY.ToString();
740 //m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.regionLocX, aSim.regionLocY);
741 simProfileBlock["name"] = aSim.regionName;
742 simProfileBlock["access"] = aSim.AccessLevel.ToString();
743 simProfileBlock["region-flags"] = 512;
744 simProfileBlock["water-height"] = 0;
745 simProfileBlock["agents"] = 1;
746 simProfileBlock["map-image-id"] = aSim.regionMapTextureID.ToString();
747
748 // For Sugilite compatibility
749 simProfileBlock["regionhandle"] = aSim.regionHandle.ToString();
750 simProfileBlock["sim_ip"] = aSim.serverIP;
751 simProfileBlock["sim_port"] = aSim.serverPort.ToString();
752 simProfileBlock["sim_uri"] = aSim.serverURI.ToString();
753 simProfileBlock["uuid"] = aSim.UUID.ToString();
754 simProfileBlock["remoting_port"] = aSim.remotingPort.ToString();
755 simProfileBlock["http_port"] = aSim.httpPort.ToString();
756
757 simProfileList.Add(simProfileBlock);
758 }
759 m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() +
760 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
761 }
762 else
763 {
764 RegionProfileData simProfile;
765 for (int x = xmin; x < xmax + 1; x++)
766 {
767 for (int y = ymin; y < ymax + 1; y++)
768 {
769 ulong regHandle = Utils.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize));
770 simProfile = m_gridDBService.GetRegion(regHandle);
771 if (simProfile != null)
772 {
773 Hashtable simProfileBlock = new Hashtable();
774 simProfileBlock["x"] = x;
775 simProfileBlock["y"] = y;
776 simProfileBlock["name"] = simProfile.regionName;
777 simProfileBlock["access"] = simProfile.AccessLevel.ToString();
778 simProfileBlock["region-flags"] = 0;
779 simProfileBlock["water-height"] = 20;
780 simProfileBlock["agents"] = 1;
781 simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString();
782
783 // For Sugilite compatibility
784 simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
785 simProfileBlock["sim_ip"] = simProfile.serverIP.ToString();
786 simProfileBlock["sim_port"] = simProfile.serverPort.ToString();
787 simProfileBlock["sim_uri"] = simProfile.serverURI.ToString();
788 simProfileBlock["uuid"] = simProfile.UUID.ToString();
789 simProfileBlock["remoting_port"] = simProfile.remotingPort.ToString();
790 simProfileBlock["http_port"] = simProfile.httpPort;
791
792 simProfileList.Add(simProfileBlock);
793 }
794 }
795 }
796 m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() +
797 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
798 }
799
800 responseData["sim-profiles"] = simProfileList;
801
802 return response;
803 }
804
805 /// <summary>
806 /// Returns up to <code>maxNumber</code> profiles of regions that have a name starting with <code>name</code>
807 /// </summary>
808 /// <param name="request"></param>
809 /// <returns></returns>
810 public XmlRpcResponse XmlRpcSearchForRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient)
811 {
812 Hashtable requestData = (Hashtable)request.Params[0];
813
814 if (!requestData.ContainsKey("name") || !requestData.Contains("maxNumber"))
815 {
816 m_log.Warn("[DATA] Invalid region-search request; missing name or maxNumber");
817 return new XmlRpcResponse(500, "Missing name or maxNumber in region search request");
818 }
819
820 Hashtable responseData = new Hashtable();
821
822 string name = (string)requestData["name"];
823 int maxNumber = Convert.ToInt32((string)requestData["maxNumber"]);
824 if (maxNumber == 0 || name.Length < 3)
825 {
826 // either we didn't want any, or we were too unspecific
827 responseData["numFound"] = 0;
828 }
829 else
830 {
831 List<RegionProfileData> sims = m_gridDBService.GetRegions(name, maxNumber);
832
833 responseData["numFound"] = sims.Count;
834 for (int i = 0; i < sims.Count; ++i)
835 {
836 RegionProfileData sim = sims[i];
837 string prefix = "region" + i + ".";
838 responseData[prefix + "region_name"] = sim.regionName;
839 responseData[prefix + "region_UUID"] = sim.UUID.ToString();
840 responseData[prefix + "region_locx"] = sim.regionLocX.ToString();
841 responseData[prefix + "region_locy"] = sim.regionLocY.ToString();
842 responseData[prefix + "sim_ip"] = sim.serverIP.ToString();
843 responseData[prefix + "sim_port"] = sim.serverPort.ToString();
844 responseData[prefix + "remoting_port"] = sim.remotingPort.ToString();
845 responseData[prefix + "http_port"] = sim.httpPort.ToString();
846 responseData[prefix + "map_UUID"] = sim.regionMapTextureID.ToString();
847 }
848 }
849
850 XmlRpcResponse response = new XmlRpcResponse();
851 response.Value = responseData;
852 return response;
853 }
854
855 /// <summary>
856 /// Construct an XMLRPC registration disabled response
857 /// </summary>
858 /// <param name="error"></param>
859 /// <returns></returns>
860 public static XmlRpcResponse XmlRPCRegionRegistrationDisabledResponse(string error)
861 {
862 XmlRpcResponse errorResponse = new XmlRpcResponse();
863 Hashtable errorResponseData = new Hashtable();
864 errorResponse.Value = errorResponseData;
865 errorResponseData["restricted"] = error;
866 return errorResponse;
867 }
868 }
869
870 /// <summary>
871 /// Exception generated when a simulator fails to login to the grid
872 /// </summary>
873 public class LoginException : Exception
874 {
875 /// <summary>
876 /// Return an XmlRpcResponse version of the exception message suitable for sending to a client
877 /// </summary>
878 /// <param name="message"></param>
879 /// <param name="xmlRpcMessage"></param>
880 public XmlRpcResponse XmlRpcErrorResponse
881 {
882 get { return m_xmlRpcErrorResponse; }
883 }
884 private XmlRpcResponse m_xmlRpcErrorResponse;
885
886 public LoginException(string message, string xmlRpcMessage)
887 : base(message)
888 {
889 // FIXME: Might be neater to refactor and put the method inside here
890 m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage);
891 }
892
893 public LoginException(string message, string xmlRpcMessage, Exception e)
894 : base(message, e)
895 {
896 // FIXME: Might be neater to refactor and put the method inside here
897 m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage);
898 }
899 }
900}
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 @@
1<Addin id="OpenSim.Grid.GridServer.Modules" version="0.1">
2 <Runtime>
3 <Import assembly="OpenSim.Grid.GridServer.Modules.dll"/>
4 </Runtime>
5 <Dependencies>
6 <Addin id="OpenSim.Grid.GridServer" version="0.5" />
7 </Dependencies>
8 <Extension path = "/OpenSim/GridServer">
9 <Plugin id="GridServerModules" type="OpenSim.Grid.GridServer.Modules.GridServerPlugin" />
10 </Extension>
11</Addin>
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using log4net;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Framework.Console;
36using OpenSim.Framework.Servers;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Grid.Framework;
39
40namespace OpenSim.Grid.GridServer
41{
42 /// <summary>
43 /// </summary>
44 public class GridServerBase : BaseOpenSimServer, IGridServiceCore
45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 protected GridConfig m_config;
49 public string m_consoleType = "local";
50 public IConfigSource m_configSource = null;
51 public string m_configFile = "GridServer_Config.xml";
52
53 public GridConfig Config
54 {
55 get { return m_config; }
56 }
57
58 public string Version
59 {
60 get { return m_version; }
61 }
62
63 protected List<IGridPlugin> m_plugins = new List<IGridPlugin>();
64
65 public void Work()
66 {
67 m_console.Output("Enter help for a list of commands\n");
68
69 while (true)
70 {
71 m_console.Prompt();
72 }
73 }
74
75 public GridServerBase()
76 {
77 }
78
79 protected override void StartupSpecific()
80 {
81 switch (m_consoleType)
82 {
83 case "rest":
84 m_console = new RemoteConsole("Grid");
85 break;
86 case "basic":
87 m_console = new CommandConsole("Grid");
88 break;
89 default:
90 m_console = new LocalConsole("Grid");
91 break;
92 }
93 MainConsole.Instance = m_console;
94 m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), m_configFile)));
95
96 m_log.Info("[GRID]: Starting HTTP process");
97 m_httpServer = new BaseHttpServer(m_config.HttpPort);
98 if (m_console is RemoteConsole)
99 {
100 RemoteConsole c = (RemoteConsole)m_console;
101 c.SetServer(m_httpServer);
102 IConfig netConfig = m_configSource.AddConfig("Network");
103 netConfig.Set("ConsoleUser", m_config.ConsoleUser);
104 netConfig.Set("ConsolePass", m_config.ConsolePass);
105 c.ReadConfig(m_configSource);
106 }
107
108 LoadPlugins();
109
110 m_httpServer.Start();
111
112 base.StartupSpecific();
113 }
114
115 protected virtual void LoadPlugins()
116 {
117 using (PluginLoader<IGridPlugin> loader = new PluginLoader<IGridPlugin>(new GridPluginInitialiser(this)))
118 {
119 loader.Load("/OpenSim/GridServer");
120 m_plugins = loader.Plugins;
121 }
122 }
123
124 public override void ShutdownSpecific()
125 {
126 foreach (IGridPlugin plugin in m_plugins) plugin.Dispose();
127 }
128
129 #region IServiceCore
130 protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
131
132 /// <summary>
133 /// Register an Module interface.
134 /// </summary>
135 /// <typeparam name="T"></typeparam>
136 /// <param name="iface"></param>
137 public void RegisterInterface<T>(T iface)
138 {
139 lock (m_moduleInterfaces)
140 {
141 if (!m_moduleInterfaces.ContainsKey(typeof(T)))
142 {
143 m_moduleInterfaces.Add(typeof(T), iface);
144 }
145 }
146 }
147
148 public bool TryGet<T>(out T iface)
149 {
150 if (m_moduleInterfaces.ContainsKey(typeof(T)))
151 {
152 iface = (T)m_moduleInterfaces[typeof(T)];
153 return true;
154 }
155 iface = default(T);
156 return false;
157 }
158
159 public T Get<T>()
160 {
161 return (T)m_moduleInterfaces[typeof(T)];
162 }
163
164 public BaseHttpServer GetHttpServer()
165 {
166 return m_httpServer;
167 }
168 #endregion
169 }
170}
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 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSimulator Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using OpenSim.Framework;
30
31namespace OpenSim.Grid.GridServer
32{
33 public interface IGridPlugin : IPlugin
34 {
35 void Initialise(GridServerBase gridServer);
36 void PostInitialise();
37 }
38
39 public class GridPluginInitialiser : PluginInitialiserBase
40 {
41 private GridServerBase server;
42 public GridPluginInitialiser (GridServerBase s) { server = s; }
43 public override void Initialise (IPlugin plugin)
44 {
45 IGridPlugin p = plugin as IGridPlugin;
46 p.Initialise (server);
47 }
48 }
49}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Runtime.InteropServices;
30
31// General information about an assembly is controlled through the following
32// set of attributes. Change these attribute values to modify the information
33// associated with an assembly.
34
35[assembly : AssemblyTitle("OGS-GridServer")]
36[assembly : AssemblyDescription("")]
37[assembly : AssemblyConfiguration("")]
38[assembly : AssemblyCompany("http://opensimulator.org")]
39[assembly : AssemblyProduct("OGS-GridServer")]
40[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47
48[assembly : ComVisible(false)]
49
50// The following GUID is for the ID of the typelib if this project is exposed to COM
51
52[assembly : Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
53
54// Version information for an assembly consists of the following four values:
55//
56// Major Version
57// Minor Version
58// Build Number
59// Revision
60//
61
62[assembly : AssemblyVersion("0.6.5.*")]
63[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 @@
1<Combine name="OpenGridServices.Manager" fileversion="2.0" outputpath="../../mono-1.2.3.1/lib/monodevelop/bin" MakePkgConfig="False" MakeLibPC="True">
2 <Configurations active="Debug">
3 <Configuration name="Debug" ctype="CombineConfiguration">
4 <Entry build="True" name="OpenGridServices.Manager" configuration="Debug" />
5 </Configuration>
6 <Configuration name="Release" ctype="CombineConfiguration">
7 <Entry build="True" name="OpenGridServices.Manager" configuration="Release" />
8 </Configuration>
9 </Configurations>
10 <StartMode startupentry="OpenGridServices.Manager" single="True">
11 <Execute type="None" entry="OpenGridServices.Manager" />
12 </StartMode>
13 <Entries>
14 <Entry filename="./OpenGridServices.Manager/OpenGridServices.Manager.mdp" />
15 </Entries>
16</Combine> \ 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 @@
1<?xml version="1.0"?>
2<UserCombinePreferences filename="/home/gareth/OpenGridServices.Manager/OpenGridServices.Manager.mds">
3 <Files>
4 <File filename="Welcome" />
5 <File filename="./OpenGridServices.Manager/MainWindow.cs" />
6 <File filename="./OpenGridServices.Manager/ConnectToGridServerDialog.cs" />
7 <File filename="./OpenGridServices.Manager/Main.cs" />
8 </Files>
9 <Views>
10 <ViewMemento Id="MonoDevelop.Ide.Gui.Pads.ProjectPad">
11 <TreeView>
12 <Node expanded="True">
13 <Node name="OpenGridServices.Manager" expanded="True">
14 <Node name="References" expanded="True" />
15 <Node name="Resources" expanded="True" />
16 <Node name="UserInterface" expanded="True" />
17 <Node name="ConnectToGridServerDialog.cs" expanded="False" selected="True" />
18 </Node>
19 </Node>
20 </TreeView>
21 </ViewMemento>
22 <ViewMemento Id="MonoDevelop.Ide.Gui.Pads.ClassPad">
23 <TreeView>
24 <Node expanded="True" />
25 </TreeView>
26 </ViewMemento>
27 <ViewMemento Id="MonoDevelop.NUnit.TestPad">
28 <TreeView>
29 <Node expanded="False" />
30 </TreeView>
31 </ViewMemento>
32 </Views>
33 <Properties>
34 <Properties>
35 <Property key="ActiveConfiguration" value="Debug" />
36 <Property key="ActiveWindow" value="/home/gareth/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs" />
37 </Properties>
38 </Properties>
39</UserCombinePreferences> \ 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 @@
1<?xml version="1.0" encoding="utf-8"?>
2<ArrayOfUserTask xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> \ 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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Runtime.CompilerServices;
30
31// Information about this assembly is defined by the following
32// attributes.
33//
34// change them to the information which is associated with the assembly
35// you compile.
36
37[assembly: AssemblyTitle("")]
38[assembly: AssemblyDescription("")]
39[assembly: AssemblyConfiguration("")]
40[assembly: AssemblyCompany("http://opensimulator.org")]
41[assembly: AssemblyProduct("")]
42[assembly: AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
43[assembly: AssemblyTrademark("")]
44[assembly: AssemblyCulture("")]
45
46// The assembly version has following format :
47//
48// Major.Minor.Build.Revision
49//
50// You can specify all values by your own or you can build default build and revision
51// numbers with the '*' character (the default):
52
53[assembly: AssemblyVersion("0.6.3.*")]
54
55// The following attributes specify the key for the sign of your assembly. See the
56// .NET Framework documentation for more information about signing.
57// This is not required, if you don't want signing let these attributes like they're.
58[assembly: AssemblyDelaySign(false)]
59[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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Threading;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenGridServices.Manager
34{
35 public class BlockingQueue<T>
36 {
37 private Queue<T> _queue = new Queue<T>();
38 private object _queueSync = new object();
39
40 public void Enqueue(T value)
41 {
42 lock (_queueSync)
43 {
44 _queue.Enqueue(value);
45 Monitor.Pulse(_queueSync);
46 }
47 }
48
49 public T Dequeue()
50 {
51 lock (_queueSync)
52 {
53 if (_queue.Count < 1)
54 Monitor.Wait(_queueSync);
55
56 return _queue.Dequeue();
57 }
58 }
59 }
60}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenGridServices.Manager
31{
32 public partial class Connect to grid server : Gtk.Dialog
33 {
34 public Connect to grid server()
35 {
36 this.Build();
37 }
38 }
39}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using Gtk;
29using System;
30
31namespace OpenGridServices.Manager
32{
33 public partial class ConnectToGridServerDialog : Gtk.Dialog
34 {
35 public ConnectToGridServerDialog()
36 {
37 this.Build();
38 }
39
40 protected virtual void OnResponse(object o, Gtk.ResponseArgs args)
41 {
42 switch (args.ResponseId)
43 {
44 case Gtk.ResponseType.Ok:
45 MainClass.PendingOperations.Enqueue("connect_to_gridserver " + this.entry1.Text + " " + this.entry2.Text + " " + this.entry3.Text);
46 break;
47
48 case Gtk.ResponseType.Cancel:
49 break;
50 }
51 this.Hide();
52 }
53 }
54}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using Nwc.XmlRpc;
29using System;
30using System.Net;
31using System.IO;
32using System.Xml;
33using System.Collections;
34using System.Collections.Generic;
35using libsecondlife;
36
37namespace OpenGridServices.Manager
38{
39 public class GridServerConnectionManager
40 {
41 private string ServerURL;
42 public LLUUID SessionID;
43 public bool connected=false;
44
45 public RegionBlock[][] WorldMap;
46
47 public bool Connect(string GridServerURL, string username, string password)
48 {
49 try
50 {
51 this.ServerURL=GridServerURL;
52 Hashtable LoginParamsHT = new Hashtable();
53 LoginParamsHT["username"]=username;
54 LoginParamsHT["password"]=password;
55 ArrayList LoginParams = new ArrayList();
56 LoginParams.Add(LoginParamsHT);
57 XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams);
58 XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000);
59 if (GridResp.IsFault)
60 {
61 connected=false;
62 return false;
63 }
64 else
65 {
66 Hashtable gridrespData = (Hashtable)GridResp.Value;
67 this.SessionID = new LLUUID((string)gridrespData["session_id"]);
68 connected=true;
69 return true;
70 }
71 }
72 catch(Exception e)
73 {
74 Console.WriteLine(e.ToString());
75 connected=false;
76 return false;
77 }
78 }
79
80 public void DownloadMap()
81 {
82 System.Net.WebClient mapdownloader = new WebClient();
83 Stream regionliststream = mapdownloader.OpenRead(ServerURL + "/regionlist");
84
85 RegionBlock TempRegionData;
86
87 XmlDocument doc = new XmlDocument();
88 doc.Load(regionliststream);
89 regionliststream.Close();
90 XmlNode rootnode = doc.FirstChild;
91 if (rootnode.Name != "regions")
92 {
93 // TODO - ERROR!
94 }
95
96 for (int i = 0; i <= rootnode.ChildNodes.Count; i++)
97 {
98 if (rootnode.ChildNodes.Item(i).Name != "region")
99 {
100 // TODO - ERROR!
101 }
102 else
103 {
104 TempRegionData = new RegionBlock();
105 }
106 }
107 }
108
109 public bool RestartServer()
110 {
111 return true;
112 }
113
114 public bool ShutdownServer()
115 {
116 try
117 {
118 Hashtable ShutdownParamsHT = new Hashtable();
119 ArrayList ShutdownParams = new ArrayList();
120 ShutdownParamsHT["session_id"]=this.SessionID.ToString();
121 ShutdownParams.Add(ShutdownParamsHT);
122 XmlRpcRequest GridShutdownReq = new XmlRpcRequest("shutdown",ShutdownParams);
123 XmlRpcResponse GridResp = GridShutdownReq.Send(this.ServerURL, 3000);
124 if (GridResp.IsFault)
125 {
126 return false;
127 }
128 else
129 {
130 connected=false;
131 return true;
132 }
133 }
134 catch(Exception e)
135 {
136 Console.WriteLine(e.ToString());
137 return false;
138 }
139 }
140
141 public void DisconnectServer()
142 {
143 this.connected=false;
144 }
145 }
146}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Threading;
30using Gtk;
31
32namespace OpenGridServices.Manager
33{
34 class MainClass
35 {
36
37 public static bool QuitReq=false;
38 public static BlockingQueue<string> PendingOperations = new BlockingQueue<string>();
39
40 private static Thread OperationsRunner;
41
42 private static GridServerConnectionManager gridserverConn;
43
44 private static MainWindow win;
45
46 public static void DoMainLoop()
47 {
48 while (!QuitReq)
49 {
50 Application.RunIteration();
51 }
52 }
53
54 public static void RunOperations()
55 {
56 string operation;
57 string cmd;
58 char[] sep = new char[1];
59 sep[0]=' ';
60 while (!QuitReq)
61 {
62 operation=PendingOperations.Dequeue();
63 Console.WriteLine(operation);
64 cmd = operation.Split(sep)[0];
65 switch (cmd)
66 {
67 case "connect_to_gridserver":
68 win.SetStatus("Connecting to grid server...");
69 if (gridserverConn.Connect(operation.Split(sep)[1], operation.Split(sep)[2], operation.Split(sep)[3]))
70 {
71 win.SetStatus("Connected OK with session ID:" + gridserverConn.SessionID);
72 win.SetGridServerConnected(true);
73 Thread.Sleep(3000);
74 win.SetStatus("Downloading region maps...");
75 gridserverConn.DownloadMap();
76 }
77 else
78 {
79 win.SetStatus("Could not connect");
80 }
81 break;
82
83 case "restart_gridserver":
84 win.SetStatus("Restarting grid server...");
85 if (gridserverConn.RestartServer())
86 {
87 win.SetStatus("Restarted server OK");
88 Thread.Sleep(3000);
89 win.SetStatus("");
90 }
91 else
92 {
93 win.SetStatus("Error restarting grid server!!!");
94 }
95 break;
96
97 case "shutdown_gridserver":
98 win.SetStatus("Shutting down grid server...");
99 if (gridserverConn.ShutdownServer())
100 {
101 win.SetStatus("Grid server shutdown");
102 win.SetGridServerConnected(false);
103 Thread.Sleep(3000);
104 win.SetStatus("");
105 }
106 else
107 {
108 win.SetStatus("Could not shutdown grid server!!!");
109 }
110 break;
111
112 case "disconnect_gridserver":
113 gridserverConn.DisconnectServer();
114 win.SetGridServerConnected(false);
115 break;
116 }
117 }
118 }
119
120 public static void Main (string[] args)
121 {
122 gridserverConn = new GridServerConnectionManager();
123 Application.Init ();
124 win = new MainWindow ();
125 win.Show ();
126 OperationsRunner = new Thread(new ThreadStart(RunOperations));
127 OperationsRunner.IsBackground=true;
128 OperationsRunner.Start();
129 DoMainLoop();
130 }
131 }
132}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using Gtk;
30
31namespace OpenGridServices.Manager
32{
33 public partial class MainWindow: Gtk.Window
34 {
35 public MainWindow() : base (Gtk.WindowType.Toplevel)
36 {
37 Build();
38 }
39
40 public void SetStatus(string statustext)
41 {
42 this.statusbar1.Pop(0);
43 this.statusbar1.Push(0, statustext);
44 }
45
46 public void DrawGrid(RegionBlock[][] regions)
47 {
48 for (int x=0; x<=regions.GetUpperBound(0); x++)
49 {
50 for (int y=0; y<=regions.GetUpperBound(1); y++)
51 {
52 Gdk.Image themap = new Gdk.Image(Gdk.ImageType.Fastest,Gdk.Visual.System,256,256);
53 this.drawingarea1.GdkWindow.DrawImage(new Gdk.GC(this.drawingarea1.GdkWindow),themap,0,0,x*256,y*256,256,256);
54 }
55 }
56 }
57
58 public void SetGridServerConnected(bool connected)
59 {
60 if (connected)
61 {
62 this.ConnectToGridserver.Visible=false;
63 this.DisconnectFromGridServer.Visible=true;
64 }
65 else
66 {
67 this.ConnectToGridserver.Visible=true;
68 this.DisconnectFromGridServer.Visible=false;
69 }
70 }
71
72 protected void OnDeleteEvent (object sender, DeleteEventArgs a)
73 {
74 Application.Quit ();
75 MainClass.QuitReq=true;
76 a.RetVal = true;
77 }
78
79 protected virtual void QuitMenu(object sender, System.EventArgs e)
80 {
81 MainClass.QuitReq=true;
82 Application.Quit();
83 }
84
85 protected virtual void ConnectToGridServerMenu(object sender, System.EventArgs e)
86 {
87 ConnectToGridServerDialog griddialog = new ConnectToGridServerDialog ();
88 griddialog.Show();
89 }
90
91 protected virtual void RestartGridserverMenu(object sender, System.EventArgs e)
92 {
93 MainClass.PendingOperations.Enqueue("restart_gridserver");
94 }
95
96 protected virtual void ShutdownGridserverMenu(object sender, System.EventArgs e)
97 {
98 MainClass.PendingOperations.Enqueue("shutdown_gridserver");
99 }
100
101 protected virtual void DisconnectGridServerMenu(object sender, System.EventArgs e)
102 {
103 MainClass.PendingOperations.Enqueue("disconnect_gridserver");
104 }
105 }
106}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Xml;
30using libsecondlife;
31using OpenSim.Framework.Utilities;
32
33namespace OpenGridServices.Manager
34{
35 public class RegionBlock
36 {
37 public uint regloc_x;
38 public uint regloc_y;
39
40 public string httpd_url;
41
42 public string region_name;
43
44 public ulong regionhandle {
45 get { return Util.UIntsToLong(regloc_x*256,regloc_y*256); }
46 }
47
48 public Gdk.Pixbuf MiniMap;
49
50 public RegionBlock()
51 {
52 }
53
54 public void LoadFromXmlNode(XmlNode sourcenode)
55 {
56 this.regloc_x=Convert.ToUInt32(sourcenode.Attributes.GetNamedItem("loc_x").Value);
57 this.regloc_y=Convert.ToUInt32(sourcenode.Attributes.GetNamedItem("loc_y").Value);
58 this.region_name=sourcenode.Attributes.GetNamedItem("region_name").Value;
59 this.httpd_url=sourcenode.Attributes.GetNamedItem("httpd_url").Value;
60 }
61 }
62}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32using libsecondlife.Packets;
33
34namespace OpenSim.Framework.Utilities
35{
36 public class Util
37 {
38 private static Random randomClass = new Random();
39 private static uint nextXferID = 5000;
40 private static object XferLock = new object();
41
42 public static ulong UIntsToLong(uint X, uint Y)
43 {
44 return Helpers.UIntsToLong(X, Y);
45 }
46
47 public static Random RandomClass
48 {
49 get
50 {
51 return randomClass;
52 }
53 }
54
55 public static uint GetNextXferID()
56 {
57 uint id = 0;
58 lock (XferLock)
59 {
60 id = nextXferID;
61 nextXferID++;
62 }
63 return id;
64 }
65
66 //public static int fast_distance2d(int x, int y)
67 //{
68 // x = System.Math.Abs(x);
69 // y = System.Math.Abs(y);
70
71 // int min = System.Math.Min(x, y);
72
73 // return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
74 //}
75
76 public static string FieldToString(byte[] bytes)
77 {
78 return FieldToString(bytes, String.Empty);
79 }
80
81 /// <summary>
82 /// Convert a variable length field (byte array) to a string, with a
83 /// field name prepended to each line of the output
84 /// </summary>
85 /// <remarks>If the byte array has unprintable characters in it, a
86 /// hex dump will be put in the string instead</remarks>
87 /// <param name="bytes">The byte array to convert to a string</param>
88 /// <param name="fieldName">A field name to prepend to each line of output</param>
89 /// <returns>An ASCII string or a string containing a hex dump, minus
90 /// the null terminator</returns>
91 public static string FieldToString(byte[] bytes, string fieldName)
92 {
93 // Check for a common case
94 if (bytes.Length == 0) return String.Empty;
95
96 StringBuilder output = new StringBuilder();
97 bool printable = true;
98
99 for (int i = 0; i < bytes.Length; ++i)
100 {
101 // Check if there are any unprintable characters in the array
102 if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09
103 && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00)
104 {
105 printable = false;
106 break;
107 }
108 }
109
110 if (printable)
111 {
112 if (fieldName.Length > 0)
113 {
114 output.Append(fieldName);
115 output.Append(": ");
116 }
117
118 if (bytes[bytes.Length - 1] == 0x00)
119 output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1));
120 else
121 output.Append(UTF8Encoding.UTF8.GetString(bytes));
122 }
123 else
124 {
125 for (int i = 0; i < bytes.Length; i += 16)
126 {
127 if (i != 0)
128 output.Append(Environment.NewLine);
129 if (fieldName.Length > 0)
130 {
131 output.Append(fieldName);
132 output.Append(": ");
133 }
134
135 for (int j = 0; j < 16; j++)
136 {
137 if ((i + j) < bytes.Length)
138 output.Append(String.Format("{0:X2} ", bytes[i + j]));
139 else
140 output.Append(" ");
141 }
142
143 for (int j = 0; j < 16 && (i + j) < bytes.Length; j++)
144 {
145 if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E)
146 output.Append((char)bytes[i + j]);
147 else
148 output.Append(".");
149 }
150 }
151 }
152
153 return output.ToString();
154 }
155
156 public Util()
157 {
158 }
159 }
160}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28// ------------------------------------------------------------------------------
29// <autogenerated>
30// This code was generated by a tool.
31// Mono Runtime Version: 2.0.50727.42
32//
33// Changes to this file may cause incorrect behavior and will be lost if
34// the code is regenerated.
35// </autogenerated>
36// ------------------------------------------------------------------------------
37
38namespace OpenGridServices.Manager
39{
40 public partial class ConnectToGridServerDialog
41 {
42 private Gtk.VBox vbox2;
43 private Gtk.VBox vbox3;
44 private Gtk.HBox hbox1;
45 private Gtk.Label label1;
46 private Gtk.Entry entry1;
47 private Gtk.HBox hbox2;
48 private Gtk.Label label2;
49 private Gtk.Entry entry2;
50 private Gtk.HBox hbox3;
51 private Gtk.Label label3;
52 private Gtk.Entry entry3;
53 private Gtk.Button button2;
54 private Gtk.Button button8;
55
56 protected virtual void Build()
57 {
58 Stetic.Gui.Initialize();
59 // Widget OpenGridServices.Manager.ConnectToGridServerDialog
60 this.Events = ((Gdk.EventMask)(256));
61 this.Name = "OpenGridServices.Manager.ConnectToGridServerDialog";
62 this.Title = Mono.Unix.Catalog.GetString("Connect to Grid server");
63 this.WindowPosition = ((Gtk.WindowPosition)(4));
64 this.HasSeparator = false;
65 // Internal child OpenGridServices.Manager.ConnectToGridServerDialog.VBox
66 Gtk.VBox w1 = this.VBox;
67 w1.Events = ((Gdk.EventMask)(256));
68 w1.Name = "dialog_VBox";
69 w1.BorderWidth = ((uint)(2));
70 // Container child dialog_VBox.Gtk.Box+BoxChild
71 this.vbox2 = new Gtk.VBox();
72 this.vbox2.Name = "vbox2";
73 // Container child vbox2.Gtk.Box+BoxChild
74 this.vbox3 = new Gtk.VBox();
75 this.vbox3.Name = "vbox3";
76 // Container child vbox3.Gtk.Box+BoxChild
77 this.hbox1 = new Gtk.HBox();
78 this.hbox1.Name = "hbox1";
79 // Container child hbox1.Gtk.Box+BoxChild
80 this.label1 = new Gtk.Label();
81 this.label1.Name = "label1";
82 this.label1.Xalign = 1F;
83 this.label1.LabelProp = Mono.Unix.Catalog.GetString("Grid server URL: ");
84 this.label1.Justify = ((Gtk.Justification)(1));
85 this.hbox1.Add(this.label1);
86 Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox1[this.label1]));
87 w2.Position = 0;
88 // Container child hbox1.Gtk.Box+BoxChild
89 this.entry1 = new Gtk.Entry();
90 this.entry1.CanFocus = true;
91 this.entry1.Name = "entry1";
92 this.entry1.Text = Mono.Unix.Catalog.GetString("http://gridserver:8001");
93 this.entry1.IsEditable = true;
94 this.entry1.MaxLength = 255;
95 this.entry1.InvisibleChar = '•';
96 this.hbox1.Add(this.entry1);
97 Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.hbox1[this.entry1]));
98 w3.Position = 1;
99 this.vbox3.Add(this.hbox1);
100 Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox1]));
101 w4.Position = 0;
102 w4.Expand = false;
103 w4.Fill = false;
104 // Container child vbox3.Gtk.Box+BoxChild
105 this.hbox2 = new Gtk.HBox();
106 this.hbox2.Name = "hbox2";
107 // Container child hbox2.Gtk.Box+BoxChild
108 this.label2 = new Gtk.Label();
109 this.label2.Name = "label2";
110 this.label2.Xalign = 1F;
111 this.label2.LabelProp = Mono.Unix.Catalog.GetString("Username:");
112 this.label2.Justify = ((Gtk.Justification)(1));
113 this.hbox2.Add(this.label2);
114 Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.hbox2[this.label2]));
115 w5.Position = 0;
116 // Container child hbox2.Gtk.Box+BoxChild
117 this.entry2 = new Gtk.Entry();
118 this.entry2.CanFocus = true;
119 this.entry2.Name = "entry2";
120 this.entry2.IsEditable = true;
121 this.entry2.InvisibleChar = '•';
122 this.hbox2.Add(this.entry2);
123 Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.hbox2[this.entry2]));
124 w6.Position = 1;
125 this.vbox3.Add(this.hbox2);
126 Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox2]));
127 w7.Position = 1;
128 w7.Expand = false;
129 w7.Fill = false;
130 // Container child vbox3.Gtk.Box+BoxChild
131 this.hbox3 = new Gtk.HBox();
132 this.hbox3.Name = "hbox3";
133 // Container child hbox3.Gtk.Box+BoxChild
134 this.label3 = new Gtk.Label();
135 this.label3.Name = "label3";
136 this.label3.Xalign = 1F;
137 this.label3.LabelProp = Mono.Unix.Catalog.GetString("Password:");
138 this.label3.Justify = ((Gtk.Justification)(1));
139 this.hbox3.Add(this.label3);
140 Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox3[this.label3]));
141 w8.Position = 0;
142 // Container child hbox3.Gtk.Box+BoxChild
143 this.entry3 = new Gtk.Entry();
144 this.entry3.CanFocus = true;
145 this.entry3.Name = "entry3";
146 this.entry3.IsEditable = true;
147 this.entry3.InvisibleChar = '•';
148 this.hbox3.Add(this.entry3);
149 Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.hbox3[this.entry3]));
150 w9.Position = 1;
151 this.vbox3.Add(this.hbox3);
152 Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox3]));
153 w10.Position = 2;
154 w10.Expand = false;
155 w10.Fill = false;
156 this.vbox2.Add(this.vbox3);
157 Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.vbox2[this.vbox3]));
158 w11.Position = 2;
159 w11.Expand = false;
160 w11.Fill = false;
161 w1.Add(this.vbox2);
162 Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(w1[this.vbox2]));
163 w12.Position = 0;
164 // Internal child OpenGridServices.Manager.ConnectToGridServerDialog.ActionArea
165 Gtk.HButtonBox w13 = this.ActionArea;
166 w13.Events = ((Gdk.EventMask)(256));
167 w13.Name = "OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea";
168 w13.Spacing = 6;
169 w13.BorderWidth = ((uint)(5));
170 w13.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
171 // Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild
172 this.button2 = new Gtk.Button();
173 this.button2.CanDefault = true;
174 this.button2.CanFocus = true;
175 this.button2.Name = "button2";
176 this.button2.UseUnderline = true;
177 // Container child button2.Gtk.Container+ContainerChild
178 Gtk.Alignment w14 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
179 w14.Name = "GtkAlignment";
180 // Container child GtkAlignment.Gtk.Container+ContainerChild
181 Gtk.HBox w15 = new Gtk.HBox();
182 w15.Name = "GtkHBox";
183 w15.Spacing = 2;
184 // Container child GtkHBox.Gtk.Container+ContainerChild
185 Gtk.Image w16 = new Gtk.Image();
186 w16.Name = "image1";
187 w16.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-apply", 16, 0);
188 w15.Add(w16);
189 // Container child GtkHBox.Gtk.Container+ContainerChild
190 Gtk.Label w18 = new Gtk.Label();
191 w18.Name = "GtkLabel";
192 w18.LabelProp = Mono.Unix.Catalog.GetString("Connect");
193 w18.UseUnderline = true;
194 w15.Add(w18);
195 w14.Add(w15);
196 this.button2.Add(w14);
197 this.AddActionWidget(this.button2, -5);
198 Gtk.ButtonBox.ButtonBoxChild w22 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.button2]));
199 w22.Expand = false;
200 w22.Fill = false;
201 // Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild
202 this.button8 = new Gtk.Button();
203 this.button8.CanDefault = true;
204 this.button8.CanFocus = true;
205 this.button8.Name = "button8";
206 this.button8.UseUnderline = true;
207 // Container child button8.Gtk.Container+ContainerChild
208 Gtk.Alignment w23 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
209 w23.Name = "GtkAlignment1";
210 // Container child GtkAlignment1.Gtk.Container+ContainerChild
211 Gtk.HBox w24 = new Gtk.HBox();
212 w24.Name = "GtkHBox1";
213 w24.Spacing = 2;
214 // Container child GtkHBox1.Gtk.Container+ContainerChild
215 Gtk.Image w25 = new Gtk.Image();
216 w25.Name = "image2";
217 w25.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-cancel", 16, 0);
218 w24.Add(w25);
219 // Container child GtkHBox1.Gtk.Container+ContainerChild
220 Gtk.Label w27 = new Gtk.Label();
221 w27.Name = "GtkLabel1";
222 w27.LabelProp = Mono.Unix.Catalog.GetString("Cancel");
223 w27.UseUnderline = true;
224 w24.Add(w27);
225 w23.Add(w24);
226 this.button8.Add(w23);
227 this.AddActionWidget(this.button8, -6);
228 Gtk.ButtonBox.ButtonBoxChild w31 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.button8]));
229 w31.Position = 1;
230 w31.Expand = false;
231 w31.Fill = false;
232 if (this.Child != null)
233 {
234 this.Child.ShowAll();
235 }
236 this.DefaultWidth = 476;
237 this.DefaultHeight = 137;
238 this.Show();
239 this.Response += new Gtk.ResponseHandler(this.OnResponse);
240 }
241 }
242}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28// ------------------------------------------------------------------------------
29// <autogenerated>
30// This code was generated by a tool.
31// Mono Runtime Version: 2.0.50727.42
32//
33// Changes to this file may cause incorrect behavior and will be lost if
34// the code is regenerated.
35// </autogenerated>
36// ------------------------------------------------------------------------------
37
38namespace OpenGridServices.Manager
39{
40 public partial class MainWindow
41 {
42 private Gtk.Action Grid;
43 private Gtk.Action User;
44 private Gtk.Action Asset;
45 private Gtk.Action Region;
46 private Gtk.Action Services;
47 private Gtk.Action ConnectToGridserver;
48 private Gtk.Action RestartWholeGrid;
49 private Gtk.Action ShutdownWholeGrid;
50 private Gtk.Action ExitGridManager;
51 private Gtk.Action ConnectToUserserver;
52 private Gtk.Action AccountManagment;
53 private Gtk.Action GlobalNotice;
54 private Gtk.Action DisableAllLogins;
55 private Gtk.Action DisableNonGodUsersOnly;
56 private Gtk.Action ShutdownUserServer;
57 private Gtk.Action ShutdownGridserverOnly;
58 private Gtk.Action RestartGridserverOnly;
59 private Gtk.Action DefaultLocalGridUserserver;
60 private Gtk.Action CustomUserserver;
61 private Gtk.Action RemoteGridDefaultUserserver;
62 private Gtk.Action DisconnectFromGridServer;
63 private Gtk.Action UploadAsset;
64 private Gtk.Action AssetManagement;
65 private Gtk.Action ConnectToAssetServer;
66 private Gtk.Action ConnectToDefaultAssetServerForGrid;
67 private Gtk.Action DefaultForLocalGrid;
68 private Gtk.Action DefaultForRemoteGrid;
69 private Gtk.Action CustomAssetServer;
70 private Gtk.VBox vbox1;
71 private Gtk.MenuBar menubar2;
72 private Gtk.HBox hbox1;
73 private Gtk.ScrolledWindow scrolledwindow1;
74 private Gtk.DrawingArea drawingarea1;
75 private Gtk.TreeView treeview1;
76 private Gtk.Statusbar statusbar1;
77
78 protected virtual void Build()
79 {
80 Stetic.Gui.Initialize();
81 // Widget OpenGridServices.Manager.MainWindow
82 Gtk.UIManager w1 = new Gtk.UIManager();
83 Gtk.ActionGroup w2 = new Gtk.ActionGroup("Default");
84 this.Grid = new Gtk.Action("Grid", Mono.Unix.Catalog.GetString("Grid"), null, null);
85 this.Grid.HideIfEmpty = false;
86 this.Grid.ShortLabel = Mono.Unix.Catalog.GetString("Grid");
87 w2.Add(this.Grid, "<Alt><Mod2>g");
88 this.User = new Gtk.Action("User", Mono.Unix.Catalog.GetString("User"), null, null);
89 this.User.HideIfEmpty = false;
90 this.User.ShortLabel = Mono.Unix.Catalog.GetString("User");
91 w2.Add(this.User, null);
92 this.Asset = new Gtk.Action("Asset", Mono.Unix.Catalog.GetString("Asset"), null, null);
93 this.Asset.HideIfEmpty = false;
94 this.Asset.ShortLabel = Mono.Unix.Catalog.GetString("Asset");
95 w2.Add(this.Asset, null);
96 this.Region = new Gtk.Action("Region", Mono.Unix.Catalog.GetString("Region"), null, null);
97 this.Region.ShortLabel = Mono.Unix.Catalog.GetString("Region");
98 w2.Add(this.Region, null);
99 this.Services = new Gtk.Action("Services", Mono.Unix.Catalog.GetString("Services"), null, null);
100 this.Services.ShortLabel = Mono.Unix.Catalog.GetString("Services");
101 w2.Add(this.Services, null);
102 this.ConnectToGridserver = new Gtk.Action("ConnectToGridserver", Mono.Unix.Catalog.GetString("Connect to gridserver..."), null, "gtk-connect");
103 this.ConnectToGridserver.HideIfEmpty = false;
104 this.ConnectToGridserver.ShortLabel = Mono.Unix.Catalog.GetString("Connect to gridserver");
105 w2.Add(this.ConnectToGridserver, null);
106 this.RestartWholeGrid = new Gtk.Action("RestartWholeGrid", Mono.Unix.Catalog.GetString("Restart whole grid"), null, "gtk-refresh");
107 this.RestartWholeGrid.ShortLabel = Mono.Unix.Catalog.GetString("Restart whole grid");
108 w2.Add(this.RestartWholeGrid, null);
109 this.ShutdownWholeGrid = new Gtk.Action("ShutdownWholeGrid", Mono.Unix.Catalog.GetString("Shutdown whole grid"), null, "gtk-stop");
110 this.ShutdownWholeGrid.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown whole grid");
111 w2.Add(this.ShutdownWholeGrid, null);
112 this.ExitGridManager = new Gtk.Action("ExitGridManager", Mono.Unix.Catalog.GetString("Exit grid manager"), null, "gtk-close");
113 this.ExitGridManager.ShortLabel = Mono.Unix.Catalog.GetString("Exit grid manager");
114 w2.Add(this.ExitGridManager, null);
115 this.ConnectToUserserver = new Gtk.Action("ConnectToUserserver", Mono.Unix.Catalog.GetString("Connect to userserver"), null, "gtk-connect");
116 this.ConnectToUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Connect to userserver");
117 w2.Add(this.ConnectToUserserver, null);
118 this.AccountManagment = new Gtk.Action("AccountManagment", Mono.Unix.Catalog.GetString("Account managment"), null, "gtk-properties");
119 this.AccountManagment.ShortLabel = Mono.Unix.Catalog.GetString("Account managment");
120 w2.Add(this.AccountManagment, null);
121 this.GlobalNotice = new Gtk.Action("GlobalNotice", Mono.Unix.Catalog.GetString("Global notice"), null, "gtk-network");
122 this.GlobalNotice.ShortLabel = Mono.Unix.Catalog.GetString("Global notice");
123 w2.Add(this.GlobalNotice, null);
124 this.DisableAllLogins = new Gtk.Action("DisableAllLogins", Mono.Unix.Catalog.GetString("Disable all logins"), null, "gtk-no");
125 this.DisableAllLogins.ShortLabel = Mono.Unix.Catalog.GetString("Disable all logins");
126 w2.Add(this.DisableAllLogins, null);
127 this.DisableNonGodUsersOnly = new Gtk.Action("DisableNonGodUsersOnly", Mono.Unix.Catalog.GetString("Disable non-god users only"), null, "gtk-no");
128 this.DisableNonGodUsersOnly.ShortLabel = Mono.Unix.Catalog.GetString("Disable non-god users only");
129 w2.Add(this.DisableNonGodUsersOnly, null);
130 this.ShutdownUserServer = new Gtk.Action("ShutdownUserServer", Mono.Unix.Catalog.GetString("Shutdown user server"), null, "gtk-stop");
131 this.ShutdownUserServer.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown user server");
132 w2.Add(this.ShutdownUserServer, null);
133 this.ShutdownGridserverOnly = new Gtk.Action("ShutdownGridserverOnly", Mono.Unix.Catalog.GetString("Shutdown gridserver only"), null, "gtk-stop");
134 this.ShutdownGridserverOnly.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown gridserver only");
135 w2.Add(this.ShutdownGridserverOnly, null);
136 this.RestartGridserverOnly = new Gtk.Action("RestartGridserverOnly", Mono.Unix.Catalog.GetString("Restart gridserver only"), null, "gtk-refresh");
137 this.RestartGridserverOnly.ShortLabel = Mono.Unix.Catalog.GetString("Restart gridserver only");
138 w2.Add(this.RestartGridserverOnly, null);
139 this.DefaultLocalGridUserserver = new Gtk.Action("DefaultLocalGridUserserver", Mono.Unix.Catalog.GetString("Default local grid userserver"), null, null);
140 this.DefaultLocalGridUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Default local grid userserver");
141 w2.Add(this.DefaultLocalGridUserserver, null);
142 this.CustomUserserver = new Gtk.Action("CustomUserserver", Mono.Unix.Catalog.GetString("Custom userserver..."), null, null);
143 this.CustomUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Custom userserver");
144 w2.Add(this.CustomUserserver, null);
145 this.RemoteGridDefaultUserserver = new Gtk.Action("RemoteGridDefaultUserserver", Mono.Unix.Catalog.GetString("Remote grid default userserver..."), null, null);
146 this.RemoteGridDefaultUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Remote grid default userserver");
147 w2.Add(this.RemoteGridDefaultUserserver, null);
148 this.DisconnectFromGridServer = new Gtk.Action("DisconnectFromGridServer", Mono.Unix.Catalog.GetString("Disconnect from grid server"), null, "gtk-disconnect");
149 this.DisconnectFromGridServer.ShortLabel = Mono.Unix.Catalog.GetString("Disconnect from grid server");
150 this.DisconnectFromGridServer.Visible = false;
151 w2.Add(this.DisconnectFromGridServer, null);
152 this.UploadAsset = new Gtk.Action("UploadAsset", Mono.Unix.Catalog.GetString("Upload asset"), null, null);
153 this.UploadAsset.ShortLabel = Mono.Unix.Catalog.GetString("Upload asset");
154 w2.Add(this.UploadAsset, null);
155 this.AssetManagement = new Gtk.Action("AssetManagement", Mono.Unix.Catalog.GetString("Asset management"), null, null);
156 this.AssetManagement.ShortLabel = Mono.Unix.Catalog.GetString("Asset management");
157 w2.Add(this.AssetManagement, null);
158 this.ConnectToAssetServer = new Gtk.Action("ConnectToAssetServer", Mono.Unix.Catalog.GetString("Connect to asset server"), null, null);
159 this.ConnectToAssetServer.ShortLabel = Mono.Unix.Catalog.GetString("Connect to asset server");
160 w2.Add(this.ConnectToAssetServer, null);
161 this.ConnectToDefaultAssetServerForGrid = new Gtk.Action("ConnectToDefaultAssetServerForGrid", Mono.Unix.Catalog.GetString("Connect to default asset server for grid"), null, null);
162 this.ConnectToDefaultAssetServerForGrid.ShortLabel = Mono.Unix.Catalog.GetString("Connect to default asset server for grid");
163 w2.Add(this.ConnectToDefaultAssetServerForGrid, null);
164 this.DefaultForLocalGrid = new Gtk.Action("DefaultForLocalGrid", Mono.Unix.Catalog.GetString("Default for local grid"), null, null);
165 this.DefaultForLocalGrid.ShortLabel = Mono.Unix.Catalog.GetString("Default for local grid");
166 w2.Add(this.DefaultForLocalGrid, null);
167 this.DefaultForRemoteGrid = new Gtk.Action("DefaultForRemoteGrid", Mono.Unix.Catalog.GetString("Default for remote grid..."), null, null);
168 this.DefaultForRemoteGrid.ShortLabel = Mono.Unix.Catalog.GetString("Default for remote grid...");
169 w2.Add(this.DefaultForRemoteGrid, null);
170 this.CustomAssetServer = new Gtk.Action("CustomAssetServer", Mono.Unix.Catalog.GetString("Custom asset server..."), null, null);
171 this.CustomAssetServer.ShortLabel = Mono.Unix.Catalog.GetString("Custom asset server...");
172 w2.Add(this.CustomAssetServer, null);
173 w1.InsertActionGroup(w2, 0);
174 this.AddAccelGroup(w1.AccelGroup);
175 this.WidthRequest = 800;
176 this.HeightRequest = 600;
177 this.Name = "OpenGridServices.Manager.MainWindow";
178 this.Title = Mono.Unix.Catalog.GetString("Open Grid Services Manager");
179 this.Icon = Gtk.IconTheme.Default.LoadIcon("gtk-network", 48, 0);
180 // Container child OpenGridServices.Manager.MainWindow.Gtk.Container+ContainerChild
181 this.vbox1 = new Gtk.VBox();
182 this.vbox1.Name = "vbox1";
183 // Container child vbox1.Gtk.Box+BoxChild
184 w1.AddUiFromString("<ui><menubar name='menubar2'><menu action='Grid'><menuitem action='ConnectToGridserver'/><menuitem action='DisconnectFromGridServer'/><separator/><menuitem action='RestartWholeGrid'/><menuitem action='RestartGridserverOnly'/><separator/><menuitem action='ShutdownWholeGrid'/><menuitem action='ShutdownGridserverOnly'/><separator/><menuitem action='ExitGridManager'/></menu><menu action='User'><menu action='ConnectToUserserver'><menuitem action='DefaultLocalGridUserserver'/><menuitem action='CustomUserserver'/><menuitem action='RemoteGridDefaultUserserver'/></menu><separator/><menuitem action='AccountManagment'/><menuitem action='GlobalNotice'/><separator/><menuitem action='DisableAllLogins'/><menuitem action='DisableNonGodUsersOnly'/><separator/><menuitem action='ShutdownUserServer'/></menu><menu action='Asset'><menuitem action='UploadAsset'/><menuitem action='AssetManagement'/><menu action='ConnectToAssetServer'><menuitem action='DefaultForLocalGrid'/><menuitem action='DefaultForRemoteGrid'/><menuitem action='CustomAssetServer'/></menu></menu><menu action='Region'/><menu action='Services'/></menubar></ui>");
185 this.menubar2 = ((Gtk.MenuBar)(w1.GetWidget("/menubar2")));
186 this.menubar2.HeightRequest = 25;
187 this.menubar2.Name = "menubar2";
188 this.vbox1.Add(this.menubar2);
189 Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox1[this.menubar2]));
190 w3.Position = 0;
191 w3.Expand = false;
192 w3.Fill = false;
193 // Container child vbox1.Gtk.Box+BoxChild
194 this.hbox1 = new Gtk.HBox();
195 this.hbox1.Name = "hbox1";
196 // Container child hbox1.Gtk.Box+BoxChild
197 this.scrolledwindow1 = new Gtk.ScrolledWindow();
198 this.scrolledwindow1.CanFocus = true;
199 this.scrolledwindow1.Name = "scrolledwindow1";
200 this.scrolledwindow1.VscrollbarPolicy = ((Gtk.PolicyType)(1));
201 this.scrolledwindow1.HscrollbarPolicy = ((Gtk.PolicyType)(1));
202 // Container child scrolledwindow1.Gtk.Container+ContainerChild
203 Gtk.Viewport w4 = new Gtk.Viewport();
204 w4.Name = "GtkViewport";
205 w4.ShadowType = ((Gtk.ShadowType)(0));
206 // Container child GtkViewport.Gtk.Container+ContainerChild
207 this.drawingarea1 = new Gtk.DrawingArea();
208 this.drawingarea1.Name = "drawingarea1";
209 w4.Add(this.drawingarea1);
210 this.scrolledwindow1.Add(w4);
211 this.hbox1.Add(this.scrolledwindow1);
212 Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.hbox1[this.scrolledwindow1]));
213 w7.Position = 1;
214 // Container child hbox1.Gtk.Box+BoxChild
215 this.treeview1 = new Gtk.TreeView();
216 this.treeview1.CanFocus = true;
217 this.treeview1.Name = "treeview1";
218 this.hbox1.Add(this.treeview1);
219 Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox1[this.treeview1]));
220 w8.Position = 2;
221 this.vbox1.Add(this.hbox1);
222 Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.vbox1[this.hbox1]));
223 w9.Position = 1;
224 // Container child vbox1.Gtk.Box+BoxChild
225 this.statusbar1 = new Gtk.Statusbar();
226 this.statusbar1.Name = "statusbar1";
227 this.statusbar1.Spacing = 5;
228 this.vbox1.Add(this.statusbar1);
229 Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar1]));
230 w10.PackType = ((Gtk.PackType)(1));
231 w10.Position = 2;
232 w10.Expand = false;
233 w10.Fill = false;
234 this.Add(this.vbox1);
235 if (this.Child != null)
236 {
237 this.Child.ShowAll();
238 }
239 this.DefaultWidth = 800;
240 this.DefaultHeight = 800;
241 this.Show();
242 this.DeleteEvent += new Gtk.DeleteEventHandler(this.OnDeleteEvent);
243 this.ConnectToGridserver.Activated += new System.EventHandler(this.ConnectToGridServerMenu);
244 this.ExitGridManager.Activated += new System.EventHandler(this.QuitMenu);
245 this.ShutdownGridserverOnly.Activated += new System.EventHandler(this.ShutdownGridserverMenu);
246 this.RestartGridserverOnly.Activated += new System.EventHandler(this.RestartGridserverMenu);
247 this.DisconnectFromGridServer.Activated += new System.EventHandler(this.DisconnectGridServerMenu);
248 }
249 }
250}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28// ------------------------------------------------------------------------------
29// <autogenerated>
30// This code was generated by a tool.
31// Mono Runtime Version: 2.0.50727.42
32//
33// Changes to this file may cause incorrect behavior and will be lost if
34// the code is regenerated.
35// </autogenerated>
36// ------------------------------------------------------------------------------
37
38namespace Stetic
39{
40 internal class Gui
41 {
42 private static bool initialized;
43
44 internal static void Initialize()
45 {
46 Stetic.Gui.initialized = true;
47 }
48 }
49
50 internal class ActionGroups
51 {
52 public static Gtk.ActionGroup GetActionGroup(System.Type type)
53 {
54 return Stetic.ActionGroups.GetActionGroup(type.FullName);
55 }
56
57 public static Gtk.ActionGroup GetActionGroup(string name)
58 {
59 return null;
60 }
61 }
62}
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 @@
1<?xml version="1.0" encoding="utf-8"?>
2<stetic-interface>
3 <widget class="Gtk.Window" id="OpenGridServices.Manager.MainWindow" design-size="800 800">
4 <action-group name="Default">
5 <action id="Grid">
6 <property name="Type">Action</property>
7 <property name="Accelerator">&lt;Alt&gt;&lt;Mod2&gt;g</property>
8 <property name="HideIfEmpty">False</property>
9 <property name="Label" translatable="yes">Grid</property>
10 <property name="ShortLabel" translatable="yes">Grid</property>
11 </action>
12 <action id="User">
13 <property name="Type">Action</property>
14 <property name="HideIfEmpty">False</property>
15 <property name="Label" translatable="yes">User</property>
16 <property name="ShortLabel" translatable="yes">User</property>
17 </action>
18 <action id="Asset">
19 <property name="Type">Action</property>
20 <property name="HideIfEmpty">False</property>
21 <property name="Label" translatable="yes">Asset</property>
22 <property name="ShortLabel" translatable="yes">Asset</property>
23 </action>
24 <action id="Region">
25 <property name="Type">Action</property>
26 <property name="Label" translatable="yes">Region</property>
27 <property name="ShortLabel" translatable="yes">Region</property>
28 </action>
29 <action id="Services">
30 <property name="Type">Action</property>
31 <property name="Label" translatable="yes">Services</property>
32 <property name="ShortLabel" translatable="yes">Services</property>
33 </action>
34 <action id="ConnectToGridserver">
35 <property name="Type">Action</property>
36 <property name="HideIfEmpty">False</property>
37 <property name="Label" translatable="yes">Connect to gridserver...</property>
38 <property name="ShortLabel" translatable="yes">Connect to gridserver</property>
39 <property name="StockId">gtk-connect</property>
40 <signal name="Activated" handler="ConnectToGridServerMenu" />
41 </action>
42 <action id="RestartWholeGrid">
43 <property name="Type">Action</property>
44 <property name="Label" translatable="yes">Restart whole grid</property>
45 <property name="ShortLabel" translatable="yes">Restart whole grid</property>
46 <property name="StockId">gtk-refresh</property>
47 </action>
48 <action id="ShutdownWholeGrid">
49 <property name="Type">Action</property>
50 <property name="Label" translatable="yes">Shutdown whole grid</property>
51 <property name="ShortLabel" translatable="yes">Shutdown whole grid</property>
52 <property name="StockId">gtk-stop</property>
53 </action>
54 <action id="ExitGridManager">
55 <property name="Type">Action</property>
56 <property name="Label" translatable="yes">Exit grid manager</property>
57 <property name="ShortLabel" translatable="yes">Exit grid manager</property>
58 <property name="StockId">gtk-close</property>
59 <signal name="Activated" handler="QuitMenu" after="yes" />
60 </action>
61 <action id="ConnectToUserserver">
62 <property name="Type">Action</property>
63 <property name="Label" translatable="yes">Connect to userserver</property>
64 <property name="ShortLabel" translatable="yes">Connect to userserver</property>
65 <property name="StockId">gtk-connect</property>
66 </action>
67 <action id="AccountManagment">
68 <property name="Type">Action</property>
69 <property name="Label" translatable="yes">Account managment</property>
70 <property name="ShortLabel" translatable="yes">Account managment</property>
71 <property name="StockId">gtk-properties</property>
72 </action>
73 <action id="GlobalNotice">
74 <property name="Type">Action</property>
75 <property name="Label" translatable="yes">Global notice</property>
76 <property name="ShortLabel" translatable="yes">Global notice</property>
77 <property name="StockId">gtk-network</property>
78 </action>
79 <action id="DisableAllLogins">
80 <property name="Type">Action</property>
81 <property name="Label" translatable="yes">Disable all logins</property>
82 <property name="ShortLabel" translatable="yes">Disable all logins</property>
83 <property name="StockId">gtk-no</property>
84 </action>
85 <action id="DisableNonGodUsersOnly">
86 <property name="Type">Action</property>
87 <property name="Label" translatable="yes">Disable non-god users only</property>
88 <property name="ShortLabel" translatable="yes">Disable non-god users only</property>
89 <property name="StockId">gtk-no</property>
90 </action>
91 <action id="ShutdownUserServer">
92 <property name="Type">Action</property>
93 <property name="Label" translatable="yes">Shutdown user server</property>
94 <property name="ShortLabel" translatable="yes">Shutdown user server</property>
95 <property name="StockId">gtk-stop</property>
96 </action>
97 <action id="ShutdownGridserverOnly">
98 <property name="Type">Action</property>
99 <property name="Label" translatable="yes">Shutdown gridserver only</property>
100 <property name="ShortLabel" translatable="yes">Shutdown gridserver only</property>
101 <property name="StockId">gtk-stop</property>
102 <signal name="Activated" handler="ShutdownGridserverMenu" after="yes" />
103 </action>
104 <action id="RestartGridserverOnly">
105 <property name="Type">Action</property>
106 <property name="Label" translatable="yes">Restart gridserver only</property>
107 <property name="ShortLabel" translatable="yes">Restart gridserver only</property>
108 <property name="StockId">gtk-refresh</property>
109 <signal name="Activated" handler="RestartGridserverMenu" after="yes" />
110 </action>
111 <action id="DefaultLocalGridUserserver">
112 <property name="Type">Action</property>
113 <property name="Label" translatable="yes">Default local grid userserver</property>
114 <property name="ShortLabel" translatable="yes">Default local grid userserver</property>
115 </action>
116 <action id="CustomUserserver">
117 <property name="Type">Action</property>
118 <property name="Label" translatable="yes">Custom userserver...</property>
119 <property name="ShortLabel" translatable="yes">Custom userserver</property>
120 </action>
121 <action id="RemoteGridDefaultUserserver">
122 <property name="Type">Action</property>
123 <property name="Label" translatable="yes">Remote grid default userserver...</property>
124 <property name="ShortLabel" translatable="yes">Remote grid default userserver</property>
125 </action>
126 <action id="DisconnectFromGridServer">
127 <property name="Type">Action</property>
128 <property name="Label" translatable="yes">Disconnect from grid server</property>
129 <property name="ShortLabel" translatable="yes">Disconnect from grid server</property>
130 <property name="StockId">gtk-disconnect</property>
131 <property name="Visible">False</property>
132 <signal name="Activated" handler="DisconnectGridServerMenu" after="yes" />
133 </action>
134 <action id="UploadAsset">
135 <property name="Type">Action</property>
136 <property name="Label" translatable="yes">Upload asset</property>
137 <property name="ShortLabel" translatable="yes">Upload asset</property>
138 </action>
139 <action id="AssetManagement">
140 <property name="Type">Action</property>
141 <property name="Label" translatable="yes">Asset management</property>
142 <property name="ShortLabel" translatable="yes">Asset management</property>
143 </action>
144 <action id="ConnectToAssetServer">
145 <property name="Type">Action</property>
146 <property name="Label" translatable="yes">Connect to asset server</property>
147 <property name="ShortLabel" translatable="yes">Connect to asset server</property>
148 </action>
149 <action id="ConnectToDefaultAssetServerForGrid">
150 <property name="Type">Action</property>
151 <property name="Label" translatable="yes">Connect to default asset server for grid</property>
152 <property name="ShortLabel" translatable="yes">Connect to default asset server for grid</property>
153 </action>
154 <action id="DefaultForLocalGrid">
155 <property name="Type">Action</property>
156 <property name="Label" translatable="yes">Default for local grid</property>
157 <property name="ShortLabel" translatable="yes">Default for local grid</property>
158 </action>
159 <action id="DefaultForRemoteGrid">
160 <property name="Type">Action</property>
161 <property name="Label" translatable="yes">Default for remote grid...</property>
162 <property name="ShortLabel" translatable="yes">Default for remote grid...</property>
163 </action>
164 <action id="CustomAssetServer">
165 <property name="Type">Action</property>
166 <property name="Label" translatable="yes">Custom asset server...</property>
167 <property name="ShortLabel" translatable="yes">Custom asset server...</property>
168 </action>
169 </action-group>
170 <property name="MemberName" />
171 <property name="WidthRequest">800</property>
172 <property name="HeightRequest">600</property>
173 <property name="Title" translatable="yes">Open Grid Services Manager</property>
174 <property name="Icon">stock:gtk-network Dialog</property>
175 <signal name="DeleteEvent" handler="OnDeleteEvent" />
176 <child>
177 <widget class="Gtk.VBox" id="vbox1">
178 <property name="MemberName" />
179 <child>
180 <widget class="Gtk.MenuBar" id="menubar2">
181 <property name="MemberName" />
182 <property name="HeightRequest">25</property>
183 <node name="menubar2" type="Menubar">
184 <node type="Menu" action="Grid">
185 <node type="Menuitem" action="ConnectToGridserver" />
186 <node type="Menuitem" action="DisconnectFromGridServer" />
187 <node type="Separator" />
188 <node type="Menuitem" action="RestartWholeGrid" />
189 <node type="Menuitem" action="RestartGridserverOnly" />
190 <node type="Separator" />
191 <node type="Menuitem" action="ShutdownWholeGrid" />
192 <node type="Menuitem" action="ShutdownGridserverOnly" />
193 <node type="Separator" />
194 <node type="Menuitem" action="ExitGridManager" />
195 </node>
196 <node type="Menu" action="User">
197 <node type="Menu" action="ConnectToUserserver">
198 <node type="Menuitem" action="DefaultLocalGridUserserver" />
199 <node type="Menuitem" action="CustomUserserver" />
200 <node type="Menuitem" action="RemoteGridDefaultUserserver" />
201 </node>
202 <node type="Separator" />
203 <node type="Menuitem" action="AccountManagment" />
204 <node type="Menuitem" action="GlobalNotice" />
205 <node type="Separator" />
206 <node type="Menuitem" action="DisableAllLogins" />
207 <node type="Menuitem" action="DisableNonGodUsersOnly" />
208 <node type="Separator" />
209 <node type="Menuitem" action="ShutdownUserServer" />
210 </node>
211 <node type="Menu" action="Asset">
212 <node type="Menuitem" action="UploadAsset" />
213 <node type="Menuitem" action="AssetManagement" />
214 <node type="Menu" action="ConnectToAssetServer">
215 <node type="Menuitem" action="DefaultForLocalGrid" />
216 <node type="Menuitem" action="DefaultForRemoteGrid" />
217 <node type="Menuitem" action="CustomAssetServer" />
218 </node>
219 </node>
220 <node type="Menu" action="Region" />
221 <node type="Menu" action="Services" />
222 </node>
223 </widget>
224 <packing>
225 <property name="Position">0</property>
226 <property name="AutoSize">False</property>
227 <property name="Expand">False</property>
228 <property name="Fill">False</property>
229 </packing>
230 </child>
231 <child>
232 <widget class="Gtk.HBox" id="hbox1">
233 <property name="MemberName" />
234 <child>
235 <placeholder />
236 </child>
237 <child>
238 <widget class="Gtk.ScrolledWindow" id="scrolledwindow1">
239 <property name="MemberName" />
240 <property name="CanFocus">True</property>
241 <property name="VscrollbarPolicy">Automatic</property>
242 <property name="HscrollbarPolicy">Automatic</property>
243 <child>
244 <widget class="Gtk.Viewport" id="GtkViewport">
245 <property name="MemberName" />
246 <property name="ShadowType">None</property>
247 <child>
248 <widget class="Gtk.DrawingArea" id="drawingarea1">
249 <property name="MemberName" />
250 </widget>
251 </child>
252 </widget>
253 </child>
254 </widget>
255 <packing>
256 <property name="Position">1</property>
257 <property name="AutoSize">True</property>
258 </packing>
259 </child>
260 <child>
261 <widget class="Gtk.TreeView" id="treeview1">
262 <property name="MemberName" />
263 <property name="CanFocus">True</property>
264 </widget>
265 <packing>
266 <property name="Position">2</property>
267 <property name="AutoSize">True</property>
268 </packing>
269 </child>
270 </widget>
271 <packing>
272 <property name="Position">1</property>
273 <property name="AutoSize">True</property>
274 </packing>
275 </child>
276 <child>
277 <widget class="Gtk.Statusbar" id="statusbar1">
278 <property name="MemberName">statusBar1</property>
279 <property name="Spacing">5</property>
280 <child>
281 <placeholder />
282 </child>
283 <child>
284 <placeholder />
285 </child>
286 </widget>
287 <packing>
288 <property name="PackType">End</property>
289 <property name="Position">2</property>
290 <property name="AutoSize">False</property>
291 <property name="Expand">False</property>
292 <property name="Fill">False</property>
293 </packing>
294 </child>
295 </widget>
296 </child>
297 </widget>
298 <widget class="Gtk.Dialog" id="OpenGridServices.Manager.ConnectToGridServerDialog" design-size="476 137">
299 <property name="MemberName" />
300 <property name="Events">ButtonPressMask</property>
301 <property name="Title" translatable="yes">Connect to Grid server</property>
302 <property name="WindowPosition">CenterOnParent</property>
303 <property name="Buttons">2</property>
304 <property name="HelpButton">False</property>
305 <property name="HasSeparator">False</property>
306 <signal name="Response" handler="OnResponse" />
307 <child internal-child="VBox">
308 <widget class="Gtk.VBox" id="dialog_VBox">
309 <property name="MemberName" />
310 <property name="Events">ButtonPressMask</property>
311 <property name="BorderWidth">2</property>
312 <child>
313 <widget class="Gtk.VBox" id="vbox2">
314 <property name="MemberName" />
315 <child>
316 <placeholder />
317 </child>
318 <child>
319 <placeholder />
320 </child>
321 <child>
322 <widget class="Gtk.VBox" id="vbox3">
323 <property name="MemberName" />
324 <child>
325 <widget class="Gtk.HBox" id="hbox1">
326 <property name="MemberName" />
327 <child>
328 <widget class="Gtk.Label" id="label1">
329 <property name="MemberName" />
330 <property name="Xalign">1</property>
331 <property name="LabelProp" translatable="yes">Grid server URL: </property>
332 <property name="Justify">Right</property>
333 </widget>
334 <packing>
335 <property name="Position">0</property>
336 <property name="AutoSize">False</property>
337 </packing>
338 </child>
339 <child>
340 <widget class="Gtk.Entry" id="entry1">
341 <property name="MemberName" />
342 <property name="CanFocus">True</property>
343 <property name="Text" translatable="yes">http://gridserver:8001</property>
344 <property name="IsEditable">True</property>
345 <property name="MaxLength">255</property>
346 <property name="InvisibleChar">•</property>
347 </widget>
348 <packing>
349 <property name="Position">1</property>
350 <property name="AutoSize">False</property>
351 </packing>
352 </child>
353 <child>
354 <placeholder />
355 </child>
356 </widget>
357 <packing>
358 <property name="Position">0</property>
359 <property name="AutoSize">True</property>
360 <property name="Expand">False</property>
361 <property name="Fill">False</property>
362 </packing>
363 </child>
364 <child>
365 <widget class="Gtk.HBox" id="hbox2">
366 <property name="MemberName" />
367 <child>
368 <widget class="Gtk.Label" id="label2">
369 <property name="MemberName" />
370 <property name="Xalign">1</property>
371 <property name="LabelProp" translatable="yes">Username:</property>
372 <property name="Justify">Right</property>
373 </widget>
374 <packing>
375 <property name="Position">0</property>
376 <property name="AutoSize">False</property>
377 </packing>
378 </child>
379 <child>
380 <widget class="Gtk.Entry" id="entry2">
381 <property name="MemberName" />
382 <property name="CanFocus">True</property>
383 <property name="IsEditable">True</property>
384 <property name="InvisibleChar">•</property>
385 </widget>
386 <packing>
387 <property name="Position">1</property>
388 <property name="AutoSize">True</property>
389 </packing>
390 </child>
391 <child>
392 <placeholder />
393 </child>
394 </widget>
395 <packing>
396 <property name="Position">1</property>
397 <property name="AutoSize">False</property>
398 <property name="Expand">False</property>
399 <property name="Fill">False</property>
400 </packing>
401 </child>
402 <child>
403 <widget class="Gtk.HBox" id="hbox3">
404 <property name="MemberName" />
405 <child>
406 <widget class="Gtk.Label" id="label3">
407 <property name="MemberName" />
408 <property name="Xalign">1</property>
409 <property name="LabelProp" translatable="yes">Password:</property>
410 <property name="Justify">Right</property>
411 </widget>
412 <packing>
413 <property name="Position">0</property>
414 <property name="AutoSize">False</property>
415 </packing>
416 </child>
417 <child>
418 <widget class="Gtk.Entry" id="entry3">
419 <property name="MemberName" />
420 <property name="CanFocus">True</property>
421 <property name="IsEditable">True</property>
422 <property name="InvisibleChar">•</property>
423 </widget>
424 <packing>
425 <property name="Position">1</property>
426 <property name="AutoSize">True</property>
427 </packing>
428 </child>
429 <child>
430 <placeholder />
431 </child>
432 </widget>
433 <packing>
434 <property name="Position">2</property>
435 <property name="AutoSize">True</property>
436 <property name="Expand">False</property>
437 <property name="Fill">False</property>
438 </packing>
439 </child>
440 </widget>
441 <packing>
442 <property name="Position">2</property>
443 <property name="AutoSize">True</property>
444 <property name="Expand">False</property>
445 <property name="Fill">False</property>
446 </packing>
447 </child>
448 </widget>
449 <packing>
450 <property name="Position">0</property>
451 <property name="AutoSize">True</property>
452 </packing>
453 </child>
454 </widget>
455 </child>
456 <child internal-child="ActionArea">
457 <widget class="Gtk.HButtonBox" id="OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea">
458 <property name="MemberName" />
459 <property name="Events">ButtonPressMask</property>
460 <property name="Spacing">6</property>
461 <property name="BorderWidth">5</property>
462 <property name="Size">2</property>
463 <property name="LayoutStyle">End</property>
464 <child>
465 <widget class="Gtk.Button" id="button2">
466 <property name="MemberName" />
467 <property name="CanDefault">True</property>
468 <property name="CanFocus">True</property>
469 <property name="Type">TextAndIcon</property>
470 <property name="Icon">stock:gtk-apply Menu</property>
471 <property name="Label" translatable="yes">Connect</property>
472 <property name="UseUnderline">True</property>
473 <property name="IsDialogButton">True</property>
474 <property name="ResponseId">-5</property>
475 </widget>
476 <packing>
477 <property name="Expand">False</property>
478 <property name="Fill">False</property>
479 </packing>
480 </child>
481 <child>
482 <widget class="Gtk.Button" id="button8">
483 <property name="MemberName" />
484 <property name="CanDefault">True</property>
485 <property name="CanFocus">True</property>
486 <property name="Type">TextAndIcon</property>
487 <property name="Icon">stock:gtk-cancel Menu</property>
488 <property name="Label" translatable="yes">Cancel</property>
489 <property name="UseUnderline">True</property>
490 <property name="IsDialogButton">True</property>
491 <property name="ResponseId">-6</property>
492 </widget>
493 <packing>
494 <property name="Position">1</property>
495 <property name="Expand">False</property>
496 <property name="Fill">False</property>
497 </packing>
498 </child>
499 </widget>
500 </child>
501 </widget>
502</stetic-interface> \ 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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using System.Threading;
34using System.Timers;
35using log4net;
36using Nwc.XmlRpc;
37using OpenMetaverse;
38using OpenSim.Data;
39using OpenSim.Framework;
40using OpenSim.Grid.Framework;
41using Timer = System.Timers.Timer;
42
43namespace OpenSim.Grid.MessagingServer.Modules
44{
45 public class InterMessageUserServerModule : IInterServiceUserService
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 private MessageServerConfig m_cfg;
50
51 private IGridServiceCore m_messageCore;
52
53 private Timer reconnectTimer = new Timer(300000); // 5 mins
54
55 public InterMessageUserServerModule(MessageServerConfig config, IGridServiceCore messageCore)
56 {
57 m_cfg = config;
58 m_messageCore = messageCore;
59
60 reconnectTimer.Elapsed += registerWithUserServer;
61 lock (reconnectTimer)
62 reconnectTimer.Start();
63 }
64
65 public void Initialise()
66 {
67 m_messageCore.RegisterInterface<IInterServiceUserService>(this);
68 }
69
70 public void PostInitialise()
71 {
72
73 }
74
75 public void RegisterHandlers()
76 {
77 //have these in separate method as some servers restart the http server and reregister all the handlers.
78
79 }
80
81 public void registerWithUserServer(object sender, ElapsedEventArgs e)
82 {
83 registerWithUserServer();
84 }
85
86 public bool registerWithUserServer()
87 {
88 Hashtable UserParams = new Hashtable();
89 // Login / Authentication
90
91 if (m_cfg.HttpSSL)
92 {
93 UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
94 }
95 else
96 {
97 UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
98 }
99
100 UserParams["recvkey"] = m_cfg.UserRecvKey;
101 UserParams["sendkey"] = m_cfg.UserRecvKey;
102
103 // Package into an XMLRPC Request
104 ArrayList SendParams = new ArrayList();
105 SendParams.Add(UserParams);
106
107 bool success = true;
108 string[] servers = m_cfg.UserServerURL.Split(' ');
109
110 foreach (string srv in servers)
111 {
112 // Send Request
113 try
114 {
115 XmlRpcRequest UserReq = new XmlRpcRequest("register_messageserver", SendParams);
116 XmlRpcResponse UserResp = UserReq.Send(srv, 16000);
117
118 // Process Response
119 Hashtable GridRespData = (Hashtable)UserResp.Value;
120 // if we got a response, we were successful
121 if (!GridRespData.ContainsKey("responsestring"))
122 success = false;
123 else
124 m_log.InfoFormat("[SERVER] Registered with {0}", srv);
125 }
126 catch
127 {
128 m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv);
129 success = false;
130 }
131 }
132 return success;
133 }
134
135 public bool deregisterWithUserServer()
136 {
137 Hashtable request = new Hashtable();
138
139 return SendToUserServer(request, "deregister_messageserver");
140 }
141
142 public bool SendToUserServer(Hashtable request, string method)
143 {
144 // Login / Authentication
145
146 if (m_cfg.HttpSSL)
147 {
148 request["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
149 }
150 else
151 {
152 request["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
153 }
154
155 request["recvkey"] = m_cfg.UserRecvKey;
156 request["sendkey"] = m_cfg.UserRecvKey;
157
158 // Package into an XMLRPC Request
159 ArrayList SendParams = new ArrayList();
160 SendParams.Add(request);
161
162 bool success = true;
163 string[] servers = m_cfg.UserServerURL.Split(' ');
164
165 // Send Request
166 foreach (string srv in servers)
167 {
168 try
169 {
170 XmlRpcRequest UserReq = new XmlRpcRequest(method, SendParams);
171 XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000);
172 // Process Response
173 Hashtable UserRespData = (Hashtable)UserResp.Value;
174 // if we got a response, we were successful
175 if (!UserRespData.ContainsKey("responsestring"))
176 success = false;
177 }
178 catch
179 {
180 m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv);
181 success = false;
182 }
183 }
184 return success;
185 }
186 }
187}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using System.Threading;
34using System.Timers;
35using log4net;
36using Nwc.XmlRpc;
37using OpenMetaverse;
38using OpenSim.Data;
39using OpenSim.Framework;
40using OpenSim.Grid.Framework;
41using Timer = System.Timers.Timer;
42using OpenSim.Services.Interfaces;
43using OpenSim.Services.Connectors;
44using GridRegion = OpenSim.Services.Interfaces.GridRegion;
45
46
47namespace OpenSim.Grid.MessagingServer.Modules
48{
49 public class MessageRegionModule : IMessageRegionLookup
50 {
51// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52
53 private MessageServerConfig m_cfg;
54
55 private IInterServiceUserService m_userServerModule;
56
57 private IGridServiceCore m_messageCore;
58
59 private IGridService m_GridService;
60
61 // a dictionary of all current regions this server knows about
62 private Dictionary<ulong, RegionProfileData> m_regionInfoCache = new Dictionary<ulong, RegionProfileData>();
63
64 public MessageRegionModule(MessageServerConfig config, IGridServiceCore messageCore)
65 {
66 m_cfg = config;
67 m_messageCore = messageCore;
68
69 m_GridService = new GridServicesConnector(m_cfg.GridServerURL);
70 }
71
72 public void Initialise()
73 {
74 m_messageCore.RegisterInterface<IMessageRegionLookup>(this);
75 }
76
77 public void PostInitialise()
78 {
79 IInterServiceUserService messageUserServer;
80 if (m_messageCore.TryGet<IInterServiceUserService>(out messageUserServer))
81 {
82 m_userServerModule = messageUserServer;
83 }
84 }
85
86 public void RegisterHandlers()
87 {
88 //have these in separate method as some servers restart the http server and reregister all the handlers.
89
90 }
91
92 /// <summary>
93 /// Gets and caches a RegionInfo object from the gridserver based on regionhandle
94 /// if the regionhandle is already cached, use the cached values
95 /// Gets called by lots of threads!!!!!
96 /// </summary>
97 /// <param name="regionhandle">handle to the XY of the region we're looking for</param>
98 /// <returns>A RegionInfo object to stick in the presence info</returns>
99 public RegionProfileData GetRegionInfo(ulong regionhandle)
100 {
101 RegionProfileData regionInfo = null;
102
103 lock (m_regionInfoCache)
104 {
105 m_regionInfoCache.TryGetValue(regionhandle, out regionInfo);
106 }
107
108 if (regionInfo == null) // not found in cache
109 {
110 regionInfo = RequestRegionInfo(regionhandle);
111
112 if (regionInfo != null) // lookup was successful
113 {
114 lock (m_regionInfoCache)
115 {
116 m_regionInfoCache[regionhandle] = regionInfo;
117 }
118 }
119 }
120
121 return regionInfo;
122 }
123
124 public int ClearRegionCache()
125 {
126 int cachecount = 0;
127
128 lock (m_regionInfoCache)
129 {
130 cachecount = m_regionInfoCache.Count;
131 m_regionInfoCache.Clear();
132 }
133
134 return cachecount;
135 }
136
137 /// <summary>
138 /// Get RegionProfileData from the GridServer.
139 /// We'll cache this information in GetRegionInfo and use it for presence updates
140 /// </summary>
141 /// <param name="regionHandle"></param>
142 /// <returns></returns>
143 public RegionProfileData RequestRegionInfo(ulong regionHandle)
144 {
145 uint x = 0, y = 0;
146 Utils.LongToUInts(regionHandle, out x, out y);
147 GridRegion region = m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
148
149 if (region != null)
150 return GridRegionToRegionProfile(region);
151
152 else
153 return null;
154 }
155
156 private RegionProfileData GridRegionToRegionProfile(GridRegion region)
157 {
158 RegionProfileData rprofile = new RegionProfileData();
159 rprofile.httpPort = region.HttpPort;
160 rprofile.httpServerURI = region.ServerURI;
161 rprofile.regionLocX = (uint)(region.RegionLocX / Constants.RegionSize);
162 rprofile.regionLocY = (uint)(region.RegionLocY / Constants.RegionSize);
163 rprofile.RegionName = region.RegionName;
164 rprofile.ServerHttpPort = region.HttpPort;
165 rprofile.ServerIP = region.ExternalHostName;
166 rprofile.ServerPort = (uint)region.ExternalEndPoint.Port;
167 rprofile.Uuid = region.RegionID;
168 return rprofile;
169 }
170
171 public XmlRpcResponse RegionStartup(XmlRpcRequest request, IPEndPoint remoteClient)
172 {
173 Hashtable requestData = (Hashtable)request.Params[0];
174 Hashtable result = new Hashtable();
175 result["success"] = "FALSE";
176
177 if (m_userServerModule.SendToUserServer(requestData, "region_startup"))
178 result["success"] = "TRUE";
179
180 XmlRpcResponse response = new XmlRpcResponse();
181 response.Value = result;
182 return response;
183 }
184
185 public XmlRpcResponse RegionShutdown(XmlRpcRequest request, IPEndPoint remoteClient)
186 {
187 Hashtable requestData = (Hashtable)request.Params[0];
188 Hashtable result = new Hashtable();
189 result["success"] = "FALSE";
190
191 if (m_userServerModule.SendToUserServer(requestData, "region_shutdown"))
192 result["success"] = "TRUE";
193
194 XmlRpcResponse response = new XmlRpcResponse();
195 response.Value = result;
196 return response;
197 }
198
199 }
200} \ 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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using System.Threading;
34using System.Timers;
35using log4net;
36using Nwc.XmlRpc;
37using OpenMetaverse;
38using OpenSim.Data;
39using OpenSim.Framework;
40using OpenSim.Grid.Framework;
41using Timer=System.Timers.Timer;
42
43namespace OpenSim.Grid.MessagingServer.Modules
44{
45 public class MessageService
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 private MessageServerConfig m_cfg;
50 private UserDataBaseService m_userDataBaseService;
51
52 private IGridServiceCore m_messageCore;
53
54 private IInterServiceUserService m_userServerModule;
55 private IMessageRegionLookup m_regionModule;
56
57 // a dictionary of all current presences this server knows about
58 private Dictionary<UUID, UserPresenceData> m_presences = new Dictionary<UUID,UserPresenceData>();
59
60 public MessageService(MessageServerConfig cfg, IGridServiceCore messageCore, UserDataBaseService userDataBaseService)
61 {
62 m_cfg = cfg;
63 m_messageCore = messageCore;
64
65 m_userDataBaseService = userDataBaseService;
66
67 //???
68 UserConfig uc = new UserConfig();
69 uc.DatabaseConnect = cfg.DatabaseConnect;
70 uc.DatabaseProvider = cfg.DatabaseProvider;
71 }
72
73 public void Initialise()
74 {
75 }
76
77 public void PostInitialise()
78 {
79 IInterServiceUserService messageUserServer;
80 if (m_messageCore.TryGet<IInterServiceUserService>(out messageUserServer))
81 {
82 m_userServerModule = messageUserServer;
83 }
84
85 IMessageRegionLookup messageRegion;
86 if (m_messageCore.TryGet<IMessageRegionLookup>(out messageRegion))
87 {
88 m_regionModule = messageRegion;
89 }
90 }
91
92 public void RegisterHandlers()
93 {
94 //have these in separate method as some servers restart the http server and reregister all the handlers.
95
96 }
97
98 #region FriendList Methods
99
100 /// <summary>
101 /// Process Friendlist subscriptions for a user
102 /// The login method calls this for a User
103 /// </summary>
104 /// <param name="userpresence">The Agent we're processing the friendlist subscriptions for</param>
105 private void ProcessFriendListSubscriptions(UserPresenceData userpresence)
106 {
107 lock (m_presences)
108 {
109 m_presences[userpresence.agentData.AgentID] = userpresence;
110 }
111
112 Dictionary<UUID, FriendListItem> uFriendList = userpresence.friendData;
113 foreach (KeyValuePair<UUID, FriendListItem> pair in uFriendList)
114 {
115 UserPresenceData friendup = null;
116 lock (m_presences)
117 {
118 m_presences.TryGetValue(pair.Key, out friendup);
119 }
120 if (friendup != null)
121 {
122 SubscribeToPresenceUpdates(userpresence, friendup, pair.Value);
123 }
124 }
125 }
126
127 /// <summary>
128 /// Enqueues a presence update, sending info about user 'talkingAbout' to user 'receiver'.
129 /// </summary>
130 /// <param name="talkingAbout">We are sending presence information about this user.</param>
131 /// <param name="receiver">We are sending the presence update to this user</param>
132 private void enqueuePresenceUpdate(UserPresenceData talkingAbout, UserPresenceData receiver)
133 {
134 UserAgentData p2Handle = m_userDataBaseService.GetUserAgentData(receiver.agentData.AgentID);
135 if (p2Handle != null)
136 {
137 if (receiver.lookupUserRegionYN)
138 {
139 receiver.regionData.regionHandle = p2Handle.Handle;
140 }
141 else
142 {
143 receiver.lookupUserRegionYN = true; // TODO Huh?
144 }
145
146 PresenceInformer friendlistupdater = new PresenceInformer();
147 friendlistupdater.presence1 = talkingAbout;
148 friendlistupdater.presence2 = receiver;
149 friendlistupdater.OnGetRegionData += m_regionModule.GetRegionInfo;
150 friendlistupdater.OnDone += PresenceUpdateDone;
151 Util.FireAndForget(friendlistupdater.go);
152 }
153 else
154 {
155 m_log.WarnFormat("no data found for user {0}", receiver.agentData.AgentID);
156 // Skip because we can't find any data on the user
157 }
158 }
159
160 /// <summary>
161 /// Does the necessary work to subscribe one agent to another's presence notifications
162 /// Gets called by ProcessFriendListSubscriptions. You shouldn't call this directly
163 /// unless you know what you're doing
164 /// </summary>
165 /// <param name="userpresence">P1</param>
166 /// <param name="friendpresence">P2</param>
167 /// <param name="uFriendListItem"></param>
168 private void SubscribeToPresenceUpdates(UserPresenceData userpresence,
169 UserPresenceData friendpresence,
170 FriendListItem uFriendListItem)
171 {
172 // Can the friend see me online?
173 if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0)
174 {
175 // tell user to update friend about user's presence changes
176 if (!userpresence.subscriptionData.Contains(friendpresence.agentData.AgentID))
177 {
178 userpresence.subscriptionData.Add(friendpresence.agentData.AgentID);
179 }
180
181 // send an update about user's presence to the friend
182 enqueuePresenceUpdate(userpresence, friendpresence);
183 }
184
185 // Can I see the friend online?
186 if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0)
187 {
188 // tell friend to update user about friend's presence changes
189 if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID))
190 {
191 friendpresence.subscriptionData.Add(userpresence.agentData.AgentID);
192 }
193
194 // send an update about friend's presence to user.
195 enqueuePresenceUpdate(friendpresence, userpresence);
196 }
197 }
198
199 /// <summary>
200 /// Logoff Processor. Call this to clean up agent presence data and send logoff presence notifications
201 /// </summary>
202 /// <param name="AgentID"></param>
203 private void ProcessLogOff(UUID AgentID)
204 {
205 m_log.Info("[LOGOFF]: Processing Logoff");
206
207 UserPresenceData userPresence = null;
208 lock (m_presences)
209 {
210 m_presences.TryGetValue(AgentID, out userPresence);
211 }
212
213 if (userPresence != null) // found the user
214 {
215 List<UUID> AgentsNeedingNotification = userPresence.subscriptionData;
216 userPresence.OnlineYN = false;
217
218 for (int i = 0; i < AgentsNeedingNotification.Count; i++)
219 {
220 UserPresenceData friendPresence = null;
221 lock (m_presences)
222 {
223 m_presences.TryGetValue(AgentsNeedingNotification[i], out friendPresence);
224 }
225
226 // This might need to be enumerated and checked before we try to remove it.
227 if (friendPresence != null)
228 {
229 lock (friendPresence)
230 {
231 // no updates for this user anymore
232 friendPresence.subscriptionData.Remove(AgentID);
233
234 // set user's entry in the friend's list to offline (if it exists)
235 if (friendPresence.friendData.ContainsKey(AgentID))
236 {
237 friendPresence.friendData[AgentID].onlinestatus = false;
238 }
239 }
240
241 enqueuePresenceUpdate(userPresence, friendPresence);
242 }
243 }
244 }
245 }
246
247 #endregion
248
249 private void PresenceUpdateDone(PresenceInformer obj)
250 {
251 obj.OnGetRegionData -= m_regionModule.GetRegionInfo;
252 obj.OnDone -= PresenceUpdateDone;
253 }
254
255 #region UserServer Comms
256
257 /// <summary>
258 /// Returns a list of FriendsListItems that describe the friends and permissions in the friend
259 /// relationship for UUID friendslistowner. For faster lookup, we index by friend's UUID.
260 /// </summary>
261 /// <param name="friendlistowner">The agent that we're retreiving the friends Data for.</param>
262 private Dictionary<UUID, FriendListItem> GetUserFriendList(UUID friendlistowner)
263 {
264 Dictionary<UUID, FriendListItem> buddies = new Dictionary<UUID,FriendListItem>();
265
266 try
267 {
268 Hashtable param = new Hashtable();
269 param["ownerID"] = friendlistowner.ToString();
270
271 IList parameters = new ArrayList();
272 parameters.Add(param);
273 XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters);
274 XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000);
275 Hashtable respData = (Hashtable)resp.Value;
276
277 if (respData.Contains("avcount"))
278 {
279 buddies = ConvertXMLRPCDataToFriendListItemList(respData);
280 }
281
282 }
283 catch (WebException e)
284 {
285 m_log.Warn("Error when trying to fetch Avatar's friends list: " +
286 e.Message);
287 // Return Empty list (no friends)
288 }
289 return buddies;
290 }
291
292 /// <summary>
293 /// Converts XMLRPC Friend List to FriendListItem Object
294 /// </summary>
295 /// <param name="data">XMLRPC response data Hashtable</param>
296 /// <returns></returns>
297 public Dictionary<UUID, FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data)
298 {
299 Dictionary<UUID, FriendListItem> buddies = new Dictionary<UUID,FriendListItem>();
300 int buddycount = Convert.ToInt32((string)data["avcount"]);
301
302 for (int i = 0; i < buddycount; i++)
303 {
304 FriendListItem buddylistitem = new FriendListItem();
305
306 buddylistitem.FriendListOwner = new UUID((string)data["ownerID" + i.ToString()]);
307 buddylistitem.Friend = new UUID((string)data["friendID" + i.ToString()]);
308 buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]);
309 buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]);
310
311 buddies.Add(buddylistitem.Friend, buddylistitem);
312 }
313
314 return buddies;
315 }
316
317 /// <summary>
318 /// UserServer sends an expect_user method
319 /// this handles the method and provisions the
320 /// necessary info for presence to work
321 /// </summary>
322 /// <param name="request">UserServer Data</param>
323 /// <returns></returns>
324 public XmlRpcResponse UserLoggedOn(XmlRpcRequest request, IPEndPoint remoteClient)
325 {
326 try
327 {
328 Hashtable requestData = (Hashtable)request.Params[0];
329
330 AgentCircuitData agentData = new AgentCircuitData();
331 agentData.SessionID = new UUID((string)requestData["sessionid"]);
332 agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]);
333 agentData.firstname = (string)requestData["firstname"];
334 agentData.lastname = (string)requestData["lastname"];
335 agentData.AgentID = new UUID((string)requestData["agentid"]);
336 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
337 agentData.CapsPath = (string)requestData["caps_path"];
338
339 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
340 {
341 agentData.child = true;
342 }
343 else
344 {
345 agentData.startpos =
346 new Vector3(Convert.ToSingle(requestData["positionx"]),
347 Convert.ToSingle(requestData["positiony"]),
348 Convert.ToSingle(requestData["positionz"]));
349 agentData.child = false;
350 }
351
352 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
353
354 m_log.InfoFormat("[LOGON]: User {0} {1} logged into region {2} as {3} agent, building indexes for user",
355 agentData.firstname, agentData.lastname, regionHandle, agentData.child ? "child" : "root");
356
357 UserPresenceData up = new UserPresenceData();
358 up.agentData = agentData;
359 up.friendData = GetUserFriendList(agentData.AgentID);
360 up.regionData = m_regionModule.GetRegionInfo(regionHandle);
361 up.OnlineYN = true;
362 up.lookupUserRegionYN = false;
363 ProcessFriendListSubscriptions(up);
364
365 }
366 catch (Exception e)
367 {
368 m_log.WarnFormat("[LOGIN]: Exception on UserLoggedOn: {0}", e);
369 }
370
371 return new XmlRpcResponse();
372
373 }
374
375 /// <summary>
376 /// The UserServer got a Logoff message
377 /// Cleanup time for that user. Send out presence notifications
378 /// </summary>
379 /// <param name="request"></param>
380 /// <returns></returns>
381 public XmlRpcResponse UserLoggedOff(XmlRpcRequest request, IPEndPoint remoteClient)
382 {
383 try
384 {
385 m_log.Info("[USERLOGOFF]: User logged off called");
386 Hashtable requestData = (Hashtable)request.Params[0];
387
388 UUID AgentID = new UUID((string)requestData["agentid"]);
389 ProcessLogOff(AgentID);
390 }
391 catch (Exception e)
392 {
393 m_log.WarnFormat("[USERLOGOFF]: Exception on UserLoggedOff: {0}", e);
394 }
395
396 return new XmlRpcResponse();
397 }
398
399 #endregion
400
401 public XmlRpcResponse GetPresenceInfoBulk(XmlRpcRequest request, IPEndPoint remoteClient)
402 {
403 Hashtable paramHash = (Hashtable)request.Params[0];
404 Hashtable result = new Hashtable();
405
406 // TODO check access (recv_key/send_key)
407
408 IList list = (IList)paramHash["uuids"];
409
410 // convert into List<UUID>
411 List<UUID> uuids = new List<UUID>();
412 for (int i = 0; i < list.Count; ++i)
413 {
414 UUID uuid;
415 if (UUID.TryParse((string)list[i], out uuid))
416 {
417 uuids.Add(uuid);
418 }
419 }
420
421 try {
422 Dictionary<UUID, FriendRegionInfo> infos = m_userDataBaseService.GetFriendRegionInfos(uuids);
423 m_log.DebugFormat("[FRIEND]: Got {0} region entries back.", infos.Count);
424 int count = 0;
425 foreach (KeyValuePair<UUID, FriendRegionInfo> pair in infos)
426 {
427 result["uuid_" + count] = pair.Key.ToString();
428 result["isOnline_" + count] = pair.Value.isOnline;
429 result["regionHandle_" + count] = pair.Value.regionHandle.ToString(); // XML-RPC doesn't know ulongs
430 ++count;
431 }
432 result["count"] = count;
433
434 XmlRpcResponse response = new XmlRpcResponse();
435 response.Value = result;
436 return response;
437 }
438 catch(Exception e) {
439 m_log.Error("Got exception:", e);
440 throw e;
441 }
442 }
443
444 public XmlRpcResponse AgentLocation(XmlRpcRequest request, IPEndPoint remoteClient)
445 {
446 Hashtable requestData = (Hashtable)request.Params[0];
447 Hashtable result = new Hashtable();
448 result["success"] = "FALSE";
449
450 if (m_userServerModule.SendToUserServer(requestData, "agent_location"))
451 result["success"] = "TRUE";
452
453
454 XmlRpcResponse response = new XmlRpcResponse();
455 response.Value = result;
456 return response;
457 }
458
459 public XmlRpcResponse AgentLeaving(XmlRpcRequest request, IPEndPoint remoteClient)
460 {
461 Hashtable requestData = (Hashtable)request.Params[0];
462 Hashtable result = new Hashtable();
463 result["success"] = "FALSE";
464
465 if (m_userServerModule.SendToUserServer(requestData, "agent_leaving"))
466 result["success"] = "TRUE";
467
468 XmlRpcResponse response = new XmlRpcResponse();
469 response.Value = result;
470 return response;
471 }
472
473 public XmlRpcResponse ProcessRegionShutdown(XmlRpcRequest request, IPEndPoint remoteClient)
474 {
475 Hashtable requestData = (Hashtable)request.Params[0];
476 Hashtable result = new Hashtable();
477 result["success"] = "FALSE";
478
479 UUID regionID;
480 if (UUID.TryParse((string)requestData["regionid"], out regionID))
481 {
482 m_log.DebugFormat("[PRESENCE] Processing region restart for {0}", regionID);
483 result["success"] = "TRUE";
484
485 foreach (UserPresenceData up in m_presences.Values)
486 {
487 if (up.regionData.UUID == regionID)
488 {
489 if (up.OnlineYN)
490 {
491 m_log.DebugFormat("[PRESENCE] Logging off {0} because the region they were in has gone", up.agentData.AgentID);
492 ProcessLogOff(up.agentData.AgentID);
493 }
494 }
495 }
496 }
497
498 XmlRpcResponse response = new XmlRpcResponse();
499 response.Value = result;
500 return response;
501 }
502 }
503} \ 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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections.Generic;
29using OpenMetaverse;
30
31namespace OpenSim.Grid.MessagingServer.Modules
32{
33 // This is a wrapper for a List<UUID> so it can be happily stored in a hashtable.
34 public class PresenceBackreferenceEntry
35 {
36 List<UUID> AgentList = new List<UUID>();
37
38 public PresenceBackreferenceEntry()
39 {
40
41 }
42
43 public void Add(UUID item)
44 {
45 lock (AgentList)
46 {
47 AgentList.Add(item);
48 }
49 }
50
51 public UUID getitem(int index)
52 {
53 UUID result = UUID.Zero;
54 lock (AgentList)
55 {
56 if (index > 0 && index < AgentList.Count)
57 {
58 result = AgentList[index];
59 }
60 }
61 return result;
62 }
63
64 public int Count
65 {
66 get
67 {
68 int count = 0;
69 lock (AgentList)
70 {
71 count = AgentList.Count;
72 }
73 return count;
74 }
75 }
76
77 public void Remove(UUID item)
78 {
79 lock (AgentList)
80 {
81 if (AgentList.Contains(item))
82 AgentList.Remove(item);
83 }
84 }
85
86 public bool contains(UUID item)
87 {
88 bool result = false;
89 lock (AgentList)
90 {
91 result = AgentList.Contains(item);
92 }
93 return result;
94 }
95 }
96}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections;
29using System.Net;
30using System.Reflection;
31using log4net;
32using Nwc.XmlRpc;
33using OpenSim.Data;
34
35namespace OpenSim.Grid.MessagingServer.Modules
36{
37 public delegate RegionProfileData GetRegionData(ulong region_handle);
38 public delegate void Done(PresenceInformer obj);
39
40
41 public class PresenceInformer
42 {
43 public event GetRegionData OnGetRegionData;
44 public event Done OnDone;
45
46 private GetRegionData handlerGetRegionData = null;
47 private Done handlerDone = null;
48
49 public UserPresenceData presence1 = null;
50 public UserPresenceData presence2 = null;
51 public string gridserverurl, gridserversendkey, gridserverrecvkey;
52 public bool lookupRegion = true;
53 //public methodGroup
54
55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
56
57 public PresenceInformer()
58 {
59
60 }
61 public void go(object o)
62 {
63 if (presence1 != null && presence2 != null)
64 {
65 SendRegionPresenceUpdate(presence1, presence2);
66 }
67
68 }
69
70 /// <summary>
71 /// Informs a region about an Agent
72 /// </summary>
73 /// <param name="TalkingAbout">User to talk about</param>
74 /// <param name="UserToUpdate">User we're sending this too (contains the region)</param>
75 public void SendRegionPresenceUpdate(UserPresenceData TalkingAbout, UserPresenceData UserToUpdate)
76 {
77 // TODO: Fill in pertenant Presence Data from 'TalkingAbout'
78 RegionProfileData whichRegion = new RegionProfileData();
79 if (lookupRegion)
80 {
81 handlerGetRegionData = OnGetRegionData;
82 if (handlerGetRegionData != null)
83 {
84 whichRegion = handlerGetRegionData(UserToUpdate.regionData.regionHandle);
85 }
86 //RegionProfileData rp = RegionProfileData.RequestSimProfileData(UserToUpdate.regionData.regionHandle, gridserverurl, gridserversendkey, gridserverrecvkey);
87
88 //whichRegion = rp;
89 }
90 else
91 {
92 whichRegion = UserToUpdate.regionData;
93 }
94 //whichRegion.httpServerURI
95
96 if (whichRegion != null)
97 {
98 Hashtable PresenceParams = new Hashtable();
99 PresenceParams.Add("agent_id",TalkingAbout.agentData.AgentID.ToString());
100 PresenceParams.Add("notify_id",UserToUpdate.agentData.AgentID.ToString());
101 if (TalkingAbout.OnlineYN)
102 PresenceParams.Add("status","TRUE");
103 else
104 PresenceParams.Add("status","FALSE");
105
106 ArrayList SendParams = new ArrayList();
107 SendParams.Add(PresenceParams);
108
109 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);
110 // Send
111 XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams);
112 try
113 {
114 // XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000);
115 RegionReq.Send(whichRegion.httpServerURI, 6000);
116 }
117 catch (WebException)
118 {
119 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);
120 }
121 }
122 else
123 {
124 m_log.Info("[PRESENCEUPDATER]: Region data was null skipping");
125
126 }
127
128 handlerDone = OnDone;
129 if (handlerDone != null)
130 {
131 handlerDone(this);
132 }
133 }
134 }
135}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Grid.MessagingServer.Modules
29{
30 class PresenceService
31 {
32 }
33}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Framework;
30using OpenSim.Framework.Communications;
31
32namespace OpenSim.Grid.MessagingServer.Modules
33{
34 public class UserDataBaseService : UserManagerBase
35 {
36 /// <summary>
37 /// Constructor.
38 /// </summary>
39 /// Passing null to parent because we never use any function that requires an interservice inventory call.
40 public UserDataBaseService()
41 : base(null)
42 {
43 }
44
45 public UserAgentData GetUserAgentData(UUID AgentID)
46 {
47 UserProfileData userProfile = GetUserProfile(AgentID);
48
49 if (userProfile != null)
50 {
51 return userProfile.CurrentAgent;
52 }
53
54 return null;
55 }
56
57 public override UserProfileData SetupMasterUser(string firstName, string lastName)
58 {
59 //throw new Exception("The method or operation is not implemented.");
60 return null;
61 }
62
63 public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
64 {
65 //throw new Exception("The method or operation is not implemented.");
66 return null;
67 }
68
69 public override UserProfileData SetupMasterUser(UUID uuid)
70 {
71 //throw new Exception("The method or operation is not implemented.");
72 return null;
73 }
74 }
75}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Data;
32using OpenSim.Framework;
33
34namespace OpenSim.Grid.MessagingServer
35{
36 public class UserPresenceData
37 {
38 public AgentCircuitData agentData = new AgentCircuitData();
39 public RegionProfileData regionData = new RegionProfileData();
40 public string httpURI = String.Empty;
41 public Dictionary<UUID, FriendListItem> friendData = new Dictionary<UUID,FriendListItem>();
42 public List<UUID> subscriptionData = new List<UUID>();
43 public bool OnlineYN = true;
44 public bool lookupUserRegionYN = true;
45
46 public UserPresenceData()
47 {
48 }
49 }
50}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Grid.MessagingServer.Modules
29{
30 public class WorkUnitBase
31 {
32 }
33}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Grid.MessagingServer.Modules
29{
30 public class WorkUnitPresenceUpdate : WorkUnitBase
31 {
32 }
33}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using log4net;
33using Nini.Config;
34using log4net.Config;
35using OpenSim.Framework;
36using OpenSim.Framework.Console;
37using OpenSim.Framework.Servers;
38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Grid.Framework;
40using OpenSim.Grid.MessagingServer.Modules;
41
42namespace OpenSim.Grid.MessagingServer
43{
44 /// <summary>
45 /// </summary>
46 public class OpenMessage_Main : BaseOpenSimServer , IGridServiceCore
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 private MessageServerConfig Cfg;
51 private MessageService msgsvc;
52
53 private MessageRegionModule m_regionModule;
54 private InterMessageUserServerModule m_userServerModule;
55
56 private UserDataBaseService m_userDataBaseService;
57
58 // private UUID m_lastCreatedUser = UUID.Random();
59
60 protected static string m_consoleType = "local";
61 protected static IConfigSource m_config = null;
62 protected static string m_configFile = "MessagingServer_Config.xml";
63
64 public static void Main(string[] args)
65 {
66 ArgvConfigSource argvSource = new ArgvConfigSource(args);
67 argvSource.AddSwitch("Startup", "console", "c");
68 argvSource.AddSwitch("Startup", "xmlfile", "x");
69
70 IConfig startupConfig = argvSource.Configs["Startup"];
71 if (startupConfig != null)
72 {
73 m_consoleType = startupConfig.GetString("console", "local");
74 m_configFile = startupConfig.GetString("xmlfile", "MessagingServer_Config.xml");
75 }
76
77 m_config = argvSource;
78
79 XmlConfigurator.Configure();
80
81 m_log.Info("[SERVER]: Launching MessagingServer...");
82
83 OpenMessage_Main messageserver = new OpenMessage_Main();
84
85 messageserver.Startup();
86 messageserver.Work();
87 }
88
89 public OpenMessage_Main()
90 {
91 switch (m_consoleType)
92 {
93 case "rest":
94 m_console = new RemoteConsole("Messaging");
95 break;
96 case "basic":
97 m_console = new CommandConsole("Messaging");
98 break;
99 default:
100 m_console = new LocalConsole("Messaging");
101 break;
102 }
103 MainConsole.Instance = m_console;
104 }
105
106 private void Work()
107 {
108 m_console.Output("Enter help for a list of commands\n");
109
110 while (true)
111 {
112 m_console.Prompt();
113 }
114 }
115
116 private void registerWithUserServer()
117 {
118 if (m_userServerModule.registerWithUserServer())
119 {
120 if (m_httpServer == null)
121 {
122 m_log.Info("[SERVER]: Starting HTTP process");
123 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
124
125 if (m_console is RemoteConsole)
126 {
127 RemoteConsole c = (RemoteConsole)m_console;
128 c.SetServer(m_httpServer);
129 IConfig netConfig = m_config.AddConfig("Network");
130 netConfig.Set("ConsoleUser", Cfg.ConsoleUser);
131 netConfig.Set("ConsolePass", Cfg.ConsolePass);
132 c.ReadConfig(m_config);
133 }
134
135 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
136 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff);
137 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk);
138 m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown);
139 m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation);
140 m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving);
141
142 m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup);
143 m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown);
144
145 m_httpServer.Start();
146 }
147 m_log.Info("[SERVER]: Userserver registration was successful");
148 }
149 else
150 {
151 m_log.Error("[STARTUP]: Unable to connect to User Server");
152 }
153
154 }
155
156 private void deregisterFromUserServer()
157 {
158 m_userServerModule.deregisterWithUserServer();
159// if (m_httpServer != null)
160// {
161 // try a completely fresh registration, with fresh handlers, too
162// m_httpServer.Stop();
163// m_httpServer = null;
164// }
165 m_console.Output("[SERVER]: Deregistered from userserver.");
166 }
167
168 protected override void StartupSpecific()
169 {
170 Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), m_configFile)));
171
172 m_userDataBaseService = new UserDataBaseService();
173 m_userDataBaseService.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect);
174
175 //Register the database access service so modules can fetch it
176 // RegisterInterface<UserDataBaseService>(m_userDataBaseService);
177
178 m_userServerModule = new InterMessageUserServerModule(Cfg, this);
179 m_userServerModule.Initialise();
180
181 msgsvc = new MessageService(Cfg, this, m_userDataBaseService);
182 msgsvc.Initialise();
183
184 m_regionModule = new MessageRegionModule(Cfg, this);
185 m_regionModule.Initialise();
186
187 registerWithUserServer();
188
189 m_userServerModule.PostInitialise();
190 msgsvc.PostInitialise();
191 m_regionModule.PostInitialise();
192
193 m_log.Info("[SERVER]: Messageserver 0.5 - Startup complete");
194
195 base.StartupSpecific();
196
197 m_console.Commands.AddCommand("messageserver", false, "clear cache",
198 "clear cache",
199 "Clear presence cache", HandleClearCache);
200
201 m_console.Commands.AddCommand("messageserver", false, "register",
202 "register",
203 "Re-register with user server(s)", HandleRegister);
204 }
205
206 public void do_create(string what)
207 {
208 //switch (what)
209 //{
210 // case "user":
211 // try
212 // {
213 // //userID =
214 // //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
215 // } catch (Exception ex)
216 // {
217 // m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString());
218 // }
219
220 // try
221 // {
222 // //RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/",
223 // //userID.Guid);
224 // }
225 // catch (Exception ex)
226 // {
227 // m_console.Error("[SERVER]: Error creating inventory for user: {0}", ex.ToString());
228 // }
229 // // m_lastCreatedUser = userID;
230 // break;
231 //}
232 }
233
234 private void HandleClearCache(string module, string[] cmd)
235 {
236 int entries = m_regionModule.ClearRegionCache();
237 m_console.Output("Region cache cleared! Cleared " +
238 entries.ToString() + " entries");
239 }
240
241 private void HandleRegister(string module, string[] cmd)
242 {
243 deregisterFromUserServer();
244 registerWithUserServer();
245 }
246
247 public override void ShutdownSpecific()
248 {
249 m_userServerModule.deregisterWithUserServer();
250 }
251
252 #region IUGAIMCore
253 protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
254
255 /// <summary>
256 /// Register an Module interface.
257 /// </summary>
258 /// <typeparam name="T"></typeparam>
259 /// <param name="iface"></param>
260 public void RegisterInterface<T>(T iface)
261 {
262 lock (m_moduleInterfaces)
263 {
264 if (!m_moduleInterfaces.ContainsKey(typeof(T)))
265 {
266 m_moduleInterfaces.Add(typeof(T), iface);
267 }
268 }
269 }
270
271 public bool TryGet<T>(out T iface)
272 {
273 if (m_moduleInterfaces.ContainsKey(typeof(T)))
274 {
275 iface = (T)m_moduleInterfaces[typeof(T)];
276 return true;
277 }
278 iface = default(T);
279 return false;
280 }
281
282 public T Get<T>()
283 {
284 return (T)m_moduleInterfaces[typeof(T)];
285 }
286
287 public BaseHttpServer GetHttpServer()
288 {
289 return m_httpServer;
290 }
291 #endregion
292 }
293}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following
31// attributes.
32//
33// change them to the information which is associated with the assembly
34// you compile.
35
36[assembly: AssemblyTitle("UserConfig")]
37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("http://opensimulator.org")]
40[assembly: AssemblyProduct("UserConfig")]
41[assembly: AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")]
44
45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)]
48
49// The assembly version has following format :
50//
51// Major.Minor.Build.Revision
52//
53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default):
55
56[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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using Db4objects.Db4o;
30using OpenSim.Framework.Configuration;
31using OpenSim.Framework.Console;
32using OpenSim.Framework.Interfaces;
33
34namespace OpenUser.Config.UserConfigDb4o
35{
36 public class Db4oConfigPlugin: IUserConfig
37 {
38 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
39
40 public UserConfig GetConfigObject()
41 {
42 m_log.Info("[DBUSERCONFIG]: Loading Db40Config dll");
43 return new DbUserConfig();
44 }
45 }
46
47 public class DbUserConfig : UserConfig
48 {
49 private IObjectContainer db;
50
51 public void LoadDefaults()
52 {
53 m_log.Info("DbUserConfig.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
54
55 this.DefaultStartupMsg = m_log.CmdPrompt("Default startup message", "Welcome to OGS");
56
57 this.GridServerURL = m_log.CmdPrompt("Grid server URL","http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/");
58 this.GridSendKey = m_log.CmdPrompt("Key to send to grid server","null");
59 this.GridRecvKey = m_log.CmdPrompt("Key to expect from grid server","null");
60 }
61
62 public override void InitConfig()
63 {
64 try
65 {
66 db = Db4oFactory.OpenFile("openuser.yap");
67 IObjectSet result = db.Get(typeof(DbUserConfig));
68 if (result.Count == 1)
69 {
70 m_log.Info("[DBUSERCONFIG]: DbUserConfig.cs:InitConfig() - Found a UserConfig object in the local database, loading");
71 foreach (DbUserConfig cfg in result)
72 {
73 this.GridServerURL=cfg.GridServerURL;
74 this.GridSendKey=cfg.GridSendKey;
75 this.GridRecvKey=cfg.GridRecvKey;
76 this.DefaultStartupMsg=cfg.DefaultStartupMsg;
77 }
78 }
79 else
80 {
81 m_log.Info("[DBUSERCONFIG]: DbUserConfig.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
82 LoadDefaults();
83 m_log.Info("[DBUSERCONFIG]: Writing out default settings to local database");
84 db.Set(this);
85 db.Close();
86 }
87 }
88 catch(Exception e)
89 {
90 m_log.Warn("DbUserConfig.cs:InitConfig() - Exception occured");
91 m_log.Warn(e.ToString());
92 }
93
94 m_log.Info("[DBUSERCONFIG]: User settings loaded:");
95 m_log.Info("[DBUSERCONFIG]: Default startup message: " + this.DefaultStartupMsg);
96 m_log.Info("[DBUSERCONFIG]: Grid server URL: " + this.GridServerURL);
97 m_log.Info("[DBUSERCONFIG]: Key to send to grid: " + this.GridSendKey);
98 m_log.Info("[DBUSERCONFIG]: Key to expect from grid: " + this.GridRecvKey);
99 }
100
101 public void Shutdown()
102 {
103 db.Close();
104 }
105 }
106}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32using System.Threading;
33using log4net;
34using Nwc.XmlRpc;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Framework.Console;
38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Servers;
40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Grid.Framework;
42
43
44namespace OpenSim.Grid.UserServer.Modules
45{
46 public class AvatarCreationModule
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 private UserDataBaseService m_userDataBaseService;
51 // private BaseHttpServer m_httpServer;
52 // TODO: unused: private UserConfig m_config;
53
54 private string m_inventoryServerUrl;
55 private IInterServiceInventoryServices m_inventoryService;
56
57 public AvatarCreationModule(UserDataBaseService userDataBaseService, UserConfig config, IInterServiceInventoryServices inventoryService)
58 {
59 // TODO: unused: m_config = config;
60 m_userDataBaseService = userDataBaseService;
61 m_inventoryService = inventoryService;
62 m_inventoryServerUrl = config.InventoryUrl.OriginalString;
63 }
64
65 public void Initialise(IGridServiceCore core)
66 {
67 CommandConsole console;
68 if (core.TryGet<CommandConsole>(out console))
69 {
70 console.Commands.AddCommand("userserver", false, "clone avatar",
71 "clone avatar <TemplateAvatarFirstName> <TemplateAvatarLastName> <TargetAvatarFirstName> <TargetAvatarLastName>",
72 "Clone the template avatar's inventory into a target avatar", RunCommand);
73 }
74 }
75
76 public void PostInitialise()
77 {
78
79 }
80
81 public void RegisterHandlers(BaseHttpServer httpServer)
82 {
83 }
84
85 public void RunCommand(string module, string[] cmd)
86 {
87 if ((cmd.Length == 6) && (cmd[0] == "clone") && (cmd[1] == "avatar"))
88 {
89 try
90 {
91 string tFirst = cmd[2];
92 string tLast = cmd[3];
93
94 string nFirst = cmd[4];
95 string nLast = cmd[5];
96
97 UserProfileData templateAvatar = m_userDataBaseService.GetUserProfile(tFirst, tLast);
98 UserProfileData newAvatar = m_userDataBaseService.GetUserProfile(nFirst, nLast);
99
100 if (templateAvatar == null)
101 {
102 m_log.ErrorFormat("[AvatarAppearance] Clone Avatar: Could not find template avatar {0} , {1}", tFirst, tLast);
103 return;
104 }
105
106 if (newAvatar == null)
107 {
108 m_log.ErrorFormat("[AvatarAppearance] Clone Avatar: Could not find target avatar {0} , {1}", nFirst, nLast);
109 return;
110 }
111 Guid avatar = newAvatar.ID.Guid;
112 Guid template = templateAvatar.ID.Guid;
113 CloneAvatar(avatar, template, true, true);
114
115 }
116 catch (Exception e)
117 {
118 m_log.Error("Error: " + e.ToString());
119 }
120 }
121 }
122 #region Avatar Appearance Creation
123
124 public bool CloneAvatar(Guid avatarID, Guid templateID, bool modifyPermissions, bool removeTargetsClothes)
125 {
126 m_log.InfoFormat("[AvatarAppearance] Starting to clone avatar {0} inventory to avatar {1}", templateID.ToString(), avatarID.ToString());
127 // TODO: unused: Guid bodyFolder = Guid.Empty;
128 // TODO: unused: Guid clothesFolder = Guid.Empty;
129 bool success = false;
130
131 UUID avID = new UUID(avatarID);
132 List<InventoryFolderBase> avatarInventory = m_inventoryService.GetInventorySkeleton(avID);
133 if ((avatarInventory == null) || (avatarInventory.Count == 0))
134 {
135 m_log.InfoFormat("[AvatarAppearance] No inventory found for user {0} , so creating it", avID.ToString());
136 m_inventoryService.CreateNewUserInventory(avID);
137 Thread.Sleep(5000);
138 avatarInventory = m_inventoryService.GetInventorySkeleton(avID);
139 }
140
141 if ((avatarInventory != null) && (avatarInventory.Count > 0))
142 {
143 UUID tempOwnID = new UUID(templateID);
144 AvatarAppearance appearance = m_userDataBaseService.GetUserAppearance(tempOwnID);
145
146 if (removeTargetsClothes)
147 {
148 //remove clothes and attachments from target avatar so that the end result isn't a merger of its existing clothes
149 // and the clothes from the template avatar.
150 RemoveClothesAndAttachments(avID);
151 }
152
153 List<InventoryFolderBase> templateInventory = m_inventoryService.GetInventorySkeleton(tempOwnID);
154 if ((templateInventory != null) && (templateInventory.Count != 0))
155 {
156 for (int i = 0; i < templateInventory.Count; i++)
157 {
158 if (templateInventory[i].ParentID == UUID.Zero)
159 {
160 success = CloneFolder(avatarInventory, avID, UUID.Zero, appearance, templateInventory[i], templateInventory, modifyPermissions);
161 break;
162 }
163 }
164 }
165 else
166 {
167 m_log.InfoFormat("[AvatarAppearance] Failed to find the template owner's {0} inventory", tempOwnID);
168 }
169 }
170 m_log.InfoFormat("[AvatarAppearance] finished cloning avatar with result: {0}", success);
171 return success;
172 }
173
174 private bool CloneFolder(List<InventoryFolderBase> avatarInventory, UUID avID, UUID parentFolder, AvatarAppearance appearance, InventoryFolderBase templateFolder, List<InventoryFolderBase> templateFolders, bool modifyPermissions)
175 {
176 bool success = false;
177 UUID templateFolderId = templateFolder.ID;
178 if (templateFolderId != UUID.Zero)
179 {
180 InventoryFolderBase toFolder = FindFolder(templateFolder.Name, parentFolder.Guid, avatarInventory);
181 if (toFolder == null)
182 {
183 //create new folder
184 toFolder = new InventoryFolderBase();
185 toFolder.ID = UUID.Random();
186 toFolder.Name = templateFolder.Name;
187 toFolder.Owner = avID;
188 toFolder.Type = templateFolder.Type;
189 toFolder.Version = 1;
190 toFolder.ParentID = parentFolder;
191 if (!SynchronousRestObjectRequester.MakeRequest<InventoryFolderBase, bool>(
192 "POST", m_inventoryServerUrl + "CreateFolder/", toFolder))
193 {
194 m_log.InfoFormat("[AvatarApperance] Couldn't make new folder {0} in users inventory", toFolder.Name);
195 return false;
196 }
197 else
198 {
199 // m_log.InfoFormat("made new folder {0} in users inventory", toFolder.Name);
200 }
201 }
202
203 List<InventoryItemBase> templateItems = SynchronousRestObjectRequester.MakeRequest<Guid, List<InventoryItemBase>>(
204 "POST", m_inventoryServerUrl + "GetItems/", templateFolderId.Guid);
205 if ((templateItems != null) && (templateItems.Count > 0))
206 {
207 List<ClothesAttachment> wornClothes = new List<ClothesAttachment>();
208 List<ClothesAttachment> attachedItems = new List<ClothesAttachment>();
209
210 foreach (InventoryItemBase item in templateItems)
211 {
212
213 UUID clonedItemId = CloneInventoryItem(avID, toFolder.ID, item, modifyPermissions);
214 if (clonedItemId != UUID.Zero)
215 {
216 int appearanceType = ItemIsPartOfAppearance(item, appearance);
217 if (appearanceType >= 0)
218 {
219 // UpdateAvatarAppearance(avID, appearanceType, clonedItemId, item.AssetID);
220 wornClothes.Add(new ClothesAttachment(appearanceType, clonedItemId, item.AssetID));
221 }
222
223 if (appearance != null)
224 {
225 int attachment = appearance.GetAttachpoint(item.ID);
226 if (attachment > 0)
227 {
228 //UpdateAvatarAttachment(avID, attachment, clonedItemId, item.AssetID);
229 attachedItems.Add(new ClothesAttachment(attachment, clonedItemId, item.AssetID));
230 }
231 }
232 success = true;
233 }
234 }
235
236 if ((wornClothes.Count > 0) || (attachedItems.Count > 0))
237 {
238 //Update the worn clothes and attachments
239 AvatarAppearance targetAppearance = GetAppearance(avID);
240 if (targetAppearance != null)
241 {
242 foreach (ClothesAttachment wornItem in wornClothes)
243 {
244 targetAppearance.Wearables[wornItem.Type].AssetID = wornItem.AssetID;
245 targetAppearance.Wearables[wornItem.Type].ItemID = wornItem.ItemID;
246 }
247
248 foreach (ClothesAttachment wornItem in attachedItems)
249 {
250 targetAppearance.SetAttachment(wornItem.Type, wornItem.ItemID, wornItem.AssetID);
251 }
252
253 m_userDataBaseService.UpdateUserAppearance(avID, targetAppearance);
254 wornClothes.Clear();
255 attachedItems.Clear();
256 }
257 }
258 }
259 else if ((templateItems != null) && (templateItems.Count == 0))
260 {
261 // m_log.Info("[AvatarAppearance]Folder being cloned was empty");
262 success = true;
263 }
264
265 List<InventoryFolderBase> subFolders = FindSubFolders(templateFolder.ID.Guid, templateFolders);
266 foreach (InventoryFolderBase subFolder in subFolders)
267 {
268 if (subFolder.Name.ToLower() != "trash")
269 {
270 success = CloneFolder(avatarInventory, avID, toFolder.ID, appearance, subFolder, templateFolders, modifyPermissions);
271 }
272 }
273 }
274 else
275 {
276 m_log.Info("[AvatarAppearance] Failed to find the template folder");
277 }
278 return success;
279 }
280
281 private UUID CloneInventoryItem(UUID avatarID, UUID avatarFolder, InventoryItemBase item, bool modifyPerms)
282 {
283 if (avatarFolder != UUID.Zero)
284 {
285 InventoryItemBase clonedItem = new InventoryItemBase();
286 clonedItem.Owner = avatarID;
287 clonedItem.AssetID = item.AssetID;
288 clonedItem.AssetType = item.AssetType;
289 clonedItem.BasePermissions = item.BasePermissions;
290 clonedItem.CreationDate = item.CreationDate;
291 clonedItem.CreatorId = item.CreatorId;
292 clonedItem.CreatorIdAsUuid = item.CreatorIdAsUuid;
293 clonedItem.CurrentPermissions = item.CurrentPermissions;
294 clonedItem.Description = item.Description;
295 clonedItem.EveryOnePermissions = item.EveryOnePermissions;
296 clonedItem.Flags = item.Flags;
297 clonedItem.Folder = avatarFolder;
298 clonedItem.GroupID = item.GroupID;
299 clonedItem.GroupOwned = item.GroupOwned;
300 clonedItem.GroupPermissions = item.GroupPermissions;
301 clonedItem.ID = UUID.Random();
302 clonedItem.InvType = item.InvType;
303 clonedItem.Name = item.Name;
304 clonedItem.NextPermissions = item.NextPermissions;
305 clonedItem.SalePrice = item.SalePrice;
306 clonedItem.SaleType = item.SaleType;
307
308 if (modifyPerms)
309 {
310 ModifyPermissions(ref clonedItem);
311 }
312
313 SynchronousRestObjectRequester.MakeRequest<InventoryItemBase, bool>(
314 "POST", m_inventoryServerUrl + "AddNewItem/", clonedItem);
315
316 return clonedItem.ID;
317 }
318
319 return UUID.Zero;
320 }
321
322 // TODO: unused
323 // private void UpdateAvatarAppearance(UUID avatarID, int wearableType, UUID itemID, UUID assetID)
324 // {
325 // AvatarAppearance appearance = GetAppearance(avatarID);
326 // appearance.Wearables[wearableType].AssetID = assetID;
327 // appearance.Wearables[wearableType].ItemID = itemID;
328 // m_userDataBaseService.UpdateUserAppearance(avatarID, appearance);
329 // }
330
331 // TODO: unused
332 // private void UpdateAvatarAttachment(UUID avatarID, int attachmentPoint, UUID itemID, UUID assetID)
333 // {
334 // AvatarAppearance appearance = GetAppearance(avatarID);
335 // appearance.SetAttachment(attachmentPoint, itemID, assetID);
336 // m_userDataBaseService.UpdateUserAppearance(avatarID, appearance);
337 // }
338
339 private void RemoveClothesAndAttachments(UUID avatarID)
340 {
341 AvatarAppearance appearance = GetAppearance(avatarID);
342
343 appearance.ClearWearables();
344 appearance.ClearAttachments();
345 m_userDataBaseService.UpdateUserAppearance(avatarID, appearance);
346
347 }
348
349 private AvatarAppearance GetAppearance(UUID avatarID)
350 {
351 AvatarAppearance appearance = m_userDataBaseService.GetUserAppearance(avatarID);
352 if (appearance == null)
353 {
354 appearance = CreateDefaultAppearance(avatarID);
355 }
356 return appearance;
357 }
358
359 // TODO: unused
360 // private UUID FindFolderID(string name, List<InventoryFolderBase> folders)
361 // {
362 // foreach (InventoryFolderBase folder in folders)
363 // {
364 // if (folder.Name == name)
365 // {
366 // return folder.ID;
367 // }
368 // }
369 // return UUID.Zero;
370 // }
371
372 // TODO: unused
373 // private InventoryFolderBase FindFolder(string name, List<InventoryFolderBase> folders)
374 // {
375 // foreach (InventoryFolderBase folder in folders)
376 // {
377 // if (folder.Name == name)
378 // {
379 // return folder;
380 // }
381 // }
382 // return null;
383 // }
384
385 private InventoryFolderBase FindFolder(string name, Guid parentFolderID, List<InventoryFolderBase> folders)
386 {
387 foreach (InventoryFolderBase folder in folders)
388 {
389 if ((folder.Name == name) && (folder.ParentID.Guid == parentFolderID))
390 {
391 return folder;
392 }
393 }
394 return null;
395 }
396
397 // TODO: unused
398 // private InventoryItemBase GetItem(string itemName, List<InventoryItemBase> items)
399 // {
400 // foreach (InventoryItemBase item in items)
401 // {
402 // if (item.Name.ToLower() == itemName.ToLower())
403 // {
404 // return item;
405 // }
406 // }
407 // return null;
408 // }
409
410 private List<InventoryFolderBase> FindSubFolders(Guid parentFolderID, List<InventoryFolderBase> folders)
411 {
412 List<InventoryFolderBase> subFolders = new List<InventoryFolderBase>();
413 foreach (InventoryFolderBase folder in folders)
414 {
415 if (folder.ParentID.Guid == parentFolderID)
416 {
417 subFolders.Add(folder);
418 }
419 }
420 return subFolders;
421 }
422
423 protected virtual void ModifyPermissions(ref InventoryItemBase item)
424 {
425 // Propagate Permissions
426 item.BasePermissions = item.BasePermissions & item.NextPermissions;
427 item.CurrentPermissions = item.BasePermissions;
428 item.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions;
429 item.GroupPermissions = item.GroupPermissions & item.NextPermissions;
430
431 }
432
433 private AvatarAppearance CreateDefaultAppearance(UUID avatarId)
434 {
435 AvatarAppearance appearance = null;
436 AvatarWearable[] wearables;
437 byte[] visualParams;
438 GetDefaultAvatarAppearance(out wearables, out visualParams);
439 appearance = new AvatarAppearance(avatarId, wearables, visualParams);
440
441 return appearance;
442 }
443
444 private static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
445 {
446 visualParams = GetDefaultVisualParams();
447 wearables = AvatarWearable.DefaultWearables;
448 }
449
450 private static byte[] GetDefaultVisualParams()
451 {
452 byte[] visualParams;
453 visualParams = new byte[218];
454 for (int i = 0; i < 218; i++)
455 {
456 visualParams[i] = 100;
457 }
458 return visualParams;
459 }
460
461 private int ItemIsPartOfAppearance(InventoryItemBase item, AvatarAppearance appearance)
462 {
463 if (appearance != null)
464 {
465 if (appearance.BodyItem == item.ID)
466 return (int)WearableType.Shape;
467
468 if (appearance.EyesItem == item.ID)
469 return (int)WearableType.Eyes;
470
471 if (appearance.GlovesItem == item.ID)
472 return (int)WearableType.Gloves;
473
474 if (appearance.HairItem == item.ID)
475 return (int)WearableType.Hair;
476
477 if (appearance.JacketItem == item.ID)
478 return (int)WearableType.Jacket;
479
480 if (appearance.PantsItem == item.ID)
481 return (int)WearableType.Pants;
482
483 if (appearance.ShirtItem == item.ID)
484 return (int)WearableType.Shirt;
485
486 if (appearance.ShoesItem == item.ID)
487 return (int)WearableType.Shoes;
488
489 if (appearance.SkinItem == item.ID)
490 return (int)WearableType.Skin;
491
492 if (appearance.SkirtItem == item.ID)
493 return (int)WearableType.Skirt;
494
495 if (appearance.SocksItem == item.ID)
496 return (int)WearableType.Socks;
497
498 if (appearance.UnderPantsItem == item.ID)
499 return (int)WearableType.Underpants;
500
501 if (appearance.UnderShirtItem == item.ID)
502 return (int)WearableType.Undershirt;
503 }
504 return -1;
505 }
506 #endregion
507
508 public enum PermissionMask
509 {
510 None = 0,
511 Transfer = 8192,
512 Modify = 16384,
513 Copy = 32768,
514 Move = 524288,
515 Damage = 1048576,
516 All = 2147483647,
517 }
518
519 public enum WearableType
520 {
521 Shape = 0,
522 Skin = 1,
523 Hair = 2,
524 Eyes = 3,
525 Shirt = 4,
526 Pants = 5,
527 Shoes = 6,
528 Socks = 7,
529 Jacket = 8,
530 Gloves = 9,
531 Undershirt = 10,
532 Underpants = 11,
533 Skirt = 12,
534 }
535
536 public class ClothesAttachment
537 {
538 public int Type;
539 public UUID ItemID;
540 public UUID AssetID;
541
542 public ClothesAttachment(int type, UUID itemID, UUID assetID)
543 {
544 Type = type;
545 ItemID = itemID;
546 AssetID = assetID;
547 }
548 }
549 }
550} \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer.Modules/GridInfoServiceModule.cs b/OpenSim/Grid/UserServer.Modules/GridInfoServiceModule.cs
deleted file mode 100644
index 0c84348..0000000
--- a/OpenSim/Grid/UserServer.Modules/GridInfoServiceModule.cs
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using log4net;
33using log4net.Config;
34using OpenMetaverse;
35using OpenSim.Framework;
36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Communications.Services;
38using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Servers;
40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Grid.Communications.OGS1;
42using OpenSim.Grid.Framework;
43
44namespace OpenSim.Grid.UserServer.Modules
45{
46 public class GridInfoServiceModule
47 {
48 protected IGridServiceCore m_core;
49 protected GridInfoService m_gridInfoService;
50 protected BaseHttpServer m_httpServer;
51
52 public GridInfoServiceModule()
53 {
54 }
55
56 public void Initialise(IGridServiceCore core)
57 {
58 m_core = core;
59 m_gridInfoService = new GridInfoService();
60 }
61
62 public void PostInitialise()
63 {
64
65 }
66
67 public void RegisterHandlers(BaseHttpServer httpServer)
68 {
69 m_httpServer = httpServer;
70 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info",
71 m_gridInfoService.RestGetGridInfoMethod));
72 m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
73 }
74
75 public void Close()
76 {
77 }
78 }
79}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections;
29using System.Collections.Generic;
30using System.Net;
31using System.Reflection;
32using System.Threading;
33using log4net;
34using Nwc.XmlRpc;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Framework.Servers;
38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Grid.Framework;
40
41namespace OpenSim.Grid.UserServer.Modules
42{
43 public enum NotificationRequest : int
44 {
45 Login = 0,
46 Logout = 1,
47 Shutdown = 2
48 }
49
50 public struct PresenceNotification
51 {
52 public NotificationRequest request;
53 public UUID agentID;
54 public UUID sessionID;
55 public UUID RegionID;
56 public ulong regionhandle;
57 public float positionX;
58 public float positionY;
59 public float positionZ;
60 public string firstname;
61 public string lastname;
62 }
63
64 public delegate void AgentLocationDelegate(UUID agentID, UUID regionID, ulong regionHandle);
65 public delegate void AgentLeavingDelegate(UUID agentID, UUID regionID, ulong regionHandle);
66 public delegate void RegionStartupDelegate(UUID regionID);
67 public delegate void RegionShutdownDelegate(UUID regionID);
68
69
70 public class MessageServersConnector
71 {
72 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
73
74 public Dictionary<string, MessageServerInfo> MessageServers;
75
76 private BaseHttpServer m_httpServer;
77
78 private OpenSim.Framework.BlockingQueue<PresenceNotification> m_NotifyQueue =
79 new OpenSim.Framework.BlockingQueue<PresenceNotification>();
80
81 private IGridServiceCore m_core;
82
83 public event AgentLocationDelegate OnAgentLocation;
84 public event AgentLeavingDelegate OnAgentLeaving;
85 public event RegionStartupDelegate OnRegionStartup;
86 public event RegionShutdownDelegate OnRegionShutdown;
87
88 public MessageServersConnector()
89 {
90 MessageServers = new Dictionary<string, MessageServerInfo>();
91 }
92
93 public void Initialise(IGridServiceCore core)
94 {
95 m_core = core;
96 m_core.RegisterInterface<MessageServersConnector>(this);
97
98 Watchdog.StartThread(NotifyQueueRunner, "NotifyQueueRunner", ThreadPriority.Normal, true);
99 }
100
101 public void PostInitialise()
102 {
103 }
104
105 public void RegisterHandlers(BaseHttpServer httpServer)
106 {
107 m_httpServer = httpServer;
108
109 m_httpServer.AddXmlRPCHandler("region_startup", RegionStartup);
110 m_httpServer.AddXmlRPCHandler("region_shutdown", RegionShutdown);
111 m_httpServer.AddXmlRPCHandler("agent_location", AgentLocation);
112 m_httpServer.AddXmlRPCHandler("agent_leaving", AgentLeaving);
113 // Message Server ---> User Server
114 m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer);
115 m_httpServer.AddXmlRPCHandler("agent_change_region", XmlRPCUserMovedtoRegion);
116 m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer);
117 }
118
119 public void RegisterMessageServer(string URI, MessageServerInfo serverData)
120 {
121 lock (MessageServers)
122 {
123 if (!MessageServers.ContainsKey(URI))
124 MessageServers.Add(URI, serverData);
125 }
126 }
127
128 public void DeRegisterMessageServer(string URI)
129 {
130 lock (MessageServers)
131 {
132 if (MessageServers.ContainsKey(URI))
133 MessageServers.Remove(URI);
134 }
135 }
136
137 public void AddResponsibleRegion(string URI, ulong regionhandle)
138 {
139 if (!MessageServers.ContainsKey(URI))
140 {
141 m_log.Warn("[MSGSERVER]: Got addResponsibleRegion Request for a MessageServer that isn't registered");
142 }
143 else
144 {
145 MessageServerInfo msginfo = MessageServers["URI"];
146 msginfo.responsibleForRegions.Add(regionhandle);
147 MessageServers["URI"] = msginfo;
148 }
149 }
150 public void RemoveResponsibleRegion(string URI, ulong regionhandle)
151 {
152 if (!MessageServers.ContainsKey(URI))
153 {
154 m_log.Warn("[MSGSERVER]: Got RemoveResponsibleRegion Request for a MessageServer that isn't registered");
155 }
156 else
157 {
158 MessageServerInfo msginfo = MessageServers["URI"];
159 if (msginfo.responsibleForRegions.Contains(regionhandle))
160 {
161 msginfo.responsibleForRegions.Remove(regionhandle);
162 MessageServers["URI"] = msginfo;
163 }
164 }
165
166 }
167 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request, IPEndPoint remoteClient)
168 {
169 XmlRpcResponse response = new XmlRpcResponse();
170 Hashtable requestData = (Hashtable)request.Params[0];
171 Hashtable responseData = new Hashtable();
172
173 if (requestData.Contains("uri"))
174 {
175 string URI = (string)requestData["uri"];
176 string sendkey=(string)requestData["sendkey"];
177 string recvkey=(string)requestData["recvkey"];
178 MessageServerInfo m = new MessageServerInfo();
179 m.URI = URI;
180 m.sendkey = sendkey;
181 m.recvkey = recvkey;
182 RegisterMessageServer(URI, m);
183 responseData["responsestring"] = "TRUE";
184 response.Value = responseData;
185 }
186 return response;
187 }
188 public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request, IPEndPoint remoteClient)
189 {
190 XmlRpcResponse response = new XmlRpcResponse();
191 Hashtable requestData = (Hashtable)request.Params[0];
192 Hashtable responseData = new Hashtable();
193
194 if (requestData.Contains("uri"))
195 {
196 string URI = (string)requestData["uri"];
197
198 DeRegisterMessageServer(URI);
199 responseData["responsestring"] = "TRUE";
200 response.Value = responseData;
201 }
202 return response;
203 }
204
205 public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request, IPEndPoint remoteClient)
206 {
207 XmlRpcResponse response = new XmlRpcResponse();
208 Hashtable requestData = (Hashtable)request.Params[0];
209 Hashtable responseData = new Hashtable();
210
211 if (requestData.Contains("fromuri"))
212 {
213 // string sURI = (string)requestData["fromuri"];
214 // string sagentID = (string)requestData["agentid"];
215 // string ssessionID = (string)requestData["sessionid"];
216 // string scurrentRegionID = (string)requestData["regionid"];
217 // string sregionhandle = (string)requestData["regionhandle"];
218 // string scurrentpos = (string)requestData["currentpos"];
219 //Vector3.TryParse((string)reader["currentPos"], out retval.currentPos);
220 // TODO: Okay now raise event so the user server can pass this data to the Usermanager
221
222 responseData["responsestring"] = "TRUE";
223 response.Value = responseData;
224 }
225 return response;
226 }
227
228 public void TellMessageServersAboutUser(UUID agentID, UUID sessionID, UUID RegionID,
229 ulong regionhandle, float positionX, float positionY,
230 float positionZ, string firstname, string lastname)
231 {
232 PresenceNotification notification = new PresenceNotification();
233
234 notification.request = NotificationRequest.Login;
235 notification.agentID = agentID;
236 notification.sessionID = sessionID;
237 notification.RegionID = RegionID;
238 notification.regionhandle = regionhandle;
239 notification.positionX = positionX;
240 notification.positionY = positionY;
241 notification.positionZ = positionZ;
242 notification.firstname = firstname;
243 notification.lastname = lastname;
244
245 m_NotifyQueue.Enqueue(notification);
246 }
247
248 private void TellMessageServersAboutUserInternal(UUID agentID, UUID sessionID, UUID RegionID,
249 ulong regionhandle, float positionX, float positionY,
250 float positionZ, string firstname, string lastname)
251 {
252 // Loop over registered Message Servers (AND THERE WILL BE MORE THEN ONE :D)
253 lock (MessageServers)
254 {
255 if (MessageServers.Count > 0)
256 {
257 m_log.Info("[MSGCONNECTOR]: Sending login notice to registered message servers");
258 }
259// else
260// {
261// m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring");
262// }
263 foreach (MessageServerInfo serv in MessageServers.Values)
264 {
265 NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID,
266 regionhandle, positionX, positionY, positionZ,
267 firstname, lastname);
268 }
269 }
270 }
271
272 private void TellMessageServersAboutUserLogoffInternal(UUID agentID)
273 {
274 lock (MessageServers)
275 {
276 if (MessageServers.Count > 0)
277 {
278 m_log.Info("[MSGCONNECTOR]: Sending logoff notice to registered message servers");
279 }
280 else
281 {
282// m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring");
283 }
284 foreach (MessageServerInfo serv in MessageServers.Values)
285 {
286 NotifyMessageServerAboutUserLogoff(serv,agentID);
287 }
288 }
289 }
290
291 private void TellMessageServersAboutRegionShutdownInternal(UUID regionID)
292 {
293 lock (MessageServers)
294 {
295 if (MessageServers.Count > 0)
296 {
297 m_log.Info("[MSGCONNECTOR]: Sending region down notice to registered message servers");
298 }
299 else
300 {
301// m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring");
302 }
303 foreach (MessageServerInfo serv in MessageServers.Values)
304 {
305 NotifyMessageServerAboutRegionShutdown(serv,regionID);
306 }
307 }
308 }
309
310 public void TellMessageServersAboutUserLogoff(UUID agentID)
311 {
312 PresenceNotification notification = new PresenceNotification();
313
314 notification.request = NotificationRequest.Logout;
315 notification.agentID = agentID;
316
317 m_NotifyQueue.Enqueue(notification);
318 }
319
320 public void TellMessageServersAboutRegionShutdown(UUID regionID)
321 {
322 PresenceNotification notification = new PresenceNotification();
323
324 notification.request = NotificationRequest.Shutdown;
325 notification.RegionID = regionID;
326
327 m_NotifyQueue.Enqueue(notification);
328 }
329
330 private void NotifyMessageServerAboutUserLogoff(MessageServerInfo serv, UUID agentID)
331 {
332 Hashtable reqparams = new Hashtable();
333 reqparams["sendkey"] = serv.sendkey;
334 reqparams["agentid"] = agentID.ToString();
335 ArrayList SendParams = new ArrayList();
336 SendParams.Add(reqparams);
337
338 XmlRpcRequest GridReq = new XmlRpcRequest("logout_of_simulator", SendParams);
339 try
340 {
341 GridReq.Send(serv.URI, 6000);
342 }
343 catch (WebException)
344 {
345 m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about log out. Other users might still think this user is online");
346 }
347 m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout");
348 }
349
350 private void NotifyMessageServerAboutRegionShutdown(MessageServerInfo serv, UUID regionID)
351 {
352 Hashtable reqparams = new Hashtable();
353 reqparams["sendkey"] = serv.sendkey;
354 reqparams["regionid"] = regionID.ToString();
355 ArrayList SendParams = new ArrayList();
356 SendParams.Add(reqparams);
357
358 XmlRpcRequest GridReq = new XmlRpcRequest("process_region_shutdown", SendParams);
359 try
360 {
361 GridReq.Send(serv.URI, 6000);
362 }
363 catch (WebException)
364 {
365 m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about region shutdown.");
366 }
367 m_log.Info("[REGION UPDOWN]: Notified : " + serv.URI + " about region state change");
368 }
369
370 private void NotifyMessageServerAboutUser(MessageServerInfo serv,
371 UUID agentID, UUID sessionID, UUID RegionID,
372 ulong regionhandle, float positionX, float positionY, float positionZ,
373 string firstname, string lastname)
374 {
375 Hashtable reqparams = new Hashtable();
376 reqparams["sendkey"] = serv.sendkey;
377 reqparams["agentid"] = agentID.ToString();
378 reqparams["sessionid"] = sessionID.ToString();
379 reqparams["regionid"] = RegionID.ToString();
380 reqparams["regionhandle"] = regionhandle.ToString();
381 reqparams["positionx"] = positionX.ToString();
382 reqparams["positiony"] = positionY.ToString();
383 reqparams["positionz"] = positionZ.ToString();
384 reqparams["firstname"] = firstname;
385 reqparams["lastname"] = lastname;
386
387 //reqparams["position"] = Position.ToString();
388
389 ArrayList SendParams = new ArrayList();
390 SendParams.Add(reqparams);
391
392 XmlRpcRequest GridReq = new XmlRpcRequest("login_to_simulator", SendParams);
393 try
394 {
395 GridReq.Send(serv.URI, 6000);
396 m_log.Info("[LOGIN]: Notified : " + serv.URI + " about user login");
397 }
398 catch (WebException)
399 {
400 m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user");
401 }
402
403 }
404
405 private void NotifyQueueRunner()
406 {
407 while (true)
408 {
409 PresenceNotification presence = m_NotifyQueue.Dequeue();
410
411 if (presence.request == NotificationRequest.Shutdown)
412 {
413 TellMessageServersAboutRegionShutdownInternal(presence.RegionID);
414 }
415
416 if (presence.request == NotificationRequest.Login)
417 {
418 TellMessageServersAboutUserInternal(presence.agentID,
419 presence.sessionID, presence.RegionID,
420 presence.regionhandle, presence.positionX,
421 presence.positionY, presence.positionZ,
422 presence.firstname, presence.lastname);
423 }
424
425 if (presence.request == NotificationRequest.Logout)
426 {
427 TellMessageServersAboutUserLogoffInternal(presence.agentID);
428 }
429
430 Watchdog.UpdateThread();
431 }
432 }
433
434 public XmlRpcResponse RegionStartup(XmlRpcRequest request, IPEndPoint remoteClient)
435 {
436 Hashtable requestData = (Hashtable)request.Params[0];
437 Hashtable result = new Hashtable();
438
439 UUID regionID;
440 if (UUID.TryParse((string)requestData["RegionUUID"], out regionID))
441 {
442 if (OnRegionStartup != null)
443 OnRegionStartup(regionID);
444
445 result["responsestring"] = "TRUE";
446 }
447
448 XmlRpcResponse response = new XmlRpcResponse();
449 response.Value = result;
450 return response;
451 }
452
453 public XmlRpcResponse RegionShutdown(XmlRpcRequest request, IPEndPoint remoteClient)
454 {
455 Hashtable requestData = (Hashtable)request.Params[0];
456 Hashtable result = new Hashtable();
457
458 UUID regionID;
459 if (UUID.TryParse((string)requestData["RegionUUID"], out regionID))
460 {
461 if (OnRegionShutdown != null)
462 OnRegionShutdown(regionID);
463
464 result["responsestring"] = "TRUE";
465 }
466
467 XmlRpcResponse response = new XmlRpcResponse();
468 response.Value = result;
469 return response;
470 }
471
472 public XmlRpcResponse AgentLocation(XmlRpcRequest request, IPEndPoint remoteClient)
473 {
474 Hashtable requestData = (Hashtable)request.Params[0];
475 Hashtable result = new Hashtable();
476
477 UUID agentID;
478 UUID regionID;
479 ulong regionHandle;
480 if (UUID.TryParse((string)requestData["AgentID"], out agentID) && UUID.TryParse((string)requestData["RegionUUID"], out regionID) && ulong.TryParse((string)requestData["RegionHandle"], out regionHandle))
481 {
482 if (OnAgentLocation != null)
483 OnAgentLocation(agentID, regionID, regionHandle);
484
485 result["responsestring"] = "TRUE";
486 }
487
488 XmlRpcResponse response = new XmlRpcResponse();
489 response.Value = result;
490 return response;
491 }
492
493 public XmlRpcResponse AgentLeaving(XmlRpcRequest request, IPEndPoint remoteClient)
494 {
495 Hashtable requestData = (Hashtable)request.Params[0];
496 Hashtable result = new Hashtable();
497
498 UUID agentID;
499 UUID regionID;
500 ulong regionHandle;
501 if (UUID.TryParse((string)requestData["AgentID"], out agentID) && UUID.TryParse((string)requestData["RegionUUID"], out regionID) && ulong.TryParse((string)requestData["RegionHandle"], out regionHandle))
502 {
503 if (OnAgentLeaving != null)
504 OnAgentLeaving(agentID, regionID, regionHandle);
505
506 result["responsestring"] = "TRUE";
507 }
508
509 XmlRpcResponse response = new XmlRpcResponse();
510 response.Value = result;
511 return response;
512 }
513 }
514}
diff --git a/OpenSim/Grid/UserServer.Modules/OpenIdService.cs b/OpenSim/Grid/UserServer.Modules/OpenIdService.cs
deleted file mode 100644
index 49dfd86..0000000
--- a/OpenSim/Grid/UserServer.Modules/OpenIdService.cs
+++ /dev/null
@@ -1,338 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Collections.Specialized;
31using System.IO;
32using System.Net;
33using System.Web;
34using DotNetOpenId;
35using DotNetOpenId.Provider;
36using OpenSim.Framework;
37using OpenSim.Framework.Servers;
38using OpenSim.Framework.Servers.HttpServer;
39
40namespace OpenSim.Grid.UserServer.Modules
41{
42 /// <summary>
43 /// Temporary, in-memory store for OpenID associations
44 /// </summary>
45 public class ProviderMemoryStore : IAssociationStore<AssociationRelyingPartyType>
46 {
47 private class AssociationItem
48 {
49 public AssociationRelyingPartyType DistinguishingFactor;
50 public string Handle;
51 public DateTime Expires;
52 public byte[] PrivateData;
53 }
54
55 Dictionary<string, AssociationItem> m_store = new Dictionary<string, AssociationItem>();
56 SortedList<DateTime, AssociationItem> m_sortedStore = new SortedList<DateTime, AssociationItem>();
57 object m_syncRoot = new object();
58
59 #region IAssociationStore<AssociationRelyingPartyType> Members
60
61 public void StoreAssociation(AssociationRelyingPartyType distinguishingFactor, Association assoc)
62 {
63 AssociationItem item = new AssociationItem();
64 item.DistinguishingFactor = distinguishingFactor;
65 item.Handle = assoc.Handle;
66 item.Expires = assoc.Expires.ToLocalTime();
67 item.PrivateData = assoc.SerializePrivateData();
68
69 lock (m_syncRoot)
70 {
71 m_store[item.Handle] = item;
72 m_sortedStore[item.Expires] = item;
73 }
74 }
75
76 public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor)
77 {
78 lock (m_syncRoot)
79 {
80 if (m_sortedStore.Count > 0)
81 {
82 AssociationItem item = m_sortedStore.Values[m_sortedStore.Count - 1];
83 return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData);
84 }
85 else
86 {
87 return null;
88 }
89 }
90 }
91
92 public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
93 {
94 AssociationItem item;
95 bool success = false;
96 lock (m_syncRoot)
97 success = m_store.TryGetValue(handle, out item);
98
99 if (success)
100 return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData);
101 else
102 return null;
103 }
104
105 public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
106 {
107 lock (m_syncRoot)
108 {
109 for (int i = 0; i < m_sortedStore.Values.Count; i++)
110 {
111 AssociationItem item = m_sortedStore.Values[i];
112 if (item.Handle == handle)
113 {
114 m_sortedStore.RemoveAt(i);
115 break;
116 }
117 }
118
119 return m_store.Remove(handle);
120 }
121 }
122
123 public void ClearExpiredAssociations()
124 {
125 lock (m_syncRoot)
126 {
127 List<AssociationItem> itemsCopy = new List<AssociationItem>(m_sortedStore.Values);
128 DateTime now = DateTime.Now;
129
130 for (int i = 0; i < itemsCopy.Count; i++)
131 {
132 AssociationItem item = itemsCopy[i];
133
134 if (item.Expires <= now)
135 {
136 m_sortedStore.RemoveAt(i);
137 m_store.Remove(item.Handle);
138 }
139 }
140 }
141 }
142
143 #endregion
144 }
145
146 public class OpenIdStreamHandler : IStreamHandler
147 {
148 #region HTML
149
150 /// <summary>Login form used to authenticate OpenID requests</summary>
151 const string LOGIN_PAGE =
152@"<html>
153<head><title>OpenSim OpenID Login</title></head>
154<body>
155<h3>OpenSim Login</h3>
156<form method=""post"">
157<label for=""first"">First Name:</label> <input readonly type=""text"" name=""first"" id=""first"" value=""{0}""/>
158<label for=""last"">Last Name:</label> <input readonly type=""text"" name=""last"" id=""last"" value=""{1}""/>
159<label for=""pass"">Password:</label> <input type=""password"" name=""pass"" id=""pass""/>
160<input type=""submit"" value=""Login"">
161</form>
162</body>
163</html>";
164
165 /// <summary>Page shown for a valid OpenID identity</summary>
166 const string OPENID_PAGE =
167@"<html>
168<head>
169<title>{2} {3}</title>
170<link rel=""openid2.provider openid.server"" href=""{0}://{1}/openid/server/""/>
171</head>
172<body>OpenID identifier for {2} {3}</body>
173</html>
174";
175
176 /// <summary>Page shown for an invalid OpenID identity</summary>
177 const string INVALID_OPENID_PAGE =
178@"<html><head><title>Identity not found</title></head>
179<body>Invalid OpenID identity</body></html>";
180
181 /// <summary>Page shown if the OpenID endpoint is requested directly</summary>
182 const string ENDPOINT_PAGE =
183@"<html><head><title>OpenID Endpoint</title></head><body>
184This is an OpenID server endpoint, not a human-readable resource.
185For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
186</body></html>";
187
188 #endregion HTML
189
190 public string ContentType { get { return m_contentType; } }
191 public string HttpMethod { get { return m_httpMethod; } }
192 public string Path { get { return m_path; } }
193
194 string m_contentType;
195 string m_httpMethod;
196 string m_path;
197 UserLoginService m_loginService;
198 ProviderMemoryStore m_openidStore = new ProviderMemoryStore();
199
200 /// <summary>
201 /// Constructor
202 /// </summary>
203 public OpenIdStreamHandler(string httpMethod, string path, UserLoginService loginService)
204 {
205 m_loginService = loginService;
206 m_httpMethod = httpMethod;
207 m_path = path;
208
209 m_contentType = "text/html";
210 }
211
212 /// <summary>
213 /// Handles all GET and POST requests for OpenID identifier pages and endpoint
214 /// server communication
215 /// </summary>
216 public void Handle(string path, Stream request, Stream response, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
217 {
218 Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath));
219
220 // Defult to returning HTML content
221 m_contentType = "text/html";
222
223 try
224 {
225 NameValueCollection postQuery = HttpUtility.ParseQueryString(new StreamReader(httpRequest.InputStream).ReadToEnd());
226 NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query);
227 NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery);
228
229 OpenIdProvider provider = new OpenIdProvider(m_openidStore, providerEndpoint, httpRequest.Url, openIdQuery);
230
231 if (provider.Request != null)
232 {
233 if (!provider.Request.IsResponseReady && provider.Request is IAuthenticationRequest)
234 {
235 IAuthenticationRequest authRequest = (IAuthenticationRequest)provider.Request;
236 string[] passwordValues = postQuery.GetValues("pass");
237
238 UserProfileData profile;
239 if (TryGetProfile(new Uri(authRequest.ClaimedIdentifier.ToString()), out profile))
240 {
241 // Check for form POST data
242 if (passwordValues != null && passwordValues.Length == 1)
243 {
244 if (profile != null && m_loginService.AuthenticateUser(profile, passwordValues[0]))
245 authRequest.IsAuthenticated = true;
246 else
247 authRequest.IsAuthenticated = false;
248 }
249 else
250 {
251 // Authentication was requested, send the client a login form
252 using (StreamWriter writer = new StreamWriter(response))
253 writer.Write(String.Format(LOGIN_PAGE, profile.FirstName, profile.SurName));
254 return;
255 }
256 }
257 else
258 {
259 // Cannot find an avatar matching the claimed identifier
260 authRequest.IsAuthenticated = false;
261 }
262 }
263
264 // Add OpenID headers to the response
265 foreach (string key in provider.Request.Response.Headers.Keys)
266 httpResponse.AddHeader(key, provider.Request.Response.Headers[key]);
267
268 string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type");
269 if (contentTypeValues != null && contentTypeValues.Length == 1)
270 m_contentType = contentTypeValues[0];
271
272 // Set the response code and document body based on the OpenID result
273 httpResponse.StatusCode = (int)provider.Request.Response.Code;
274 response.Write(provider.Request.Response.Body, 0, provider.Request.Response.Body.Length);
275 response.Close();
276 }
277 else if (httpRequest.Url.AbsolutePath.Contains("/openid/server"))
278 {
279 // Standard HTTP GET was made on the OpenID endpoint, send the client the default error page
280 using (StreamWriter writer = new StreamWriter(response))
281 writer.Write(ENDPOINT_PAGE);
282 }
283 else
284 {
285 // Try and lookup this avatar
286 UserProfileData profile;
287 if (TryGetProfile(httpRequest.Url, out profile))
288 {
289 using (StreamWriter writer = new StreamWriter(response))
290 {
291 // TODO: Print out a full profile page for this avatar
292 writer.Write(String.Format(OPENID_PAGE, httpRequest.Url.Scheme,
293 httpRequest.Url.Authority, profile.FirstName, profile.SurName));
294 }
295 }
296 else
297 {
298 // Couldn't parse an avatar name, or couldn't find the avatar in the user server
299 using (StreamWriter writer = new StreamWriter(response))
300 writer.Write(INVALID_OPENID_PAGE);
301 }
302 }
303 }
304 catch (Exception ex)
305 {
306 httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError;
307 using (StreamWriter writer = new StreamWriter(response))
308 writer.Write(ex.Message);
309 }
310 }
311
312 /// <summary>
313 /// Parse a URL with a relative path of the form /users/First_Last and try to
314 /// retrieve the profile matching that avatar name
315 /// </summary>
316 /// <param name="requestUrl">URL to parse for an avatar name</param>
317 /// <param name="profile">Profile data for the avatar</param>
318 /// <returns>True if the parse and lookup were successful, otherwise false</returns>
319 bool TryGetProfile(Uri requestUrl, out UserProfileData profile)
320 {
321 if (requestUrl.Segments.Length == 3 && requestUrl.Segments[1] == "users/")
322 {
323 // Parse the avatar name from the path
324 string username = requestUrl.Segments[requestUrl.Segments.Length - 1];
325 string[] name = username.Split('_');
326
327 if (name.Length == 2)
328 {
329 profile = m_loginService.GetTheUser(name[0], name[1]);
330 return (profile != null);
331 }
332 }
333
334 profile = null;
335 return false;
336 }
337 }
338}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32using log4net;
33using Nwc.XmlRpc;
34using OpenMetaverse;
35using OpenSim.Framework;
36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Servers;
38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Grid.Framework;
40
41namespace OpenSim.Grid.UserServer.Modules
42{
43 public class UserDataBaseService : UserManagerBase
44 {
45 protected IGridServiceCore m_core;
46
47 public UserDataBaseService(CommunicationsManager commsManager)
48 : base(commsManager)
49 {
50 }
51
52 public void Initialise(IGridServiceCore core)
53 {
54 m_core = core;
55
56 UserConfig cfg;
57 if (m_core.TryGet<UserConfig>(out cfg))
58 {
59 AddPlugin(cfg.DatabaseProvider, cfg.DatabaseConnect);
60 }
61
62 m_core.RegisterInterface<UserDataBaseService>(this);
63 }
64
65 public void PostInitialise()
66 {
67 }
68
69 public void RegisterHandlers(BaseHttpServer httpServer)
70 {
71 }
72
73 public UserAgentData GetUserAgentData(UUID AgentID)
74 {
75 UserProfileData userProfile = GetUserProfile(AgentID);
76
77 if (userProfile != null)
78 {
79 return userProfile.CurrentAgent;
80 }
81
82 return null;
83 }
84
85 public override UserProfileData SetupMasterUser(string firstName, string lastName)
86 {
87 throw new Exception("The method or operation is not implemented.");
88 }
89
90 public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
91 {
92 throw new Exception("The method or operation is not implemented.");
93 }
94
95 public override UserProfileData SetupMasterUser(UUID uuid)
96 {
97 throw new Exception("The method or operation is not implemented.");
98 }
99 }
100}
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs
deleted file mode 100644
index 77caf47..0000000
--- a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs
+++ /dev/null
@@ -1,225 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32using System.Text.RegularExpressions;
33using log4net;
34using Nwc.XmlRpc;
35using OpenMetaverse;
36using OpenSim.Data;
37using OpenSim.Framework;
38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Services;
40using OpenSim.Framework.Communications.Cache;
41using OpenSim.Framework.Capabilities;
42using OpenSim.Framework.Servers;
43using OpenSim.Framework.Servers.HttpServer;
44
45namespace OpenSim.Grid.UserServer.Modules
46{
47
48 /// <summary>
49 /// Hypergrid login service used in grid mode.
50 /// </summary>
51 public class UserLoginAuthService : HGLoginAuthService
52 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54
55 public UserConfig m_config;
56 private readonly IRegionProfileRouter m_regionProfileService;
57
58 protected BaseHttpServer m_httpServer;
59
60 public UserLoginAuthService(
61 UserManagerBase userManager, IInterServiceInventoryServices inventoryService,
62 LibraryRootFolder libraryRootFolder,
63 UserConfig config, string welcomeMess, IRegionProfileRouter regionProfileService)
64 : base(userManager, welcomeMess, inventoryService, null, true, libraryRootFolder, null)
65 {
66 m_config = config;
67 m_defaultHomeX = m_config.DefaultX;
68 m_defaultHomeY = m_config.DefaultY;
69 m_interInventoryService = inventoryService;
70 m_regionProfileService = regionProfileService;
71
72 NetworkServersInfo serversinfo = new NetworkServersInfo(1000, 1000);
73 serversinfo.GridRecvKey = m_config.GridRecvKey;
74 serversinfo.GridSendKey = m_config.GridSendKey;
75 serversinfo.GridURL = m_config.GridServerURL.ToString();
76 serversinfo.InventoryURL = m_config.InventoryUrl.ToString();
77 serversinfo.UserURL = m_config.AuthUrl.ToString();
78 SetServersInfo(serversinfo);
79 }
80
81 public void RegisterHandlers(BaseHttpServer httpServer)
82 {
83 m_httpServer = httpServer;
84
85 httpServer.AddXmlRPCHandler("hg_login", XmlRpcLoginMethod);
86 httpServer.AddXmlRPCHandler("hg_new_auth_key", XmlRpcGenerateKeyMethod);
87 httpServer.AddXmlRPCHandler("hg_verify_auth_key", XmlRpcVerifyKeyMethod);
88 }
89
90
91 public override void LogOffUser(UserProfileData theUser, string message)
92 {
93 RegionProfileData SimInfo;
94 try
95 {
96 SimInfo = m_regionProfileService.RequestSimProfileData(
97 theUser.CurrentAgent.Handle, m_config.GridServerURL,
98 m_config.GridSendKey, m_config.GridRecvKey);
99
100 if (SimInfo == null)
101 {
102 m_log.Error("[GRID]: Region user was in isn't currently logged in");
103 return;
104 }
105 }
106 catch (Exception)
107 {
108 m_log.Error("[GRID]: Unable to look up region to log user off");
109 return;
110 }
111
112 // Prepare notification
113 Hashtable SimParams = new Hashtable();
114 SimParams["agent_id"] = theUser.ID.ToString();
115 SimParams["region_secret"] = theUser.CurrentAgent.SecureSessionID.ToString();
116 SimParams["region_secret2"] = SimInfo.regionSecret;
117 //m_log.Info(SimInfo.regionSecret);
118 SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString();
119 SimParams["message"] = message;
120 ArrayList SendParams = new ArrayList();
121 SendParams.Add(SimParams);
122
123 m_log.InfoFormat(
124 "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
125 SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI,
126 theUser.FirstName + " " + theUser.SurName);
127
128 try
129 {
130 XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams);
131 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
132
133 if (GridResp.IsFault)
134 {
135 m_log.ErrorFormat(
136 "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.",
137 SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
138 }
139 }
140 catch (Exception)
141 {
142 m_log.Error("[LOGIN]: Error telling region to logout user!");
143 }
144
145 // Prepare notification
146 SimParams = new Hashtable();
147 SimParams["agent_id"] = theUser.ID.ToString();
148 SimParams["region_secret"] = SimInfo.regionSecret;
149 //m_log.Info(SimInfo.regionSecret);
150 SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString();
151 SimParams["message"] = message;
152 SendParams = new ArrayList();
153 SendParams.Add(SimParams);
154
155 m_log.InfoFormat(
156 "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
157 SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI,
158 theUser.FirstName + " " + theUser.SurName);
159
160 try
161 {
162 XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams);
163 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
164
165 if (GridResp.IsFault)
166 {
167 m_log.ErrorFormat(
168 "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.",
169 SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
170 }
171 }
172 catch (Exception)
173 {
174 m_log.Error("[LOGIN]: Error telling region to logout user!");
175 }
176 //base.LogOffUser(theUser);
177 }
178
179 protected override RegionInfo RequestClosestRegion(string region)
180 {
181 RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(region,
182 m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
183
184 if (profileData != null)
185 {
186 return profileData.ToRegionInfo();
187 }
188 else
189 {
190 return null;
191 }
192 }
193
194 protected override RegionInfo GetRegionInfo(ulong homeRegionHandle)
195 {
196 RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionHandle,
197 m_config.GridServerURL, m_config.GridSendKey,
198 m_config.GridRecvKey);
199 if (profileData != null)
200 {
201 return profileData.ToRegionInfo();
202 }
203 else
204 {
205 return null;
206 }
207 }
208
209 protected override RegionInfo GetRegionInfo(UUID homeRegionId)
210 {
211 RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionId,
212 m_config.GridServerURL, m_config.GridSendKey,
213 m_config.GridRecvKey);
214 if (profileData != null)
215 {
216 return profileData.ToRegionInfo();
217 }
218 else
219 {
220 return null;
221 }
222 }
223
224 }
225}
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
deleted file mode 100644
index d46ff9b..0000000
--- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
+++ /dev/null
@@ -1,423 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using System.Text.RegularExpressions;
34using log4net;
35using Nwc.XmlRpc;
36using OpenMetaverse;
37using Nini.Config;
38using OpenSim.Data;
39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41using OpenSim.Framework.Communications.Services;
42using OpenSim.Framework.Communications.Cache;
43using OpenSim.Framework.Capabilities;
44using OpenSim.Framework.Servers;
45using OpenSim.Framework.Servers.HttpServer;
46using OpenSim.Services.Interfaces;
47using OpenSim.Services.Connectors;
48using GridRegion = OpenSim.Services.Interfaces.GridRegion;
49
50namespace OpenSim.Grid.UserServer.Modules
51{
52 public delegate void UserLoggedInAtLocation(UUID agentID, UUID sessionID, UUID RegionID,
53 ulong regionhandle, float positionX, float positionY, float positionZ,
54 string firstname, string lastname);
55
56 /// <summary>
57 /// Login service used in grid mode.
58 /// </summary>
59 public class UserLoginService : LoginService
60 {
61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
62
63 public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
64
65 private UserLoggedInAtLocation handlerUserLoggedInAtLocation;
66
67 public UserConfig m_config;
68 private readonly IRegionProfileRouter m_regionProfileService;
69
70 private IGridService m_GridService;
71
72 protected BaseHttpServer m_httpServer;
73
74 public UserLoginService(
75 UserManagerBase userManager, IInterServiceInventoryServices inventoryService,
76 LibraryRootFolder libraryRootFolder,
77 UserConfig config, string welcomeMess, IRegionProfileRouter regionProfileService)
78 : base(userManager, libraryRootFolder, welcomeMess)
79 {
80 m_config = config;
81 m_defaultHomeX = m_config.DefaultX;
82 m_defaultHomeY = m_config.DefaultY;
83 m_interInventoryService = inventoryService;
84 m_regionProfileService = regionProfileService;
85
86 m_GridService = new GridServicesConnector(config.GridServerURL.ToString());
87 }
88
89 public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers)
90 {
91 m_httpServer = httpServer;
92
93 m_httpServer.AddXmlRPCHandler("login_to_simulator", XmlRpcLoginMethod);
94 m_httpServer.AddHTTPHandler("login", ProcessHTMLLogin);
95 m_httpServer.AddXmlRPCHandler("set_login_params", XmlRPCSetLoginParams);
96 m_httpServer.AddXmlRPCHandler("check_auth_session", XmlRPCCheckAuthSession, false);
97
98 if (registerLLSDHandler)
99 {
100 m_httpServer.SetDefaultLLSDHandler(LLSDLoginMethod);
101 }
102
103 if (registerOpenIDHandlers)
104 {
105 // Handler for OpenID avatar identity pages
106 m_httpServer.AddStreamHandler(new OpenIdStreamHandler("GET", "/users/", this));
107 // Handlers for the OpenID endpoint server
108 m_httpServer.AddStreamHandler(new OpenIdStreamHandler("POST", "/openid/server/", this));
109 m_httpServer.AddStreamHandler(new OpenIdStreamHandler("GET", "/openid/server/", this));
110 }
111 }
112
113 public void setloginlevel(int level)
114 {
115 m_minLoginLevel = level;
116 m_log.InfoFormat("[GRID]: Login Level set to {0} ", level);
117 }
118 public void setwelcometext(string text)
119 {
120 m_welcomeMessage = text;
121 m_log.InfoFormat("[GRID]: Login text set to {0} ", text);
122 }
123
124 public override void LogOffUser(UserProfileData theUser, string message)
125 {
126 RegionProfileData SimInfo;
127 try
128 {
129 SimInfo = m_regionProfileService.RequestSimProfileData(
130 theUser.CurrentAgent.Handle, m_config.GridServerURL,
131 m_config.GridSendKey, m_config.GridRecvKey);
132
133 if (SimInfo == null)
134 {
135 m_log.Error("[GRID]: Region user was in isn't currently logged in");
136 return;
137 }
138 }
139 catch (Exception)
140 {
141 m_log.Error("[GRID]: Unable to look up region to log user off");
142 return;
143 }
144
145 // Prepare notification
146 Hashtable SimParams = new Hashtable();
147 SimParams["agent_id"] = theUser.ID.ToString();
148 SimParams["region_secret"] = theUser.CurrentAgent.SecureSessionID.ToString();
149 SimParams["region_secret2"] = SimInfo.regionSecret;
150 //m_log.Info(SimInfo.regionSecret);
151 SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString();
152 SimParams["message"] = message;
153 ArrayList SendParams = new ArrayList();
154 SendParams.Add(SimParams);
155
156 m_log.InfoFormat(
157 "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
158 SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI,
159 theUser.FirstName + " " + theUser.SurName);
160
161 try
162 {
163 XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams);
164 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
165
166 if (GridResp.IsFault)
167 {
168 m_log.ErrorFormat(
169 "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.",
170 SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
171 }
172 }
173 catch (Exception)
174 {
175 m_log.Error("[LOGIN]: Error telling region to logout user!");
176 }
177
178 // Prepare notification
179 SimParams = new Hashtable();
180 SimParams["agent_id"] = theUser.ID.ToString();
181 SimParams["region_secret"] = SimInfo.regionSecret;
182 //m_log.Info(SimInfo.regionSecret);
183 SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString();
184 SimParams["message"] = message;
185 SendParams = new ArrayList();
186 SendParams.Add(SimParams);
187
188 m_log.InfoFormat(
189 "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
190 SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI,
191 theUser.FirstName + " " + theUser.SurName);
192
193 try
194 {
195 XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams);
196 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
197
198 if (GridResp.IsFault)
199 {
200 m_log.ErrorFormat(
201 "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.",
202 SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
203 }
204 }
205 catch (Exception)
206 {
207 m_log.Error("[LOGIN]: Error telling region to logout user!");
208 }
209 //base.LogOffUser(theUser);
210 }
211
212 protected override RegionInfo RequestClosestRegion(string region)
213 {
214 return GridRegionToRegionInfo(m_GridService.GetRegionByName(UUID.Zero, region));
215 }
216
217 protected override RegionInfo GetRegionInfo(ulong homeRegionHandle)
218 {
219 uint x = 0, y = 0;
220 Utils.LongToUInts(homeRegionHandle, out x, out y);
221 return GridRegionToRegionInfo(m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y));
222 }
223
224 protected override RegionInfo GetRegionInfo(UUID homeRegionId)
225 {
226 return GridRegionToRegionInfo(m_GridService.GetRegionByUUID(UUID.Zero, homeRegionId));
227 }
228
229 private RegionInfo GridRegionToRegionInfo(GridRegion gregion)
230 {
231 if (gregion == null)
232 return null;
233
234 RegionInfo rinfo = new RegionInfo();
235 rinfo.ExternalHostName = gregion.ExternalHostName;
236 rinfo.HttpPort = gregion.HttpPort;
237 rinfo.InternalEndPoint = gregion.InternalEndPoint;
238 rinfo.RegionID = gregion.RegionID;
239 rinfo.RegionLocX = (uint)(gregion.RegionLocX / Constants.RegionSize);
240 rinfo.RegionLocY = (uint)(gregion.RegionLocY / Constants.RegionSize);
241 rinfo.RegionName = gregion.RegionName;
242 rinfo.ScopeID = gregion.ScopeID;
243 rinfo.ServerURI = gregion.ServerURI;
244
245 return rinfo;
246 }
247
248 protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient)
249 {
250 return PrepareLoginToRegion(RegionProfileData.FromRegionInfo(regionInfo), user, response, remoteClient);
251 }
252
253 /// <summary>
254 /// Prepare a login to the given region. This involves both telling the region to expect a connection
255 /// and appropriately customising the response to the user.
256 /// </summary>
257 /// <param name="regionInfo"></param>
258 /// <param name="user"></param>
259 /// <param name="response"></param>
260 /// <returns>true if the region was successfully contacted, false otherwise</returns>
261 private bool PrepareLoginToRegion(RegionProfileData regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient)
262 {
263 try
264 {
265 response.SimAddress = Util.GetHostFromURL(regionInfo.serverURI).ToString();
266 response.SimPort = uint.Parse(regionInfo.serverURI.Split(new char[] { '/', ':' })[4]);
267 response.RegionX = regionInfo.regionLocX;
268 response.RegionY = regionInfo.regionLocY;
269
270 string capsPath = CapsUtil.GetRandomCapsObjectPath();
271
272 // Adam's working code commented for now -- Diva 5/25/2009
273 //// For NAT
274 ////string host = NetworkUtil.GetHostFor(remoteClient.Address, regionInfo.ServerIP);
275 //string host = response.SimAddress;
276 //// TODO: This doesnt support SSL. -Adam
277 //string serverURI = "http://" + host + ":" + regionInfo.ServerPort;
278
279 //response.SeedCapability = serverURI + CapsUtil.GetCapsSeedPath(capsPath);
280
281 // Take off trailing / so that the caps path isn't //CAPS/someUUID
282 string uri = regionInfo.httpServerURI.Trim(new char[] { '/' });
283 response.SeedCapability = uri + CapsUtil.GetCapsSeedPath(capsPath);
284
285
286 // Notify the target of an incoming user
287 m_log.InfoFormat(
288 "[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection",
289 regionInfo.regionName, response.RegionX, response.RegionY, regionInfo.httpServerURI);
290
291 // Update agent with target sim
292 user.CurrentAgent.Region = regionInfo.UUID;
293 user.CurrentAgent.Handle = regionInfo.regionHandle;
294
295 // Prepare notification
296 Hashtable loginParams = new Hashtable();
297 loginParams["session_id"] = user.CurrentAgent.SessionID.ToString();
298 loginParams["secure_session_id"] = user.CurrentAgent.SecureSessionID.ToString();
299 loginParams["firstname"] = user.FirstName;
300 loginParams["lastname"] = user.SurName;
301 loginParams["agent_id"] = user.ID.ToString();
302 loginParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
303 loginParams["startpos_x"] = user.CurrentAgent.Position.X.ToString();
304 loginParams["startpos_y"] = user.CurrentAgent.Position.Y.ToString();
305 loginParams["startpos_z"] = user.CurrentAgent.Position.Z.ToString();
306 loginParams["regionhandle"] = user.CurrentAgent.Handle.ToString();
307 loginParams["caps_path"] = capsPath;
308
309 // Get appearance
310 AvatarAppearance appearance = m_userManager.GetUserAppearance(user.ID);
311 if (appearance != null)
312 {
313 loginParams["appearance"] = appearance.ToHashTable();
314 m_log.DebugFormat("[LOGIN]: Found appearance for {0} {1}", user.FirstName, user.SurName);
315 }
316 else
317 {
318 m_log.DebugFormat("[LOGIN]: Appearance not for {0} {1}. Creating default.", user.FirstName, user.SurName);
319 appearance = new AvatarAppearance(user.ID);
320 loginParams["appearance"] = appearance.ToHashTable();
321 }
322
323 ArrayList SendParams = new ArrayList();
324 SendParams.Add(loginParams);
325
326 // Send
327 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
328 XmlRpcResponse GridResp = GridReq.Send(regionInfo.httpServerURI, 6000);
329
330 if (!GridResp.IsFault)
331 {
332 bool responseSuccess = true;
333
334 if (GridResp.Value != null)
335 {
336 Hashtable resp = (Hashtable)GridResp.Value;
337 if (resp.ContainsKey("success"))
338 {
339 if ((string)resp["success"] == "FALSE")
340 {
341 responseSuccess = false;
342 }
343 }
344 }
345
346 if (responseSuccess)
347 {
348 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
349 if (handlerUserLoggedInAtLocation != null)
350 {
351 handlerUserLoggedInAtLocation(user.ID, user.CurrentAgent.SessionID,
352 user.CurrentAgent.Region,
353 user.CurrentAgent.Handle,
354 user.CurrentAgent.Position.X,
355 user.CurrentAgent.Position.Y,
356 user.CurrentAgent.Position.Z,
357 user.FirstName, user.SurName);
358 }
359 }
360 else
361 {
362 m_log.ErrorFormat("[LOGIN]: Region responded that it is not available to receive clients");
363 return false;
364 }
365 }
366 else
367 {
368 m_log.ErrorFormat("[LOGIN]: XmlRpc request to region failed with message {0}, code {1} ", GridResp.FaultString, GridResp.FaultCode);
369 return false;
370 }
371 }
372 catch (Exception e)
373 {
374 m_log.ErrorFormat("[LOGIN]: Region not available for login, {0}", e);
375 return false;
376 }
377
378 return true;
379 }
380
381 public XmlRpcResponse XmlRPCSetLoginParams(XmlRpcRequest request, IPEndPoint remoteClient)
382 {
383 XmlRpcResponse response = new XmlRpcResponse();
384 Hashtable requestData = (Hashtable)request.Params[0];
385 UserProfileData userProfile;
386 Hashtable responseData = new Hashtable();
387
388 UUID uid;
389 string pass = requestData["password"].ToString();
390
391 if (!UUID.TryParse((string)requestData["avatar_uuid"], out uid))
392 {
393 responseData["error"] = "No authorization";
394 response.Value = responseData;
395 return response;
396 }
397
398 userProfile = m_userManager.GetUserProfile(uid);
399
400 if (userProfile == null ||
401 (!AuthenticateUser(userProfile, pass)) ||
402 userProfile.GodLevel < 200)
403 {
404 responseData["error"] = "No authorization";
405 response.Value = responseData;
406 return response;
407 }
408
409 if (requestData.ContainsKey("login_level"))
410 {
411 m_minLoginLevel = Convert.ToInt32(requestData["login_level"]);
412 }
413
414 if (requestData.ContainsKey("login_motd"))
415 {
416 m_welcomeMessage = requestData["login_motd"].ToString();
417 }
418
419 response.Value = responseData;
420 return response;
421 }
422 }
423}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using log4net;
34using Nwc.XmlRpc;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Grid.Framework;
41
42namespace OpenSim.Grid.UserServer.Modules
43{
44 public delegate void logOffUser(UUID AgentID);
45
46 public class UserManager
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 public event logOffUser OnLogOffUser;
51 private logOffUser handlerLogOffUser;
52
53 private UserDataBaseService m_userDataBaseService;
54 private BaseHttpServer m_httpServer;
55
56 /// <summary>
57 ///
58 /// </summary>
59 /// <param name="userDataBaseService"></param>
60 public UserManager(UserDataBaseService userDataBaseService)
61 {
62 m_userDataBaseService = userDataBaseService;
63 }
64
65 public void Initialise(IGridServiceCore core)
66 {
67
68 }
69
70 public void PostInitialise()
71 {
72
73 }
74
75 private string RESTGetUserProfile(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
76 {
77 UUID id;
78 UserProfileData userProfile;
79
80 try
81 {
82 id = new UUID(param);
83 }
84 catch (Exception)
85 {
86 httpResponse.StatusCode = 500;
87 return "Malformed Param [" + param + "]";
88 }
89
90 userProfile = m_userDataBaseService.GetUserProfile(id);
91
92 if (userProfile == null)
93 {
94 httpResponse.StatusCode = 404;
95 return "Not Found.";
96 }
97
98 return ProfileToXmlRPCResponse(userProfile).ToString();
99 }
100
101 public void RegisterHandlers(BaseHttpServer httpServer)
102 {
103 m_httpServer = httpServer;
104
105 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/users/", RESTGetUserProfile));
106
107 m_httpServer.AddXmlRPCHandler("get_user_by_name", XmlRPCGetUserMethodName);
108 m_httpServer.AddXmlRPCHandler("get_user_by_uuid", XmlRPCGetUserMethodUUID);
109 m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar);
110
111 // Used by IAR module to do password checks
112 m_httpServer.AddXmlRPCHandler("authenticate_user_by_password", XmlRPCAuthenticateUserMethodPassword);
113
114 m_httpServer.AddXmlRPCHandler("update_user_current_region", XmlRPCAtRegion);
115 m_httpServer.AddXmlRPCHandler("logout_of_simulator", XmlRPCLogOffUserMethodUUID);
116 m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", XmlRPCGetAgentMethodUUID);
117
118 m_httpServer.AddXmlRPCHandler("update_user_profile", XmlRpcResponseXmlRPCUpdateUserProfile);
119
120 m_httpServer.AddStreamHandler(new RestStreamHandler("DELETE", "/usersessions/", RestDeleteUserSessionMethod));
121 }
122
123 /// <summary>
124 /// Deletes an active agent session
125 /// </summary>
126 /// <param name="request">The request</param>
127 /// <param name="path">The path (eg /bork/narf/test)</param>
128 /// <param name="param">Parameters sent</param>
129 /// <param name="httpRequest">HTTP request header object</param>
130 /// <param name="httpResponse">HTTP response header object</param>
131 /// <returns>Success "OK" else error</returns>
132 public string RestDeleteUserSessionMethod(string request, string path, string param,
133 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
134 {
135 // TODO! Important!
136
137 return "OK";
138 }
139
140 public XmlRpcResponse AvatarPickerListtoXmlRPCResponse(UUID queryID, List<AvatarPickerAvatar> returnUsers)
141 {
142 XmlRpcResponse response = new XmlRpcResponse();
143 Hashtable responseData = new Hashtable();
144 // Query Result Information
145 responseData["queryid"] = queryID.ToString();
146 responseData["avcount"] = returnUsers.Count.ToString();
147
148 for (int i = 0; i < returnUsers.Count; i++)
149 {
150 responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString();
151 responseData["firstname" + i] = returnUsers[i].firstName;
152 responseData["lastname" + i] = returnUsers[i].lastName;
153 }
154 response.Value = responseData;
155
156 return response;
157 }
158
159 /// <summary>
160 /// Converts a user profile to an XML element which can be returned
161 /// </summary>
162 /// <param name="profile">The user profile</param>
163 /// <returns>A string containing an XML Document of the user profile</returns>
164 public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile)
165 {
166 XmlRpcResponse response = new XmlRpcResponse();
167 Hashtable responseData = new Hashtable();
168
169 // Account information
170 responseData["firstname"] = profile.FirstName;
171 responseData["lastname"] = profile.SurName;
172 responseData["email"] = profile.Email;
173 responseData["uuid"] = profile.ID.ToString();
174 // Server Information
175 responseData["server_inventory"] = profile.UserInventoryURI;
176 responseData["server_asset"] = profile.UserAssetURI;
177 // Profile Information
178 responseData["profile_about"] = profile.AboutText;
179 responseData["profile_firstlife_about"] = profile.FirstLifeAboutText;
180 responseData["profile_firstlife_image"] = profile.FirstLifeImage.ToString();
181 responseData["profile_can_do"] = profile.CanDoMask.ToString();
182 responseData["profile_want_do"] = profile.WantDoMask.ToString();
183 responseData["profile_image"] = profile.Image.ToString();
184 responseData["profile_created"] = profile.Created.ToString();
185 responseData["profile_lastlogin"] = profile.LastLogin.ToString();
186 // Home region information
187 responseData["home_coordinates_x"] = profile.HomeLocation.X.ToString();
188 responseData["home_coordinates_y"] = profile.HomeLocation.Y.ToString();
189 responseData["home_coordinates_z"] = profile.HomeLocation.Z.ToString();
190
191 responseData["home_region"] = profile.HomeRegion.ToString();
192 responseData["home_region_id"] = profile.HomeRegionID.ToString();
193
194 responseData["home_look_x"] = profile.HomeLookAt.X.ToString();
195 responseData["home_look_y"] = profile.HomeLookAt.Y.ToString();
196 responseData["home_look_z"] = profile.HomeLookAt.Z.ToString();
197
198 responseData["user_flags"] = profile.UserFlags.ToString();
199 responseData["god_level"] = profile.GodLevel.ToString();
200 responseData["custom_type"] = profile.CustomType;
201 responseData["partner"] = profile.Partner.ToString();
202 response.Value = responseData;
203
204 return response;
205 }
206
207 #region XMLRPC User Methods
208
209 /// <summary>
210 /// Authenticate a user using their password
211 /// </summary>
212 /// <param name="request">Must contain values for "user_uuid" and "password" keys</param>
213 /// <param name="remoteClient"></param>
214 /// <returns></returns>
215 public XmlRpcResponse XmlRPCAuthenticateUserMethodPassword(XmlRpcRequest request, IPEndPoint remoteClient)
216 {
217// m_log.DebugFormat("[USER MANAGER]: Received authenticated user by password request from {0}", remoteClient);
218
219 Hashtable requestData = (Hashtable)request.Params[0];
220 string userUuidRaw = (string)requestData["user_uuid"];
221 string password = (string)requestData["password"];
222
223 if (null == userUuidRaw)
224 return Util.CreateUnknownUserErrorResponse();
225
226 UUID userUuid;
227 if (!UUID.TryParse(userUuidRaw, out userUuid))
228 return Util.CreateUnknownUserErrorResponse();
229
230 UserProfileData userProfile = m_userDataBaseService.GetUserProfile(userUuid);
231 if (null == userProfile)
232 return Util.CreateUnknownUserErrorResponse();
233
234 string authed;
235
236 if (null == password)
237 {
238 authed = "FALSE";
239 }
240 else
241 {
242 if (m_userDataBaseService.AuthenticateUserByPassword(userUuid, password))
243 authed = "TRUE";
244 else
245 authed = "FALSE";
246 }
247
248// m_log.DebugFormat(
249// "[USER MANAGER]: Authentication by password result from {0} for {1} is {2}",
250// remoteClient, userUuid, authed);
251
252 XmlRpcResponse response = new XmlRpcResponse();
253 Hashtable responseData = new Hashtable();
254 responseData["auth_user"] = authed;
255 response.Value = responseData;
256
257 return response;
258 }
259
260 public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request, IPEndPoint remoteClient)
261 {
262 // XmlRpcResponse response = new XmlRpcResponse();
263 Hashtable requestData = (Hashtable)request.Params[0];
264 List<AvatarPickerAvatar> returnAvatar = new List<AvatarPickerAvatar>();
265 UUID queryID = new UUID(UUID.Zero.ToString());
266
267 if (requestData.Contains("avquery") && requestData.Contains("queryid"))
268 {
269 queryID = new UUID((string)requestData["queryid"]);
270 returnAvatar = m_userDataBaseService.GenerateAgentPickerRequestResponse(queryID, (string)requestData["avquery"]);
271 }
272
273 m_log.InfoFormat("[AVATARINFO]: Servicing Avatar Query: " + (string)requestData["avquery"]);
274 return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar);
275 }
276
277 public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request, IPEndPoint remoteClient)
278 {
279 XmlRpcResponse response = new XmlRpcResponse();
280 Hashtable requestData = (Hashtable)request.Params[0];
281 Hashtable responseData = new Hashtable();
282 string returnstring = "FALSE";
283
284 if (requestData.Contains("avatar_id") && requestData.Contains("region_handle") &&
285 requestData.Contains("region_uuid"))
286 {
287 // ulong cregionhandle = 0;
288 UUID regionUUID;
289 UUID avatarUUID;
290
291 UUID.TryParse((string)requestData["avatar_id"], out avatarUUID);
292 UUID.TryParse((string)requestData["region_uuid"], out regionUUID);
293
294 if (avatarUUID != UUID.Zero)
295 {
296 UserProfileData userProfile = m_userDataBaseService.GetUserProfile(avatarUUID);
297 userProfile.CurrentAgent.Region = regionUUID;
298 userProfile.CurrentAgent.Handle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
299 //userProfile.CurrentAgent.
300 m_userDataBaseService.CommitAgent(ref userProfile);
301 //setUserProfile(userProfile);
302
303 returnstring = "TRUE";
304 }
305 }
306
307 responseData.Add("returnString", returnstring);
308 response.Value = responseData;
309 return response;
310 }
311
312 public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request, IPEndPoint remoteClient)
313 {
314 // XmlRpcResponse response = new XmlRpcResponse();
315 Hashtable requestData = (Hashtable)request.Params[0];
316 UserProfileData userProfile;
317 if (requestData.Contains("avatar_name"))
318 {
319 string query = (string)requestData["avatar_name"];
320
321 if (null == query)
322 return Util.CreateUnknownUserErrorResponse();
323
324 // Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
325
326 string[] querysplit = query.Split(' ');
327
328 if (querysplit.Length == 2)
329 {
330 userProfile = m_userDataBaseService.GetUserProfile(querysplit[0], querysplit[1]);
331 if (userProfile == null)
332 {
333 return Util.CreateUnknownUserErrorResponse();
334 }
335 }
336 else
337 {
338 return Util.CreateUnknownUserErrorResponse();
339 }
340 }
341 else
342 {
343 return Util.CreateUnknownUserErrorResponse();
344 }
345
346 return ProfileToXmlRPCResponse(userProfile);
347 }
348
349 public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request, IPEndPoint remoteClient)
350 {
351 // XmlRpcResponse response = new XmlRpcResponse();
352 Hashtable requestData = (Hashtable)request.Params[0];
353 UserProfileData userProfile;
354 //CFK: this clogs the UserServer log and is not necessary at this time.
355 //CFK: m_log.Debug("METHOD BY UUID CALLED");
356 if (requestData.Contains("avatar_uuid"))
357 {
358 try
359 {
360 UUID guess = new UUID((string)requestData["avatar_uuid"]);
361
362 userProfile = m_userDataBaseService.GetUserProfile(guess);
363 }
364 catch (FormatException)
365 {
366 return Util.CreateUnknownUserErrorResponse();
367 }
368
369 if (userProfile == null)
370 {
371 return Util.CreateUnknownUserErrorResponse();
372 }
373 }
374 else
375 {
376 return Util.CreateUnknownUserErrorResponse();
377 }
378
379 return ProfileToXmlRPCResponse(userProfile);
380 }
381
382 public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request, IPEndPoint remoteClient)
383 {
384 XmlRpcResponse response = new XmlRpcResponse();
385 Hashtable requestData = (Hashtable)request.Params[0];
386 UserProfileData userProfile;
387 //CFK: this clogs the UserServer log and is not necessary at this time.
388 //CFK: m_log.Debug("METHOD BY UUID CALLED");
389 if (requestData.Contains("avatar_uuid"))
390 {
391 UUID guess;
392
393 UUID.TryParse((string)requestData["avatar_uuid"], out guess);
394
395 if (guess == UUID.Zero)
396 {
397 return Util.CreateUnknownUserErrorResponse();
398 }
399
400 userProfile = m_userDataBaseService.GetUserProfile(guess);
401
402 if (userProfile == null)
403 {
404 return Util.CreateUnknownUserErrorResponse();
405 }
406
407 // no agent???
408 if (userProfile.CurrentAgent == null)
409 {
410 return Util.CreateUnknownUserErrorResponse();
411 }
412 Hashtable responseData = new Hashtable();
413
414 responseData["handle"] = userProfile.CurrentAgent.Handle.ToString();
415 responseData["session"] = userProfile.CurrentAgent.SessionID.ToString();
416 if (userProfile.CurrentAgent.AgentOnline)
417 responseData["agent_online"] = "TRUE";
418 else
419 responseData["agent_online"] = "FALSE";
420
421 response.Value = responseData;
422 }
423 else
424 {
425 return Util.CreateUnknownUserErrorResponse();
426 }
427
428 return response;
429 }
430
431 public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserProfile(XmlRpcRequest request, IPEndPoint remoteClient)
432 {
433 m_log.Debug("[UserManager]: Got request to update user profile");
434 XmlRpcResponse response = new XmlRpcResponse();
435 Hashtable requestData = (Hashtable)request.Params[0];
436 Hashtable responseData = new Hashtable();
437
438 if (!requestData.Contains("avatar_uuid"))
439 {
440 return Util.CreateUnknownUserErrorResponse();
441 }
442
443 UUID UserUUID = new UUID((string)requestData["avatar_uuid"]);
444 UserProfileData userProfile = m_userDataBaseService.GetUserProfile(UserUUID);
445 if (null == userProfile)
446 {
447 return Util.CreateUnknownUserErrorResponse();
448 }
449 // don't know how yet.
450 if (requestData.Contains("AllowPublish"))
451 {
452 }
453 if (requestData.Contains("FLImageID"))
454 {
455 userProfile.FirstLifeImage = new UUID((string)requestData["FLImageID"]);
456 }
457 if (requestData.Contains("ImageID"))
458 {
459 userProfile.Image = new UUID((string)requestData["ImageID"]);
460 }
461 // dont' know how yet
462 if (requestData.Contains("MaturePublish"))
463 {
464 }
465 if (requestData.Contains("AboutText"))
466 {
467 userProfile.AboutText = (string)requestData["AboutText"];
468 }
469 if (requestData.Contains("FLAboutText"))
470 {
471 userProfile.FirstLifeAboutText = (string)requestData["FLAboutText"];
472 }
473 // not in DB yet.
474 if (requestData.Contains("ProfileURL"))
475 {
476 }
477 if (requestData.Contains("home_region"))
478 {
479 try
480 {
481 userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]);
482 }
483 catch (ArgumentException)
484 {
485 m_log.Error("[PROFILE]:Failed to set home region, Invalid Argument");
486 }
487 catch (FormatException)
488 {
489 m_log.Error("[PROFILE]:Failed to set home region, Invalid Format");
490 }
491 catch (OverflowException)
492 {
493 m_log.Error("[PROFILE]:Failed to set home region, Value was too large");
494 }
495 }
496 if (requestData.Contains("home_region_id"))
497 {
498 UUID regionID;
499 UUID.TryParse((string)requestData["home_region_id"], out regionID);
500 userProfile.HomeRegionID = regionID;
501 }
502 if (requestData.Contains("home_pos_x"))
503 {
504 try
505 {
506 userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]);
507 }
508 catch (InvalidCastException)
509 {
510 m_log.Error("[PROFILE]:Failed to set home postion x");
511 }
512 }
513 if (requestData.Contains("home_pos_y"))
514 {
515 try
516 {
517 userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]);
518 }
519 catch (InvalidCastException)
520 {
521 m_log.Error("[PROFILE]:Failed to set home postion y");
522 }
523 }
524 if (requestData.Contains("home_pos_z"))
525 {
526 try
527 {
528 userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]);
529 }
530 catch (InvalidCastException)
531 {
532 m_log.Error("[PROFILE]:Failed to set home postion z");
533 }
534 }
535 if (requestData.Contains("home_look_x"))
536 {
537 try
538 {
539 userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]);
540 }
541 catch (InvalidCastException)
542 {
543 m_log.Error("[PROFILE]:Failed to set home lookat x");
544 }
545 }
546 if (requestData.Contains("home_look_y"))
547 {
548 try
549 {
550 userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]);
551 }
552 catch (InvalidCastException)
553 {
554 m_log.Error("[PROFILE]:Failed to set home lookat y");
555 }
556 }
557 if (requestData.Contains("home_look_z"))
558 {
559 try
560 {
561 userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]);
562 }
563 catch (InvalidCastException)
564 {
565 m_log.Error("[PROFILE]:Failed to set home lookat z");
566 }
567 }
568 if (requestData.Contains("user_flags"))
569 {
570 try
571 {
572 userProfile.UserFlags = Convert.ToInt32((string)requestData["user_flags"]);
573 }
574 catch (InvalidCastException)
575 {
576 m_log.Error("[PROFILE]:Failed to set user flags");
577 }
578 }
579 if (requestData.Contains("god_level"))
580 {
581 try
582 {
583 userProfile.GodLevel = Convert.ToInt32((string)requestData["god_level"]);
584 }
585 catch (InvalidCastException)
586 {
587 m_log.Error("[PROFILE]:Failed to set god level");
588 }
589 }
590 if (requestData.Contains("custom_type"))
591 {
592 try
593 {
594 userProfile.CustomType = (string)requestData["custom_type"];
595 }
596 catch (InvalidCastException)
597 {
598 m_log.Error("[PROFILE]:Failed to set custom type");
599 }
600 }
601 if (requestData.Contains("partner"))
602 {
603 try
604 {
605 userProfile.Partner = new UUID((string)requestData["partner"]);
606 }
607 catch (InvalidCastException)
608 {
609 m_log.Error("[PROFILE]:Failed to set partner");
610 }
611 }
612 else
613 {
614 userProfile.Partner = UUID.Zero;
615 }
616
617 // call plugin!
618 bool ret = m_userDataBaseService.UpdateUserProfile(userProfile);
619 responseData["returnString"] = ret.ToString();
620 response.Value = responseData;
621 return response;
622 }
623
624 public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request, IPEndPoint remoteClient)
625 {
626 XmlRpcResponse response = new XmlRpcResponse();
627 Hashtable requestData = (Hashtable)request.Params[0];
628
629 if (requestData.Contains("avatar_uuid"))
630 {
631 try
632 {
633 UUID userUUID = new UUID((string)requestData["avatar_uuid"]);
634 UUID RegionID = new UUID((string)requestData["region_uuid"]);
635 ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
636 Vector3 position = new Vector3(
637 (float)Convert.ToDecimal((string)requestData["region_pos_x"]),
638 (float)Convert.ToDecimal((string)requestData["region_pos_y"]),
639 (float)Convert.ToDecimal((string)requestData["region_pos_z"]));
640 Vector3 lookat = new Vector3(
641 (float)Convert.ToDecimal((string)requestData["lookat_x"]),
642 (float)Convert.ToDecimal((string)requestData["lookat_y"]),
643 (float)Convert.ToDecimal((string)requestData["lookat_z"]));
644
645 handlerLogOffUser = OnLogOffUser;
646 if (handlerLogOffUser != null)
647 handlerLogOffUser(userUUID);
648
649 m_userDataBaseService.LogOffUser(userUUID, RegionID, regionhandle, position, lookat);
650 }
651 catch (FormatException)
652 {
653 m_log.Warn("[LOGOUT]: Error in Logout XMLRPC Params");
654 return response;
655 }
656 }
657 else
658 {
659 return Util.CreateUnknownUserErrorResponse();
660 }
661
662 return response;
663 }
664
665 #endregion
666
667
668 public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle)
669 {
670 UserProfileData userProfile = m_userDataBaseService.GetUserProfile(agentID);
671 if (userProfile != null)
672 {
673 userProfile.CurrentAgent.Region = regionID;
674 userProfile.CurrentAgent.Handle = regionHandle;
675 m_userDataBaseService.CommitAgent(ref userProfile);
676 }
677 }
678
679 public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle)
680 {
681 UserProfileData userProfile = m_userDataBaseService.GetUserProfile(agentID);
682 if (userProfile != null)
683 {
684 if (userProfile.CurrentAgent.Region == regionID)
685 {
686 UserAgentData userAgent = userProfile.CurrentAgent;
687 if (userAgent != null && userAgent.AgentOnline)
688 {
689 userAgent.AgentOnline = false;
690 userAgent.LogoutTime = Util.UnixTimeSinceEpoch();
691 if (regionID != UUID.Zero)
692 {
693 userAgent.Region = regionID;
694 }
695 userAgent.Handle = regionHandle;
696 userProfile.LastLogin = userAgent.LogoutTime;
697
698 m_userDataBaseService.CommitAgent(ref userProfile);
699
700 handlerLogOffUser = OnLogOffUser;
701 if (handlerLogOffUser != null)
702 handlerLogOffUser(agentID);
703 }
704 }
705 }
706 }
707
708 public void HandleRegionStartup(UUID regionID)
709 {
710 m_userDataBaseService.LogoutUsers(regionID);
711 }
712
713 public void HandleRegionShutdown(UUID regionID)
714 {
715 m_userDataBaseService.LogoutUsers(regionID);
716 }
717 }
718}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using log4net;
34using Nwc.XmlRpc;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Grid.Framework;
41
42namespace OpenSim.Grid.UserServer.Modules
43{
44 public class UserServerAvatarAppearanceModule
45 {
46 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 private UserDataBaseService m_userDataBaseService;
49 private BaseHttpServer m_httpServer;
50
51 public UserServerAvatarAppearanceModule(UserDataBaseService userDataBaseService)
52 {
53 m_userDataBaseService = userDataBaseService;
54 }
55
56 public void Initialise(IGridServiceCore core)
57 {
58
59 }
60
61 public void PostInitialise()
62 {
63
64 }
65
66 public void RegisterHandlers(BaseHttpServer httpServer)
67 {
68 m_httpServer = httpServer;
69
70 m_httpServer.AddXmlRPCHandler("get_avatar_appearance", XmlRPCGetAvatarAppearance);
71 m_httpServer.AddXmlRPCHandler("update_avatar_appearance", XmlRPCUpdateAvatarAppearance);
72 }
73
74 public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient)
75 {
76 XmlRpcResponse response = new XmlRpcResponse();
77 Hashtable requestData = (Hashtable)request.Params[0];
78 AvatarAppearance appearance;
79 Hashtable responseData;
80 if (requestData.Contains("owner"))
81 {
82 appearance = m_userDataBaseService.GetUserAppearance(new UUID((string)requestData["owner"]));
83 if (appearance == null)
84 {
85 responseData = new Hashtable();
86 responseData["error_type"] = "no appearance";
87 responseData["error_desc"] = "There was no appearance found for this avatar";
88 }
89 else
90 {
91 responseData = appearance.ToHashTable();
92 }
93 }
94 else
95 {
96 responseData = new Hashtable();
97 responseData["error_type"] = "unknown_avatar";
98 responseData["error_desc"] = "The avatar appearance requested is not in the database";
99 }
100
101 response.Value = responseData;
102 return response;
103 }
104
105 public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient)
106 {
107 XmlRpcResponse response = new XmlRpcResponse();
108 Hashtable requestData = (Hashtable)request.Params[0];
109 Hashtable responseData;
110 if (requestData.Contains("owner"))
111 {
112 AvatarAppearance appearance = new AvatarAppearance(requestData);
113
114 // TODO: Sometime in the future we may have a database layer that is capable of updating appearance when
115 // the TextureEntry is null. When that happens, this check can be removed
116 if (appearance.Texture != null)
117 m_userDataBaseService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance);
118
119 responseData = new Hashtable();
120 responseData["returnString"] = "TRUE";
121 }
122 else
123 {
124 responseData = new Hashtable();
125 responseData["error_type"] = "unknown_avatar";
126 responseData["error_desc"] = "The avatar appearance requested is not in the database";
127 }
128 response.Value = responseData;
129 return response;
130 }
131 }
132}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using log4net;
34using Nwc.XmlRpc;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Grid.Framework;
41
42namespace OpenSim.Grid.UserServer.Modules
43{
44 public class UserServerFriendsModule
45 {
46 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 private UserDataBaseService m_userDataBaseService;
49
50 private BaseHttpServer m_httpServer;
51
52 public UserServerFriendsModule(UserDataBaseService userDataBaseService)
53 {
54 m_userDataBaseService = userDataBaseService;
55 }
56
57 public void Initialise(IGridServiceCore core)
58 {
59
60 }
61
62 public void PostInitialise()
63 {
64
65 }
66
67 public void RegisterHandlers(BaseHttpServer httpServer)
68 {
69 m_httpServer = httpServer;
70
71 m_httpServer.AddXmlRPCHandler("add_new_user_friend", XmlRpcResponseXmlRPCAddUserFriend);
72 m_httpServer.AddXmlRPCHandler("remove_user_friend", XmlRpcResponseXmlRPCRemoveUserFriend);
73 m_httpServer.AddXmlRPCHandler("update_user_friend_perms", XmlRpcResponseXmlRPCUpdateUserFriendPerms);
74 m_httpServer.AddXmlRPCHandler("get_user_friend_list", XmlRpcResponseXmlRPCGetUserFriendList);
75 }
76
77 public XmlRpcResponse FriendListItemListtoXmlRPCResponse(List<FriendListItem> returnUsers)
78 {
79 XmlRpcResponse response = new XmlRpcResponse();
80 Hashtable responseData = new Hashtable();
81 // Query Result Information
82
83 responseData["avcount"] = returnUsers.Count.ToString();
84
85 for (int i = 0; i < returnUsers.Count; i++)
86 {
87 responseData["ownerID" + i] = returnUsers[i].FriendListOwner.ToString();
88 responseData["friendID" + i] = returnUsers[i].Friend.ToString();
89 responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString();
90 responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString();
91 }
92 response.Value = responseData;
93
94 return response;
95 }
96
97 public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request, IPEndPoint remoteClient)
98 {
99 XmlRpcResponse response = new XmlRpcResponse();
100 Hashtable requestData = (Hashtable)request.Params[0];
101 Hashtable responseData = new Hashtable();
102 string returnString = "FALSE";
103 // Query Result Information
104
105 if (requestData.Contains("ownerID") && requestData.Contains("friendID") &&
106 requestData.Contains("friendPerms"))
107 {
108 // UserManagerBase.AddNewuserFriend
109 m_userDataBaseService.AddNewUserFriend(new UUID((string)requestData["ownerID"]),
110 new UUID((string)requestData["friendID"]),
111 (uint)Convert.ToInt32((string)requestData["friendPerms"]));
112 returnString = "TRUE";
113 }
114 responseData["returnString"] = returnString;
115 response.Value = responseData;
116 return response;
117 }
118
119 public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request, IPEndPoint remoteClient)
120 {
121 XmlRpcResponse response = new XmlRpcResponse();
122 Hashtable requestData = (Hashtable)request.Params[0];
123 Hashtable responseData = new Hashtable();
124 string returnString = "FALSE";
125 // Query Result Information
126
127 if (requestData.Contains("ownerID") && requestData.Contains("friendID"))
128 {
129 // UserManagerBase.AddNewuserFriend
130 m_userDataBaseService.RemoveUserFriend(new UUID((string)requestData["ownerID"]),
131 new UUID((string)requestData["friendID"]));
132 returnString = "TRUE";
133 }
134 responseData["returnString"] = returnString;
135 response.Value = responseData;
136 return response;
137 }
138
139 public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request, IPEndPoint remoteClient)
140 {
141 XmlRpcResponse response = new XmlRpcResponse();
142 Hashtable requestData = (Hashtable)request.Params[0];
143 Hashtable responseData = new Hashtable();
144 string returnString = "FALSE";
145
146 if (requestData.Contains("ownerID") && requestData.Contains("friendID") &&
147 requestData.Contains("friendPerms"))
148 {
149 m_userDataBaseService.UpdateUserFriendPerms(new UUID((string)requestData["ownerID"]),
150 new UUID((string)requestData["friendID"]),
151 (uint)Convert.ToInt32((string)requestData["friendPerms"]));
152 // UserManagerBase.
153 returnString = "TRUE";
154 }
155 responseData["returnString"] = returnString;
156 response.Value = responseData;
157 return response;
158 }
159
160 public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request, IPEndPoint remoteClient)
161 {
162 // XmlRpcResponse response = new XmlRpcResponse();
163 Hashtable requestData = (Hashtable)request.Params[0];
164 // Hashtable responseData = new Hashtable();
165
166 List<FriendListItem> returndata = new List<FriendListItem>();
167
168 if (requestData.Contains("ownerID"))
169 {
170 returndata = m_userDataBaseService.GetUserFriendList(new UUID((string)requestData["ownerID"]));
171 }
172
173 return FriendListItemListtoXmlRPCResponse(returndata);
174 }
175 }
176}
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
deleted file mode 100644
index 286076d7..0000000
--- a/OpenSim/Grid/UserServer/Main.cs
+++ /dev/null
@@ -1,330 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using log4net;
33using log4net.Config;
34using OpenMetaverse;
35using OpenSim.Data;
36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Console;
40using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Framework.Statistics;
43using OpenSim.Grid.Communications.OGS1;
44using OpenSim.Grid.Framework;
45using OpenSim.Grid.UserServer.Modules;
46using Nini.Config;
47
48namespace OpenSim.Grid.UserServer
49{
50 /// <summary>
51 /// Grid user server main class
52 /// </summary>
53 public class OpenUser_Main : BaseOpenSimServer, IGridServiceCore
54 {
55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
56
57 protected UserConfig Cfg;
58
59 protected UserDataBaseService m_userDataBaseService;
60
61 public UserManager m_userManager;
62
63 protected UserServerAvatarAppearanceModule m_avatarAppearanceModule;
64 protected UserServerFriendsModule m_friendsModule;
65
66 public UserLoginService m_loginService;
67 public UserLoginAuthService m_loginAuthService;
68 public MessageServersConnector m_messagesService;
69
70 protected GridInfoServiceModule m_gridInfoService;
71
72 protected UserServerCommandModule m_consoleCommandModule;
73 protected UserServerEventDispatchModule m_eventDispatcher;
74
75 protected AvatarCreationModule m_appearanceModule;
76
77 protected static string m_consoleType = "local";
78 protected static IConfigSource m_config = null;
79 protected static string m_configFile = "UserServer_Config.xml";
80
81 public static void Main(string[] args)
82 {
83 ArgvConfigSource argvSource = new ArgvConfigSource(args);
84 argvSource.AddSwitch("Startup", "console", "c");
85 argvSource.AddSwitch("Startup", "xmlfile", "x");
86
87 IConfig startupConfig = argvSource.Configs["Startup"];
88 if (startupConfig != null)
89 {
90 m_consoleType = startupConfig.GetString("console", "local");
91 m_configFile = startupConfig.GetString("xmlfile", "UserServer_Config.xml");
92 }
93
94 m_config = argvSource;
95
96 XmlConfigurator.Configure();
97
98 m_log.Info("Launching UserServer...");
99
100 OpenUser_Main userserver = new OpenUser_Main();
101
102 userserver.Startup();
103 userserver.Work();
104 }
105
106 public OpenUser_Main()
107 {
108 switch (m_consoleType)
109 {
110 case "rest":
111 m_console = new RemoteConsole("User");
112 break;
113 case "basic":
114 m_console = new CommandConsole("User");
115 break;
116 default:
117 m_console = new LocalConsole("User");
118 break;
119 }
120 MainConsole.Instance = m_console;
121 }
122
123 public void Work()
124 {
125 m_console.Output("Enter help for a list of commands\n");
126
127 while (true)
128 {
129 m_console.Prompt();
130 }
131 }
132
133 protected override void StartupSpecific()
134 {
135 IInterServiceInventoryServices inventoryService = StartupCoreComponents();
136
137 m_stats = StatsManager.StartCollectingUserStats();
138
139 //setup services/modules
140 StartupUserServerModules();
141
142 StartOtherComponents(inventoryService);
143
144 //PostInitialise the modules
145 PostInitialiseModules();
146
147 //register http handlers and start http server
148 m_log.Info("[STARTUP]: Starting HTTP process");
149 RegisterHttpHandlers();
150 m_httpServer.Start();
151
152 base.StartupSpecific();
153 }
154
155 protected virtual IInterServiceInventoryServices StartupCoreComponents()
156 {
157 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), m_configFile)));
158
159 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
160
161 if (m_console is RemoteConsole)
162 {
163 RemoteConsole c = (RemoteConsole)m_console;
164 c.SetServer(m_httpServer);
165 IConfig netConfig = m_config.AddConfig("Network");
166 netConfig.Set("ConsoleUser", Cfg.ConsoleUser);
167 netConfig.Set("ConsolePass", Cfg.ConsolePass);
168 c.ReadConfig(m_config);
169 }
170
171 RegisterInterface<CommandConsole>(m_console);
172 RegisterInterface<UserConfig>(Cfg);
173
174 //Should be in modules?
175 IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
176 // IRegionProfileRouter regionProfileService = new RegionProfileServiceProxy();
177
178 RegisterInterface<IInterServiceInventoryServices>(inventoryService);
179 // RegisterInterface<IRegionProfileRouter>(regionProfileService);
180
181 return inventoryService;
182 }
183
184 /// <summary>
185 /// Start up the user manager
186 /// </summary>
187 /// <param name="inventoryService"></param>
188 protected virtual void StartupUserServerModules()
189 {
190 m_log.Info("[STARTUP]: Establishing data connection");
191
192 //we only need core components so we can request them from here
193 IInterServiceInventoryServices inventoryService;
194 TryGet<IInterServiceInventoryServices>(out inventoryService);
195
196 CommunicationsManager commsManager = new UserServerCommsManager(inventoryService);
197
198 //setup database access service, for now this has to be created before the other modules.
199 m_userDataBaseService = new UserDataBaseService(commsManager);
200 m_userDataBaseService.Initialise(this);
201
202 //TODO: change these modules so they fetch the databaseService class in the PostInitialise method
203 m_userManager = new UserManager(m_userDataBaseService);
204 m_userManager.Initialise(this);
205
206 m_avatarAppearanceModule = new UserServerAvatarAppearanceModule(m_userDataBaseService);
207 m_avatarAppearanceModule.Initialise(this);
208
209 m_friendsModule = new UserServerFriendsModule(m_userDataBaseService);
210 m_friendsModule.Initialise(this);
211
212 m_consoleCommandModule = new UserServerCommandModule();
213 m_consoleCommandModule.Initialise(this);
214
215 m_messagesService = new MessageServersConnector();
216 m_messagesService.Initialise(this);
217
218 m_gridInfoService = new GridInfoServiceModule();
219 m_gridInfoService.Initialise(this);
220 }
221
222 protected virtual void StartOtherComponents(IInterServiceInventoryServices inventoryService)
223 {
224 m_appearanceModule = new AvatarCreationModule(m_userDataBaseService, Cfg, inventoryService);
225 m_appearanceModule.Initialise(this);
226
227 StartupLoginService(inventoryService);
228 //
229 // Get the minimum defaultLevel to access to the grid
230 //
231 m_loginService.setloginlevel((int)Cfg.DefaultUserLevel);
232
233 RegisterInterface<UserLoginService>(m_loginService); //TODO: should be done in the login service
234
235 m_eventDispatcher = new UserServerEventDispatchModule(m_userManager, m_messagesService, m_loginService);
236 m_eventDispatcher.Initialise(this);
237 }
238
239 /// <summary>
240 /// Start up the login service
241 /// </summary>
242 /// <param name="inventoryService"></param>
243 protected virtual void StartupLoginService(IInterServiceInventoryServices inventoryService)
244 {
245 m_loginService = new UserLoginService(
246 m_userDataBaseService, inventoryService, new LibraryRootFolder(Cfg.LibraryXmlfile), Cfg, Cfg.DefaultStartupMsg, new RegionProfileServiceProxy());
247
248 if (Cfg.EnableHGLogin)
249 m_loginAuthService = new UserLoginAuthService(m_userDataBaseService, inventoryService, new LibraryRootFolder(Cfg.LibraryXmlfile),
250 Cfg, Cfg.DefaultStartupMsg, new RegionProfileServiceProxy());
251 }
252
253 protected virtual void PostInitialiseModules()
254 {
255 m_consoleCommandModule.PostInitialise(); //it will register its Console command handlers in here
256 m_userDataBaseService.PostInitialise();
257 m_messagesService.PostInitialise();
258 m_eventDispatcher.PostInitialise(); //it will register event handlers in here
259 m_gridInfoService.PostInitialise();
260 m_userManager.PostInitialise();
261 m_avatarAppearanceModule.PostInitialise();
262 m_friendsModule.PostInitialise();
263 }
264
265 protected virtual void RegisterHttpHandlers()
266 {
267 m_loginService.RegisterHandlers(m_httpServer, Cfg.EnableLLSDLogin, true);
268
269 if (m_loginAuthService != null)
270 m_loginAuthService.RegisterHandlers(m_httpServer);
271
272 m_userManager.RegisterHandlers(m_httpServer);
273 m_friendsModule.RegisterHandlers(m_httpServer);
274 m_avatarAppearanceModule.RegisterHandlers(m_httpServer);
275 m_messagesService.RegisterHandlers(m_httpServer);
276 m_gridInfoService.RegisterHandlers(m_httpServer);
277 }
278
279 public override void ShutdownSpecific()
280 {
281 m_eventDispatcher.Close();
282 }
283
284 #region IUGAIMCore
285 protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
286
287 /// <summary>
288 /// Register an Module interface.
289 /// </summary>
290 /// <typeparam name="T"></typeparam>
291 /// <param name="iface"></param>
292 public void RegisterInterface<T>(T iface)
293 {
294 lock (m_moduleInterfaces)
295 {
296 if (!m_moduleInterfaces.ContainsKey(typeof(T)))
297 {
298 m_moduleInterfaces.Add(typeof(T), iface);
299 }
300 }
301 }
302
303 public bool TryGet<T>(out T iface)
304 {
305 if (m_moduleInterfaces.ContainsKey(typeof(T)))
306 {
307 iface = (T)m_moduleInterfaces[typeof(T)];
308 return true;
309 }
310 iface = default(T);
311 return false;
312 }
313
314 public T Get<T>()
315 {
316 return (T)m_moduleInterfaces[typeof(T)];
317 }
318
319 public BaseHttpServer GetHttpServer()
320 {
321 return m_httpServer;
322 }
323 #endregion
324
325 public void TestResponse(List<InventoryFolderBase> resp)
326 {
327 m_console.Output("response got");
328 }
329 }
330}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Runtime.InteropServices;
30
31// General information about an assembly is controlled through the following
32// set of attributes. Change these attribute values to modify the information
33// associated with an assembly.
34
35[assembly : AssemblyTitle("OGS-UserServer")]
36[assembly : AssemblyDescription("")]
37[assembly : AssemblyConfiguration("")]
38[assembly : AssemblyCompany("http://opensimulator.org")]
39[assembly : AssemblyProduct("OGS-UserServer")]
40[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47
48[assembly : ComVisible(false)]
49
50// The following GUID is for the ID of the typelib if this project is exposed to COM
51
52[assembly : Guid("e266513a-090b-4d38-80f6-8599eef68c8c")]
53
54// Version information for an assembly consists of the following four values:
55//
56// Major Version
57// Minor Version
58// Build Number
59// Revision
60//
61
62[assembly : AssemblyVersion("0.6.5.*")]
63[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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using log4net;
33using log4net.Config;
34using OpenMetaverse;
35using OpenSim.Data;
36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Console;
40using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Framework.Statistics;
43using OpenSim.Grid.Communications.OGS1;
44using OpenSim.Grid.Framework;
45using OpenSim.Grid.UserServer.Modules;
46
47namespace OpenSim.Grid.UserServer
48{
49 public class UserServerCommandModule
50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52
53 protected CommandConsole m_console;
54 protected UserConfig m_cfg;
55
56 protected UserDataBaseService m_userDataBaseService;
57 protected UserLoginService m_loginService;
58
59 protected UUID m_lastCreatedUser = UUID.Random();
60
61 protected IGridServiceCore m_core;
62
63 public UserServerCommandModule()
64 {
65 }
66
67 public void Initialise(IGridServiceCore core)
68 {
69 m_core = core;
70 }
71
72 public void PostInitialise()
73 {
74 UserConfig cfg;
75 if (m_core.TryGet<UserConfig>(out cfg))
76 {
77 m_cfg = cfg;
78 }
79
80 UserDataBaseService userDBservice;
81 if (m_core.TryGet<UserDataBaseService>(out userDBservice))
82 {
83 m_userDataBaseService = userDBservice;
84 }
85
86 UserLoginService loginService;
87 if (m_core.TryGet<UserLoginService>(out loginService))
88 {
89 m_loginService = loginService;
90 }
91
92 CommandConsole console;
93 if ((m_core.TryGet<CommandConsole>(out console)) && (m_cfg != null)
94 && (m_userDataBaseService != null) && (m_loginService != null))
95 {
96 RegisterConsoleCommands(console);
97 }
98 }
99
100 public void RegisterHandlers(BaseHttpServer httpServer)
101 {
102
103 }
104
105 private void RegisterConsoleCommands(CommandConsole console)
106 {
107 m_console = console;
108 m_console.Commands.AddCommand("userserver", false, "create user",
109 "create user [<first> [<last> [<x> <y> [email]]]]",
110 "Create a new user account", RunCommand);
111
112 m_console.Commands.AddCommand("userserver", false, "reset user password",
113 "reset user password [<first> [<last> [<new password>]]]",
114 "Reset a user's password", RunCommand);
115
116 m_console.Commands.AddCommand("userserver", false, "login level",
117 "login level <level>",
118 "Set the minimum user level to log in", HandleLoginCommand);
119
120 m_console.Commands.AddCommand("userserver", false, "login reset",
121 "login reset",
122 "Reset the login level to allow all users",
123 HandleLoginCommand);
124
125 m_console.Commands.AddCommand("userserver", false, "login text",
126 "login text <text>",
127 "Set the text users will see on login", HandleLoginCommand);
128
129 m_console.Commands.AddCommand("userserver", false, "test-inventory",
130 "test-inventory",
131 "Perform a test inventory transaction", RunCommand);
132
133 m_console.Commands.AddCommand("userserver", false, "logoff-user",
134 "logoff-user <first> <last> <message>",
135 "Log off a named user", RunCommand);
136 }
137
138 #region Console Command Handlers
139 public void do_create(string[] args)
140 {
141 switch (args[0])
142 {
143 case "user":
144 CreateUser(args);
145 break;
146 }
147 }
148
149 /// <summary>
150 /// Execute switch for some of the reset commands
151 /// </summary>
152 /// <param name="args"></param>
153 protected void Reset(string[] args)
154 {
155 if (args.Length == 0)
156 return;
157
158 switch (args[0])
159 {
160 case "user":
161
162 switch (args[1])
163 {
164 case "password":
165 ResetUserPassword(args);
166 break;
167 }
168
169 break;
170 }
171 }
172
173 /// <summary>
174 /// Create a new user
175 /// </summary>
176 /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
177 protected void CreateUser(string[] cmdparams)
178 {
179 string firstName;
180 string lastName;
181 string password;
182 string email;
183 uint regX = 1000;
184 uint regY = 1000;
185
186 if (cmdparams.Length < 2)
187 firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
188 else firstName = cmdparams[1];
189
190 if (cmdparams.Length < 3)
191 lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
192 else lastName = cmdparams[2];
193
194 if (cmdparams.Length < 4)
195 password = MainConsole.Instance.PasswdPrompt("Password");
196 else password = cmdparams[3];
197
198 if (cmdparams.Length < 5)
199 regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
200 else regX = Convert.ToUInt32(cmdparams[4]);
201
202 if (cmdparams.Length < 6)
203 regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
204 else regY = Convert.ToUInt32(cmdparams[5]);
205
206 if (cmdparams.Length < 7)
207 email = MainConsole.Instance.CmdPrompt("Email", "");
208 else email = cmdparams[6];
209
210 if (null == m_userDataBaseService.GetUserProfile(firstName, lastName))
211 {
212 m_lastCreatedUser = m_userDataBaseService.AddUser(firstName, lastName, password, email, regX, regY);
213 }
214 else
215 {
216 m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", firstName, lastName);
217 }
218 }
219
220 /// <summary>
221 /// Reset a user password.
222 /// </summary>
223 /// <param name="cmdparams"></param>
224 private void ResetUserPassword(string[] cmdparams)
225 {
226 string firstName;
227 string lastName;
228 string newPassword;
229
230 if (cmdparams.Length < 3)
231 firstName = MainConsole.Instance.CmdPrompt("First name");
232 else firstName = cmdparams[2];
233
234 if (cmdparams.Length < 4)
235 lastName = MainConsole.Instance.CmdPrompt("Last name");
236 else lastName = cmdparams[3];
237
238 if (cmdparams.Length < 5)
239 newPassword = MainConsole.Instance.PasswdPrompt("New password");
240 else newPassword = cmdparams[4];
241
242 m_userDataBaseService.ResetUserPassword(firstName, lastName, newPassword);
243 }
244
245 /*
246 private void HandleTestCommand(string module, string[] cmd)
247 {
248 m_log.Info("test command received");
249 }
250 */
251
252 private void HandleLoginCommand(string module, string[] cmd)
253 {
254 string subcommand = cmd[1];
255
256 switch (subcommand)
257 {
258 case "level":
259 // Set the minimal level to allow login
260 // Useful to allow grid update without worrying about users.
261 // or fixing critical issues
262 //
263 if (cmd.Length > 2)
264 {
265 int level = Convert.ToInt32(cmd[2]);
266 m_loginService.setloginlevel(level);
267 }
268 break;
269 case "reset":
270 m_loginService.setloginlevel(0);
271 break;
272 case "text":
273 if (cmd.Length > 2)
274 {
275 m_loginService.setwelcometext(cmd[2]);
276 }
277 break;
278 }
279 }
280
281 public void RunCommand(string module, string[] cmd)
282 {
283 List<string> args = new List<string>(cmd);
284 string command = cmd[0];
285
286 args.RemoveAt(0);
287
288 string[] cmdparams = args.ToArray();
289
290 switch (command)
291 {
292 case "create":
293 do_create(cmdparams);
294 break;
295
296 case "reset":
297 Reset(cmdparams);
298 break;
299
300
301 case "test-inventory":
302 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
303 // requester.ReturnResponseVal = TestResponse;
304 // requester.BeginPostObject<UUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
305 SynchronousRestObjectPoster.BeginPostObject<UUID, List<InventoryFolderBase>>(
306 "POST", m_cfg.InventoryUrl + "RootFolders/", m_lastCreatedUser);
307 break;
308
309 case "logoff-user":
310 if (cmdparams.Length >= 3)
311 {
312 string firstname = cmdparams[0];
313 string lastname = cmdparams[1];
314 string message = "";
315
316 for (int i = 2; i < cmdparams.Length; i++)
317 message += " " + cmdparams[i];
318
319 UserProfileData theUser = null;
320 try
321 {
322 theUser = m_loginService.GetTheUser(firstname, lastname);
323 }
324 catch (Exception)
325 {
326 m_log.Error("[LOGOFF]: Error getting user data from the database.");
327 }
328
329 if (theUser != null)
330 {
331 if (theUser.CurrentAgent != null)
332 {
333 if (theUser.CurrentAgent.AgentOnline)
334 {
335 m_log.Info("[LOGOFF]: Logging off requested user!");
336 m_loginService.LogOffUser(theUser, message);
337
338 theUser.CurrentAgent.AgentOnline = false;
339
340 m_loginService.CommitAgent(ref theUser);
341 }
342 else
343 {
344 m_log.Info(
345 "[LOGOFF]: User Doesn't appear to be online, sending the logoff message anyway.");
346 m_loginService.LogOffUser(theUser, message);
347
348 theUser.CurrentAgent.AgentOnline = false;
349
350 m_loginService.CommitAgent(ref theUser);
351 }
352 }
353 else
354 {
355 m_log.Error(
356 "[LOGOFF]: Unable to logoff-user. User doesn't have an agent record so I can't find the simulator to notify");
357 }
358 }
359 else
360 {
361 m_log.Info("[LOGOFF]: User doesn't exist in the database");
362 }
363 }
364 else
365 {
366 m_log.Error(
367 "[LOGOFF]: Invalid amount of parameters. logoff-user takes at least three. Firstname, Lastname, and message");
368 }
369
370 break;
371 }
372 }
373 }
374 #endregion
375}
diff --git a/OpenSim/Grid/UserServer/UserServerCommsManager.cs b/OpenSim/Grid/UserServer/UserServerCommsManager.cs
deleted file mode 100644
index 8ef693b..0000000
--- a/OpenSim/Grid/UserServer/UserServerCommsManager.cs
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenSim.Framework.Communications;
29
30namespace OpenSim.Grid.UserServer
31{
32 public class UserServerCommsManager : CommunicationsManager
33 {
34 public UserServerCommsManager(IInterServiceInventoryServices interServiceInventoryService)
35 : base(null, null)
36 {
37 m_interServiceInventoryService = interServiceInventoryService;
38 }
39 }
40}
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using log4net;
33using log4net.Config;
34using OpenMetaverse;
35using OpenSim.Data;
36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Console;
40using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Framework.Statistics;
43using OpenSim.Grid.Communications.OGS1;
44using OpenSim.Grid.Framework;
45using OpenSim.Grid.UserServer.Modules;
46
47namespace OpenSim.Grid.UserServer
48{
49 //Do we actually need these event dispatchers?
50 //shouldn't the other modules just directly register event handlers to each other?
51 public class UserServerEventDispatchModule
52 {
53 protected UserManager m_userManager;
54 protected MessageServersConnector m_messagesService;
55 protected UserLoginService m_loginService;
56
57 public UserServerEventDispatchModule(UserManager userManager, MessageServersConnector messagesService, UserLoginService loginService)
58 {
59 m_userManager = userManager;
60 m_messagesService = messagesService;
61 m_loginService = loginService;
62 }
63
64 public void Initialise(IGridServiceCore core)
65 {
66 }
67
68 public void PostInitialise()
69 {
70 m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation;
71 m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff;
72
73 m_messagesService.OnAgentLocation += HandleAgentLocation;
74 m_messagesService.OnAgentLeaving += HandleAgentLeaving;
75 m_messagesService.OnRegionStartup += HandleRegionStartup;
76 m_messagesService.OnRegionShutdown += HandleRegionShutdown;
77 }
78
79 public void RegisterHandlers(BaseHttpServer httpServer)
80 {
81
82 }
83
84 public void Close()
85 {
86 m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
87 }
88
89 #region Event Handlers
90 public void NotifyMessageServersUserLoggOff(UUID agentID)
91 {
92 m_messagesService.TellMessageServersAboutUserLogoff(agentID);
93 }
94
95 public void NotifyMessageServersUserLoggedInToLocation(UUID agentID, UUID sessionID, UUID RegionID,
96 ulong regionhandle, float positionX, float positionY,
97 float positionZ, string firstname, string lastname)
98 {
99 m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX,
100 positionY, positionZ, firstname, lastname);
101 }
102
103 public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle)
104 {
105 m_userManager.HandleAgentLocation(agentID, regionID, regionHandle);
106 }
107
108 public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle)
109 {
110 m_userManager.HandleAgentLeaving(agentID, regionID, regionHandle);
111 }
112
113 public void HandleRegionStartup(UUID regionID)
114 {
115 // This might seem strange, that we send this back to the
116 // server it came from. But there is method to the madness.
117 // There can be multiple user servers on the same database,
118 // and each can have multiple messaging servers. So, we send
119 // it to all known user servers, who send it to all known
120 // message servers. That way, we should be able to finally
121 // update presence to all regions and thereby all friends
122 //
123 m_userManager.HandleRegionStartup(regionID);
124 m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
125 }
126
127 public void HandleRegionShutdown(UUID regionID)
128 {
129 // This might seem strange, that we send this back to the
130 // server it came from. But there is method to the madness.
131 // There can be multiple user servers on the same database,
132 // and each can have multiple messaging servers. So, we send
133 // it to all known user servers, who send it to all known
134 // message servers. That way, we should be able to finally
135 // update presence to all regions and thereby all friends
136 //
137 m_userManager.HandleRegionShutdown(regionID);
138 m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
139 }
140 #endregion
141 }
142}