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