aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/RegionInfo.cs')
-rw-r--r--OpenSim/Framework/RegionInfo.cs73
1 files changed, 71 insertions, 2 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 3896a6e..d3a5357 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Net; 30using System.Net;
30using System.Net.Sockets; 31using System.Net.Sockets;
31using System.Xml; 32using System.Xml;
@@ -63,6 +64,13 @@ namespace OpenSim.Framework
63 } 64 }
64 protected string m_serverURI; 65 protected string m_serverURI;
65 66
67 public string RegionName
68 {
69 get { return m_regionName; }
70 set { m_regionName = value; }
71 }
72 protected string m_regionName = String.Empty;
73
66 protected bool Allow_Alternate_Ports; 74 protected bool Allow_Alternate_Ports;
67 public bool m_allow_alternate_ports; 75 public bool m_allow_alternate_ports;
68 protected string m_externalHostName; 76 protected string m_externalHostName;
@@ -100,6 +108,7 @@ namespace OpenSim.Framework
100 108
101 public SimpleRegionInfo(RegionInfo ConvertFrom) 109 public SimpleRegionInfo(RegionInfo ConvertFrom)
102 { 110 {
111 m_regionName = ConvertFrom.RegionName;
103 m_regionLocX = ConvertFrom.RegionLocX; 112 m_regionLocX = ConvertFrom.RegionLocX;
104 m_regionLocY = ConvertFrom.RegionLocY; 113 m_regionLocY = ConvertFrom.RegionLocY;
105 m_internalEndPoint = ConvertFrom.InternalEndPoint; 114 m_internalEndPoint = ConvertFrom.InternalEndPoint;
@@ -197,6 +206,67 @@ namespace OpenSim.Framework
197 { 206 {
198 return m_internalEndPoint.Port; 207 return m_internalEndPoint.Port;
199 } 208 }
209
210 public Dictionary<string, object> ToKeyValuePairs()
211 {
212 Dictionary<string, object> kvp = new Dictionary<string, object>();
213 kvp["uuid"] = RegionID.ToString();
214 kvp["locX"] = RegionLocX.ToString();
215 kvp["locY"] = RegionLocY.ToString();
216 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
217 kvp["external_port"] = ExternalEndPoint.Port.ToString();
218 kvp["external_host_name"] = ExternalHostName;
219 kvp["http_port"] = HttpPort.ToString();
220 kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
221 kvp["internal_port"] = InternalEndPoint.Port.ToString();
222 kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
223 kvp["server_uri"] = ServerURI;
224
225 return kvp;
226 }
227
228 public SimpleRegionInfo(Dictionary<string, object> kvp)
229 {
230 if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null))
231 {
232 int port = 0;
233 Int32.TryParse((string)kvp["external_port"], out port);
234 IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port);
235 ExternalEndPoint = ep;
236 }
237 else
238 ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
239
240 if (kvp["external_host_name"] != null)
241 ExternalHostName = (string)kvp["external_host_name"];
242
243 if (kvp["http_port"] != null)
244 {
245 UInt32 port = 0;
246 UInt32.TryParse((string)kvp["http_port"], out port);
247 HttpPort = port;
248 }
249
250 if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null))
251 {
252 int port = 0;
253 Int32.TryParse((string)kvp["internal_port"], out port);
254 IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port);
255 InternalEndPoint = ep;
256 }
257 else
258 InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
259
260 if (kvp["alternate_ports"] != null)
261 {
262 bool alts = false;
263 Boolean.TryParse((string)kvp["alternate_ports"], out alts);
264 m_allow_alternate_ports = alts;
265 }
266
267 if (kvp["server_uri"] != null)
268 ServerURI = (string)kvp["server_uri"];
269 }
200 } 270 }
201 271
202 public class RegionInfo : SimpleRegionInfo 272 public class RegionInfo : SimpleRegionInfo
@@ -222,7 +292,6 @@ namespace OpenSim.Framework
222 public UUID originRegionID = UUID.Zero; 292 public UUID originRegionID = UUID.Zero;
223 public string proxyUrl = ""; 293 public string proxyUrl = "";
224 public int ProxyOffset = 0; 294 public int ProxyOffset = 0;
225 public string RegionName = String.Empty;
226 public string regionSecret = UUID.Random().ToString(); 295 public string regionSecret = UUID.Random().ToString();
227 296
228 public string osSecret; 297 public string osSecret;
@@ -971,7 +1040,7 @@ namespace OpenSim.Framework
971 public static RegionInfo Create(UUID regionID, string regionName, uint regX, uint regY, string externalHostName, uint httpPort, uint simPort, uint remotingPort, string serverURI) 1040 public static RegionInfo Create(UUID regionID, string regionName, uint regX, uint regY, string externalHostName, uint httpPort, uint simPort, uint remotingPort, string serverURI)
972 { 1041 {
973 RegionInfo regionInfo; 1042 RegionInfo regionInfo;
974 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(Util.GetHostFromDNS(externalHostName), (int)simPort); 1043 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(Util.GetHostFromDNS(externalHostName), (int)simPort);
975 regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, externalHostName); 1044 regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, externalHostName);
976 regionInfo.RemotingPort = remotingPort; 1045 regionInfo.RemotingPort = remotingPort;
977 regionInfo.RemotingAddress = externalHostName; 1046 regionInfo.RemotingAddress = externalHostName;