aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim.RegionServer')
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.csproj45
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.dll.build1
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs77
-rw-r--r--OpenSim.RegionServer/OpenSimNetworkHandler.cs1
-rw-r--r--OpenSim.RegionServer/PacketServer.cs74
5 files changed, 129 insertions, 69 deletions
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index bd9ffb6..df66b48 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.RegionServer</AssemblyName> 13 <AssemblyName>OpenSim.RegionServer</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType> 18 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>OpenSim.RegionServer</RootNamespace> 21 <RootNamespace>OpenSim.RegionServer</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,26 +61,28 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="System" > 68 <Reference Include="System">
62 <HintPath>System.dll</HintPath> 69 <HintPath>System.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System.Xml" > 72 <Reference Include="System.Data" />
73 <Reference Include="System.Xml">
66 <HintPath>System.Xml.dll</HintPath> 74 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private> 75 <Private>False</Private>
68 </Reference> 76 </Reference>
69 <Reference Include="libsecondlife.dll" > 77 <Reference Include="libsecondlife.dll">
70 <HintPath>..\bin\libsecondlife.dll</HintPath> 78 <HintPath>..\bin\libsecondlife.dll</HintPath>
71 <Private>False</Private> 79 <Private>False</Private>
72 </Reference> 80 </Reference>
73 <Reference Include="Axiom.MathLib.dll" > 81 <Reference Include="Axiom.MathLib.dll">
74 <HintPath>..\bin\Axiom.MathLib.dll</HintPath> 82 <HintPath>..\bin\Axiom.MathLib.dll</HintPath>
75 <Private>False</Private> 83 <Private>False</Private>
76 </Reference> 84 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" > 85 <Reference Include="Db4objects.Db4o.dll">
78 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> 86 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private> 87 <Private>False</Private>
80 </Reference> 88 </Reference>
@@ -84,25 +92,25 @@
84 <Name>OpenSim.Framework</Name> 92 <Name>OpenSim.Framework</Name>
85 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> 93 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 94 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private> 95 <Private>False</Private>
88 </ProjectReference> 96 </ProjectReference>
89 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 97 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
90 <Name>OpenSim.Framework.Console</Name> 98 <Name>OpenSim.Framework.Console</Name>
91 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> 99 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 100 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private> 101 <Private>False</Private>
94 </ProjectReference> 102 </ProjectReference>
95 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> 103 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
96 <Name>OpenSim.Physics.Manager</Name> 104 <Name>OpenSim.Physics.Manager</Name>
97 <Project>{8BE16150-0000-0000-0000-000000000000}</Project> 105 <Project>{8BE16150-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 106 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private> 107 <Private>False</Private>
100 </ProjectReference> 108 </ProjectReference>
101 <ProjectReference Include="..\Servers\OpenSim.Servers.csproj"> 109 <ProjectReference Include="..\Servers\OpenSim.Servers.csproj">
102 <Name>OpenSim.Servers</Name> 110 <Name>OpenSim.Servers</Name>
103 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> 111 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 112 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private> 113 <Private>False</Private>
106 </ProjectReference> 114 </ProjectReference>
107 </ItemGroup> 115 </ItemGroup>
108 <ItemGroup> 116 <ItemGroup>
@@ -121,6 +129,7 @@
121 <Compile Include="OpenSimNetworkHandler.cs"> 129 <Compile Include="OpenSimNetworkHandler.cs">
122 <SubType>Code</SubType> 130 <SubType>Code</SubType>
123 </Compile> 131 </Compile>
132 <Compile Include="PacketServer.cs" />
124 <Compile Include="QueItem.cs"> 133 <Compile Include="QueItem.cs">
125 <SubType>Code</SubType> 134 <SubType>Code</SubType>
126 </Compile> 135 </Compile>
@@ -180,4 +189,4 @@
180 <PostBuildEvent> 189 <PostBuildEvent>
181 </PostBuildEvent> 190 </PostBuildEvent>
182 </PropertyGroup> 191 </PropertyGroup>
183</Project> 192</Project> \ No newline at end of file
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
index 5e29b48..6f86970 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
@@ -16,6 +16,7 @@
16 <include name="Grid.cs" /> 16 <include name="Grid.cs" />
17 <include name="OpenSimMain.cs" /> 17 <include name="OpenSimMain.cs" />
18 <include name="OpenSimNetworkHandler.cs" /> 18 <include name="OpenSimNetworkHandler.cs" />
19 <include name="PacketServer.cs" />
19 <include name="QueItem.cs" /> 20 <include name="QueItem.cs" />
20 <include name="SimClient.cs" /> 21 <include name="SimClient.cs" />
21 <include name="SimConsole.cs" /> 22 <include name="SimConsole.cs" />
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index f004f91..74b9e44 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -53,16 +53,15 @@ namespace OpenSim
53 53
54 public class OpenSimMain : OpenSimNetworkHandler, conscmd_callback 54 public class OpenSimMain : OpenSimNetworkHandler, conscmd_callback
55 { 55 {
56 private SimConfig Cfg;
56 private PhysicsManager physManager; 57 private PhysicsManager physManager;
57 private World LocalWorld;
58 private Grid GridServers; 58 private Grid GridServers;
59 private SimConfig Cfg; 59 private BaseHttpServer _httpServer;
60 //private SimCAPSHTTPServer HttpServer; 60 private PacketServer _packetServer;
61 private BaseHttpServer HttpServer; 61 private World LocalWorld;
62 private AssetCache AssetCache; 62 private AssetCache AssetCache;
63 private InventoryCache InventoryCache; 63 private InventoryCache InventoryCache;
64 //public Dictionary<EndPoint, SimClient> ClientThreads = new Dictionary<EndPoint, SimClient>(); 64 //private Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>();
65 private Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>();
66 private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); 65 private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
67 private DateTime startuptime; 66 private DateTime startuptime;
68 67
@@ -125,13 +124,18 @@ namespace OpenSim
125 m_console.WriteLine("Main.cs:Startup() - Contacting gridserver"); 124 m_console.WriteLine("Main.cs:Startup() - Contacting gridserver");
126 Cfg.LoadFromGrid(); 125 Cfg.LoadFromGrid();
127 126
127 PacketServer packetServer = new PacketServer(this);
128
128 m_console.WriteLine("Main.cs:Startup() - We are " + Cfg.RegionName + " at " + Cfg.RegionLocX.ToString() + "," + Cfg.RegionLocY.ToString()); 129 m_console.WriteLine("Main.cs:Startup() - We are " + Cfg.RegionName + " at " + Cfg.RegionLocX.ToString() + "," + Cfg.RegionLocY.ToString());
129 m_console.WriteLine("Initialising world"); 130 m_console.WriteLine("Initialising world");
130 LocalWorld = new World(ClientThreads, Cfg.RegionHandle, Cfg.RegionName, Cfg); 131 LocalWorld = new World(this._packetServer.ClientThreads, Cfg.RegionHandle, Cfg.RegionName, Cfg);
131 LocalWorld.LandMap = Cfg.LoadWorld(); 132 LocalWorld.LandMap = Cfg.LoadWorld();
132 LocalWorld.InventoryCache = InventoryCache; 133 LocalWorld.InventoryCache = InventoryCache;
133 LocalWorld.AssetCache = AssetCache; 134 LocalWorld.AssetCache = AssetCache;
134 135
136 this._packetServer.LocalWorld = LocalWorld;
137 this._packetServer.RegisterClientPacketHandlers();
138
135 this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); 139 this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
136 this.physManager.LoadPlugins(); 140 this.physManager.LoadPlugins();
137 141
@@ -152,16 +156,14 @@ namespace OpenSim
152 AssetCache.LoadDefaultTextureSet(); 156 AssetCache.LoadDefaultTextureSet();
153 } 157 }
154 158
155 RegisterClientPacketHandlers();
156
157 m_console.WriteLine("Main.cs:Startup() - Initialising HTTP server"); 159 m_console.WriteLine("Main.cs:Startup() - Initialising HTTP server");
158 // HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort); 160 // HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort);
159 HttpServer = new BaseHttpServer(Cfg.IPListenPort); 161 _httpServer = new BaseHttpServer(Cfg.IPListenPort);
160 162
161 if (gridServer.GetName() == "Remote") 163 if (gridServer.GetName() == "Remote")
162 { 164 {
163 //we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server 165 //we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server
164 HttpServer.AddXmlRPCHandler("expect_user", 166 _httpServer.AddXmlRPCHandler("expect_user",
165 delegate(XmlRpcRequest request) 167 delegate(XmlRpcRequest request)
166 { 168 {
167 Hashtable requestData = (Hashtable)request.Params[0]; 169 Hashtable requestData = (Hashtable)request.Params[0];
@@ -179,7 +181,6 @@ namespace OpenSim
179 }); 181 });
180 } 182 }
181 183
182
183 LoginServer loginServer = null; 184 LoginServer loginServer = null;
184 LoginServer adminLoginServer = null; 185 LoginServer adminLoginServer = null;
185 186
@@ -195,20 +196,20 @@ namespace OpenSim
195 this.GridServers.UserServer = loginServer; 196 this.GridServers.UserServer = loginServer;
196 adminLoginServer = loginServer; 197 adminLoginServer = loginServer;
197 198
198 HttpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod); 199 _httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod);
199 } 200 }
200 else 201 else
201 { 202 {
202 //sandbox mode with loginserver not using accounts 203 //sandbox mode with loginserver not using accounts
203 HttpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); 204 _httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
204 } 205 }
205 } 206 }
206 207
207 AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer); 208 AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer);
208 adminWebFront.LoadMethods( HttpServer ); 209 adminWebFront.LoadMethods( _httpServer );
209 210
210 m_console.WriteLine("Main.cs:Startup() - Starting HTTP server"); 211 m_console.WriteLine("Main.cs:Startup() - Starting HTTP server");
211 HttpServer.Start(); 212 _httpServer.Start();
212 213
213 MainServerListener(); 214 MainServerListener();
214 215
@@ -260,19 +261,20 @@ namespace OpenSim
260 // do we already have a circuit for this endpoint 261 // do we already have a circuit for this endpoint
261 if (this.clientCircuits.ContainsKey(epSender)) 262 if (this.clientCircuits.ContainsKey(epSender))
262 { 263 {
263 ClientThreads[this.clientCircuits[epSender]].InPacket(packet); 264 //ClientThreads[this.clientCircuits[epSender]].InPacket(packet);
265 this._packetServer.ClientInPacket(this.clientCircuits[epSender], packet);
264 } 266 }
265 else if (packet.Type == PacketType.UseCircuitCode) 267 else if (packet.Type == PacketType.UseCircuitCode)
266 { // new client 268 { // new client
267 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 269 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
268 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 270 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
269 SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox); 271 SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox);
270 if ((this.GridServers.UserServer != null) && (user_accounts)) 272 if ((this.GridServers.UserServer != null) && (user_accounts))
271 { 273 {
272 newuser.UserServer = this.GridServers.UserServer; 274 newuser.UserServer = this.GridServers.UserServer;
273 } 275 }
274 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); 276 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
275 ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); 277 this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
276 } 278 }
277 else 279 else
278 { // invalid client 280 { // invalid client
@@ -301,6 +303,11 @@ namespace OpenSim
301 303
302 } 304 }
303 305
306 public void RegisterPacketServer(PacketServer server)
307 {
308 this._packetServer = server;
309 }
310
304 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)//EndPoint packetSender) 311 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)//EndPoint packetSender)
305 { 312 {
306 // find the endpoint for this circuit 313 // find the endpoint for this circuit
@@ -396,38 +403,6 @@ namespace OpenSim
396 break; 403 break;
397 } 404 }
398 } 405 }
399
400 protected virtual void RegisterClientPacketHandlers()
401 {
402 SimClient.AddPacketHandler(PacketType.ModifyLand, LocalWorld.ModifyTerrain);
403 SimClient.AddPacketHandler(PacketType.ChatFromViewer, LocalWorld.SimChat);
404 SimClient.AddPacketHandler(PacketType.RezObject, LocalWorld.RezObject);
405 SimClient.AddPacketHandler(PacketType.DeRezObject, LocalWorld.DeRezObject);
406 SimClient.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName);
407 }
408
409 #region Client Packet Handlers
410
411 public bool RequestUUIDName(SimClient simClient, Packet packet)
412 {
413 System.Text.Encoding enc = System.Text.Encoding.ASCII;
414 Console.WriteLine(packet.ToString());
415 UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket)packet;
416 UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket();
417 nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length];
418
419 for (int i = 0; i < nameRequest.UUIDNameBlock.Length; i++)
420 {
421 nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
422 nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID;
423 nameReply.UUIDNameBlock[i].FirstName = enc.GetBytes("Who\0"); //for now send any name
424 nameReply.UUIDNameBlock[i].LastName = enc.GetBytes("Knows\0"); //in future need to look it up
425 }
426 simClient.OutPacket(nameReply);
427 return true;
428 }
429
430 #endregion
431 } 406 }
432 407
433 408
diff --git a/OpenSim.RegionServer/OpenSimNetworkHandler.cs b/OpenSim.RegionServer/OpenSimNetworkHandler.cs
index 4ed201e..6649120 100644
--- a/OpenSim.RegionServer/OpenSimNetworkHandler.cs
+++ b/OpenSim.RegionServer/OpenSimNetworkHandler.cs
@@ -12,5 +12,6 @@ namespace OpenSim
12 // public abstract void Shutdown(); 12 // public abstract void Shutdown();
13 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); 13 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender);
14 void RemoveClientCircuit(uint circuitcode); 14 void RemoveClientCircuit(uint circuitcode);
15 void RegisterPacketServer(PacketServer server);
15 } 16 }
16} 17}
diff --git a/OpenSim.RegionServer/PacketServer.cs b/OpenSim.RegionServer/PacketServer.cs
new file mode 100644
index 0000000..af0382c
--- /dev/null
+++ b/OpenSim.RegionServer/PacketServer.cs
@@ -0,0 +1,74 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.world;
5using libsecondlife.Packets;
6
7namespace OpenSim
8{
9 public class PacketServer
10 {
11 private OpenSimNetworkHandler _networkHandler;
12 private World _localWorld;
13 public Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>();
14
15 public PacketServer(OpenSimNetworkHandler networkHandler)
16 {
17 _networkHandler = networkHandler;
18 _networkHandler.RegisterPacketServer(this);
19 }
20
21 public World LocalWorld
22 {
23 set
24 {
25 this._localWorld = value;
26 }
27 }
28
29 public void ClientInPacket(uint circuitCode, Packet packet)
30 {
31 if (this.ClientThreads.ContainsKey(circuitCode))
32 {
33 ClientThreads[circuitCode].InPacket(packet);
34 }
35 }
36
37 public bool AddNewCircuitCodeClient(uint circuitCode)
38 {
39 return false;
40 }
41
42 public virtual void RegisterClientPacketHandlers()
43 {
44 SimClient.AddPacketHandler(PacketType.ModifyLand, _localWorld.ModifyTerrain);
45 SimClient.AddPacketHandler(PacketType.ChatFromViewer, _localWorld.SimChat);
46 SimClient.AddPacketHandler(PacketType.RezObject, _localWorld.RezObject);
47 SimClient.AddPacketHandler(PacketType.DeRezObject, _localWorld.DeRezObject);
48 SimClient.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName);
49 }
50
51 #region Client Packet Handlers
52
53 public bool RequestUUIDName(SimClient simClient, Packet packet)
54 {
55 System.Text.Encoding enc = System.Text.Encoding.ASCII;
56 Console.WriteLine(packet.ToString());
57 UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket)packet;
58 UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket();
59 nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length];
60
61 for (int i = 0; i < nameRequest.UUIDNameBlock.Length; i++)
62 {
63 nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
64 nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID;
65 nameReply.UUIDNameBlock[i].FirstName = enc.GetBytes("Who\0"); //for now send any name
66 nameReply.UUIDNameBlock[i].LastName = enc.GetBytes("Knows\0"); //in future need to look it up
67 }
68 simClient.OutPacket(nameReply);
69 return true;
70 }
71
72 #endregion
73 }
74}