aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
authorMW2007-05-15 15:15:01 +0000
committerMW2007-05-15 15:15:01 +0000
commit6b15c6e55642363cc0ce1b5908154bd57178dfcb (patch)
tree66021cea16b3f2fc16f56c5df99af41fafea7b7f /OpenSim.RegionServer
parentTurned SimClient into a partial class (and added SimClient(Grid), so that gri... (diff)
downloadopensim-SC-6b15c6e55642363cc0ce1b5908154bd57178dfcb.zip
opensim-SC-6b15c6e55642363cc0ce1b5908154bd57178dfcb.tar.gz
opensim-SC-6b15c6e55642363cc0ce1b5908154bd57178dfcb.tar.bz2
opensim-SC-6b15c6e55642363cc0ce1b5908154bd57178dfcb.tar.xz
Added SimClientPacketHandlers.cs (moved the SimClient Packet handlers into it)
Diffstat (limited to 'OpenSim.RegionServer')
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.csproj3
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.dll.build1
-rw-r--r--OpenSim.RegionServer/SimClient.cs138
-rw-r--r--OpenSim.RegionServer/SimClientPacketHandlers.cs156
4 files changed, 161 insertions, 137 deletions
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index b1af05f..9bffb2a 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -151,6 +151,9 @@
151 <Compile Include="SimClient.cs"> 151 <Compile Include="SimClient.cs">
152 <SubType>Code</SubType> 152 <SubType>Code</SubType>
153 </Compile> 153 </Compile>
154 <Compile Include="SimClientPacketHandlers.cs">
155 <SubType>Code</SubType>
156 </Compile>
154 <Compile Include="VersionInfo.cs"> 157 <Compile Include="VersionInfo.cs">
155 <SubType>Code</SubType> 158 <SubType>Code</SubType>
156 </Compile> 159 </Compile>
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
index 7adca31..bb7f9ab 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
@@ -20,6 +20,7 @@
20 <include name="RegionInfo.cs" /> 20 <include name="RegionInfo.cs" />
21 <include name="SimClient(Grid).cs" /> 21 <include name="SimClient(Grid).cs" />
22 <include name="SimClient.cs" /> 22 <include name="SimClient.cs" />
23 <include name="SimClientPacketHandlers.cs" />
23 <include name="VersionInfo.cs" /> 24 <include name="VersionInfo.cs" />
24 <include name="Assets/AssetCache.cs" /> 25 <include name="Assets/AssetCache.cs" />
25 <include name="Assets/InventoryCache.cs" /> 26 <include name="Assets/InventoryCache.cs" />
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index 03e151a..92156f0 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -954,119 +954,7 @@ namespace OpenSim
954 ClientLoop(); 954 ClientLoop();
955 } 955 }
956 } 956 }
957 #region Packet handlers 957
958
959 protected virtual bool Logout(SimClient simClient, Packet packet)
960 {
961 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"OpenSimClient.cs:ProcessInPacket() - Got a logout request");
962 //send reply to let the client logout
963 LogoutReplyPacket logReply = new LogoutReplyPacket();
964 logReply.AgentData.AgentID = this.AgentID;
965 logReply.AgentData.SessionID = this.SessionID;
966 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
967 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
968 logReply.InventoryData[0].ItemID = LLUUID.Zero;
969 OutPacket(logReply);
970 //tell all clients to kill our object
971 KillObjectPacket kill = new KillObjectPacket();
972 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
973 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
974 kill.ObjectData[0].ID = this.ClientAvatar.localid;
975 foreach (SimClient client in m_clientThreads.Values)
976 {
977 client.OutPacket(kill);
978 }
979 if (this.m_userServer != null)
980 {
981 this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer);
982 }
983 else
984 {
985 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
986 }
987
988 m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
989 /*lock (m_world.Entities)
990 {
991 m_world.Entities.Remove(this.AgentID);
992 }*/
993 m_world.RemoveViewerAgent(this);
994 //need to do other cleaning up here too
995 m_clientThreads.Remove(this.CircuitCode);
996 m_application.RemoveClientCircuit(this.CircuitCode);
997 this.ClientThread.Abort();
998 return true;
999 }
1000
1001 protected bool AgentTextureCached(SimClient simclient, Packet packet)
1002 {
1003 // Console.WriteLine(packet.ToString());
1004 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet;
1005 AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket();
1006 cachedresp.AgentData.AgentID = this.AgentID;
1007 cachedresp.AgentData.SessionID = this.SessionID;
1008 cachedresp.AgentData.SerialNum = this.cachedtextureserial;
1009 this.cachedtextureserial++;
1010 cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length];
1011 for (int i = 0; i < chechedtex.WearableData.Length; i++)
1012 {
1013 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
1014 cachedresp.WearableData[i].TextureIndex = chechedtex.WearableData[i].TextureIndex;
1015 cachedresp.WearableData[i].TextureID = LLUUID.Zero;
1016 cachedresp.WearableData[i].HostName = new byte[0];
1017 }
1018 this.OutPacket(cachedresp);
1019 return true;
1020 }
1021
1022 protected bool MultipleObjUpdate(SimClient simClient, Packet packet)
1023 {
1024 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
1025 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
1026 {
1027 if (multipleupdate.ObjectData[i].Type == 9) //change position
1028 {
1029 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
1030 foreach (Entity ent in m_world.Entities.Values)
1031 {
1032 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
1033 {
1034 ((OpenSim.world.Primitive)ent).UpdatePosition(pos);
1035
1036 }
1037 }
1038 //should update stored position of the prim
1039 }
1040 else if (multipleupdate.ObjectData[i].Type == 10)//rotation
1041 {
1042 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
1043 foreach (Entity ent in m_world.Entities.Values)
1044 {
1045 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
1046 {
1047 ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
1048 ((OpenSim.world.Primitive)ent).UpdateFlag = true;
1049 }
1050 }
1051 }
1052 else if (multipleupdate.ObjectData[i].Type == 13)//scale
1053 {
1054
1055 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
1056 foreach (Entity ent in m_world.Entities.Values)
1057 {
1058 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
1059 {
1060 ((OpenSim.world.Primitive)ent).Scale = scale;
1061 }
1062 }
1063 }
1064 }
1065 return true;
1066 }
1067
1068 #endregion
1069
1070 private AgentInventory CreateInventory(LLUUID baseFolder) 958 private AgentInventory CreateInventory(LLUUID baseFolder)
1071 { 959 {
1072 AgentInventory inventory = null; 960 AgentInventory inventory = null;
@@ -1127,29 +1015,5 @@ namespace OpenSim
1127 m_assetCache.AddAsset(asset); 1015 m_assetCache.AddAsset(asset);
1128 m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset); 1016 m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset);
1129 } 1017 }
1130
1131 public void RequestMapLayer() //should be getting the map layer from the grid server
1132 {
1133 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
1134 MapLayerReplyPacket mapReply = new MapLayerReplyPacket();
1135 mapReply.AgentData.AgentID = this.AgentID;
1136 mapReply.AgentData.Flags = 0;
1137 mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1];
1138 mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock();
1139 mapReply.LayerData[0].Bottom = 800;
1140 mapReply.LayerData[0].Left = 800;
1141 mapReply.LayerData[0].Top = 1200;
1142 mapReply.LayerData[0].Right = 1200;
1143 mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006");
1144 this.OutPacket(mapReply);
1145 }
1146
1147 public void RequestMapBlock( int minX, int minY, int maxX, int maxY)
1148 {
1149 //check if our own map was requested
1150 this.m_world.RequestMapBlock(this, minX, minY, maxX, maxY);
1151
1152 //now should get other regions maps from gridserver
1153 }
1154 } 1018 }
1155} 1019}
diff --git a/OpenSim.RegionServer/SimClientPacketHandlers.cs b/OpenSim.RegionServer/SimClientPacketHandlers.cs
new file mode 100644
index 0000000..5007a60
--- /dev/null
+++ b/OpenSim.RegionServer/SimClientPacketHandlers.cs
@@ -0,0 +1,156 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using libsecondlife;
5using libsecondlife.Packets;
6using Nwc.XmlRpc;
7using System.Net;
8using System.Net.Sockets;
9using System.IO;
10using System.Threading;
11using System.Timers;
12using OpenSim.Framework.Interfaces;
13using OpenSim.Framework.Types;
14using OpenSim.Framework.Inventory;
15using OpenSim.Framework.Utilities;
16using OpenSim.world;
17using OpenSim.Assets;
18
19namespace OpenSim
20{
21 public partial class SimClient
22 {
23 protected virtual bool Logout(SimClient simClient, Packet packet)
24 {
25 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:ProcessInPacket() - Got a logout request");
26 //send reply to let the client logout
27 LogoutReplyPacket logReply = new LogoutReplyPacket();
28 logReply.AgentData.AgentID = this.AgentID;
29 logReply.AgentData.SessionID = this.SessionID;
30 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
31 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
32 logReply.InventoryData[0].ItemID = LLUUID.Zero;
33 OutPacket(logReply);
34 //tell all clients to kill our object
35 KillObjectPacket kill = new KillObjectPacket();
36 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
37 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
38 kill.ObjectData[0].ID = this.ClientAvatar.localid;
39 foreach (SimClient client in m_clientThreads.Values)
40 {
41 client.OutPacket(kill);
42 }
43 if (this.m_userServer != null)
44 {
45 this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer);
46 }
47 else
48 {
49 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
50 }
51
52 m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
53 /*lock (m_world.Entities)
54 {
55 m_world.Entities.Remove(this.AgentID);
56 }*/
57 m_world.RemoveViewerAgent(this);
58 //need to do other cleaning up here too
59 m_clientThreads.Remove(this.CircuitCode);
60 m_application.RemoveClientCircuit(this.CircuitCode);
61 this.ClientThread.Abort();
62 return true;
63 }
64
65 protected bool AgentTextureCached(SimClient simclient, Packet packet)
66 {
67 // Console.WriteLine(packet.ToString());
68 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet;
69 AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket();
70 cachedresp.AgentData.AgentID = this.AgentID;
71 cachedresp.AgentData.SessionID = this.SessionID;
72 cachedresp.AgentData.SerialNum = this.cachedtextureserial;
73 this.cachedtextureserial++;
74 cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length];
75 for (int i = 0; i < chechedtex.WearableData.Length; i++)
76 {
77 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
78 cachedresp.WearableData[i].TextureIndex = chechedtex.WearableData[i].TextureIndex;
79 cachedresp.WearableData[i].TextureID = LLUUID.Zero;
80 cachedresp.WearableData[i].HostName = new byte[0];
81 }
82 this.OutPacket(cachedresp);
83 return true;
84 }
85
86 protected bool MultipleObjUpdate(SimClient simClient, Packet packet)
87 {
88 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
89 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
90 {
91 if (multipleupdate.ObjectData[i].Type == 9) //change position
92 {
93 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
94 foreach (Entity ent in m_world.Entities.Values)
95 {
96 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
97 {
98 ((OpenSim.world.Primitive)ent).UpdatePosition(pos);
99
100 }
101 }
102 //should update stored position of the prim
103 }
104 else if (multipleupdate.ObjectData[i].Type == 10)//rotation
105 {
106 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
107 foreach (Entity ent in m_world.Entities.Values)
108 {
109 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
110 {
111 ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
112 ((OpenSim.world.Primitive)ent).UpdateFlag = true;
113 }
114 }
115 }
116 else if (multipleupdate.ObjectData[i].Type == 13)//scale
117 {
118
119 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
120 foreach (Entity ent in m_world.Entities.Values)
121 {
122 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
123 {
124 ((OpenSim.world.Primitive)ent).Scale = scale;
125 }
126 }
127 }
128 }
129 return true;
130 }
131
132 public void RequestMapLayer() //should be getting the map layer from the grid server
133 {
134 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
135 MapLayerReplyPacket mapReply = new MapLayerReplyPacket();
136 mapReply.AgentData.AgentID = this.AgentID;
137 mapReply.AgentData.Flags = 0;
138 mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1];
139 mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock();
140 mapReply.LayerData[0].Bottom = 800;
141 mapReply.LayerData[0].Left = 800;
142 mapReply.LayerData[0].Top = 1200;
143 mapReply.LayerData[0].Right = 1200;
144 mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006");
145 this.OutPacket(mapReply);
146 }
147
148 public void RequestMapBlock(int minX, int minY, int maxX, int maxY)
149 {
150 //check if our own map was requested
151 this.m_world.RequestMapBlock(this, minX, minY, maxX, maxY);
152
153 //now should get other regions maps from gridserver
154 }
155 }
156}