aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/ClientStackManager.cs147
-rw-r--r--OpenSim/Region/ClientStack/IClientNetworkServer.cs59
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs49
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs3
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs107
5 files changed, 49 insertions, 316 deletions
diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs
deleted file mode 100644
index 3ec968f..0000000
--- a/OpenSim/Region/ClientStack/ClientStackManager.cs
+++ /dev/null
@@ -1,147 +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.Net;
31using System.Reflection;
32using log4net;
33using Nini.Config;
34using OpenSim.Framework;
35
36namespace OpenSim.Region.ClientStack
37{
38 public class ClientStackManager
39 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41
42 private List<Type> plugin = new List<Type>();
43 private List<Assembly> pluginAssembly = new List<Assembly>();
44
45 public ClientStackManager(string pDllName)
46 {
47 List<string> clientstacks = new List<string>();
48 if (pDllName.Contains(","))
49 {
50 clientstacks = new List<string>(pDllName.Split(','));
51 }
52 else
53 {
54 clientstacks.Add(pDllName);
55 }
56 foreach (string dllName in clientstacks)
57 {
58 m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName);
59
60 try
61 {
62 //plugin = null;
63 Assembly itemAssembly = Assembly.LoadFrom(dllName);
64 pluginAssembly.Add(itemAssembly);
65
66 foreach (Type pluginType in itemAssembly.GetTypes())
67 {
68 if (pluginType.IsPublic)
69 {
70 Type typeInterface = pluginType.GetInterface("IClientNetworkServer");
71
72 if (typeInterface != null)
73 {
74 m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface");
75 plugin.Add(pluginType);
76 break;
77 }
78 }
79 }
80 }
81 catch (ReflectionTypeLoadException e)
82 {
83 foreach (Exception e2 in e.LoaderExceptions)
84 {
85 m_log.Error(e2.ToString());
86 }
87 throw e;
88 }
89 }
90 }
91
92 /// <summary>
93 /// Create a server that can set up sessions for virtual world client <-> server communications
94 /// </summary>
95 /// <param name="_listenIP"></param>
96 /// <param name="port"></param>
97 /// <param name="proxyPortOffset"></param>
98 /// <param name="allow_alternate_port"></param>
99 /// <param name="assetCache"></param>
100 /// <param name="authenticateClass"></param>
101 /// <returns></returns>
102 public List<IClientNetworkServer> CreateServers(
103 IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port,
104 AgentCircuitManager authenticateClass)
105 {
106 return CreateServers(
107 _listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass);
108 }
109
110 /// <summary>
111 /// Create a server that can set up sessions for virtual world client <-> server communications
112 /// </summary>
113 /// <param name="_listenIP"></param>
114 /// <param name="port"></param>
115 /// <param name="proxyPortOffset"></param>
116 /// <param name="allow_alternate_port"></param>
117 /// <param name="configSource">
118 /// Can be null, in which case default values are used
119 /// </param>
120 /// <param name="assetCache"></param>
121 /// <param name="authenticateClass"></param>
122 /// <returns></returns>
123 public List<IClientNetworkServer> CreateServers(
124 IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource,
125 AgentCircuitManager authenticateClass)
126 {
127 List<IClientNetworkServer> servers = new List<IClientNetworkServer>();
128 if (plugin != null)
129 {
130 for (int i = 0; i < plugin.Count; i++)
131 {
132 IClientNetworkServer server =
133 (IClientNetworkServer) Activator.CreateInstance(pluginAssembly[i].GetType(plugin[i].ToString()));
134
135 server.Initialise(
136 _listenIP, ref port, proxyPortOffset, allow_alternate_port,
137 configSource, authenticateClass);
138 servers.Add(server);
139 }
140 return servers;
141 }
142
143 m_log.Error("[CLIENTSTACK]: Couldn't initialize a new server");
144 return null;
145 }
146 }
147}
diff --git a/OpenSim/Region/ClientStack/IClientNetworkServer.cs b/OpenSim/Region/ClientStack/IClientNetworkServer.cs
deleted file mode 100644
index bb7e6d0..0000000
--- a/OpenSim/Region/ClientStack/IClientNetworkServer.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.Net;
29using System.Net.Sockets;
30using Nini.Config;
31using OpenSim.Framework;
32
33namespace OpenSim.Region.ClientStack
34{
35 public interface IClientNetworkServer
36 {
37 void Initialise(
38 IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource,
39 AgentCircuitManager authenticateClass);
40
41 bool HandlesRegion(Location x);
42
43 /// <summary>
44 /// Add the given scene to be handled by this IClientNetworkServer.
45 /// </summary>
46 /// <param name='scene'></param>
47 void AddScene(IScene scene);
48
49 /// <summary>
50 /// Start sending and receiving data.
51 /// </summary>
52 void Start();
53
54 /// <summary>
55 /// Stop sending and receiving data.
56 /// </summary>
57 void Stop();
58 }
59}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 76be91a..4528714 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -40,8 +40,9 @@ using OpenSim.Framework;
40using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
41using OpenSim.Framework.Monitoring; 41using OpenSim.Framework.Monitoring;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Interfaces;
43using OpenMetaverse; 44using OpenMetaverse;
44 45using Mono.Addins;
45using TokenBucket = OpenSim.Region.ClientStack.LindenUDP.TokenBucket; 46using TokenBucket = OpenSim.Region.ClientStack.LindenUDP.TokenBucket;
46 47
47namespace OpenSim.Region.ClientStack.LindenUDP 48namespace OpenSim.Region.ClientStack.LindenUDP
@@ -49,14 +50,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP
49 /// <summary> 50 /// <summary>
50 /// A shim around LLUDPServer that implements the IClientNetworkServer interface 51 /// A shim around LLUDPServer that implements the IClientNetworkServer interface
51 /// </summary> 52 /// </summary>
52 public sealed class LLUDPServerShim : IClientNetworkServer 53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LLUDPServerShim")]
54 public sealed class LLUDPServerShim : INonSharedRegionModule
53 { 55 {
56 private bool m_Enabled = true;
57 private IConfigSource m_Config;
54 LLUDPServer m_udpServer; 58 LLUDPServer m_udpServer;
55 59
56 public LLUDPServerShim() 60 #region INonSharedRegionModule
61 public string Name
62 {
63 get { return "LLUDPServerShim"; }
64 }
65
66 public Type ReplaceableInterface
67 {
68 get { return null; }
69 }
70
71 public void Initialise(IConfigSource source)
72 {
73 m_Config = source;
74 }
75
76 public void Close()
77 {
78 }
79
80 public void AddRegion(Scene scene)
57 { 81 {
82 uint port = (uint)scene.RegionInfo.InternalEndPoint.Port;
83
84 IPAddress listenIP = scene.RegionInfo.InternalEndPoint.Address;
85 Initialise(listenIP, ref port, scene.RegionInfo.ProxyOffset, scene.RegionInfo.m_allow_alternate_ports, m_Config, scene.AuthenticateHandler);
86 scene.RegionInfo.InternalEndPoint.Port = (int)port;
87
88 AddScene(scene);
58 } 89 }
59 90
91 public void RemoveRegion(Scene scene)
92 {
93 Stop();
94 }
95
96 public void RegionLoaded(Scene scene)
97 {
98 Start();
99 }
100 #endregion
101
60 public void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) 102 public void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
61 { 103 {
62 m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager); 104 m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager);
@@ -200,6 +242,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
200 { 242 {
201 m_udpServer.Stop(); 243 m_udpServer.Stop();
202 } 244 }
245
203 } 246 }
204 247
205 /// <summary> 248 /// <summary>
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
index 8795c0c..a1ff69e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
@@ -1,6 +1,7 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins;
4 5
5// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
@@ -31,3 +32,5 @@ using System.Runtime.InteropServices;
31// 32//
32[assembly: AssemblyVersion("0.8.2.*")] 33[assembly: AssemblyVersion("0.8.2.*")]
33 34
35[assembly: Addin("LindenUDP", OpenSim.VersionInfo.VersionNumber)]
36[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
deleted file mode 100644
index 343780b..0000000
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ /dev/null
@@ -1,107 +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 System.Net;
30using System.Reflection;
31using log4net;
32using Nini.Config;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Region.Framework;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.PhysicsModules.SharedBase;
42using OpenSim.Services.Interfaces;
43
44namespace OpenSim.Region.ClientStack
45{
46 public abstract class RegionApplicationBase : BaseOpenSimServer
47 {
48 private static readonly ILog m_log
49 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>();
52 protected NetworkServersInfo m_networkServersInfo;
53 protected uint m_httpServerPort;
54 protected ISimulationDataService m_simulationDataService;
55 protected IEstateDataService m_estateDataService;
56 protected ClientStackManager m_clientStackManager;
57
58 public SceneManager SceneManager { get; protected set; }
59 public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } }
60 public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } }
61 public IEstateDataService EstateDataService { get { return m_estateDataService; } }
62
63 protected abstract void Initialize();
64
65 protected abstract ClientStackManager CreateClientStackManager();
66 protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager);
67
68 protected override void StartupSpecific()
69 {
70 SceneManager = SceneManager.Instance;
71 m_clientStackManager = CreateClientStackManager();
72
73 Initialize();
74
75 m_httpServer
76 = new BaseHttpServer(
77 m_httpServerPort, m_networkServersInfo.HttpUsesSSL, m_networkServersInfo.httpSSLPort,
78 m_networkServersInfo.HttpSSLCN);
79
80 if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort))
81 {
82 m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports");
83 }
84
85 m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort);
86 m_httpServer.Start();
87
88 MainServer.AddHttpServer(m_httpServer);
89 MainServer.Instance = m_httpServer;
90
91 // "OOB" Server
92 if (m_networkServersInfo.ssl_listener)
93 {
94 BaseHttpServer server = new BaseHttpServer(
95 m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path,
96 m_networkServersInfo.cert_pass);
97
98 m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port);
99 MainServer.AddHttpServer(server);
100 server.Start();
101 }
102
103 base.StartupSpecific();
104 }
105
106 }
107} \ No newline at end of file