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