diff options
author | Adam Frisby | 2009-02-22 08:48:55 +0000 |
---|---|---|
committer | Adam Frisby | 2009-02-22 08:48:55 +0000 |
commit | 937a2e6dcae6c4369ee6952a2697ae31aaba4903 (patch) | |
tree | c205d090b7595a16bd261723a1e3f1bef5dbada8 /OpenSim/Client/MXP/MXPModule.cs | |
parent | Refactor log4net logger handling in script engine. (#3148) (diff) | |
download | opensim-SC_OLD-937a2e6dcae6c4369ee6952a2697ae31aaba4903.zip opensim-SC_OLD-937a2e6dcae6c4369ee6952a2697ae31aaba4903.tar.gz opensim-SC_OLD-937a2e6dcae6c4369ee6952a2697ae31aaba4903.tar.bz2 opensim-SC_OLD-937a2e6dcae6c4369ee6952a2697ae31aaba4903.tar.xz |
* Adds initial support for the MXP Virtual Worlds protocol (http://www.bubblecloud.org)
* Handled via the MXPModule.cs located in OpenSim.Client.MXP namespace.
* Also implements MXPClientView and MXPPacketServer for IClientAPI compatibility.
* No changes were required to Core to implement this - the thing is self contained in OpenSim.Client.MXP.dll.
* Includes reference implementation of MXP as MXP.dll - this is under the Apache 2.0 license.
* Requires OpenSim.ini setting to enable. "[MXP] \n Enabled=true \n Port=1253"
* May break. Highly untested.
Diffstat (limited to 'OpenSim/Client/MXP/MXPModule.cs')
-rw-r--r-- | OpenSim/Client/MXP/MXPModule.cs | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/OpenSim/Client/MXP/MXPModule.cs b/OpenSim/Client/MXP/MXPModule.cs new file mode 100644 index 0000000..345e4fb --- /dev/null +++ b/OpenSim/Client/MXP/MXPModule.cs | |||
@@ -0,0 +1,87 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.Timers; | ||
5 | using MXP; | ||
6 | using Nini.Config; | ||
7 | using OpenMetaverse; | ||
8 | using OpenSim.Client.MXP.PacketHandler; | ||
9 | using OpenSim.Region.Framework.Interfaces; | ||
10 | using OpenSim.Region.Framework.Scenes; | ||
11 | |||
12 | namespace OpenSim.Client.MXP | ||
13 | { | ||
14 | public class MXPModule : IRegionModule | ||
15 | { | ||
16 | private int mxp_Port = 1253; | ||
17 | private double mxp_BubbleRadius = 181.01933598375616624661615669884; // Radius of a sphere big enough to encapsulate a 256x256 square | ||
18 | |||
19 | private readonly Timer ticker = new Timer(100); | ||
20 | |||
21 | private int ticks; | ||
22 | private bool shutdown = false; | ||
23 | |||
24 | private IConfigSource config; | ||
25 | |||
26 | private readonly Dictionary<UUID,Scene> m_scenes = new Dictionary<UUID, Scene>(); | ||
27 | |||
28 | private MXPPacketServer server; | ||
29 | |||
30 | |||
31 | public void Initialise(Scene scene, IConfigSource source) | ||
32 | { | ||
33 | m_scenes.Add(scene.RegionInfo.RegionID, scene); | ||
34 | config = source; | ||
35 | } | ||
36 | |||
37 | public void PostInitialise() | ||
38 | { | ||
39 | if (config.Configs["MXP"] != null) | ||
40 | { | ||
41 | IConfig con = config.Configs["MXP"]; | ||
42 | |||
43 | if(!con.GetBoolean("Enabled",false)) | ||
44 | return; | ||
45 | |||
46 | mxp_Port = con.GetInt("Port", mxp_Port); | ||
47 | |||
48 | |||
49 | server = new MXPPacketServer("http://null", mxp_Port, m_scenes); | ||
50 | |||
51 | ticker.AutoReset = false; | ||
52 | ticker.Elapsed += ticker_Elapsed; | ||
53 | |||
54 | ticker.Start(); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | void ticker_Elapsed(object sender, ElapsedEventArgs e) | ||
59 | { | ||
60 | server.Process(); | ||
61 | |||
62 | if (!shutdown) | ||
63 | ticker.Start(); | ||
64 | |||
65 | if(++ticks % 100 == 0) | ||
66 | { | ||
67 | server.PrintDebugInformation(); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | public void Close() | ||
72 | { | ||
73 | shutdown = true; | ||
74 | ticker.Stop(); | ||
75 | } | ||
76 | |||
77 | public string Name | ||
78 | { | ||
79 | get { return "MXP ClientStack Module"; } | ||
80 | } | ||
81 | |||
82 | public bool IsSharedModule | ||
83 | { | ||
84 | get { return true; } | ||
85 | } | ||
86 | } | ||
87 | } | ||