diff options
author | Johan Berntsson | 2008-06-20 01:35:54 +0000 |
---|---|---|
committer | Johan Berntsson | 2008-06-20 01:35:54 +0000 |
commit | 20e403685345e0e85d2eb54557b61dddc0af885e (patch) | |
tree | 91651802445b37bb6d64a6277a2b4231b14673a6 /OpenSim | |
parent | Mantis#1573. Thank you kindly, Mikem for a patch to our (diff) | |
download | opensim-SC-20e403685345e0e85d2eb54557b61dddc0af885e.zip opensim-SC-20e403685345e0e85d2eb54557b61dddc0af885e.tar.gz opensim-SC-20e403685345e0e85d2eb54557b61dddc0af885e.tar.bz2 opensim-SC-20e403685345e0e85d2eb54557b61dddc0af885e.tar.xz |
Implemented plugin support for ClientStack, with LindenUDP as the default plugin. This makes it easy for developers to experiment with alternative communication protocols
Diffstat (limited to '')
6 files changed, 107 insertions, 6 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 6d74903..572e98f 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -81,6 +81,7 @@ namespace OpenSim | |||
81 | protected LocalLoginService m_loginService; | 81 | protected LocalLoginService m_loginService; |
82 | 82 | ||
83 | protected string m_storageDll; | 83 | protected string m_storageDll; |
84 | protected string m_clientstackDll; | ||
84 | 85 | ||
85 | protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>(); | 86 | protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>(); |
86 | protected List<RegionInfo> m_regionData = new List<RegionInfo>(); | 87 | protected List<RegionInfo> m_regionData = new List<RegionInfo>(); |
@@ -214,6 +215,7 @@ namespace OpenSim | |||
214 | config.Set("shutdown_console_commands_file", String.Empty); | 215 | config.Set("shutdown_console_commands_file", String.Empty); |
215 | config.Set("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); | 216 | config.Set("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); |
216 | config.Set("asset_database", "sqlite"); | 217 | config.Set("asset_database", "sqlite"); |
218 | config.Set("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); | ||
217 | } | 219 | } |
218 | 220 | ||
219 | if (DefaultConfig.Configs["StandAlone"] == null) | 221 | if (DefaultConfig.Configs["StandAlone"] == null) |
@@ -301,6 +303,7 @@ namespace OpenSim | |||
301 | 303 | ||
302 | m_scriptEngine = startupConfig.GetString("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); | 304 | m_scriptEngine = startupConfig.GetString("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); |
303 | m_assetStorage = startupConfig.GetString("asset_database", "local"); | 305 | m_assetStorage = startupConfig.GetString("asset_database", "local"); |
306 | m_clientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); | ||
304 | } | 307 | } |
305 | 308 | ||
306 | IConfig standaloneConfig = m_config.Configs["StandAlone"]; | 309 | IConfig standaloneConfig = m_config.Configs["StandAlone"]; |
@@ -553,6 +556,11 @@ namespace OpenSim | |||
553 | return new StorageManager(m_storageDll, connectionstring, m_storagePersistPrimInventories); | 556 | return new StorageManager(m_storageDll, connectionstring, m_storagePersistPrimInventories); |
554 | } | 557 | } |
555 | 558 | ||
559 | protected override ClientStackManager CreateClientStackManager() | ||
560 | { | ||
561 | return new ClientStackManager(m_clientstackDll); | ||
562 | } | ||
563 | |||
556 | protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, | 564 | protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, |
557 | AgentCircuitManager circuitManager) | 565 | AgentCircuitManager circuitManager) |
558 | { | 566 | { |
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 | |||
28 | using System; | ||
29 | using System.Net; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.ClientStack; | ||
34 | using OpenSim.Framework.Communications; | ||
35 | using OpenSim.Framework.Communications.Cache; | ||
36 | |||
37 | namespace 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 | ||
28 | using System.Net; | ||
28 | using System.Net.Sockets; | 29 | using System.Net.Sockets; |
29 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
30 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Framework.Communications; | ||
33 | using OpenSim.Framework.Communications.Cache; | ||
31 | 34 | ||
32 | namespace OpenSim.Region.ClientStack | 35 | namespace 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; | |||
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Communications.Cache; | 36 | using OpenSim.Framework.Communications.Cache; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Region.ClientStack.LindenUDP; | ||
39 | using OpenSim.Region.Environment; | 38 | using OpenSim.Region.Environment; |
40 | using OpenSim.Region.Environment.Scenes; | 39 | using OpenSim.Region.Environment.Scenes; |
41 | using OpenSim.Region.Physics.Manager; | 40 | using 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); |