aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Client/Sirikata
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Client/Sirikata')
-rw-r--r--OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs21
-rw-r--r--OpenSim/Client/Sirikata/SirikataModule.cs37
2 files changed, 57 insertions, 1 deletions
diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
index 78f231a..e8d1889 100644
--- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
+++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
@@ -1,6 +1,7 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Net; 3using System.Net;
4using System.Net.Sockets;
4using System.Text; 5using System.Text;
5using OpenMetaverse; 6using OpenMetaverse;
6using OpenMetaverse.Packets; 7using OpenMetaverse.Packets;
@@ -11,6 +12,26 @@ namespace OpenSim.Client.Sirikata.ClientStack
11{ 12{
12 class SirikataClientView : IClientAPI, IClientCore 13 class SirikataClientView : IClientAPI, IClientCore
13 { 14 {
15 private readonly NetworkStream stream;
16
17 public SirikataClientView(TcpClient client)
18 {
19 stream = client.GetStream();
20
21 sessionId = UUID.Random();
22
23
24 // Handshake with client
25 string con = "SSTTCP01" + sessionId;
26 byte[] handshake = Util.UTF8.GetBytes(con);
27
28 byte[] clientHandshake = new byte[2+6+36];
29
30 stream.Read(clientHandshake, 0, handshake.Length);
31 stream.Write(handshake, 0, handshake.Length - 1); // Remove null terminator (hence the -1)
32 }
33
34
14 #region Implementation of IClientAPI 35 #region Implementation of IClientAPI
15 36
16 private Vector3 startPos; 37 private Vector3 startPos;
diff --git a/OpenSim/Client/Sirikata/SirikataModule.cs b/OpenSim/Client/Sirikata/SirikataModule.cs
index d2d7ff8..cbb6c23 100644
--- a/OpenSim/Client/Sirikata/SirikataModule.cs
+++ b/OpenSim/Client/Sirikata/SirikataModule.cs
@@ -60,8 +60,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 60
61using System; 61using System;
62using System.Collections.Generic; 62using System.Collections.Generic;
63using System.Net;
64using System.Net.Sockets;
63using Nini.Config; 65using Nini.Config;
64using OpenMetaverse; 66using OpenMetaverse;
67using OpenSim.Client.Sirikata.ClientStack;
65using OpenSim.Framework; 68using OpenSim.Framework;
66using OpenSim.Framework.Servers; 69using OpenSim.Framework.Servers;
67using OpenSim.Framework.Servers.HttpServer; 70using OpenSim.Framework.Servers.HttpServer;
@@ -72,18 +75,50 @@ namespace OpenSim.Client.Sirikata
72{ 75{
73 class SirikataModule : IRegionModule 76 class SirikataModule : IRegionModule
74 { 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
75 #region Implementation of IRegionModule 86 #region Implementation of IRegionModule
76 87
77 public void Initialise(Scene scene, IConfigSource source) 88 public void Initialise(Scene scene, IConfigSource source)
78 { 89 {
79 90 lock (m_scenes)
91 m_scenes.Add(scene);
80 } 92 }
81 93
82 public void PostInitialise() 94 public void PostInitialise()
83 { 95 {
96 if(!m_enabled)
97 return;
98
99 m_listener = new TcpListener(IPAddress.Any, 5943);
84 100
85 } 101 }
86 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
87 public void Close() 122 public void Close()
88 { 123 {
89 124