aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer/PacketServer.cs
diff options
context:
space:
mode:
authorMW2007-05-24 12:35:32 +0000
committerMW2007-05-24 12:35:32 +0000
commitf95b6081cba084d1b067acea99c0effa2b3bf42c (patch)
tree7a7ab4aa037f75afa54f403c701a735acb101575 /OpenSim/OpenSim.RegionServer/PacketServer.cs
parentDie ServiceManager! (Not really Gareth, just the old directory, new directory... (diff)
downloadopensim-SC-f95b6081cba084d1b067acea99c0effa2b3bf42c.zip
opensim-SC-f95b6081cba084d1b067acea99c0effa2b3bf42c.tar.gz
opensim-SC-f95b6081cba084d1b067acea99c0effa2b3bf42c.tar.bz2
opensim-SC-f95b6081cba084d1b067acea99c0effa2b3bf42c.tar.xz
Renamed the new Directories. (removed the "-Source" from the end of them)
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/PacketServer.cs')
-rw-r--r--OpenSim/OpenSim.RegionServer/PacketServer.cs89
1 files changed, 89 insertions, 0 deletions
diff --git a/OpenSim/OpenSim.RegionServer/PacketServer.cs b/OpenSim/OpenSim.RegionServer/PacketServer.cs
new file mode 100644
index 0000000..fb35723
--- /dev/null
+++ b/OpenSim/OpenSim.RegionServer/PacketServer.cs
@@ -0,0 +1,89 @@
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, ClientView> ClientThreads = new Dictionary<uint, ClientView>();
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 virtual void ClientInPacket(uint circuitCode, Packet packet)
30 {
31 if (this.ClientThreads.ContainsKey(circuitCode))
32 {
33 ClientThreads[circuitCode].InPacket(packet);
34 }
35 }
36
37 public virtual bool AddNewCircuitCodeClient(uint circuitCode)
38 {
39 return false;
40 }
41
42 public virtual void SendPacketToAllClients(Packet packet)
43 {
44
45 }
46
47 public virtual void SendPacketToAllExcept(Packet packet, ClientView simClient)
48 {
49
50 }
51
52 public virtual void AddClientPacketHandler(PacketType packetType, PacketMethod handler)
53 {
54
55 }
56
57 public virtual void RegisterClientPacketHandlers()
58 {
59 if (this._localWorld != null)
60 {
61 //ClientView.AddPacketHandler(PacketType.DeRezObject, _localWorld.DeRezObject);
62 ClientView.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName);
63 }
64 }
65
66 #region Client Packet Handlers
67
68 public bool RequestUUIDName(ClientView simClient, Packet packet)
69 {
70 System.Text.Encoding enc = System.Text.Encoding.ASCII;
71 Console.WriteLine(packet.ToString());
72 UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket)packet;
73 UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket();
74 nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length];
75
76 for (int i = 0; i < nameRequest.UUIDNameBlock.Length; i++)
77 {
78 nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
79 nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID;
80 nameReply.UUIDNameBlock[i].FirstName = enc.GetBytes("Who\0"); //for now send any name
81 nameReply.UUIDNameBlock[i].LastName = enc.GetBytes("Knows\0"); //in future need to look it up
82 }
83 simClient.OutPacket(nameReply);
84 return true;
85 }
86
87 #endregion
88 }
89}