aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Client/Sirikata/SirikataModule.cs
diff options
context:
space:
mode:
authorMelanie2009-12-27 15:49:09 +0000
committerMelanie2009-12-27 15:49:09 +0000
commit769dad278373c0b945aa01a75365c0d658c98540 (patch)
tree601347095dd91b365a5fdcbec8a1f693048faa03 /OpenSim/Client/Sirikata/SirikataModule.cs
parentChange the signature of the forms requester data in preparation to getting (diff)
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC_OLD-769dad278373c0b945aa01a75365c0d658c98540.zip
opensim-SC_OLD-769dad278373c0b945aa01a75365c0d658c98540.tar.gz
opensim-SC_OLD-769dad278373c0b945aa01a75365c0d658c98540.tar.bz2
opensim-SC_OLD-769dad278373c0b945aa01a75365c0d658c98540.tar.xz
Merge branch 'master' into presence-refactor
Diffstat (limited to 'OpenSim/Client/Sirikata/SirikataModule.cs')
-rw-r--r--OpenSim/Client/Sirikata/SirikataModule.cs139
1 files changed, 139 insertions, 0 deletions
diff --git a/OpenSim/Client/Sirikata/SirikataModule.cs b/OpenSim/Client/Sirikata/SirikataModule.cs
new file mode 100644
index 0000000..cbb6c23
--- /dev/null
+++ b/OpenSim/Client/Sirikata/SirikataModule.cs
@@ -0,0 +1,139 @@
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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26// THIS MODULE USES CODE FROM SIRIKATA, THE SIRIKATA LICENSE IS BELOW
27/*
28Sirikata is Licensed using the revised BSD license.
29If you have any questions, contact Patrick Horn at <patrick.horn@gmail.com>
30
31
32 Copyright (c) 2008, the Sirikata developers (see AUTHORS file for credit).
33 All rights reserved.
34
35 Redistribution and use in source and binary forms, with or without
36 modification, are permitted provided that the following conditions are
37 met:
38 * Redistributions of source code must retain the above copyright
39 notice, this list of conditions and the following disclaimer.
40 * Redistributions in binary form must reproduce the above copyright
41 notice, this list of conditions and the following disclaimer in
42 the documentation and/or other materials provided with the
43 distribution.
44 * Neither the name of Sirikata nor the names of its contributors may
45 be used to endorse or promote products derived from this software
46 without specific prior written permission.
47
48THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
49IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
50TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
51PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
52OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
53EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
54PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
55PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
56LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
57NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
58SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59*/
60
61using System;
62using System.Collections.Generic;
63using System.Net;
64using System.Net.Sockets;
65using Nini.Config;
66using OpenMetaverse;
67using OpenSim.Client.Sirikata.ClientStack;
68using OpenSim.Framework;
69using OpenSim.Framework.Servers;
70using OpenSim.Framework.Servers.HttpServer;
71using OpenSim.Region.Framework.Interfaces;
72using OpenSim.Region.Framework.Scenes;
73
74namespace OpenSim.Client.Sirikata
75{
76 class SirikataModule : IRegionModule
77 {
78 private bool m_enabled = false;
79
80 private TcpListener m_listener;
81 private bool m_running = true;
82
83 private List<Scene> m_scenes = new List<Scene>();
84 private Dictionary<UUID,SirikataClientView> m_clients = new Dictionary<UUID, SirikataClientView>();
85
86 #region Implementation of IRegionModule
87
88 public void Initialise(Scene scene, IConfigSource source)
89 {
90 lock (m_scenes)
91 m_scenes.Add(scene);
92 }
93
94 public void PostInitialise()
95 {
96 if(!m_enabled)
97 return;
98
99 m_listener = new TcpListener(IPAddress.Any, 5943);
100
101 }
102
103 private void ListenLoop()
104 {
105 while(m_running)
106 {
107 m_listener.BeginAcceptTcpClient(AcceptSocket, m_listener);
108 }
109 }
110
111 private void AcceptSocket(IAsyncResult ar)
112 {
113 TcpListener listener = (TcpListener) ar.AsyncState;
114 TcpClient client = listener.EndAcceptTcpClient(ar);
115
116 SirikataClientView clientView = new SirikataClientView(client);
117
118 lock (m_clients)
119 m_clients.Add(clientView.SessionId, clientView);
120 }
121
122 public void Close()
123 {
124
125 }
126
127 public string Name
128 {
129 get { return "Sirikata ClientStack Module"; }
130 }
131
132 public bool IsSharedModule
133 {
134 get { return true; }
135 }
136
137 #endregion
138 }
139}