diff options
Diffstat (limited to 'OpenSim/Services/Interfaces/IGridService.cs')
-rw-r--r-- | OpenSim/Services/Interfaces/IGridService.cs | 102 |
1 files changed, 29 insertions, 73 deletions
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index f5f1f75..ead5d3c 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -85,7 +85,7 @@ namespace OpenSim.Services.Interfaces | |||
85 | GridRegion GetRegionByName(UUID scopeID, string regionName); | 85 | GridRegion GetRegionByName(UUID scopeID, string regionName); |
86 | 86 | ||
87 | /// <summary> | 87 | /// <summary> |
88 | /// Get information about regions starting with the provided name. | 88 | /// Get information about regions starting with the provided name. |
89 | /// </summary> | 89 | /// </summary> |
90 | /// <param name="name"> | 90 | /// <param name="name"> |
91 | /// The name to match against. | 91 | /// The name to match against. |
@@ -95,7 +95,7 @@ namespace OpenSim.Services.Interfaces | |||
95 | /// </param> | 95 | /// </param> |
96 | /// <returns> | 96 | /// <returns> |
97 | /// A list of <see cref="RegionInfo"/>s of regions with matching name. If the | 97 | /// A list of <see cref="RegionInfo"/>s of regions with matching name. If the |
98 | /// grid-server couldn't be contacted or returned an error, return null. | 98 | /// grid-server couldn't be contacted or returned an error, return null. |
99 | /// </returns> | 99 | /// </returns> |
100 | List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber); | 100 | List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber); |
101 | 101 | ||
@@ -139,7 +139,7 @@ namespace OpenSim.Services.Interfaces | |||
139 | #pragma warning restore 414 | 139 | #pragma warning restore 414 |
140 | 140 | ||
141 | /// <summary> | 141 | /// <summary> |
142 | /// The port by which http communication occurs with the region | 142 | /// The port by which http communication occurs with the region |
143 | /// </summary> | 143 | /// </summary> |
144 | public uint HttpPort { get; set; } | 144 | public uint HttpPort { get; set; } |
145 | 145 | ||
@@ -148,7 +148,7 @@ namespace OpenSim.Services.Interfaces | |||
148 | /// </summary> | 148 | /// </summary> |
149 | public string ServerURI | 149 | public string ServerURI |
150 | { | 150 | { |
151 | get { | 151 | get { |
152 | if (!String.IsNullOrEmpty(m_serverURI)) { | 152 | if (!String.IsNullOrEmpty(m_serverURI)) { |
153 | return m_serverURI; | 153 | return m_serverURI; |
154 | } else { | 154 | } else { |
@@ -158,14 +158,25 @@ namespace OpenSim.Services.Interfaces | |||
158 | return "http://" + m_externalHostName + ":" + HttpPort + "/"; | 158 | return "http://" + m_externalHostName + ":" + HttpPort + "/"; |
159 | } | 159 | } |
160 | } | 160 | } |
161 | set { | 161 | set { |
162 | if (value.EndsWith("/")) { | 162 | if ( value == null) |
163 | { | ||
164 | m_serverURI = String.Empty; | ||
165 | return; | ||
166 | } | ||
167 | |||
168 | if ( value.EndsWith("/") ) | ||
169 | { | ||
170 | |||
163 | m_serverURI = value; | 171 | m_serverURI = value; |
164 | } else { | 172 | } |
173 | else | ||
174 | { | ||
165 | m_serverURI = value + '/'; | 175 | m_serverURI = value + '/'; |
166 | } | 176 | } |
167 | } | 177 | } |
168 | } | 178 | } |
179 | |||
169 | protected string m_serverURI; | 180 | protected string m_serverURI; |
170 | 181 | ||
171 | /// <summary> | 182 | /// <summary> |
@@ -260,31 +271,6 @@ namespace OpenSim.Services.Interfaces | |||
260 | m_serverURI = string.Empty; | 271 | m_serverURI = string.Empty; |
261 | } | 272 | } |
262 | 273 | ||
263 | /* | ||
264 | public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) | ||
265 | { | ||
266 | m_regionLocX = regionLocX; | ||
267 | m_regionLocY = regionLocY; | ||
268 | RegionSizeX = (int)Constants.RegionSize; | ||
269 | RegionSizeY = (int)Constants.RegionSize; | ||
270 | |||
271 | m_internalEndPoint = internalEndPoint; | ||
272 | m_externalHostName = externalUri; | ||
273 | } | ||
274 | |||
275 | public GridRegion(int regionLocX, int regionLocY, string externalUri, uint port) | ||
276 | { | ||
277 | m_regionLocX = regionLocX; | ||
278 | m_regionLocY = regionLocY; | ||
279 | RegionSizeX = (int)Constants.RegionSize; | ||
280 | RegionSizeY = (int)Constants.RegionSize; | ||
281 | |||
282 | m_externalHostName = externalUri; | ||
283 | |||
284 | m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port); | ||
285 | } | ||
286 | */ | ||
287 | |||
288 | public GridRegion(uint xcell, uint ycell) | 274 | public GridRegion(uint xcell, uint ycell) |
289 | { | 275 | { |
290 | m_regionLocX = (int)Util.RegionToWorldLoc(xcell); | 276 | m_regionLocX = (int)Util.RegionToWorldLoc(xcell); |
@@ -333,7 +319,7 @@ namespace OpenSim.Services.Interfaces | |||
333 | RegionSecret = ConvertFrom.RegionSecret; | 319 | RegionSecret = ConvertFrom.RegionSecret; |
334 | EstateOwner = ConvertFrom.EstateOwner; | 320 | EstateOwner = ConvertFrom.EstateOwner; |
335 | } | 321 | } |
336 | 322 | ||
337 | public GridRegion(Dictionary<string, object> kvp) | 323 | public GridRegion(Dictionary<string, object> kvp) |
338 | { | 324 | { |
339 | if (kvp.ContainsKey("uuid")) | 325 | if (kvp.ContainsKey("uuid")) |
@@ -358,6 +344,13 @@ namespace OpenSim.Services.Interfaces | |||
358 | if (kvp.ContainsKey("regionName")) | 344 | if (kvp.ContainsKey("regionName")) |
359 | RegionName = (string)kvp["regionName"]; | 345 | RegionName = (string)kvp["regionName"]; |
360 | 346 | ||
347 | if (kvp.ContainsKey("access")) | ||
348 | { | ||
349 | byte access = Convert.ToByte((string)kvp["access"]); | ||
350 | Access = access; | ||
351 | Maturity = (int)Util.ConvertAccessLevelToMaturity(access); | ||
352 | } | ||
353 | |||
361 | if (kvp.ContainsKey("flags") && kvp["flags"] != null) | 354 | if (kvp.ContainsKey("flags") && kvp["flags"] != null) |
362 | RegionFlags = (OpenSim.Framework.RegionFlags?)Convert.ToInt32((string)kvp["flags"]); | 355 | RegionFlags = (OpenSim.Framework.RegionFlags?)Convert.ToInt32((string)kvp["flags"]); |
363 | 356 | ||
@@ -394,9 +387,6 @@ namespace OpenSim.Services.Interfaces | |||
394 | if (kvp.ContainsKey("parcelMapTexture")) | 387 | if (kvp.ContainsKey("parcelMapTexture")) |
395 | UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); | 388 | UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); |
396 | 389 | ||
397 | if (kvp.ContainsKey("access")) | ||
398 | Access = Byte.Parse((string)kvp["access"]); | ||
399 | |||
400 | if (kvp.ContainsKey("regionSecret")) | 390 | if (kvp.ContainsKey("regionSecret")) |
401 | RegionSecret =(string)kvp["regionSecret"]; | 391 | RegionSecret =(string)kvp["regionSecret"]; |
402 | 392 | ||
@@ -409,7 +399,7 @@ namespace OpenSim.Services.Interfaces | |||
409 | // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", | 399 | // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", |
410 | // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); | 400 | // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); |
411 | } | 401 | } |
412 | 402 | ||
413 | public Dictionary<string, object> ToKeyValuePairs() | 403 | public Dictionary<string, object> ToKeyValuePairs() |
414 | { | 404 | { |
415 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | 405 | Dictionary<string, object> kvp = new Dictionary<string, object>(); |
@@ -472,41 +462,7 @@ namespace OpenSim.Services.Interfaces | |||
472 | /// </value> | 462 | /// </value> |
473 | public IPEndPoint ExternalEndPoint | 463 | public IPEndPoint ExternalEndPoint |
474 | { | 464 | { |
475 | get | 465 | get { return Util.getEndPoint(m_externalHostName, m_internalEndPoint.Port); } |
476 | { | ||
477 | // Old one defaults to IPv6 | ||
478 | //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); | ||
479 | |||
480 | IPAddress ia = null; | ||
481 | // If it is already an IP, don't resolve it - just return directly | ||
482 | if (IPAddress.TryParse(m_externalHostName, out ia)) | ||
483 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
484 | |||
485 | // Reset for next check | ||
486 | ia = null; | ||
487 | try | ||
488 | { | ||
489 | foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) | ||
490 | { | ||
491 | if (ia == null) | ||
492 | ia = Adr; | ||
493 | |||
494 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
495 | { | ||
496 | ia = Adr; | ||
497 | break; | ||
498 | } | ||
499 | } | ||
500 | } | ||
501 | catch (SocketException e) | ||
502 | { | ||
503 | throw new Exception( | ||
504 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | ||
505 | e + "' attached to this exception", e); | ||
506 | } | ||
507 | |||
508 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
509 | } | ||
510 | } | 466 | } |
511 | 467 | ||
512 | public string ExternalHostName | 468 | public string ExternalHostName |
@@ -526,4 +482,4 @@ namespace OpenSim.Services.Interfaces | |||
526 | get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } | 482 | get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } |
527 | } | 483 | } |
528 | } | 484 | } |
529 | } \ No newline at end of file | 485 | } |