aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionInfo.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-04-29 14:04:55 +0000
committerAdam Frisby2008-04-29 14:04:55 +0000
commit375163a6fece8b3a57c7555246abe8338223a599 (patch)
tree163001ca96a4b4d08589e9772f78510677d5d0dc /OpenSim/Framework/RegionInfo.cs
parentPatch from Melanie: 0001087: Crash to bash de-linking objects. Thanks Melanie! (diff)
downloadopensim-SC_OLD-375163a6fece8b3a57c7555246abe8338223a599.zip
opensim-SC_OLD-375163a6fece8b3a57c7555246abe8338223a599.tar.gz
opensim-SC_OLD-375163a6fece8b3a57c7555246abe8338223a599.tar.bz2
opensim-SC_OLD-375163a6fece8b3a57c7555246abe8338223a599.tar.xz
* Spring cleaning.
* Added new generic "Location" class to handle 2D integer locations. Going to use it to replace all RegionHandle and X,Y coordinate references throughout the entire project. You have been warned.
Diffstat (limited to 'OpenSim/Framework/RegionInfo.cs')
-rw-r--r--OpenSim/Framework/RegionInfo.cs148
1 files changed, 67 insertions, 81 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 20a2709..88c9ea6 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -37,9 +37,26 @@ namespace OpenSim.Framework
37 [Serializable] 37 [Serializable]
38 public class SimpleRegionInfo 38 public class SimpleRegionInfo
39 { 39 {
40 // private static readonly log4net.ILog m_log 40 // private static readonly log4net.ILog m_log
41 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 41 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 protected bool Allow_Alternate_Ports;
44 public bool m_allow_alternate_ports;
45 protected string m_externalHostName;
46
47 /// <value>
48 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
49 /// </value>
50 protected uint m_httpPort;
51
52 protected IPEndPoint m_internalEndPoint;
53 protected uint? m_regionLocX;
54 protected uint? m_regionLocY;
55 protected uint m_remotingPort;
56 protected string m_serverURI;
57 public LLUUID RegionID = LLUUID.Zero;
58 public string RemotingAddress;
59
43 public SimpleRegionInfo() 60 public SimpleRegionInfo()
44 { 61 {
45 } 62 }
@@ -74,52 +91,27 @@ namespace OpenSim.Framework
74 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; 91 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
75 RemotingAddress = ConvertFrom.RemotingAddress; 92 RemotingAddress = ConvertFrom.RemotingAddress;
76 RegionID = LLUUID.Zero; 93 RegionID = LLUUID.Zero;
77 ServerURI = ConvertFrom.ServerURI; 94 ServerURI = ConvertFrom.ServerURI;
78 } 95 }
79 96
80 public LLUUID RegionID = LLUUID.Zero;
81
82 protected uint m_remotingPort;
83
84 public uint RemotingPort 97 public uint RemotingPort
85 { 98 {
86 get { return m_remotingPort; } 99 get { return m_remotingPort; }
87 set { m_remotingPort = value; } 100 set { m_remotingPort = value; }
88 } 101 }
89 102
90 /// <value>
91 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
92 /// </value>
93 protected uint m_httpPort;
94 public uint HttpPort 103 public uint HttpPort
95 { 104 {
96 get { return m_httpPort; } 105 get { return m_httpPort; }
97 set { m_httpPort = value; } 106 set { m_httpPort = value; }
98 } 107 }
99
100 public bool m_allow_alternate_ports;
101
102 protected string m_serverURI;
103
104 public int getInternalEndPointPort()
105 {
106 return m_internalEndPoint.Port;
107 }
108 108
109 public string ServerURI 109 public string ServerURI
110 { 110 {
111 get 111 get { return m_serverURI; }
112 { 112 set { m_serverURI = value; }
113 return m_serverURI;
114 }
115 set
116 {
117 m_serverURI = value;
118 }
119 } 113 }
120 114
121 public string RemotingAddress;
122
123 /// <value> 115 /// <value>
124 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. 116 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
125 /// 117 ///
@@ -139,7 +131,7 @@ namespace OpenSim.Framework
139 131
140 // Reset for next check 132 // Reset for next check
141 ia = null; 133 ia = null;
142 134
143 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) 135 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
144 { 136 {
145 if (ia == null) 137 if (ia == null)
@@ -158,33 +150,24 @@ namespace OpenSim.Framework
158 set { m_externalHostName = value.ToString(); } 150 set { m_externalHostName = value.ToString(); }
159 } 151 }
160 152
161 protected string m_externalHostName;
162 public string ExternalHostName 153 public string ExternalHostName
163 { 154 {
164 get { return m_externalHostName; } 155 get { return m_externalHostName; }
165 set { m_externalHostName = value; } 156 set { m_externalHostName = value; }
166 } 157 }
167 158
168 protected bool Allow_Alternate_Ports;
169
170 protected IPEndPoint m_internalEndPoint;
171
172 public IPEndPoint InternalEndPoint 159 public IPEndPoint InternalEndPoint
173 { 160 {
174 get { return m_internalEndPoint; } 161 get { return m_internalEndPoint; }
175 set { m_internalEndPoint = value; } 162 set { m_internalEndPoint = value; }
176 } 163 }
177 164
178 protected uint? m_regionLocX;
179
180 public uint RegionLocX 165 public uint RegionLocX
181 { 166 {
182 get { return m_regionLocX.Value; } 167 get { return m_regionLocX.Value; }
183 set { m_regionLocX = value; } 168 set { m_regionLocX = value; }
184 } 169 }
185 170
186 protected uint? m_regionLocY;
187
188 public uint RegionLocY 171 public uint RegionLocY
189 { 172 {
190 get { return m_regionLocY.Value; } 173 get { return m_regionLocY.Value; }
@@ -193,49 +176,39 @@ namespace OpenSim.Framework
193 176
194 public ulong RegionHandle 177 public ulong RegionHandle
195 { 178 {
196 get { return Util.UIntsToLong((RegionLocX * (uint)Constants.RegionSize), (RegionLocY * (uint)Constants.RegionSize)); } 179 get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
180 }
181
182 public int getInternalEndPointPort()
183 {
184 return m_internalEndPoint.Port;
197 } 185 }
198 } 186 }
199 187
200 public class RegionInfo : SimpleRegionInfo 188 public class RegionInfo : SimpleRegionInfo
201 { 189 {
202 // private static readonly log4net.ILog m_log 190 // private static readonly log4net.ILog m_log
203 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 191 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
204
205 public string RegionName = String.Empty;
206 192
193 public bool commFailTF = false;
194 public ConfigurationMember configMember;
195 public LLUUID CovenantID = LLUUID.Zero;
207 public string DataStore = String.Empty; 196 public string DataStore = String.Empty;
208 public bool isSandbox = false; 197 public bool isSandbox = false;
209 public bool commFailTF = false; 198 private EstateSettings m_estateSettings;
210 199
211// public bool m_allow_alternate_ports; 200// public bool m_allow_alternate_ports;
212 201
213 public LLUUID MasterAvatarAssignedUUID = LLUUID.Zero; 202 public LLUUID MasterAvatarAssignedUUID = LLUUID.Zero;
214 public LLUUID CovenantID = LLUUID.Zero;
215 public string MasterAvatarFirstName = String.Empty; 203 public string MasterAvatarFirstName = String.Empty;
216 public string MasterAvatarLastName = String.Empty; 204 public string MasterAvatarLastName = String.Empty;
217 public string MasterAvatarSandboxPassword = String.Empty; 205 public string MasterAvatarSandboxPassword = String.Empty;
218 public string regionSecret = LLUUID.Random().ToString();
219 public string proxyUrl = "";
220 public LLUUID originRegionID = LLUUID.Zero; 206 public LLUUID originRegionID = LLUUID.Zero;
207 public string proxyUrl = "";
208 public string RegionName = String.Empty;
209 public string regionSecret = LLUUID.Random().ToString();
221 210
222 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. 211 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
223 private EstateSettings m_estateSettings;
224
225 public EstateSettings EstateSettings
226 {
227 get
228 {
229 if (m_estateSettings == null)
230 {
231 m_estateSettings = new EstateSettings();
232 }
233
234 return m_estateSettings;
235 }
236 }
237
238 public ConfigurationMember configMember;
239 212
240 public RegionInfo(string description, string filename, bool skipConsoleConfig) 213 public RegionInfo(string description, string filename, bool skipConsoleConfig)
241 { 214 {
@@ -286,15 +259,27 @@ namespace OpenSim.Framework
286 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; 259 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
287 RemotingAddress = ConvertFrom.RemotingAddress; 260 RemotingAddress = ConvertFrom.RemotingAddress;
288 RegionID = LLUUID.Zero; 261 RegionID = LLUUID.Zero;
289 ServerURI = ConvertFrom.ServerURI; 262 ServerURI = ConvertFrom.ServerURI;
290 } 263 }
291 264
265 public EstateSettings EstateSettings
266 {
267 get
268 {
269 if (m_estateSettings == null)
270 {
271 m_estateSettings = new EstateSettings();
272 }
273
274 return m_estateSettings;
275 }
276 }
277
292 public void SetEndPoint(string ipaddr, int port) 278 public void SetEndPoint(string ipaddr, int port)
293 { 279 {
294 IPAddress tmpIP = IPAddress.Parse(ipaddr); 280 IPAddress tmpIP = IPAddress.Parse(ipaddr);
295 IPEndPoint tmpEPE= new IPEndPoint(tmpIP, port); 281 IPEndPoint tmpEPE = new IPEndPoint(tmpIP, port);
296 m_internalEndPoint = tmpEPE; 282 m_internalEndPoint = tmpEPE;
297
298 } 283 }
299 284
300 //not in use, should swap to nini though. 285 //not in use, should swap to nini though.
@@ -351,8 +336,9 @@ namespace OpenSim.Framework
351 return true; 336 return true;
352 } 337 }
353 338
354 public void SaveRegionToFile(string description, string filename) { 339 public void SaveRegionToFile(string description, string filename)
355 configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, 340 {
341 configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
356 ignoreIncomingConfiguration, false); 342 ignoreIncomingConfiguration, false);
357 configMember.performConfigurationRetrieve(); 343 configMember.performConfigurationRetrieve();
358 } 344 }
@@ -371,13 +357,13 @@ namespace OpenSim.Framework
371 //configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); 357 //configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
372 configMember.addConfigurationOption("internal_ip_address", 358 configMember.addConfigurationOption("internal_ip_address",
373 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, 359 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
374 "Internal IP Address for incoming UDP client connections", 360 "Internal IP Address for incoming UDP client connections",
375 m_internalEndPoint.Address.ToString(), 361 m_internalEndPoint.Address.ToString(),
376 true); 362 true);
377 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 363 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
378 "Internal IP Port for incoming UDP client connections", 364 "Internal IP Port for incoming UDP client connections",
379 m_internalEndPoint.Port.ToString(), true); 365 m_internalEndPoint.Port.ToString(), true);
380 configMember.addConfigurationOption("allow_alternate_ports", 366 configMember.addConfigurationOption("allow_alternate_ports",
381 ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, 367 ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
382 "Allow sim to find alternate UDP ports when ports are in use?", 368 "Allow sim to find alternate UDP ports when ports are in use?",
383 m_allow_alternate_ports.ToString(), true); 369 m_allow_alternate_ports.ToString(), true);
@@ -396,7 +382,7 @@ namespace OpenSim.Framework
396 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, 382 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
397 "Last Name of Master Avatar", MasterAvatarLastName, true); 383 "Last Name of Master Avatar", MasterAvatarLastName, true);
398 configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 384 configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
399 "(Sandbox Mode Only)Password for Master Avatar account", 385 "(Sandbox Mode Only)Password for Master Avatar account",
400 MasterAvatarSandboxPassword, true); 386 MasterAvatarSandboxPassword, true);
401 } 387 }
402 388
@@ -461,7 +447,7 @@ namespace OpenSim.Framework
461 { 447 {
462 case "sim_UUID": 448 case "sim_UUID":
463 RegionID = (LLUUID) configuration_result; 449 RegionID = (LLUUID) configuration_result;
464 originRegionID = (LLUUID)configuration_result; 450 originRegionID = (LLUUID) configuration_result;
465 break; 451 break;
466 case "sim_name": 452 case "sim_name":
467 RegionName = (string) configuration_result; 453 RegionName = (string) configuration_result;
@@ -480,10 +466,10 @@ namespace OpenSim.Framework
480 m_internalEndPoint = new IPEndPoint(address, 0); 466 m_internalEndPoint = new IPEndPoint(address, 0);
481 break; 467 break;
482 case "internal_ip_port": 468 case "internal_ip_port":
483 m_internalEndPoint.Port = (int)configuration_result; 469 m_internalEndPoint.Port = (int) configuration_result;
484 break; 470 break;
485 case "allow_alternate_ports": 471 case "allow_alternate_ports":
486 m_allow_alternate_ports = (bool)configuration_result; 472 m_allow_alternate_ports = (bool) configuration_result;
487 break; 473 break;
488 case "external_host_name": 474 case "external_host_name":
489 if ((string) configuration_result != "SYSTEMIP") 475 if ((string) configuration_result != "SYSTEMIP")
@@ -517,9 +503,9 @@ namespace OpenSim.Framework
517 return true; 503 return true;
518 } 504 }
519 505
520 public void SaveEstatecovenantUUID(LLUUID notecard) 506 public void SaveEstatecovenantUUID(LLUUID notecard)
521 { 507 {
522 configMember.forceSetConfigurationOption("estate_covanant_uuid", notecard.ToString()); 508 configMember.forceSetConfigurationOption("estate_covanant_uuid", notecard.ToString());
523 } 509 }
524 } 510 }
525} 511} \ No newline at end of file