diff options
Diffstat (limited to 'OpenSim/Framework/General/RegionInfo.cs')
-rw-r--r-- | OpenSim/Framework/General/RegionInfo.cs | 187 |
1 files changed, 84 insertions, 103 deletions
diff --git a/OpenSim/Framework/General/RegionInfo.cs b/OpenSim/Framework/General/RegionInfo.cs index 32f0c76..c14afd2 100644 --- a/OpenSim/Framework/General/RegionInfo.cs +++ b/OpenSim/Framework/General/RegionInfo.cs | |||
@@ -26,14 +26,10 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Globalization; | ||
30 | using System.Net; | 29 | using System.Net; |
31 | using System.Net.Sockets; | 30 | using System.Net.Sockets; |
32 | using Nini.Config; | ||
33 | using libsecondlife; | 31 | using libsecondlife; |
34 | using OpenSim.Framework.Console; | 32 | using Nini.Config; |
35 | using OpenSim.Framework.Interfaces; | ||
36 | using OpenSim.Framework; | ||
37 | 33 | ||
38 | namespace OpenSim.Framework | 34 | namespace OpenSim.Framework |
39 | { | 35 | { |
@@ -45,7 +41,6 @@ namespace OpenSim.Framework | |||
45 | 41 | ||
46 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | 42 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) |
47 | { | 43 | { |
48 | |||
49 | m_regionLocX = regionLocX; | 44 | m_regionLocX = regionLocX; |
50 | m_regionLocY = regionLocY; | 45 | m_regionLocY = regionLocY; |
51 | 46 | ||
@@ -55,7 +50,6 @@ namespace OpenSim.Framework | |||
55 | 50 | ||
56 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) | 51 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) |
57 | { | 52 | { |
58 | |||
59 | m_regionLocX = regionLocX; | 53 | m_regionLocX = regionLocX; |
60 | m_regionLocY = regionLocY; | 54 | m_regionLocY = regionLocY; |
61 | 55 | ||
@@ -67,16 +61,11 @@ namespace OpenSim.Framework | |||
67 | public LLUUID RegionID = new LLUUID(); | 61 | public LLUUID RegionID = new LLUUID(); |
68 | 62 | ||
69 | private uint m_remotingPort; | 63 | private uint m_remotingPort; |
64 | |||
70 | public uint RemotingPort | 65 | public uint RemotingPort |
71 | { | 66 | { |
72 | get | 67 | get { return m_remotingPort; } |
73 | { | 68 | set { m_remotingPort = value; } |
74 | return m_remotingPort; | ||
75 | } | ||
76 | set | ||
77 | { | ||
78 | m_remotingPort = value; | ||
79 | } | ||
80 | } | 69 | } |
81 | 70 | ||
82 | public string RemotingAddress; | 71 | public string RemotingAddress; |
@@ -109,76 +98,49 @@ namespace OpenSim.Framework | |||
109 | ia = Adr; | 98 | ia = Adr; |
110 | break; | 99 | break; |
111 | } | 100 | } |
112 | |||
113 | } | 101 | } |
114 | 102 | ||
115 | return new IPEndPoint(ia, m_internalEndPoint.Port); | 103 | return new IPEndPoint(ia, m_internalEndPoint.Port); |
116 | } | 104 | } |
117 | 105 | ||
118 | set | 106 | set { m_externalHostName = value.ToString(); } |
119 | { | ||
120 | m_externalHostName = value.ToString(); | ||
121 | } | ||
122 | } | 107 | } |
123 | 108 | ||
124 | protected string m_externalHostName; | 109 | protected string m_externalHostName; |
110 | |||
125 | public string ExternalHostName | 111 | public string ExternalHostName |
126 | { | 112 | { |
127 | get | 113 | get { return m_externalHostName; } |
128 | { | 114 | set { m_externalHostName = value; } |
129 | return m_externalHostName; | ||
130 | } | ||
131 | set | ||
132 | { | ||
133 | m_externalHostName = value; | ||
134 | } | ||
135 | } | 115 | } |
136 | 116 | ||
137 | protected IPEndPoint m_internalEndPoint; | 117 | protected IPEndPoint m_internalEndPoint; |
118 | |||
138 | public IPEndPoint InternalEndPoint | 119 | public IPEndPoint InternalEndPoint |
139 | { | 120 | { |
140 | get | 121 | get { return m_internalEndPoint; } |
141 | { | 122 | set { m_internalEndPoint = value; } |
142 | return m_internalEndPoint; | ||
143 | } | ||
144 | set | ||
145 | { | ||
146 | m_internalEndPoint = value; | ||
147 | } | ||
148 | } | 123 | } |
149 | 124 | ||
150 | protected uint? m_regionLocX; | 125 | protected uint? m_regionLocX; |
126 | |||
151 | public uint RegionLocX | 127 | public uint RegionLocX |
152 | { | 128 | { |
153 | get | 129 | get { return m_regionLocX.Value; } |
154 | { | 130 | set { m_regionLocX = value; } |
155 | return m_regionLocX.Value; | ||
156 | } | ||
157 | set | ||
158 | { | ||
159 | m_regionLocX = value; | ||
160 | } | ||
161 | } | 131 | } |
162 | 132 | ||
163 | protected uint? m_regionLocY; | 133 | protected uint? m_regionLocY; |
134 | |||
164 | public uint RegionLocY | 135 | public uint RegionLocY |
165 | { | 136 | { |
166 | get | 137 | get { return m_regionLocY.Value; } |
167 | { | 138 | set { m_regionLocY = value; } |
168 | return m_regionLocY.Value; | ||
169 | } | ||
170 | set | ||
171 | { | ||
172 | m_regionLocY = value; | ||
173 | } | ||
174 | } | 139 | } |
175 | 140 | ||
176 | public ulong RegionHandle | 141 | public ulong RegionHandle |
177 | { | 142 | { |
178 | get | 143 | get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); } |
179 | { | ||
180 | return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | ||
181 | } | ||
182 | } | 144 | } |
183 | } | 145 | } |
184 | 146 | ||
@@ -196,80 +158,81 @@ namespace OpenSim.Framework | |||
196 | 158 | ||
197 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. | 159 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. |
198 | private static EstateSettings m_estateSettings; | 160 | private static EstateSettings m_estateSettings; |
161 | |||
199 | public EstateSettings EstateSettings | 162 | public EstateSettings EstateSettings |
200 | { | 163 | { |
201 | get | 164 | get |
202 | { | 165 | { |
203 | if( m_estateSettings == null ) | 166 | if (m_estateSettings == null) |
204 | { | 167 | { |
205 | m_estateSettings = new EstateSettings(); | 168 | m_estateSettings = new EstateSettings(); |
206 | } | 169 | } |
207 | 170 | ||
208 | return m_estateSettings; | 171 | return m_estateSettings; |
209 | } | 172 | } |
210 | |||
211 | } | 173 | } |
212 | 174 | ||
213 | public ConfigurationMember configMember; | 175 | public ConfigurationMember configMember; |
176 | |||
214 | public RegionInfo(string description, string filename) | 177 | public RegionInfo(string description, string filename) |
215 | { | 178 | { |
216 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); | 179 | configMember = |
180 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); | ||
217 | configMember.performConfigurationRetrieve(); | 181 | configMember.performConfigurationRetrieve(); |
218 | } | 182 | } |
219 | 183 | ||
220 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : | 184 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : |
221 | base(regionLocX, regionLocY, internalEndPoint, externalUri) | 185 | base(regionLocX, regionLocY, internalEndPoint, externalUri) |
222 | { | 186 | { |
223 | |||
224 | |||
225 | } | 187 | } |
226 | 188 | ||
227 | public RegionInfo() | 189 | public RegionInfo() |
228 | { | 190 | { |
229 | |||
230 | } | 191 | } |
231 | 192 | ||
232 | //not in use, should swap to nini though. | 193 | //not in use, should swap to nini though. |
233 | public void LoadFromNiniSource(IConfigSource source) | 194 | public void LoadFromNiniSource(IConfigSource source) |
234 | { | 195 | { |
235 | this.LoadFromNiniSource(source, "RegionInfo"); | 196 | LoadFromNiniSource(source, "RegionInfo"); |
236 | } | 197 | } |
237 | 198 | ||
238 | //not in use, should swap to nini though. | 199 | //not in use, should swap to nini though. |
239 | public void LoadFromNiniSource(IConfigSource source, string sectionName) | 200 | public void LoadFromNiniSource(IConfigSource source, string sectionName) |
240 | { | 201 | { |
241 | string errorMessage = ""; | 202 | string errorMessage = ""; |
242 | this.RegionID = new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated())); | 203 | RegionID = |
243 | this.RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); | 204 | new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated())); |
244 | this.m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); | 205 | RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); |
245 | this.m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); | 206 | m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); |
246 | this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); | 207 | m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); |
208 | DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); | ||
247 | 209 | ||
248 | string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); | 210 | string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); |
249 | IPAddress ipAddressResult; | 211 | IPAddress ipAddressResult; |
250 | if (IPAddress.TryParse(ipAddress, out ipAddressResult)) | 212 | if (IPAddress.TryParse(ipAddress, out ipAddressResult)) |
251 | { | 213 | { |
252 | this.m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); | 214 | m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); |
253 | } | 215 | } |
254 | else | 216 | else |
255 | { | 217 | { |
256 | errorMessage = "needs an IP Address (IPAddress)"; | 218 | errorMessage = "needs an IP Address (IPAddress)"; |
257 | } | 219 | } |
258 | this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort); | 220 | m_internalEndPoint.Port = |
221 | source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort); | ||
259 | 222 | ||
260 | string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); | 223 | string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); |
261 | if (externalHost != "SYSTEMIP") | 224 | if (externalHost != "SYSTEMIP") |
262 | { | 225 | { |
263 | this.m_externalHostName = externalHost; | 226 | m_externalHostName = externalHost; |
264 | } | 227 | } |
265 | else | 228 | else |
266 | { | 229 | { |
267 | this.m_externalHostName = Util.GetLocalHost().ToString(); | 230 | m_externalHostName = Util.GetLocalHost().ToString(); |
268 | } | 231 | } |
269 | 232 | ||
270 | this.MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); | 233 | MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); |
271 | this.MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); | 234 | MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); |
272 | this.MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); | 235 | MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); |
273 | 236 | ||
274 | if (errorMessage != "") | 237 | if (errorMessage != "") |
275 | { | 238 | { |
@@ -279,17 +242,36 @@ namespace OpenSim.Framework | |||
279 | 242 | ||
280 | public void loadConfigurationOptions() | 243 | public void loadConfigurationOptions() |
281 | { | 244 | { |
282 | configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Region (Default is recommended, random UUID)", LLUUID.Random().ToString(), true); | 245 | configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, |
283 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Region Name", "OpenSim Test", false); | 246 | "UUID of Region (Default is recommended, random UUID)", |
284 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); | 247 | LLUUID.Random().ToString(), true); |
285 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); | 248 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, |
286 | configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); | 249 | "Region Name", "OpenSim Test", false); |
287 | configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); | 250 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, |
288 | configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); | 251 | "Grid Location (X Axis)", "1000", false); |
289 | configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); | 252 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, |
290 | configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false); | 253 | "Grid Location (Y Axis)", "1000", false); |
291 | configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false); | 254 | configMember.addConfigurationOption("datastore", |
292 | configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false); | 255 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, |
256 | "Filename for local storage", "OpenSim.db", false); | ||
257 | configMember.addConfigurationOption("internal_ip_address", | ||
258 | ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, | ||
259 | "Internal IP Address for incoming UDP client connections", "0.0.0.0", | ||
260 | false); | ||
261 | configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
262 | "Internal IP Port for incoming UDP client connections", | ||
263 | NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); | ||
264 | configMember.addConfigurationOption("external_host_name", | ||
265 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
266 | "External Host Name", "127.0.0.1", false); | ||
267 | configMember.addConfigurationOption("master_avatar_first", | ||
268 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
269 | "First Name of Master Avatar", "Test", false); | ||
270 | configMember.addConfigurationOption("master_avatar_last", | ||
271 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
272 | "Last Name of Master Avatar", "User", false); | ||
273 | configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
274 | "(Sandbox Mode Only)Password for Master Avatar account", "test", false); | ||
293 | } | 275 | } |
294 | 276 | ||
295 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | 277 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) |
@@ -297,51 +279,50 @@ namespace OpenSim.Framework | |||
297 | switch (configuration_key) | 279 | switch (configuration_key) |
298 | { | 280 | { |
299 | case "sim_UUID": | 281 | case "sim_UUID": |
300 | this.RegionID = (LLUUID)configuration_result; | 282 | RegionID = (LLUUID) configuration_result; |
301 | break; | 283 | break; |
302 | case "sim_name": | 284 | case "sim_name": |
303 | this.RegionName = (string)configuration_result; | 285 | RegionName = (string) configuration_result; |
304 | break; | 286 | break; |
305 | case "sim_location_x": | 287 | case "sim_location_x": |
306 | this.m_regionLocX = (uint)configuration_result; | 288 | m_regionLocX = (uint) configuration_result; |
307 | break; | 289 | break; |
308 | case "sim_location_y": | 290 | case "sim_location_y": |
309 | this.m_regionLocY = (uint)configuration_result; | 291 | m_regionLocY = (uint) configuration_result; |
310 | break; | 292 | break; |
311 | case "datastore": | 293 | case "datastore": |
312 | this.DataStore = (string)configuration_result; | 294 | DataStore = (string) configuration_result; |
313 | break; | 295 | break; |
314 | case "internal_ip_address": | 296 | case "internal_ip_address": |
315 | IPAddress address = (IPAddress)configuration_result; | 297 | IPAddress address = (IPAddress) configuration_result; |
316 | this.m_internalEndPoint = new IPEndPoint(address, 0); | 298 | m_internalEndPoint = new IPEndPoint(address, 0); |
317 | break; | 299 | break; |
318 | case "internal_ip_port": | 300 | case "internal_ip_port": |
319 | this.m_internalEndPoint.Port = (int)configuration_result; | 301 | m_internalEndPoint.Port = (int) configuration_result; |
320 | break; | 302 | break; |
321 | case "external_host_name": | 303 | case "external_host_name": |
322 | if ((string)configuration_result != "SYSTEMIP") | 304 | if ((string) configuration_result != "SYSTEMIP") |
323 | { | 305 | { |
324 | this.m_externalHostName = (string)configuration_result; | 306 | m_externalHostName = (string) configuration_result; |
325 | } | 307 | } |
326 | else | 308 | else |
327 | { | 309 | { |
328 | this.m_externalHostName = Util.GetLocalHost().ToString(); | 310 | m_externalHostName = Util.GetLocalHost().ToString(); |
329 | } | 311 | } |
330 | break; | 312 | break; |
331 | case "master_avatar_first": | 313 | case "master_avatar_first": |
332 | this.MasterAvatarFirstName = (string)configuration_result; | 314 | MasterAvatarFirstName = (string) configuration_result; |
333 | break; | 315 | break; |
334 | case "master_avatar_last": | 316 | case "master_avatar_last": |
335 | this.MasterAvatarLastName = (string)configuration_result; | 317 | MasterAvatarLastName = (string) configuration_result; |
336 | break; | 318 | break; |
337 | case "master_avatar_pass": | 319 | case "master_avatar_pass": |
338 | string tempMD5Passwd = (string)configuration_result; | 320 | string tempMD5Passwd = (string) configuration_result; |
339 | this.MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); | 321 | MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); |
340 | break; | 322 | break; |
341 | } | 323 | } |
342 | 324 | ||
343 | return true; | 325 | return true; |
344 | } | 326 | } |
345 | |||
346 | } | 327 | } |
347 | } | 328 | } \ No newline at end of file |