aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/ClientStackManager.cs81
-rw-r--r--OpenSim/Region/ClientStack/IClientNetworkServer.cs7
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs5
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs10
5 files changed, 99 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs
new file mode 100644
index 0000000..b5cd06a
--- /dev/null
+++ b/OpenSim/Region/ClientStack/ClientStackManager.cs
@@ -0,0 +1,81 @@
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 OpenSim 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.Net;
30using System.Reflection;
31using log4net;
32using OpenSim.Framework;
33using OpenSim.Region.ClientStack;
34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Communications.Cache;
36
37namespace OpenSim.Region.Environment
38{
39 public class ClientStackManager
40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42
43 private Type plugin;
44 private Assembly pluginAssembly;
45
46 public ClientStackManager(string dllName) {
47 m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName);
48
49 plugin=null;
50 pluginAssembly = Assembly.LoadFrom(dllName);
51
52 foreach (Type pluginType in pluginAssembly.GetTypes())
53 {
54 if (pluginType.IsPublic)
55 {
56 Type typeInterface = pluginType.GetInterface("IClientNetworkServer", true);
57
58 if (typeInterface != null)
59 {
60 m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface");
61 plugin = pluginType;
62 return;
63 }
64 }
65 }
66 }
67
68 public IClientNetworkServer CreateServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass)
69 {
70 if (plugin != null)
71 {
72 IClientNetworkServer server =
73 (IClientNetworkServer) Activator.CreateInstance(pluginAssembly.GetType(plugin.ToString()));
74 server.Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, assetCache, authenticateClass);
75 return server;
76 }
77 m_log.Error("[CLIENTSTACK] Couldn't initialize a new server");
78 return null;
79 }
80 }
81}
diff --git a/OpenSim/Region/ClientStack/IClientNetworkServer.cs b/OpenSim/Region/ClientStack/IClientNetworkServer.cs
index 10da599..1743fd6 100644
--- a/OpenSim/Region/ClientStack/IClientNetworkServer.cs
+++ b/OpenSim/Region/ClientStack/IClientNetworkServer.cs
@@ -25,14 +25,19 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Net;
28using System.Net.Sockets; 29using System.Net.Sockets;
29using OpenSim.Framework; 30using OpenSim.Framework;
30using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using OpenSim.Framework.Communications;
33using OpenSim.Framework.Communications.Cache;
31 34
32namespace OpenSim.Region.ClientStack 35namespace OpenSim.Region.ClientStack
33{ 36{
34 public interface IClientNetworkServer 37 public interface IClientNetworkServer
35 { 38 {
39 void Initialise(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass);
40
36 Socket Server { get; } 41 Socket Server { get; }
37 bool HandlesRegion(Location x); 42 bool HandlesRegion(Location x);
38 void AddScene(Scene x); 43 void AddScene(Scene x);
@@ -40,4 +45,4 @@ namespace OpenSim.Region.ClientStack
40 void Start(); 45 void Start();
41 void Stop(); 46 void Stop();
42 } 47 }
43} \ No newline at end of file 48}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 3dddbfb..3b3ec3d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
72 // } 72 // }
73 73
74 /* static variables */ 74 /* static variables */
75 public static TerrainManager TerrainManager; 75 public static TerrainManager TerrainManager = new TerrainManager(new SecondLife());
76 76
77 public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, LLUUID agentID, ThrottleOutPacketType throttlePacketType); 77 public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, LLUUID agentID, ThrottleOutPacketType throttlePacketType);
78 public static SynchronizeClientHandler SynchronizeClient = null; 78 public static SynchronizeClientHandler SynchronizeClient = null;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 4a56048..eb4b8e7 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -121,6 +121,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
121 121
122 public LLUDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass) 122 public LLUDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass)
123 { 123 {
124 Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, assetCache, authenticateClass);
125 }
126
127 public void Initialise(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass)
128 {
124 this.proxyPortOffset = proxyPortOffset; 129 this.proxyPortOffset = proxyPortOffset;
125 listenPort = (uint) (port + proxyPortOffset); 130 listenPort = (uint) (port + proxyPortOffset);
126 listenIP = _listenIP; 131 listenIP = _listenIP;
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index d96336a..621d0ef 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -35,7 +35,6 @@ using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Communications.Cache; 36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Region.ClientStack.LindenUDP;
39using OpenSim.Region.Environment; 38using OpenSim.Region.Environment;
40using OpenSim.Region.Environment.Scenes; 39using OpenSim.Region.Environment.Scenes;
41using OpenSim.Region.Physics.Manager; 40using OpenSim.Region.Physics.Manager;
@@ -64,6 +63,8 @@ namespace OpenSim.Region.ClientStack
64 protected StorageManager m_storageManager; 63 protected StorageManager m_storageManager;
65 protected string m_storageConnectionString; 64 protected string m_storageConnectionString;
66 65
66 protected ClientStackManager m_clientStackManager;
67
67 // An attribute to indicate whether prim inventories should be persisted. 68 // An attribute to indicate whether prim inventories should be persisted.
68 // Probably will be temporary until this stops being experimental. 69 // Probably will be temporary until this stops being experimental.
69 protected bool m_storagePersistPrimInventories; 70 protected bool m_storagePersistPrimInventories;
@@ -77,10 +78,10 @@ namespace OpenSim.Region.ClientStack
77 { 78 {
78 base.Startup(); 79 base.Startup();
79 80
80 LLClientView.TerrainManager = new TerrainManager(new SecondLife());
81
82 m_storageManager = CreateStorageManager(m_storageConnectionString); 81 m_storageManager = CreateStorageManager(m_storageConnectionString);
83 82
83 m_clientStackManager = CreateClientStackManager();
84
84 Initialize(); 85 Initialize();
85 86
86 m_httpServer = new BaseHttpServer(m_httpServerPort); 87 m_httpServer = new BaseHttpServer(m_httpServerPort);
@@ -101,6 +102,7 @@ namespace OpenSim.Region.ClientStack
101 // protected abstract ConsoleBase CreateConsole(); 102 // protected abstract ConsoleBase CreateConsole();
102 protected abstract PhysicsScene GetPhysicsScene(); 103 protected abstract PhysicsScene GetPhysicsScene();
103 protected abstract StorageManager CreateStorageManager(string connectionstring); 104 protected abstract StorageManager CreateStorageManager(string connectionstring);
105 protected abstract ClientStackManager CreateClientStackManager();
104 106
105 protected PhysicsScene GetPhysicsScene(string engine, string meshEngine, IConfigSource config) 107 protected PhysicsScene GetPhysicsScene(string engine, string meshEngine, IConfigSource config)
106 { 108 {
@@ -123,7 +125,7 @@ namespace OpenSim.Region.ClientStack
123 // listenIP = IPAddress.Parse("0.0.0.0"); 125 // listenIP = IPAddress.Parse("0.0.0.0");
124 126
125 uint port = (uint) regionInfo.InternalEndPoint.Port; 127 uint port = (uint) regionInfo.InternalEndPoint.Port;
126 clientServer = new LLUDPServer(listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager); 128 clientServer = m_clientStackManager.CreateServer(listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager);
127 regionInfo.InternalEndPoint.Port = (int)port; 129 regionInfo.InternalEndPoint.Port = (int)port;
128 130
129 Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); 131 Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);