diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/General/Types/RegionInfo.cs | 127 |
1 files changed, 94 insertions, 33 deletions
diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs index 0fba6ca..1ead3c4 100644 --- a/OpenSim/Framework/General/Types/RegionInfo.cs +++ b/OpenSim/Framework/General/Types/RegionInfo.cs | |||
@@ -40,9 +40,38 @@ namespace OpenSim.Framework.Types | |||
40 | { | 40 | { |
41 | public LLUUID SimUUID = new LLUUID(); | 41 | public LLUUID SimUUID = new LLUUID(); |
42 | public string RegionName = ""; | 42 | public string RegionName = ""; |
43 | public uint RegionLocX = 0; | 43 | |
44 | public uint RegionLocY = 0; | 44 | private uint? m_regionLocX; |
45 | public ulong RegionHandle = 0; | 45 | public uint RegionLocX |
46 | { | ||
47 | get | ||
48 | { | ||
49 | return m_regionLocX.Value; | ||
50 | } | ||
51 | } | ||
52 | |||
53 | private uint? m_regionLocY; | ||
54 | public uint RegionLocY | ||
55 | { | ||
56 | get | ||
57 | { | ||
58 | return m_regionLocY.Value; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | private ulong? m_regionHandle; | ||
63 | public ulong RegionHandle | ||
64 | { | ||
65 | get | ||
66 | { | ||
67 | if (!m_regionHandle.HasValue) | ||
68 | { | ||
69 | m_regionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | ||
70 | } | ||
71 | |||
72 | return m_regionHandle.Value; | ||
73 | } | ||
74 | } | ||
46 | 75 | ||
47 | public string DataStore = ""; | 76 | public string DataStore = ""; |
48 | public bool isSandbox = false; | 77 | public bool isSandbox = false; |
@@ -52,19 +81,43 @@ namespace OpenSim.Framework.Types | |||
52 | public string MasterAvatarLastName = ""; | 81 | public string MasterAvatarLastName = ""; |
53 | public string MasterAvatarSandboxPassword = ""; | 82 | public string MasterAvatarSandboxPassword = ""; |
54 | 83 | ||
84 | private int? m_commsIPListenPort; | ||
85 | |||
55 | /// <summary> | 86 | /// <summary> |
56 | /// Port used for listening (TCP and UDP) | 87 | /// Port used for listening (TCP and UDP) |
57 | /// </summary> | 88 | /// </summary> |
58 | /// <remarks>Seperate TCP and UDP</remarks> | 89 | /// <remarks>Seperate TCP and UDP</remarks> |
59 | public int CommsIPListenPort = 0; | 90 | public int CommsIPListenPort |
91 | { | ||
92 | get | ||
93 | { | ||
94 | return m_commsIPListenPort.Value; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | private string m_commsIPListenAddr; | ||
60 | /// <summary> | 99 | /// <summary> |
61 | /// Address used for internal listening (default: 0.0.0.0?) | 100 | /// Address used for internal listening (default: 0.0.0.0?) |
62 | /// </summary> | 101 | /// </summary> |
63 | public string CommsIPListenAddr = ""; | 102 | public string CommsIPListenAddr |
103 | { | ||
104 | get | ||
105 | { | ||
106 | return m_commsIPListenAddr; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | private string m_commsExternalAddress; | ||
64 | /// <summary> | 111 | /// <summary> |
65 | /// Address used for external addressing (DNS or IP) | 112 | /// Address used for external addressing (DNS or IP) |
66 | /// </summary> | 113 | /// </summary> |
67 | public string CommsExternalAddress = ""; | 114 | public string CommsExternalAddress |
115 | { | ||
116 | get | ||
117 | { | ||
118 | return m_commsExternalAddress; | ||
119 | } | ||
120 | } | ||
68 | 121 | ||
69 | 122 | ||
70 | public EstateSettings estateSettings; | 123 | public EstateSettings estateSettings; |
@@ -73,7 +126,16 @@ namespace OpenSim.Framework.Types | |||
73 | { | 126 | { |
74 | estateSettings = new EstateSettings(); | 127 | estateSettings = new EstateSettings(); |
75 | } | 128 | } |
76 | 129 | ||
130 | public RegionInfo( uint regionLocX, uint regionLocY, string simIp, int simPort, string simUri ) : this() | ||
131 | { | ||
132 | m_regionLocX = regionLocX; | ||
133 | m_regionLocY = regionLocY; | ||
134 | |||
135 | m_commsIPListenAddr = simIp; | ||
136 | m_commsIPListenPort = simPort; | ||
137 | m_commsExternalAddress = simUri; | ||
138 | } | ||
77 | 139 | ||
78 | public void InitConfig(bool sandboxMode, IGenericConfig configData) | 140 | public void InitConfig(bool sandboxMode, IGenericConfig configData) |
79 | { | 141 | { |
@@ -112,11 +174,11 @@ namespace OpenSim.Framework.Types | |||
112 | { | 174 | { |
113 | string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Grid Location X", "1000"); | 175 | string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Grid Location X", "1000"); |
114 | configData.SetAttribute("SimLocationX", location); | 176 | configData.SetAttribute("SimLocationX", location); |
115 | this.RegionLocX = (uint)Convert.ToUInt32(location); | 177 | m_regionLocX = (uint)Convert.ToUInt32(location); |
116 | } | 178 | } |
117 | else | 179 | else |
118 | { | 180 | { |
119 | this.RegionLocX = (uint)Convert.ToUInt32(attri); | 181 | m_regionLocX = (uint)Convert.ToUInt32(attri); |
120 | } | 182 | } |
121 | // Sim/Grid location Y | 183 | // Sim/Grid location Y |
122 | attri = ""; | 184 | attri = ""; |
@@ -125,13 +187,15 @@ namespace OpenSim.Framework.Types | |||
125 | { | 187 | { |
126 | string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Grid Location Y", "1000"); | 188 | string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Grid Location Y", "1000"); |
127 | configData.SetAttribute("SimLocationY", location); | 189 | configData.SetAttribute("SimLocationY", location); |
128 | this.RegionLocY = (uint)Convert.ToUInt32(location); | 190 | m_regionLocY = (uint)Convert.ToUInt32(location); |
129 | } | 191 | } |
130 | else | 192 | else |
131 | { | 193 | { |
132 | this.RegionLocY = (uint)Convert.ToUInt32(attri); | 194 | m_regionLocY = (uint)Convert.ToUInt32(attri); |
133 | } | 195 | } |
134 | 196 | ||
197 | m_regionHandle = null; | ||
198 | |||
135 | // Local storage datastore | 199 | // Local storage datastore |
136 | attri = ""; | 200 | attri = ""; |
137 | attri = configData.GetAttribute("Datastore"); | 201 | attri = configData.GetAttribute("Datastore"); |
@@ -153,11 +217,11 @@ namespace OpenSim.Framework.Types | |||
153 | { | 217 | { |
154 | string port = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("UDP port for client connections", "9000"); | 218 | string port = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("UDP port for client connections", "9000"); |
155 | configData.SetAttribute("SimListenPort", port); | 219 | configData.SetAttribute("SimListenPort", port); |
156 | this.CommsIPListenPort = Convert.ToInt32(port); | 220 | m_commsIPListenPort = Convert.ToInt32(port); |
157 | } | 221 | } |
158 | else | 222 | else |
159 | { | 223 | { |
160 | this.CommsIPListenPort = Convert.ToInt32(attri); | 224 | m_commsIPListenPort = Convert.ToInt32(attri); |
161 | } | 225 | } |
162 | 226 | ||
163 | //Sim Listen Address | 227 | //Sim Listen Address |
@@ -165,8 +229,8 @@ namespace OpenSim.Framework.Types | |||
165 | attri = configData.GetAttribute("SimListenAddress"); | 229 | attri = configData.GetAttribute("SimListenAddress"); |
166 | if (attri == "") | 230 | if (attri == "") |
167 | { | 231 | { |
168 | this.CommsIPListenAddr = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("IP Address to listen on for client connections", "0.0.0.0"); | 232 | m_commsIPListenAddr = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("IP Address to listen on for client connections", "0.0.0.0"); |
169 | configData.SetAttribute("SimListenAddress", this.CommsIPListenAddr); | 233 | configData.SetAttribute("SimListenAddress", CommsIPListenAddr ); |
170 | } | 234 | } |
171 | else | 235 | else |
172 | { | 236 | { |
@@ -177,26 +241,25 @@ namespace OpenSim.Framework.Types | |||
177 | System.Net.IPAddress[] ips = System.Net.Dns.GetHostAddresses(localhostname); | 241 | System.Net.IPAddress[] ips = System.Net.Dns.GetHostAddresses(localhostname); |
178 | try | 242 | try |
179 | { | 243 | { |
180 | this.CommsIPListenAddr = "0.0.0.0"; // Incase a IPv4 address isnt found | 244 | m_commsIPListenAddr = "0.0.0.0"; // Incase a IPv4 address isnt found |
181 | 245 | ||
182 | foreach (System.Net.IPAddress ip in ips) | 246 | foreach (System.Net.IPAddress ip in ips) |
183 | { | 247 | { |
184 | if (ip.AddressFamily.ToString() == System.Net.Sockets.ProtocolFamily.InterNetwork.ToString()) | 248 | if (ip.AddressFamily.ToString() == System.Net.Sockets.ProtocolFamily.InterNetwork.ToString()) |
185 | { | 249 | { |
186 | this.CommsIPListenAddr = ip.ToString(); | 250 | m_commsIPListenAddr = ip.ToString(); |
187 | break; | 251 | break; |
188 | } | 252 | } |
189 | } | 253 | } |
190 | } | 254 | } |
191 | catch (Exception e) | 255 | catch (Exception) |
192 | { | 256 | { |
193 | e.ToString(); | 257 | m_commsIPListenAddr = "0.0.0.0"; // Use the default if we fail |
194 | this.CommsIPListenAddr = "0.0.0.0"; // Use the default if we fail | ||
195 | } | 258 | } |
196 | } | 259 | } |
197 | else | 260 | else |
198 | { | 261 | { |
199 | this.CommsIPListenAddr = attri; | 262 | m_commsIPListenAddr = attri; |
200 | } | 263 | } |
201 | } | 264 | } |
202 | 265 | ||
@@ -205,12 +268,12 @@ namespace OpenSim.Framework.Types | |||
205 | attri = configData.GetAttribute("SimExternalAddress"); | 268 | attri = configData.GetAttribute("SimExternalAddress"); |
206 | if (attri == "") | 269 | if (attri == "") |
207 | { | 270 | { |
208 | this.CommsExternalAddress = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("IP or DNS address to send external clients to", "localhost"); | 271 | m_commsExternalAddress = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("IP or DNS address to send external clients to", "localhost"); |
209 | configData.SetAttribute("SimExternalAddress", this.CommsExternalAddress); | 272 | configData.SetAttribute("SimExternalAddress", CommsExternalAddress); |
210 | } | 273 | } |
211 | else | 274 | else |
212 | { | 275 | { |
213 | this.CommsExternalAddress = attri; | 276 | m_commsExternalAddress = attri; |
214 | } | 277 | } |
215 | 278 | ||
216 | attri = ""; | 279 | attri = ""; |
@@ -281,8 +344,6 @@ namespace OpenSim.Framework.Types | |||
281 | } | 344 | } |
282 | } | 345 | } |
283 | 346 | ||
284 | this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | ||
285 | |||
286 | configData.Commit(); | 347 | configData.Commit(); |
287 | } | 348 | } |
288 | catch (Exception e) | 349 | catch (Exception e) |
@@ -292,13 +353,13 @@ namespace OpenSim.Framework.Types | |||
292 | } | 353 | } |
293 | 354 | ||
294 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Sim settings loaded:"); | 355 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Sim settings loaded:"); |
295 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "UUID: " + this.SimUUID.ToStringHyphenated()); | 356 | OpenSim.Framework.Console.MainLog.Instance.Verbose("UUID: " + this.SimUUID.ToStringHyphenated()); |
296 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "Name: " + this.RegionName); | 357 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Name: " + this.RegionName); |
297 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); | 358 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); |
298 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "Region Handle: " + this.RegionHandle.ToString()); | 359 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Region Handle: " + this.RegionHandle.ToString()); |
299 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "Listening on IP: " + this.CommsIPListenAddr + ":" + this.CommsIPListenPort); | 360 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Listening on IP: " + this.CommsIPListenAddr + ":" + this.CommsIPListenPort); |
300 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "Sandbox Mode? " + isSandbox.ToString()); | 361 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Sandbox Mode? " + isSandbox.ToString()); |
301 | 362 | ||
302 | } | 363 | } |
303 | } | 364 | } |
304 | } | 365 | } |