aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
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(Grid).cs146
-rw-r--r--OpenSim.RegionServer/SimClient.cs124
4 files changed, 151 insertions, 123 deletions
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index 9901fa5..b1af05f 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -145,6 +145,9 @@
145 <Compile Include="RegionInfo.cs"> 145 <Compile Include="RegionInfo.cs">
146 <SubType>Code</SubType> 146 <SubType>Code</SubType>
147 </Compile> 147 </Compile>
148 <Compile Include="SimClient(Grid).cs">
149 <SubType>Code</SubType>
150 </Compile>
148 <Compile Include="SimClient.cs"> 151 <Compile Include="SimClient.cs">
149 <SubType>Code</SubType> 152 <SubType>Code</SubType>
150 </Compile> 153 </Compile>
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
index ca1fa8c..7adca31 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
@@ -18,6 +18,7 @@
18 <include name="PacketServer.cs" /> 18 <include name="PacketServer.cs" />
19 <include name="QueItem.cs" /> 19 <include name="QueItem.cs" />
20 <include name="RegionInfo.cs" /> 20 <include name="RegionInfo.cs" />
21 <include name="SimClient(Grid).cs" />
21 <include name="SimClient.cs" /> 22 <include name="SimClient.cs" />
22 <include name="VersionInfo.cs" /> 23 <include name="VersionInfo.cs" />
23 <include name="Assets/AssetCache.cs" /> 24 <include name="Assets/AssetCache.cs" />
diff --git a/OpenSim.RegionServer/SimClient(Grid).cs b/OpenSim.RegionServer/SimClient(Grid).cs
new file mode 100644
index 0000000..b0d59cc
--- /dev/null
+++ b/OpenSim.RegionServer/SimClient(Grid).cs
@@ -0,0 +1,146 @@
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
24 public void EnableNeighbours()
25 {
26 if ((this.m_gridServer.GetName() == "Remote") && (!this.m_child))
27 {
28 Hashtable SimParams;
29 ArrayList SendParams;
30 XmlRpcRequest GridReq;
31 XmlRpcResponse GridResp;
32 List<Packet> enablePackets = new List<Packet>();
33 foreach (Hashtable neighbour in ((RemoteGridBase)this.m_gridServer).neighbours)
34 {
35 Console.WriteLine("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]);
36 SimParams = new Hashtable();
37 SimParams["session_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].SessionID.ToString();
38 SimParams["secure_session_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].SecureSessionID.ToString();
39 SimParams["firstname"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].firstname;
40 SimParams["lastname"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].lastname;
41 SimParams["agent_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].AgentID.ToString();
42 SimParams["circuit_code"] = (Int32)this.CircuitCode;
43 SimParams["child_agent"] = "1";
44 SendParams = new ArrayList();
45 SendParams.Add(SimParams);
46
47 GridReq = new XmlRpcRequest("expect_user", SendParams);
48 GridResp = GridReq.Send("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"], 3000);
49 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
50 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
51 enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256));
52 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)neighbour["sim_ip"]);
53 byte[] byteIP = neighbourIP.GetAddressBytes();
54 enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
55 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
56 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
57 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
58 enablesimpacket.SimulatorInfo.Port = (ushort)Convert.ToInt32(neighbour["sim_port"]);
59 enablePackets.Add(enablesimpacket);
60 }
61 Thread.Sleep(3000);
62 foreach (Packet enable in enablePackets)
63 {
64 this.OutPacket(enable);
65 }
66 enablePackets.Clear();
67 }
68 }
69
70 public void CrossSimBorder(LLVector3 avatarpos)
71 { // VERY VERY BASIC
72
73 LLVector3 newpos = avatarpos;
74 uint neighbourx = this.m_regionData.RegionLocX;
75 uint neighboury = this.m_regionData.RegionLocY;
76
77 if (avatarpos.X < 0)
78 {
79 neighbourx -= 1;
80 newpos.X = 254;
81 }
82 if (avatarpos.X > 255)
83 {
84 neighbourx += 1;
85 newpos.X = 1;
86 }
87 if (avatarpos.Y < 0)
88 {
89 neighboury -= 1;
90 newpos.Y = 254;
91 }
92 if (avatarpos.Y > 255)
93 {
94 neighbourx += 1;
95 newpos.Y = 1;
96 }
97 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]");
98
99 Hashtable SimParams;
100 ArrayList SendParams;
101 XmlRpcRequest GridReq;
102 XmlRpcResponse GridResp;
103 foreach (Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours)
104 {
105 if (((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString()))
106 {
107 SimParams = new Hashtable();
108 SimParams["firstname"] = this.ClientAvatar.firstname;
109 SimParams["lastname"] = this.ClientAvatar.lastname;
110 SimParams["circuit_code"] = this.CircuitCode.ToString();
111 SimParams["pos_x"] = newpos.X.ToString();
112 SimParams["pos_y"] = newpos.Y.ToString();
113 SimParams["pos_z"] = newpos.Z.ToString();
114 SendParams = new ArrayList();
115 SendParams.Add(SimParams);
116
117 GridReq = new XmlRpcRequest("agent_crossing", SendParams);
118 GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000);
119
120 CrossedRegionPacket NewSimPack = new CrossedRegionPacket();
121 NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
122 NewSimPack.AgentData.AgentID = this.AgentID;
123 NewSimPack.AgentData.SessionID = this.SessionID;
124 NewSimPack.Info = new CrossedRegionPacket.InfoBlock();
125 NewSimPack.Info.Position = newpos;
126 NewSimPack.Info.LookAt = new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
127 NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock();
128 NewSimPack.RegionData.RegionHandle = Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256));
129 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]);
130 byte[] byteIP = neighbourIP.GetAddressBytes();
131 NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24;
132 NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16;
133 NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8;
134 NewSimPack.RegionData.SimIP += (uint)byteIP[0];
135 NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]);
136 NewSimPack.RegionData.SeedCapability = new byte[0];
137 lock (PacketQueue)
138 {
139 ProcessOutPacket(NewSimPack);
140 DowngradeClient();
141 }
142 }
143 }
144 }
145 }
146}
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index 49221f8..03e151a 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -50,7 +50,7 @@ namespace OpenSim
50 /// Handles new client connections 50 /// Handles new client connections
51 /// Constructor takes a single Packet and authenticates everything 51 /// Constructor takes a single Packet and authenticates everything
52 /// </summary> 52 /// </summary>
53 public class SimClient 53 public partial class SimClient
54 { 54 {
55 public LLUUID AgentID; 55 public LLUUID AgentID;
56 public LLUUID SessionID; 56 public LLUUID SessionID;
@@ -142,82 +142,6 @@ namespace OpenSim
142 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); 142 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
143 } 143 }
144 144
145 public void CrossSimBorder(LLVector3 avatarpos)
146 { // VERY VERY BASIC
147
148 LLVector3 newpos = avatarpos;
149 uint neighbourx = this.m_regionData.RegionLocX;
150 uint neighboury = this.m_regionData.RegionLocY;
151
152 if (avatarpos.X < 0)
153 {
154 neighbourx -= 1;
155 newpos.X = 254;
156 }
157 if (avatarpos.X > 255)
158 {
159 neighbourx += 1;
160 newpos.X = 1;
161 }
162 if (avatarpos.Y < 0)
163 {
164 neighboury -= 1;
165 newpos.Y = 254;
166 }
167 if (avatarpos.Y > 255)
168 {
169 neighbourx += 1;
170 newpos.Y = 1;
171 }
172 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]");
173
174 Hashtable SimParams;
175 ArrayList SendParams;
176 XmlRpcRequest GridReq;
177 XmlRpcResponse GridResp;
178 foreach (Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours)
179 {
180 if (((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString()))
181 {
182 SimParams = new Hashtable();
183 SimParams["firstname"] = this.ClientAvatar.firstname;
184 SimParams["lastname"] = this.ClientAvatar.lastname;
185 SimParams["circuit_code"] = this.CircuitCode.ToString();
186 SimParams["pos_x"] = newpos.X.ToString();
187 SimParams["pos_y"] = newpos.Y.ToString();
188 SimParams["pos_z"] = newpos.Z.ToString();
189 SendParams = new ArrayList();
190 SendParams.Add(SimParams);
191
192 GridReq = new XmlRpcRequest("agent_crossing", SendParams);
193 GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000);
194
195 CrossedRegionPacket NewSimPack = new CrossedRegionPacket();
196 NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
197 NewSimPack.AgentData.AgentID = this.AgentID;
198 NewSimPack.AgentData.SessionID = this.SessionID;
199 NewSimPack.Info = new CrossedRegionPacket.InfoBlock();
200 NewSimPack.Info.Position = newpos;
201 NewSimPack.Info.LookAt = new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
202 NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock();
203 NewSimPack.RegionData.RegionHandle = Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256));
204 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]);
205 byte[] byteIP = neighbourIP.GetAddressBytes();
206 NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24;
207 NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16;
208 NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8;
209 NewSimPack.RegionData.SimIP += (uint)byteIP[0];
210 NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]);
211 NewSimPack.RegionData.SeedCapability = new byte[0];
212 lock (PacketQueue)
213 {
214 ProcessOutPacket(NewSimPack);
215 DowngradeClient();
216 }
217 }
218 }
219 }
220
221 public void UpgradeClient() 145 public void UpgradeClient()
222 { 146 {
223 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"SimClient.cs:UpgradeClient() - upgrading child to full agent"); 147 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"SimClient.cs:UpgradeClient() - upgrading child to full agent");
@@ -1227,51 +1151,5 @@ namespace OpenSim
1227 1151
1228 //now should get other regions maps from gridserver 1152 //now should get other regions maps from gridserver
1229 } 1153 }
1230
1231 public void EnableNeighbours()
1232 {
1233 if ((this.m_gridServer.GetName() == "Remote") && (!this.m_child))
1234 {
1235 Hashtable SimParams;
1236 ArrayList SendParams;
1237 XmlRpcRequest GridReq;
1238 XmlRpcResponse GridResp;
1239 List<Packet> enablePackets = new List<Packet>();
1240 foreach (Hashtable neighbour in ((RemoteGridBase)this.m_gridServer).neighbours)
1241 {
1242 Console.WriteLine( "http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]);
1243 SimParams = new Hashtable();
1244 SimParams["session_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].SessionID.ToString();
1245 SimParams["secure_session_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].SecureSessionID.ToString();
1246 SimParams["firstname"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].firstname;
1247 SimParams["lastname"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].lastname;
1248 SimParams["agent_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].AgentID.ToString();
1249 SimParams["circuit_code"] = (Int32)this.CircuitCode;
1250 SimParams["child_agent"] = "1";
1251 SendParams = new ArrayList();
1252 SendParams.Add(SimParams);
1253
1254 GridReq = new XmlRpcRequest("expect_user", SendParams);
1255 GridResp = GridReq.Send("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"], 3000);
1256 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
1257 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
1258 enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256));
1259 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)neighbour["sim_ip"]);
1260 byte[] byteIP = neighbourIP.GetAddressBytes();
1261 enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
1262 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
1263 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
1264 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
1265 enablesimpacket.SimulatorInfo.Port = (ushort)Convert.ToInt32(neighbour["sim_port"]);
1266 enablePackets.Add(enablesimpacket);
1267 }
1268 Thread.Sleep(3000);
1269 foreach (Packet enable in enablePackets)
1270 {
1271 this.OutPacket(enable);
1272 }
1273 enablePackets.Clear();
1274 }
1275 }
1276 } 1154 }
1277} 1155}