29 using System.Collections;
30 using System.Collections.Generic;
32 using System.Net.Sockets;
33 using System.Reflection;
35 using OpenSim.Framework;
40 namespace OpenSim.Services.Interfaces
50 string RegisterRegion(UUID scopeID,
GridRegion regionInfos);
58 bool DeregisterRegion(UUID regionID);
66 List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID);
68 GridRegion GetRegionByUUID(UUID scopeID, UUID regionID);
77 GridRegion GetRegionByPosition(UUID scopeID,
int x,
int y);
85 GridRegion GetRegionByName(UUID scopeID,
string regionName);
100 List<GridRegion> GetRegionsByName(UUID scopeID,
string name,
int maxNumber);
102 List<GridRegion> GetRegionRange(UUID scopeID,
int xmin,
int xmax,
int ymin,
int ymax);
104 List<GridRegion> GetDefaultRegions(UUID scopeID);
105 List<GridRegion> GetDefaultHypergridRegions(UUID scopeID);
106 List<GridRegion> GetFallbackRegions(UUID scopeID,
int x,
int y);
107 List<GridRegion> GetHyperlinks(UUID scopeID);
122 int GetRegionFlags(UUID scopeID, UUID regionID);
124 Dictionary<string,object> GetExtraFeatures();
129 GridRegion TryLinkRegionToCoords(UUID scopeID,
string mapName,
int xloc,
int yloc, UUID ownerID, out
string reason);
130 bool TryUnlinkRegion(
string mapName);
137 #pragma warning disable 414
138 private static readonly
string LogHeader =
"[GRID REGION]";
139 #pragma warning restore 414
144 public uint HttpPort {
get; set; }
149 public string ServerURI
152 if (!String.IsNullOrEmpty(m_serverURI)) {
156 return "http://" + m_externalHostName +
"/";
158 return "http://" + m_externalHostName +
":" + HttpPort +
"/";
164 m_serverURI = String.Empty;
168 if ( value.EndsWith(
"/") )
175 m_serverURI = value +
'/';
185 public string RawServerURI
187 get {
return m_serverURI; }
188 set { m_serverURI = value; }
192 public string RegionName
194 get {
return m_regionName; }
195 set { m_regionName = value; }
197 protected string m_regionName = String.Empty;
217 public int RegionCoordX {
get {
return (
int)Util.WorldToRegionLoc((uint)RegionLocX); } }
222 public int RegionCoordY {
get {
return (
int)Util.WorldToRegionLoc((uint)RegionLocY); } }
228 public int RegionLocX
230 get {
return m_regionLocX; }
231 set { m_regionLocX = value; }
235 public int RegionSizeX {
get; set; }
236 public int RegionSizeY {
get; set; }
242 public int RegionLocY
244 get {
return m_regionLocY; }
245 set { m_regionLocY = value; }
251 public UUID EstateOwner
253 get {
return m_estateOwner; }
254 set { m_estateOwner = value; }
257 public UUID RegionID = UUID.Zero;
258 public UUID ScopeID = UUID.Zero;
260 public UUID TerrainImage = UUID.Zero;
261 public UUID ParcelImage = UUID.Zero;
264 public string RegionSecret = string.Empty;
265 public string Token = string.Empty;
270 RegionSizeY = (
int)Constants.RegionSize;
271 m_serverURI = string.Empty;
301 m_regionLocX = (int)Util.RegionToWorldLoc(xcell);
302 m_regionLocY = (int)Util.RegionToWorldLoc(ycell);
304 RegionSizeY = (
int)Constants.RegionSize;
309 m_regionName = ConvertFrom.RegionName;
310 m_regionLocX = (int)(ConvertFrom.
WorldLocX);
311 m_regionLocY = (int)(ConvertFrom.
WorldLocY);
313 RegionSizeY = (
int)ConvertFrom.RegionSizeY;
314 m_internalEndPoint = ConvertFrom.InternalEndPoint;
315 m_externalHostName = ConvertFrom.ExternalHostName;
316 HttpPort = ConvertFrom.HttpPort;
317 RegionID = ConvertFrom.RegionID;
318 ServerURI = ConvertFrom.ServerURI;
319 TerrainImage = ConvertFrom.RegionSettings.TerrainImageID;
320 ParcelImage = ConvertFrom.RegionSettings.ParcelImageID;
321 Access = ConvertFrom.AccessLevel;
322 Maturity = ConvertFrom.RegionSettings.Maturity;
323 RegionSecret = ConvertFrom.regionSecret;
324 EstateOwner = ConvertFrom.EstateSettings.EstateOwner;
329 m_regionName = ConvertFrom.RegionName;
331 m_regionLocX = ConvertFrom.RegionLocX;
332 m_regionLocY = ConvertFrom.RegionLocY;
333 RegionSizeX = ConvertFrom.RegionSizeX;
334 RegionSizeY = ConvertFrom.RegionSizeY;
335 m_internalEndPoint = ConvertFrom.InternalEndPoint;
336 m_externalHostName = ConvertFrom.ExternalHostName;
337 HttpPort = ConvertFrom.HttpPort;
338 RegionID = ConvertFrom.RegionID;
339 ServerURI = ConvertFrom.ServerURI;
340 TerrainImage = ConvertFrom.TerrainImage;
341 ParcelImage = ConvertFrom.ParcelImage;
342 Access = ConvertFrom.Access;
343 Maturity = ConvertFrom.Maturity;
344 RegionSecret = ConvertFrom.RegionSecret;
345 EstateOwner = ConvertFrom.EstateOwner;
350 if (kvp.ContainsKey(
"uuid"))
351 RegionID =
new UUID((
string)kvp[
"uuid"]);
353 if (kvp.ContainsKey(
"locX"))
354 RegionLocX = Convert.ToInt32((
string)kvp[
"locX"]);
356 if (kvp.ContainsKey(
"locY"))
357 RegionLocY = Convert.ToInt32((
string)kvp[
"locY"]);
359 if (kvp.ContainsKey(
"sizeX"))
360 RegionSizeX = Convert.ToInt32((
string)kvp[
"sizeX"]);
364 if (kvp.ContainsKey(
"sizeY"))
365 RegionSizeY = Convert.ToInt32((
string)kvp[
"sizeY"]);
369 if (kvp.ContainsKey(
"regionName"))
370 RegionName = (
string)kvp[
"regionName"];
372 if (kvp.ContainsKey(
"access"))
374 byte access = Convert.ToByte((string)kvp[
"access"]);
376 Maturity = (int)Util.ConvertAccessLevelToMaturity(access);
379 if (kvp.ContainsKey(
"flags") && kvp[
"flags"] != null)
382 if (kvp.ContainsKey(
"serverIP"))
387 ExternalHostName = (string)kvp[
"serverIP"];
390 ExternalHostName =
"127.0.0.1";
392 if (kvp.ContainsKey(
"serverPort"))
395 Int32.TryParse((string)kvp[
"serverPort"], out port);
396 InternalEndPoint =
new IPEndPoint(IPAddress.Parse(
"0.0.0.0"), port);
399 if (kvp.ContainsKey(
"serverHttpPort"))
402 UInt32.TryParse((string)kvp[
"serverHttpPort"], out port);
406 if (kvp.ContainsKey(
"serverURI"))
407 ServerURI = (
string)kvp[
"serverURI"];
409 if (kvp.ContainsKey(
"regionMapTexture"))
410 UUID.TryParse((
string)kvp[
"regionMapTexture"], out TerrainImage);
412 if (kvp.ContainsKey(
"parcelMapTexture"))
413 UUID.TryParse((
string)kvp[
"parcelMapTexture"], out ParcelImage);
415 if (kvp.ContainsKey(
"regionSecret"))
416 RegionSecret =(
string)kvp[
"regionSecret"];
418 if (kvp.ContainsKey(
"owner_uuid"))
419 EstateOwner =
new UUID(kvp[
"owner_uuid"].ToString());
421 if (kvp.ContainsKey(
"Token"))
422 Token = kvp[
"Token"].ToString();
430 Dictionary<string, object> kvp =
new Dictionary<string, object>();
431 kvp[
"uuid"] = RegionID.ToString();
432 kvp[
"locX"] = RegionLocX.ToString();
433 kvp[
"locY"] = RegionLocY.ToString();
434 kvp[
"sizeX"] = RegionSizeX.ToString();
435 kvp[
"sizeY"] = RegionSizeY.ToString();
436 kvp[
"regionName"] = RegionName;
441 kvp[
"serverIP"] = ExternalHostName;
442 kvp[
"serverHttpPort"] = HttpPort.ToString();
443 kvp[
"serverURI"] = ServerURI;
444 kvp[
"serverPort"] = InternalEndPoint.Port.ToString();
445 kvp[
"regionMapTexture"] = TerrainImage.ToString();
446 kvp[
"parcelMapTexture"] = ParcelImage.ToString();
447 kvp[
"access"] = Access.ToString();
448 kvp[
"regionSecret"] = RegionSecret;
449 kvp[
"owner_uuid"] = EstateOwner.ToString();
450 kvp[
"Token"] = Token.ToString();
456 #region Definition of equality
463 if ((
object)region == null)
466 return (RegionID != UUID.Zero) && RegionID.Equals(region.RegionID);
478 return RegionID.GetHashCode() ^ TerrainImage.GetHashCode() ^ ParcelImage.GetHashCode();
488 public IPEndPoint ExternalEndPoint
497 if (IPAddress.TryParse(m_externalHostName, out ia))
498 return new IPEndPoint(ia, m_internalEndPoint.Port);
504 foreach (IPAddress Adr
in Dns.GetHostAddresses(m_externalHostName))
509 if (Adr.AddressFamily == AddressFamily.InterNetwork)
516 catch (SocketException e)
527 return new IPEndPoint(ia, m_internalEndPoint.Port);
531 public string ExternalHostName
533 get {
return m_externalHostName; }
534 set { m_externalHostName = value; }
537 public IPEndPoint InternalEndPoint
539 get {
return m_internalEndPoint; }
540 set { m_internalEndPoint = value; }
543 public ulong RegionHandle
545 get {
return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); }
Dictionary< string, object > ToKeyValuePairs()
IPEndPoint m_internalEndPoint
override bool Equals(Object obj)
uint RegionSizeX
X dimension of the region.
string m_externalHostName
GridRegion(RegionInfo ConvertFrom)
bool Equals(GridRegion region)
Define equality as two regions having the same, non-zero UUID.
GridRegion(GridRegion ConvertFrom)
GridRegion(Dictionary< string, object > kvp)
RegionFlags
Region flags used internally by OpenSimulator to store installation specific information about region...
Interactive OpenSim region server
override int GetHashCode()
GridRegion(uint xcell, uint ycell)