aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Interfaces/IGridService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Interfaces/IGridService.cs')
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs166
1 files changed, 153 insertions, 13 deletions
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 1119e48..7e5597b 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Net; 31using System.Net;
31using System.Net.Sockets; 32using System.Net.Sockets;
@@ -119,22 +120,28 @@ namespace OpenSim.Services.Interfaces
119 /// <param name='scopeID'></param> 120 /// <param name='scopeID'></param>
120 /// <param name='regionID'></param> 121 /// <param name='regionID'></param>
121 int GetRegionFlags(UUID scopeID, UUID regionID); 122 int GetRegionFlags(UUID scopeID, UUID regionID);
123
124 Dictionary<string,object> GetExtraFeatures();
125 }
126
127 public interface IHypergridLinker
128 {
129 GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason);
130 bool TryUnlinkRegion(string mapName);
122 } 131 }
123 132
124 public class GridRegion 133 public class GridRegion
125 { 134 {
126 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 135// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
136
137#pragma warning disable 414
127 private static readonly string LogHeader = "[GRID REGION]"; 138 private static readonly string LogHeader = "[GRID REGION]";
139#pragma warning restore 414
128 140
129 /// <summary> 141 /// <summary>
130 /// The port by which http communication occurs with the region 142 /// The port by which http communication occurs with the region
131 /// </summary> 143 /// </summary>
132 public uint HttpPort 144 public uint HttpPort { get; set; }
133 {
134 get { return m_httpPort; }
135 set { m_httpPort = value; }
136 }
137 protected uint m_httpPort;
138 145
139 /// <summary> 146 /// <summary>
140 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) 147 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
@@ -142,16 +149,19 @@ namespace OpenSim.Services.Interfaces
142 public string ServerURI 149 public string ServerURI
143 { 150 {
144 get { 151 get {
145 if ( m_serverURI != string.Empty ) { 152 if (!String.IsNullOrEmpty(m_serverURI)) {
146 return m_serverURI; 153 return m_serverURI;
147 } else { 154 } else {
148 if (m_httpPort == 0) 155 if (HttpPort == 0)
149 return "http://" + m_externalHostName + "/"; 156 return "http://" + m_externalHostName + "/";
150 else 157 else
151 return "http://" + m_externalHostName + ":" + m_httpPort + "/"; 158 return "http://" + m_externalHostName + ":" + HttpPort + "/";
152 } 159 }
153 } 160 }
154 set { 161 set {
162<<<<<<< HEAD
163 if (value.EndsWith("/")) {
164=======
155 if ( value == null) 165 if ( value == null)
156 { 166 {
157 m_serverURI = String.Empty; 167 m_serverURI = String.Empty;
@@ -159,6 +169,7 @@ namespace OpenSim.Services.Interfaces
159 } 169 }
160 170
161 if ( value.EndsWith("/") ) { 171 if ( value.EndsWith("/") ) {
172>>>>>>> avn/ubitvar
162 m_serverURI = value; 173 m_serverURI = value;
163 } else { 174 } else {
164 m_serverURI = value + '/'; 175 m_serverURI = value + '/';
@@ -167,6 +178,16 @@ namespace OpenSim.Services.Interfaces
167 } 178 }
168 protected string m_serverURI; 179 protected string m_serverURI;
169 180
181 /// <summary>
182 /// Provides direct access to the 'm_serverURI' field, without returning a generated URL if m_serverURI is missing.
183 /// </summary>
184 public string RawServerURI
185 {
186 get { return m_serverURI; }
187 set { m_serverURI = value; }
188 }
189
190
170 public string RegionName 191 public string RegionName
171 { 192 {
172 get { return m_regionName; } 193 get { return m_regionName; }
@@ -174,6 +195,17 @@ namespace OpenSim.Services.Interfaces
174 } 195 }
175 protected string m_regionName = String.Empty; 196 protected string m_regionName = String.Empty;
176 197
198 /// <summary>
199 /// Region flags.
200 /// </summary>
201 /// <remarks>
202 /// If not set (chiefly if a robust service is running code pre OpenSim 0.8.1) then this will be null and
203 /// should be ignored. If you require flags information please use the separate IGridService.GetRegionFlags() call
204 /// XXX: This field is currently ignored when used in RegisterRegion, but could potentially be
205 /// used to set flags at this point.
206 /// </remarks>
207 public OpenSim.Framework.RegionFlags? RegionFlags { get; set; }
208
177 protected string m_externalHostName; 209 protected string m_externalHostName;
178 210
179 protected IPEndPoint m_internalEndPoint; 211 protected IPEndPoint m_internalEndPoint;
@@ -280,7 +312,7 @@ namespace OpenSim.Services.Interfaces
280 RegionSizeY = (int)ConvertFrom.RegionSizeY; 312 RegionSizeY = (int)ConvertFrom.RegionSizeY;
281 m_internalEndPoint = ConvertFrom.InternalEndPoint; 313 m_internalEndPoint = ConvertFrom.InternalEndPoint;
282 m_externalHostName = ConvertFrom.ExternalHostName; 314 m_externalHostName = ConvertFrom.ExternalHostName;
283 m_httpPort = ConvertFrom.HttpPort; 315 HttpPort = ConvertFrom.HttpPort;
284 RegionID = ConvertFrom.RegionID; 316 RegionID = ConvertFrom.RegionID;
285 ServerURI = ConvertFrom.ServerURI; 317 ServerURI = ConvertFrom.ServerURI;
286 TerrainImage = ConvertFrom.RegionSettings.TerrainImageID; 318 TerrainImage = ConvertFrom.RegionSettings.TerrainImageID;
@@ -294,13 +326,14 @@ namespace OpenSim.Services.Interfaces
294 public GridRegion(GridRegion ConvertFrom) 326 public GridRegion(GridRegion ConvertFrom)
295 { 327 {
296 m_regionName = ConvertFrom.RegionName; 328 m_regionName = ConvertFrom.RegionName;
329 RegionFlags = ConvertFrom.RegionFlags;
297 m_regionLocX = ConvertFrom.RegionLocX; 330 m_regionLocX = ConvertFrom.RegionLocX;
298 m_regionLocY = ConvertFrom.RegionLocY; 331 m_regionLocY = ConvertFrom.RegionLocY;
299 RegionSizeX = ConvertFrom.RegionSizeX; 332 RegionSizeX = ConvertFrom.RegionSizeX;
300 RegionSizeY = ConvertFrom.RegionSizeY; 333 RegionSizeY = ConvertFrom.RegionSizeY;
301 m_internalEndPoint = ConvertFrom.InternalEndPoint; 334 m_internalEndPoint = ConvertFrom.InternalEndPoint;
302 m_externalHostName = ConvertFrom.ExternalHostName; 335 m_externalHostName = ConvertFrom.ExternalHostName;
303 m_httpPort = ConvertFrom.HttpPort; 336 HttpPort = ConvertFrom.HttpPort;
304 RegionID = ConvertFrom.RegionID; 337 RegionID = ConvertFrom.RegionID;
305 ServerURI = ConvertFrom.ServerURI; 338 ServerURI = ConvertFrom.ServerURI;
306 TerrainImage = ConvertFrom.TerrainImage; 339 TerrainImage = ConvertFrom.TerrainImage;
@@ -310,8 +343,112 @@ namespace OpenSim.Services.Interfaces
310 RegionSecret = ConvertFrom.RegionSecret; 343 RegionSecret = ConvertFrom.RegionSecret;
311 EstateOwner = ConvertFrom.EstateOwner; 344 EstateOwner = ConvertFrom.EstateOwner;
312 } 345 }
346
347 public GridRegion(Dictionary<string, object> kvp)
348 {
349 if (kvp.ContainsKey("uuid"))
350 RegionID = new UUID((string)kvp["uuid"]);
351
352 if (kvp.ContainsKey("locX"))
353 RegionLocX = Convert.ToInt32((string)kvp["locX"]);
354
355 if (kvp.ContainsKey("locY"))
356 RegionLocY = Convert.ToInt32((string)kvp["locY"]);
357
358 if (kvp.ContainsKey("sizeX"))
359 RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]);
360 else
361 RegionSizeX = (int)Constants.RegionSize;
362
363 if (kvp.ContainsKey("sizeY"))
364 RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]);
365 else
366 RegionSizeX = (int)Constants.RegionSize;
367
368 if (kvp.ContainsKey("regionName"))
369 RegionName = (string)kvp["regionName"];
370
371 if (kvp.ContainsKey("flags") && kvp["flags"] != null)
372 RegionFlags = (OpenSim.Framework.RegionFlags?)Convert.ToInt32((string)kvp["flags"]);
373
374 if (kvp.ContainsKey("serverIP"))
375 {
376 //int port = 0;
377 //Int32.TryParse((string)kvp["serverPort"], out port);
378 //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port);
379 ExternalHostName = (string)kvp["serverIP"];
380 }
381 else
382 ExternalHostName = "127.0.0.1";
383
384 if (kvp.ContainsKey("serverPort"))
385 {
386 Int32 port = 0;
387 Int32.TryParse((string)kvp["serverPort"], out port);
388 InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
389 }
390
391 if (kvp.ContainsKey("serverHttpPort"))
392 {
393 UInt32 port = 0;
394 UInt32.TryParse((string)kvp["serverHttpPort"], out port);
395 HttpPort = port;
396 }
397
398 if (kvp.ContainsKey("serverURI"))
399 ServerURI = (string)kvp["serverURI"];
400
401 if (kvp.ContainsKey("regionMapTexture"))
402 UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage);
403
404 if (kvp.ContainsKey("parcelMapTexture"))
405 UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage);
406
407 if (kvp.ContainsKey("access"))
408 Access = Byte.Parse((string)kvp["access"]);
409
410 if (kvp.ContainsKey("regionSecret"))
411 RegionSecret =(string)kvp["regionSecret"];
412
413 if (kvp.ContainsKey("owner_uuid"))
414 EstateOwner = new UUID(kvp["owner_uuid"].ToString());
415
416 if (kvp.ContainsKey("Token"))
417 Token = kvp["Token"].ToString();
418
419 // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>",
420 // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY);
421 }
422
423 public Dictionary<string, object> ToKeyValuePairs()
424 {
425 Dictionary<string, object> kvp = new Dictionary<string, object>();
426 kvp["uuid"] = RegionID.ToString();
427 kvp["locX"] = RegionLocX.ToString();
428 kvp["locY"] = RegionLocY.ToString();
429 kvp["sizeX"] = RegionSizeX.ToString();
430 kvp["sizeY"] = RegionSizeY.ToString();
431 kvp["regionName"] = RegionName;
432
433 if (RegionFlags != null)
434 kvp["flags"] = ((int)RegionFlags).ToString();
435
436 kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString();
437 kvp["serverHttpPort"] = HttpPort.ToString();
438 kvp["serverURI"] = ServerURI;
439 kvp["serverPort"] = InternalEndPoint.Port.ToString();
440 kvp["regionMapTexture"] = TerrainImage.ToString();
441 kvp["parcelMapTexture"] = ParcelImage.ToString();
442 kvp["access"] = Access.ToString();
443 kvp["regionSecret"] = RegionSecret;
444 kvp["owner_uuid"] = EstateOwner.ToString();
445 kvp["Token"] = Token.ToString();
446 // Maturity doesn't seem to exist in the DB
447
448 return kvp;
449 }
313 450
314 # region Definition of equality 451 #region Definition of equality
315 452
316 /// <summary> 453 /// <summary>
317 /// Define equality as two regions having the same, non-zero UUID. 454 /// Define equality as two regions having the same, non-zero UUID.
@@ -402,6 +539,8 @@ namespace OpenSim.Services.Interfaces
402 { 539 {
403 get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } 540 get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); }
404 } 541 }
542<<<<<<< HEAD
543=======
405 544
406 public Dictionary<string, object> ToKeyValuePairs() 545 public Dictionary<string, object> ToKeyValuePairs()
407 { 546 {
@@ -504,5 +643,6 @@ namespace OpenSim.Services.Interfaces
504 // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", 643 // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>",
505 // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); 644 // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY);
506 } 645 }
646>>>>>>> avn/ubitvar
507 } 647 }
508} 648}