aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/SerializableRegionInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/SerializableRegionInfo.cs')
-rw-r--r--OpenSim/Framework/SerializableRegionInfo.cs202
1 files changed, 0 insertions, 202 deletions
diff --git a/OpenSim/Framework/SerializableRegionInfo.cs b/OpenSim/Framework/SerializableRegionInfo.cs
deleted file mode 100644
index c3731b2..0000000
--- a/OpenSim/Framework/SerializableRegionInfo.cs
+++ /dev/null
@@ -1,202 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Net;
30using System.Net.Sockets;
31using OpenMetaverse;
32
33namespace OpenSim.Framework
34{
35 [Serializable]
36 public class SerializableRegionInfo
37 {
38 public bool m_allow_alternate_ports;
39 protected string m_externalHostName;
40
41 /// <value>
42 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
43 ///
44 /// FIXME: Defaulting to 9000 temporarily (on the basis that this is the http port most region
45 /// servers are running) until the revision in which this change is made propogates around grids.
46 /// </value>
47 protected uint m_httpPort = 9000;
48
49 protected IPEndPoint m_internalEndPoint;
50 protected Guid m_originRegionID = UUID.Zero.Guid;
51 protected string m_proxyUrl;
52 protected uint? m_regionLocX;
53 protected uint? m_regionLocY;
54 protected string m_regionName;
55 public uint m_remotingPort;
56 protected string m_serverURI;
57 public Guid RegionID = UUID.Zero.Guid;
58 public string RemotingAddress;
59
60 /// <summary>
61 /// This is a serializable version of RegionInfo
62 /// </summary>
63 public SerializableRegionInfo()
64 {
65 }
66
67 public SerializableRegionInfo(RegionInfo ConvertFrom)
68 {
69 m_regionLocX = ConvertFrom.RegionLocX;
70 m_regionLocY = ConvertFrom.RegionLocY;
71 m_internalEndPoint = ConvertFrom.InternalEndPoint;
72 m_externalHostName = ConvertFrom.ExternalHostName;
73 m_remotingPort = ConvertFrom.RemotingPort;
74 m_httpPort = ConvertFrom.HttpPort;
75 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
76 RemotingAddress = ConvertFrom.RemotingAddress;
77 m_proxyUrl = ConvertFrom.proxyUrl;
78 OriginRegionID = ConvertFrom.originRegionID;
79 RegionName = ConvertFrom.RegionName;
80 ServerURI = ConvertFrom.ServerURI;
81 }
82
83 public SerializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
84 {
85 m_regionLocX = regionLocX;
86 m_regionLocY = regionLocY;
87
88 m_internalEndPoint = internalEndPoint;
89 m_externalHostName = externalUri;
90 }
91
92 public SerializableRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port)
93 {
94 m_regionLocX = regionLocX;
95 m_regionLocY = regionLocY;
96
97 m_externalHostName = externalUri;
98
99 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
100 }
101
102 public uint RemotingPort
103 {
104 get { return m_remotingPort; }
105 set { m_remotingPort = value; }
106 }
107
108 public uint HttpPort
109 {
110 get { return m_httpPort; }
111 set { m_httpPort = value; }
112 }
113
114 public IPEndPoint ExternalEndPoint
115 {
116 get
117 {
118 // Old one defaults to IPv6
119 //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
120
121 IPAddress ia = null;
122 // If it is already an IP, don't resolve it - just return directly
123 if (IPAddress.TryParse(m_externalHostName, out ia))
124 return new IPEndPoint(ia, m_internalEndPoint.Port);
125
126 // Reset for next check
127 ia = null;
128
129
130 // New method favors IPv4
131 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
132 {
133 if (ia == null)
134 ia = Adr;
135
136 if (Adr.AddressFamily == AddressFamily.InterNetwork)
137 {
138 ia = Adr;
139 break;
140 }
141 }
142
143 return new IPEndPoint(ia, m_internalEndPoint.Port);
144 }
145
146 set { m_externalHostName = value.ToString(); }
147 }
148
149 public string ExternalHostName
150 {
151 get { return m_externalHostName; }
152 set { m_externalHostName = value; }
153 }
154
155 public IPEndPoint InternalEndPoint
156 {
157 get { return m_internalEndPoint; }
158 set { m_internalEndPoint = value; }
159 }
160
161 public uint RegionLocX
162 {
163 get { return m_regionLocX.Value; }
164 set { m_regionLocX = value; }
165 }
166
167 public uint RegionLocY
168 {
169 get { return m_regionLocY.Value; }
170 set { m_regionLocY = value; }
171 }
172
173 public ulong RegionHandle
174 {
175 get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
176 }
177
178 public string ProxyUrl
179 {
180 get { return m_proxyUrl; }
181 set { m_proxyUrl = value; }
182 }
183
184 public UUID OriginRegionID
185 {
186 get { return new UUID(m_originRegionID); }
187 set { m_originRegionID = value.Guid; }
188 }
189
190 public string RegionName
191 {
192 get { return m_regionName; }
193 set { m_regionName = value; }
194 }
195
196 public string ServerURI
197 {
198 get { return m_serverURI; }
199 set { m_serverURI = value; }
200 }
201 }
202}