aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionInfo.cs
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Framework/RegionInfo.cs
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Framework/RegionInfo.cs')
-rw-r--r--OpenSim/Framework/RegionInfo.cs463
1 files changed, 199 insertions, 264 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 016f2a6..79fbd96 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -99,9 +99,8 @@ namespace OpenSim.Framework
99 public class RegionInfo 99 public class RegionInfo
100 { 100 {
101 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 101 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
102 private static readonly string LogHeader = "[REGION INFO]";
102 103
103 public bool commFailTF = false;
104 public ConfigurationMember configMember;
105 public string RegionFile = String.Empty; 104 public string RegionFile = String.Empty;
106 public bool isSandbox = false; 105 public bool isSandbox = false;
107 public bool Persistent = true; 106 public bool Persistent = true;
@@ -126,8 +125,8 @@ namespace OpenSim.Framework
126 private int m_physPrimMax = 0; 125 private int m_physPrimMax = 0;
127 private bool m_clampPrimSize = false; 126 private bool m_clampPrimSize = false;
128 private int m_objectCapacity = 0; 127 private int m_objectCapacity = 0;
128 private int m_maxPrimsPerUser = -1;
129 private int m_linksetCapacity = 0; 129 private int m_linksetCapacity = 0;
130 private int m_agentCapacity = 0;
131 private string m_regionType = String.Empty; 130 private string m_regionType = String.Empty;
132 private RegionLightShareData m_windlight = new RegionLightShareData(); 131 private RegionLightShareData m_windlight = new RegionLightShareData();
133 protected uint m_httpPort; 132 protected uint m_httpPort;
@@ -137,15 +136,41 @@ namespace OpenSim.Framework
137 public bool m_allow_alternate_ports; 136 public bool m_allow_alternate_ports;
138 protected string m_externalHostName; 137 protected string m_externalHostName;
139 protected IPEndPoint m_internalEndPoint; 138 protected IPEndPoint m_internalEndPoint;
140 protected uint? m_regionLocX;
141 protected uint? m_regionLocY;
142 protected uint m_remotingPort; 139 protected uint m_remotingPort;
143 public UUID RegionID = UUID.Zero; 140 public UUID RegionID = UUID.Zero;
144 public string RemotingAddress; 141 public string RemotingAddress;
145 public UUID ScopeID = UUID.Zero; 142 public UUID ScopeID = UUID.Zero;
143 private UUID m_maptileStaticUUID = UUID.Zero;
146 144
147 private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>(); 145 public uint WorldLocX = 0;
146 public uint WorldLocY = 0;
147 public uint WorldLocZ = 0;
148 148
149 /// <summary>
150 /// X dimension of the region.
151 /// </summary>
152 /// <remarks>
153 /// If this is a varregion then the default size set here will be replaced when we load the region config.
154 /// </remarks>
155 public uint RegionSizeX = Constants.RegionSize;
156
157 /// <summary>
158 /// X dimension of the region.
159 /// </summary>
160 /// <remarks>
161 /// If this is a varregion then the default size set here will be replaced when we load the region config.
162 /// </remarks>
163 public uint RegionSizeY = Constants.RegionSize;
164
165 /// <summary>
166 /// Z dimension of the region.
167 /// </summary>
168 /// <remarks>
169 /// XXX: Unknown if this accounts for regions with negative Z.
170 /// </remarks>
171 public uint RegionSizeZ = Constants.RegionHeight;
172
173 private Dictionary<String, String> m_extraSettings = new Dictionary<string, string>();
149 174
150 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. 175 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
151 176
@@ -197,7 +222,6 @@ namespace OpenSim.Framework
197 try 222 try
198 { 223 {
199 // This will throw if it's not legal Nini XML format 224 // This will throw if it's not legal Nini XML format
200 // and thereby toss it to the legacy loader
201 // 225 //
202 IConfigSource xmlsource = new XmlConfigSource(filename); 226 IConfigSource xmlsource = new XmlConfigSource(filename);
203 227
@@ -210,29 +234,27 @@ namespace OpenSim.Framework
210 catch (Exception) 234 catch (Exception)
211 { 235 {
212 } 236 }
213
214 configMember =
215 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
216 configMember.performConfigurationRetrieve();
217 RegionFile = filename;
218 } 237 }
219 238
220 // The web loader uses this 239 // The web loader uses this
221 // 240 //
222 public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource) 241 public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource)
223 { 242 {
224 // m_configSource = configSource; 243 XmlElement elem = (XmlElement)xmlNode;
225 configMember = 244 string name = elem.GetAttribute("Name");
226 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); 245 string xmlstr = "<Nini>" + xmlNode.OuterXml + "</Nini>";
227 configMember.performConfigurationRetrieve(); 246 XmlConfigSource source = new XmlConfigSource(XmlReader.Create(new StringReader(xmlstr)));
247 ReadNiniConfig(source, name);
248
228 m_serverURI = string.Empty; 249 m_serverURI = string.Empty;
229 } 250 }
230 251
231 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 252 public RegionInfo(uint legacyRegionLocX, uint legacyRegionLocY, IPEndPoint internalEndPoint, string externalUri)
232 { 253 {
233 m_regionLocX = regionLocX; 254 RegionLocX = legacyRegionLocX;
234 m_regionLocY = regionLocY; 255 RegionLocY = legacyRegionLocY;
235 256 RegionSizeX = Constants.RegionSize;
257 RegionSizeY = Constants.RegionSize;
236 m_internalEndPoint = internalEndPoint; 258 m_internalEndPoint = internalEndPoint;
237 m_externalHostName = externalUri; 259 m_externalHostName = externalUri;
238 m_serverURI = string.Empty; 260 m_serverURI = string.Empty;
@@ -318,16 +340,18 @@ namespace OpenSim.Framework
318 get { return m_objectCapacity; } 340 get { return m_objectCapacity; }
319 } 341 }
320 342
321 public int LinksetCapacity 343 public int MaxPrimsPerUser
322 { 344 {
323 get { return m_linksetCapacity; } 345 get { return m_maxPrimsPerUser; }
324 } 346 }
325 347
326 public int AgentCapacity 348 public int LinksetCapacity
327 { 349 {
328 get { return m_agentCapacity; } 350 get { return m_linksetCapacity; }
329 } 351 }
330 352
353 public int AgentCapacity { get; set; }
354
331 public byte AccessLevel 355 public byte AccessLevel
332 { 356 {
333 get { return (byte)Util.ConvertMaturityToAccessLevel((uint)RegionSettings.Maturity); } 357 get { return (byte)Util.ConvertMaturityToAccessLevel((uint)RegionSettings.Maturity); }
@@ -338,6 +362,13 @@ namespace OpenSim.Framework
338 get { return m_regionType; } 362 get { return m_regionType; }
339 } 363 }
340 364
365 public UUID MaptileStaticUUID
366 {
367 get { return m_maptileStaticUUID; }
368 }
369
370 public string MaptileStaticFile { get; private set; }
371
341 /// <summary> 372 /// <summary>
342 /// The port by which http communication occurs with the region (most noticeably, CAPS communication) 373 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
343 /// </summary> 374 /// </summary>
@@ -441,25 +472,42 @@ namespace OpenSim.Framework
441 472
442 /// <summary> 473 /// <summary>
443 /// The x co-ordinate of this region in map tiles (e.g. 1000). 474 /// The x co-ordinate of this region in map tiles (e.g. 1000).
475 /// Coordinate is scaled as world coordinates divided by the legacy region size
476 /// and is thus is the number of legacy regions.
444 /// </summary> 477 /// </summary>
445 public uint RegionLocX 478 public uint RegionLocX
446 { 479 {
447 get { return m_regionLocX.Value; } 480 get { return WorldLocX / Constants.RegionSize; }
448 set { m_regionLocX = value; } 481 set { WorldLocX = value * Constants.RegionSize; }
449 } 482 }
450 483
451 /// <summary> 484 /// <summary>
452 /// The y co-ordinate of this region in map tiles (e.g. 1000). 485 /// The y co-ordinate of this region in map tiles (e.g. 1000).
486 /// Coordinate is scaled as world coordinates divided by the legacy region size
487 /// and is thus is the number of legacy regions.
453 /// </summary> 488 /// </summary>
454 public uint RegionLocY 489 public uint RegionLocY
455 { 490 {
456 get { return m_regionLocY.Value; } 491 get { return WorldLocY / Constants.RegionSize; }
457 set { m_regionLocY = value; } 492 set { WorldLocY = value * Constants.RegionSize; }
493 }
494
495 public void SetDefaultRegionSize()
496 {
497 WorldLocX = 0;
498 WorldLocY = 0;
499 WorldLocZ = 0;
500 RegionSizeX = Constants.RegionSize;
501 RegionSizeY = Constants.RegionSize;
502 RegionSizeZ = Constants.RegionHeight;
458 } 503 }
459 504
505 // A unique region handle is created from the region's world coordinates.
506 // This cannot be changed because some code expects to receive the region handle and then
507 // compute the region coordinates from it.
460 public ulong RegionHandle 508 public ulong RegionHandle
461 { 509 {
462 get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } 510 get { return Util.UIntsToLong(WorldLocX, WorldLocY); }
463 } 511 }
464 512
465 public void SetEndPoint(string ipaddr, int port) 513 public void SetEndPoint(string ipaddr, int port)
@@ -469,20 +517,20 @@ namespace OpenSim.Framework
469 m_internalEndPoint = tmpEPE; 517 m_internalEndPoint = tmpEPE;
470 } 518 }
471 519
472 public string GetOtherSetting(string key) 520 public string GetSetting(string key)
473 { 521 {
474 string val; 522 string val;
475 string keylower = key.ToLower(); 523 string keylower = key.ToLower();
476 if (m_otherSettings.TryGetValue(keylower, out val)) 524 if (m_extraSettings.TryGetValue(keylower, out val))
477 return val; 525 return val;
478 m_log.DebugFormat("[RegionInfo] Could not locate value for parameter {0}", key); 526 m_log.DebugFormat("[RegionInfo] Could not locate value for parameter {0}", key);
479 return null; 527 return null;
480 } 528 }
481 529
482 public void SetOtherSetting(string key, string value) 530 private void SetExtraSetting(string key, string value)
483 { 531 {
484 string keylower = key.ToLower(); 532 string keylower = key.ToLower();
485 m_otherSettings[keylower] = value; 533 m_extraSettings[keylower] = value;
486 } 534 }
487 535
488 private void ReadNiniConfig(IConfigSource source, string name) 536 private void ReadNiniConfig(IConfigSource source, string name)
@@ -566,8 +614,25 @@ namespace OpenSim.Framework
566 614
567 string[] locationElements = location.Split(new char[] {','}); 615 string[] locationElements = location.Split(new char[] {','});
568 616
569 m_regionLocX = Convert.ToUInt32(locationElements[0]); 617 RegionLocX = Convert.ToUInt32(locationElements[0]);
570 m_regionLocY = Convert.ToUInt32(locationElements[1]); 618 RegionLocY = Convert.ToUInt32(locationElements[1]);
619
620 // Region size
621 // Default to legacy region size if not specified.
622 allKeys.Remove("SizeX");
623 string configSizeX = config.GetString("SizeX", Constants.RegionSize.ToString());
624 config.Set("SizeX", configSizeX);
625 RegionSizeX = Convert.ToUInt32(configSizeX);
626 allKeys.Remove("SizeY");
627 string configSizeY = config.GetString("SizeY", Constants.RegionSize.ToString());
628 config.Set("SizeY", configSizeX);
629 RegionSizeY = Convert.ToUInt32(configSizeY);
630 allKeys.Remove("SizeZ");
631 string configSizeZ = config.GetString("SizeZ", Constants.RegionHeight.ToString());
632 config.Set("SizeZ", configSizeX);
633 RegionSizeZ = Convert.ToUInt32(configSizeZ);
634
635 DoRegionSizeSanityChecks();
571 636
572 // InternalAddress 637 // InternalAddress
573 // 638 //
@@ -641,7 +706,7 @@ namespace OpenSim.Framework
641 m_regionType = config.GetString("RegionType", String.Empty); 706 m_regionType = config.GetString("RegionType", String.Empty);
642 allKeys.Remove("RegionType"); 707 allKeys.Remove("RegionType");
643 708
644 #region Prim stuff 709 #region Prim and map stuff
645 710
646 m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0); 711 m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0);
647 allKeys.Remove("NonPhysicalPrimMin"); 712 allKeys.Remove("NonPhysicalPrimMin");
@@ -661,12 +726,25 @@ namespace OpenSim.Framework
661 m_objectCapacity = config.GetInt("MaxPrims", 15000); 726 m_objectCapacity = config.GetInt("MaxPrims", 15000);
662 allKeys.Remove("MaxPrims"); 727 allKeys.Remove("MaxPrims");
663 728
729 m_maxPrimsPerUser = config.GetInt("MaxPrimsPerUser", -1);
730 allKeys.Remove("MaxPrimsPerUser");
731
664 m_linksetCapacity = config.GetInt("LinksetPrims", 0); 732 m_linksetCapacity = config.GetInt("LinksetPrims", 0);
665 allKeys.Remove("LinksetPrims"); 733 allKeys.Remove("LinksetPrims");
734
735 allKeys.Remove("MaptileStaticUUID");
736 string mapTileStaticUUID = config.GetString("MaptileStaticUUID", UUID.Zero.ToString());
737 if (UUID.TryParse(mapTileStaticUUID.Trim(), out m_maptileStaticUUID))
738 {
739 config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
740 }
741
742 MaptileStaticFile = config.GetString("MaptileStaticFile", String.Empty);
743 allKeys.Remove("MaptileStaticFile");
666 744
667 #endregion 745 #endregion
668 746
669 m_agentCapacity = config.GetInt("MaxAgents", 100); 747 AgentCapacity = config.GetInt("MaxAgents", 100);
670 allKeys.Remove("MaxAgents"); 748 allKeys.Remove("MaxAgents");
671 749
672 // Multi-tenancy 750 // Multi-tenancy
@@ -676,7 +754,58 @@ namespace OpenSim.Framework
676 754
677 foreach (String s in allKeys) 755 foreach (String s in allKeys)
678 { 756 {
679 SetOtherSetting(s, config.GetString(s)); 757 SetExtraSetting(s, config.GetString(s));
758 }
759 }
760
761 // Make sure user specified region sizes are sane.
762 // Must be multiples of legacy region size (256).
763 private void DoRegionSizeSanityChecks()
764 {
765 if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize)
766 {
767 // Doing non-legacy region sizes.
768 // Enforce region size to be multiples of the legacy region size (256)
769 uint partial = RegionSizeX % Constants.RegionSize;
770 if (partial != 0)
771 {
772 RegionSizeX -= partial;
773 if (RegionSizeX == 0)
774 RegionSizeX = Constants.RegionSize;
775 m_log.ErrorFormat("{0} Region size must be multiple of {1}. Enforcing {2}.RegionSizeX={3} instead of specified {4}",
776 LogHeader, Constants.RegionSize, m_regionName, RegionSizeX, RegionSizeX + partial);
777 }
778 partial = RegionSizeY % Constants.RegionSize;
779 if (partial != 0)
780 {
781 RegionSizeY -= partial;
782 if (RegionSizeY == 0)
783 RegionSizeY = Constants.RegionSize;
784 m_log.ErrorFormat("{0} Region size must be multiple of {1}. Enforcing {2}.RegionSizeY={3} instead of specified {4}",
785 LogHeader, Constants.RegionSize, m_regionName, RegionSizeY, RegionSizeY + partial);
786 }
787
788 // Because of things in the viewer, regions MUST be square.
789 // Remove this check when viewers have been updated.
790 if (RegionSizeX != RegionSizeY)
791 {
792 uint minSize = Math.Min(RegionSizeX, RegionSizeY);
793 RegionSizeX = minSize;
794 RegionSizeY = minSize;
795 m_log.ErrorFormat("{0} Regions must be square until viewers are updated. Forcing region {1} size to <{2},{3}>",
796 LogHeader, m_regionName, RegionSizeX, RegionSizeY);
797 }
798
799 // There is a practical limit to region size.
800 if (RegionSizeX > Constants.MaximumRegionSize || RegionSizeY > Constants.MaximumRegionSize)
801 {
802 RegionSizeX = Util.Clamp<uint>(RegionSizeX, Constants.RegionSize, Constants.MaximumRegionSize);
803 RegionSizeY = Util.Clamp<uint>(RegionSizeY, Constants.RegionSize, Constants.MaximumRegionSize);
804 m_log.ErrorFormat("{0} Region dimensions must be less than {1}. Clamping {2}'s size to <{3},{4}>",
805 LogHeader, Constants.MaximumRegionSize, m_regionName, RegionSizeX, RegionSizeY);
806 }
807
808 m_log.InfoFormat("{0} Region {1} size set to <{2},{3}>", LogHeader, m_regionName, RegionSizeX, RegionSizeY);
680 } 809 }
681 } 810 }
682 811
@@ -691,9 +820,18 @@ namespace OpenSim.Framework
691 820
692 config.Set("RegionUUID", RegionID.ToString()); 821 config.Set("RegionUUID", RegionID.ToString());
693 822
694 string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); 823 string location = String.Format("{0},{1}", RegionLocX, RegionLocY);
695 config.Set("Location", location); 824 config.Set("Location", location);
696 825
826 if (RegionSizeX > 0)
827 config.Set("SizeX", RegionSizeX);
828
829 if (RegionSizeY > 0)
830 config.Set("SizeY", RegionSizeY);
831
832// if (RegionSizeZ > 0)
833// config.Set("SizeZ", RegionSizeZ);
834
697 config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); 835 config.Set("InternalAddress", m_internalEndPoint.Address.ToString());
698 config.Set("InternalPort", m_internalEndPoint.Port); 836 config.Set("InternalPort", m_internalEndPoint.Port);
699 837
@@ -718,22 +856,26 @@ namespace OpenSim.Framework
718 if (m_objectCapacity > 0) 856 if (m_objectCapacity > 0)
719 config.Set("MaxPrims", m_objectCapacity); 857 config.Set("MaxPrims", m_objectCapacity);
720 858
859 if (m_maxPrimsPerUser > -1)
860 config.Set("MaxPrimsPerUser", m_maxPrimsPerUser);
861
721 if (m_linksetCapacity > 0) 862 if (m_linksetCapacity > 0)
722 config.Set("LinksetPrims", m_linksetCapacity); 863 config.Set("LinksetPrims", m_linksetCapacity);
723 864
724 if (m_agentCapacity > 0) 865 if (AgentCapacity > 0)
725 config.Set("MaxAgents", m_agentCapacity); 866 config.Set("MaxAgents", AgentCapacity);
726 867
727 if (ScopeID != UUID.Zero) 868 if (ScopeID != UUID.Zero)
728 config.Set("ScopeID", ScopeID.ToString()); 869 config.Set("ScopeID", ScopeID.ToString());
729 870
730 if (RegionType != String.Empty) 871 if (RegionType != String.Empty)
731 config.Set("RegionType", RegionType); 872 config.Set("RegionType", RegionType);
732 }
733 873
734 public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result) 874 if (m_maptileStaticUUID != UUID.Zero)
735 { 875 config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
736 return true; 876
877 if (MaptileStaticFile != null && MaptileStaticFile != String.Empty)
878 config.Set("MaptileStaticFile", MaptileStaticFile);
737 } 879 }
738 880
739 public void SaveRegionToFile(string description, string filename) 881 public void SaveRegionToFile(string description, string filename)
@@ -755,215 +897,14 @@ namespace OpenSim.Framework
755 897
756 return; 898 return;
757 } 899 }
758 else if (filename.ToLower().EndsWith(".xml"))
759 {
760 configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
761 ignoreIncomingConfiguration, false);
762 configMember.performConfigurationRetrieve();
763 RegionFile = filename;
764 }
765 else 900 else
766 throw new Exception("Invalid file type for region persistence."); 901 throw new Exception("Invalid file type for region persistence.");
767 } 902 }
768 903
769 public void loadConfigurationOptionsFromMe()
770 {
771 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_UUID_NULL_FREE,
772 "UUID of Region (Default is recommended, random UUID)",
773 RegionID.ToString(), true);
774 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
775 "Region Name", RegionName, true);
776 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
777 "Grid Location (X Axis)", m_regionLocX.ToString(), true);
778 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
779 "Grid Location (Y Axis)", m_regionLocY.ToString(), true);
780 //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
781 configMember.addConfigurationOption("internal_ip_address",
782 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
783 "Internal IP Address for incoming UDP client connections",
784 m_internalEndPoint.Address.ToString(),
785 true);
786 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
787 "Internal IP Port for incoming UDP client connections",
788 m_internalEndPoint.Port.ToString(), true);
789 configMember.addConfigurationOption("allow_alternate_ports",
790 ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
791 "Allow sim to find alternate UDP ports when ports are in use?",
792 m_allow_alternate_ports.ToString(), true);
793 configMember.addConfigurationOption("external_host_name",
794 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
795 "External Host Name", m_externalHostName, true);
796 configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
797 "Last Map UUID", lastMapUUID.ToString(), true);
798 configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
799 "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
800
801 configMember.addConfigurationOption("nonphysical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
802 "Minimum size for nonphysical prims", m_nonphysPrimMin.ToString(), true);
803
804 configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
805 "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true);
806
807 configMember.addConfigurationOption("physical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
808 "Minimum size for nonphysical prims", m_physPrimMin.ToString(), true);
809
810 configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
811 "Maximum size for physical prims", m_physPrimMax.ToString(), true);
812
813 configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
814 "Clamp prims to max size", m_clampPrimSize.ToString(), true);
815
816 configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
817 "Max objects this sim will hold", m_objectCapacity.ToString(), true);
818
819 configMember.addConfigurationOption("linkset_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
820 "Max prims an object will hold", m_linksetCapacity.ToString(), true);
821
822 configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
823 "Max avatars this sim will hold", m_agentCapacity.ToString(), true);
824
825 configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
826 "Scope ID for this region", ScopeID.ToString(), true);
827
828 configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
829 "Free form string describing the type of region", String.Empty, true);
830 }
831
832 public void loadConfigurationOptions()
833 {
834 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
835 "UUID of Region (Default is recommended, random UUID)",
836 UUID.Random().ToString(), true);
837 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
838 "Region Name", "OpenSim Test", false);
839 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
840 "Grid Location (X Axis)", "1000", false);
841 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
842 "Grid Location (Y Axis)", "1000", false);
843 //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
844 configMember.addConfigurationOption("internal_ip_address",
845 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
846 "Internal IP Address for incoming UDP client connections", "0.0.0.0",
847 false);
848 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
849 "Internal IP Port for incoming UDP client connections",
850 ConfigSettings.DefaultRegionHttpPort.ToString(), false);
851 configMember.addConfigurationOption("allow_alternate_ports", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
852 "Allow sim to find alternate UDP ports when ports are in use?",
853 "false", true);
854 configMember.addConfigurationOption("external_host_name",
855 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
856 "External Host Name", "127.0.0.1", false);
857 configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
858 "Last Map UUID", lastMapUUID.ToString(), true);
859
860 configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
861 "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
862
863 configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
864 "Maximum size for nonphysical prims", "0", true);
865
866 configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
867 "Maximum size for physical prims", "0", true);
868
869 configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
870 "Clamp prims to max size", "false", true);
871
872 configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
873 "Max objects this sim will hold", "15000", true);
874
875 configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
876 "Max avatars this sim will hold", "100", true);
877
878 configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
879 "Scope ID for this region", UUID.Zero.ToString(), true);
880
881 configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
882 "Region Type", String.Empty, true);
883 }
884
885 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
886 {
887 switch (configuration_key)
888 {
889 case "sim_UUID":
890 RegionID = (UUID) configuration_result;
891 originRegionID = (UUID) configuration_result;
892 break;
893 case "sim_name":
894 RegionName = (string) configuration_result;
895 break;
896 case "sim_location_x":
897 m_regionLocX = (uint) configuration_result;
898 break;
899 case "sim_location_y":
900 m_regionLocY = (uint) configuration_result;
901 break;
902 case "internal_ip_address":
903 IPAddress address = (IPAddress) configuration_result;
904 m_internalEndPoint = new IPEndPoint(address, 0);
905 break;
906 case "internal_ip_port":
907 m_internalEndPoint.Port = (int) configuration_result;
908 break;
909 case "allow_alternate_ports":
910 m_allow_alternate_ports = (bool) configuration_result;
911 break;
912 case "external_host_name":
913 if ((string) configuration_result != "SYSTEMIP")
914 {
915 m_externalHostName = (string) configuration_result;
916 }
917 else
918 {
919 m_externalHostName = Util.GetLocalHost().ToString();
920 }
921 break;
922 case "lastmap_uuid":
923 lastMapUUID = (UUID)configuration_result;
924 break;
925 case "lastmap_refresh":
926 lastMapRefresh = (string)configuration_result;
927 break;
928 case "nonphysical_prim_max":
929 m_nonphysPrimMax = (int)configuration_result;
930 break;
931 case "physical_prim_max":
932 m_physPrimMax = (int)configuration_result;
933 break;
934 case "clamp_prim_size":
935 m_clampPrimSize = (bool)configuration_result;
936 break;
937 case "object_capacity":
938 m_objectCapacity = (int)configuration_result;
939 break;
940 case "linkset_capacity":
941 m_linksetCapacity = (int)configuration_result;
942 break;
943 case "agent_capacity":
944 m_agentCapacity = (int)configuration_result;
945 break;
946 case "scope_id":
947 ScopeID = (UUID)configuration_result;
948 break;
949 case "region_type":
950 m_regionType = (string)configuration_result;
951 break;
952 }
953
954 return true;
955 }
956
957 public void SaveLastMapUUID(UUID mapUUID) 904 public void SaveLastMapUUID(UUID mapUUID)
958 { 905 {
959 lastMapUUID = mapUUID; 906 lastMapUUID = mapUUID;
960 lastMapRefresh = Util.UnixTimeSinceEpoch().ToString(); 907 lastMapRefresh = Util.UnixTimeSinceEpoch().ToString();
961
962 if (configMember == null)
963 return;
964
965 configMember.forceSetConfigurationOption("lastmap_uuid", mapUUID.ToString());
966 configMember.forceSetConfigurationOption("lastmap_refresh", lastMapRefresh);
967 } 908 }
968 909
969 public OSDMap PackRegionInfoData() 910 public OSDMap PackRegionInfoData()
@@ -975,8 +916,13 @@ namespace OpenSim.Framework
975 args["external_host_name"] = OSD.FromString(ExternalHostName); 916 args["external_host_name"] = OSD.FromString(ExternalHostName);
976 args["http_port"] = OSD.FromString(HttpPort.ToString()); 917 args["http_port"] = OSD.FromString(HttpPort.ToString());
977 args["server_uri"] = OSD.FromString(ServerURI); 918 args["server_uri"] = OSD.FromString(ServerURI);
919
978 args["region_xloc"] = OSD.FromString(RegionLocX.ToString()); 920 args["region_xloc"] = OSD.FromString(RegionLocX.ToString());
979 args["region_yloc"] = OSD.FromString(RegionLocY.ToString()); 921 args["region_yloc"] = OSD.FromString(RegionLocY.ToString());
922 args["region_size_x"] = OSD.FromString(RegionSizeX.ToString());
923 args["region_size_y"] = OSD.FromString(RegionSizeY.ToString());
924 args["region_size_z"] = OSD.FromString(RegionSizeZ.ToString());
925
980 args["internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString()); 926 args["internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString());
981 args["internal_ep_port"] = OSD.FromString(InternalEndPoint.Port.ToString()); 927 args["internal_ep_port"] = OSD.FromString(InternalEndPoint.Port.ToString());
982 if ((RemotingAddress != null) && !RemotingAddress.Equals("")) 928 if ((RemotingAddress != null) && !RemotingAddress.Equals(""))
@@ -1015,6 +961,13 @@ namespace OpenSim.Framework
1015 UInt32.TryParse(args["region_yloc"].AsString(), out locy); 961 UInt32.TryParse(args["region_yloc"].AsString(), out locy);
1016 RegionLocY = locy; 962 RegionLocY = locy;
1017 } 963 }
964 if (args.ContainsKey("region_size_x"))
965 RegionSizeX = (uint)args["region_size_x"].AsInteger();
966 if (args.ContainsKey("region_size_y"))
967 RegionSizeY = (uint)args["region_size_y"].AsInteger();
968 if (args.ContainsKey("region_size_z"))
969 RegionSizeZ = (uint)args["region_size_z"].AsInteger();
970
1018 IPAddress ip_addr = null; 971 IPAddress ip_addr = null;
1019 if (args["internal_ep_address"] != null) 972 if (args["internal_ep_address"] != null)
1020 { 973 {
@@ -1051,23 +1004,5 @@ namespace OpenSim.Framework
1051 regionInfo.ServerURI = serverURI; 1004 regionInfo.ServerURI = serverURI;
1052 return regionInfo; 1005 return regionInfo;
1053 } 1006 }
1054
1055 public Dictionary<string, object> ToKeyValuePairs()
1056 {
1057 Dictionary<string, object> kvp = new Dictionary<string, object>();
1058 kvp["uuid"] = RegionID.ToString();
1059 kvp["locX"] = RegionLocX.ToString();
1060 kvp["locY"] = RegionLocY.ToString();
1061 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
1062 kvp["external_port"] = ExternalEndPoint.Port.ToString();
1063 kvp["external_host_name"] = ExternalHostName;
1064 kvp["http_port"] = HttpPort.ToString();
1065 kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
1066 kvp["internal_port"] = InternalEndPoint.Port.ToString();
1067 kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
1068 kvp["server_uri"] = ServerURI;
1069
1070 return kvp;
1071 }
1072 } 1007 }
1073} 1008}