aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/RegionInfo.cs245
1 files changed, 0 insertions, 245 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index daf0a25..9937ed7 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -96,251 +96,6 @@ namespace OpenSim.Framework
96 96
97 } 97 }
98 98
99 [Serializable]
100 public class SimpleRegionInfo
101 {
102// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
103
104 /// <summary>
105 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
106 /// </summary>
107 public uint HttpPort
108 {
109 get { return m_httpPort; }
110 set { m_httpPort = value; }
111 }
112 protected uint m_httpPort;
113
114 /// <summary>
115 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
116 /// </summary>
117 public string ServerURI
118 {
119 get {
120 if ( m_serverURI != string.Empty ) {
121 return m_serverURI;
122 } else {
123 return "http://" + m_externalHostName + ":" + m_httpPort + "/";
124 }
125 }
126 set {
127 if ( value.EndsWith("/") ) {
128 m_serverURI = value;
129 } else {
130 m_serverURI = value + '/';
131 }
132 }
133 }
134 protected string m_serverURI;
135
136 public string RegionName
137 {
138 get { return m_regionName; }
139 set { m_regionName = value; }
140 }
141 protected string m_regionName = String.Empty;
142
143 protected bool Allow_Alternate_Ports;
144 public bool m_allow_alternate_ports;
145 protected string m_externalHostName;
146
147 protected IPEndPoint m_internalEndPoint;
148 protected uint? m_regionLocX;
149 protected uint? m_regionLocY;
150 protected uint m_remotingPort;
151 public UUID RegionID = UUID.Zero;
152 public string RemotingAddress;
153 public UUID ScopeID = UUID.Zero;
154
155 public SimpleRegionInfo()
156 {
157 m_serverURI = string.Empty;
158 }
159
160 public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
161 {
162 m_regionLocX = regionLocX;
163 m_regionLocY = regionLocY;
164
165 m_internalEndPoint = internalEndPoint;
166 m_externalHostName = externalUri;
167 m_serverURI = string.Empty;
168 }
169
170 public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port)
171 {
172 m_regionLocX = regionLocX;
173 m_regionLocY = regionLocY;
174
175 m_externalHostName = externalUri;
176
177 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
178 m_serverURI = string.Empty;
179 }
180
181 public SimpleRegionInfo(RegionInfo ConvertFrom)
182 {
183 m_regionName = ConvertFrom.RegionName;
184 m_regionLocX = ConvertFrom.RegionLocX;
185 m_regionLocY = ConvertFrom.RegionLocY;
186 m_internalEndPoint = ConvertFrom.InternalEndPoint;
187 m_externalHostName = ConvertFrom.ExternalHostName;
188 m_remotingPort = ConvertFrom.RemotingPort;
189 m_httpPort = ConvertFrom.HttpPort;
190 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
191 RemotingAddress = ConvertFrom.RemotingAddress;
192 RegionID = UUID.Zero;
193 ServerURI = ConvertFrom.ServerURI;
194 }
195
196 public uint RemotingPort
197 {
198 get { return m_remotingPort; }
199 set { m_remotingPort = value; }
200 }
201
202 /// <value>
203 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
204 ///
205 /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method?
206 /// </value>
207 public IPEndPoint ExternalEndPoint
208 {
209 get
210 {
211 // Old one defaults to IPv6
212 //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
213
214 IPAddress ia = null;
215 // If it is already an IP, don't resolve it - just return directly
216 if (IPAddress.TryParse(m_externalHostName, out ia))
217 return new IPEndPoint(ia, m_internalEndPoint.Port);
218
219 // Reset for next check
220 ia = null;
221 try
222 {
223 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
224 {
225 if (ia == null)
226 ia = Adr;
227
228 if (Adr.AddressFamily == AddressFamily.InterNetwork)
229 {
230 ia = Adr;
231 break;
232 }
233 }
234 }
235 catch (SocketException e)
236 {
237 throw new Exception(
238 "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
239 e + "' attached to this exception", e);
240 }
241
242 return new IPEndPoint(ia, m_internalEndPoint.Port);
243 }
244
245 set { m_externalHostName = value.ToString(); }
246 }
247
248 public string ExternalHostName
249 {
250 get { return m_externalHostName; }
251 set { m_externalHostName = value; }
252 }
253
254 public IPEndPoint InternalEndPoint
255 {
256 get { return m_internalEndPoint; }
257 set { m_internalEndPoint = value; }
258 }
259
260 public uint RegionLocX
261 {
262 get { return m_regionLocX.Value; }
263 set { m_regionLocX = value; }
264 }
265
266 public uint RegionLocY
267 {
268 get { return m_regionLocY.Value; }
269 set { m_regionLocY = value; }
270 }
271
272 public ulong RegionHandle
273 {
274 get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
275 }
276
277 public int getInternalEndPointPort()
278 {
279 return m_internalEndPoint.Port;
280 }
281
282 public Dictionary<string, object> ToKeyValuePairs()
283 {
284 Dictionary<string, object> kvp = new Dictionary<string, object>();
285 kvp["uuid"] = RegionID.ToString();
286 kvp["locX"] = RegionLocX.ToString();
287 kvp["locY"] = RegionLocY.ToString();
288 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
289 kvp["external_port"] = ExternalEndPoint.Port.ToString();
290 kvp["external_host_name"] = ExternalHostName;
291 kvp["http_port"] = HttpPort.ToString();
292 kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
293 kvp["internal_port"] = InternalEndPoint.Port.ToString();
294 kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
295 kvp["server_uri"] = ServerURI;
296
297 return kvp;
298 }
299
300 public SimpleRegionInfo(Dictionary<string, object> kvp)
301 {
302 if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null))
303 {
304 int port = 0;
305 Int32.TryParse((string)kvp["external_port"], out port);
306 IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port);
307 ExternalEndPoint = ep;
308 }
309 else
310 ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
311
312 if (kvp["external_host_name"] != null)
313 ExternalHostName = (string)kvp["external_host_name"];
314
315 if (kvp["http_port"] != null)
316 {
317 UInt32 port = 0;
318 UInt32.TryParse((string)kvp["http_port"], out port);
319 HttpPort = port;
320 }
321
322 if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null))
323 {
324 int port = 0;
325 Int32.TryParse((string)kvp["internal_port"], out port);
326 IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port);
327 InternalEndPoint = ep;
328 }
329 else
330 InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
331
332 if (kvp["alternate_ports"] != null)
333 {
334 bool alts = false;
335 Boolean.TryParse((string)kvp["alternate_ports"], out alts);
336 m_allow_alternate_ports = alts;
337 }
338
339 if (kvp["server_uri"] != null)
340 ServerURI = (string)kvp["server_uri"];
341 }
342 }
343
344 public class RegionInfo 99 public class RegionInfo
345 { 100 {
346 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 101 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);