diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Framework/RegionInfo.cs | |
parent | Add a build script. (diff) | |
download | opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Framework/RegionInfo.cs')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 419 |
1 files changed, 347 insertions, 72 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 79fbd96..75ed999 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -40,6 +40,7 @@ using OpenMetaverse.StructuredData; | |||
40 | 40 | ||
41 | namespace OpenSim.Framework | 41 | namespace OpenSim.Framework |
42 | { | 42 | { |
43 | [Serializable] | ||
43 | public class RegionLightShareData : ICloneable | 44 | public class RegionLightShareData : ICloneable |
44 | { | 45 | { |
45 | public bool valid = false; | 46 | public bool valid = false; |
@@ -101,6 +102,11 @@ namespace OpenSim.Framework | |||
101 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 102 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
102 | private static readonly string LogHeader = "[REGION INFO]"; | 103 | private static readonly string LogHeader = "[REGION INFO]"; |
103 | 104 | ||
105 | |||
106 | public bool commFailTF = false; | ||
107 | public ConfigurationMember configMember; | ||
108 | public string DataStore = String.Empty; | ||
109 | |||
104 | public string RegionFile = String.Empty; | 110 | public string RegionFile = String.Empty; |
105 | public bool isSandbox = false; | 111 | public bool isSandbox = false; |
106 | public bool Persistent = true; | 112 | public bool Persistent = true; |
@@ -124,7 +130,7 @@ namespace OpenSim.Framework | |||
124 | private float m_physPrimMin = 0; | 130 | private float m_physPrimMin = 0; |
125 | private int m_physPrimMax = 0; | 131 | private int m_physPrimMax = 0; |
126 | private bool m_clampPrimSize = false; | 132 | private bool m_clampPrimSize = false; |
127 | private int m_objectCapacity = 0; | 133 | private int m_objectCapacity = 15000; |
128 | private int m_maxPrimsPerUser = -1; | 134 | private int m_maxPrimsPerUser = -1; |
129 | private int m_linksetCapacity = 0; | 135 | private int m_linksetCapacity = 0; |
130 | private string m_regionType = String.Empty; | 136 | private string m_regionType = String.Empty; |
@@ -132,8 +138,6 @@ namespace OpenSim.Framework | |||
132 | protected uint m_httpPort; | 138 | protected uint m_httpPort; |
133 | protected string m_serverURI; | 139 | protected string m_serverURI; |
134 | protected string m_regionName = String.Empty; | 140 | protected string m_regionName = String.Empty; |
135 | protected bool Allow_Alternate_Ports; | ||
136 | public bool m_allow_alternate_ports; | ||
137 | protected string m_externalHostName; | 141 | protected string m_externalHostName; |
138 | protected IPEndPoint m_internalEndPoint; | 142 | protected IPEndPoint m_internalEndPoint; |
139 | protected uint m_remotingPort; | 143 | protected uint m_remotingPort; |
@@ -141,6 +145,7 @@ namespace OpenSim.Framework | |||
141 | public string RemotingAddress; | 145 | public string RemotingAddress; |
142 | public UUID ScopeID = UUID.Zero; | 146 | public UUID ScopeID = UUID.Zero; |
143 | private UUID m_maptileStaticUUID = UUID.Zero; | 147 | private UUID m_maptileStaticUUID = UUID.Zero; |
148 | private bool m_resolveAddress = false; | ||
144 | 149 | ||
145 | public uint WorldLocX = 0; | 150 | public uint WorldLocX = 0; |
146 | public uint WorldLocY = 0; | 151 | public uint WorldLocY = 0; |
@@ -170,6 +175,9 @@ namespace OpenSim.Framework | |||
170 | /// </remarks> | 175 | /// </remarks> |
171 | public uint RegionSizeZ = Constants.RegionHeight; | 176 | public uint RegionSizeZ = Constants.RegionHeight; |
172 | 177 | ||
178 | // If entering avatar has no specific coords, this is where they land | ||
179 | public Vector3 DefaultLandingPoint = new Vector3(128, 128, 30); | ||
180 | |||
173 | private Dictionary<String, String> m_extraSettings = new Dictionary<string, string>(); | 181 | private Dictionary<String, String> m_extraSettings = new Dictionary<string, string>(); |
174 | 182 | ||
175 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. | 183 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. |
@@ -368,7 +376,7 @@ namespace OpenSim.Framework | |||
368 | } | 376 | } |
369 | 377 | ||
370 | public string MaptileStaticFile { get; private set; } | 378 | public string MaptileStaticFile { get; private set; } |
371 | 379 | ||
372 | /// <summary> | 380 | /// <summary> |
373 | /// The port by which http communication occurs with the region (most noticeably, CAPS communication) | 381 | /// The port by which http communication occurs with the region (most noticeably, CAPS communication) |
374 | /// </summary> | 382 | /// </summary> |
@@ -381,17 +389,17 @@ namespace OpenSim.Framework | |||
381 | /// <summary> | 389 | /// <summary> |
382 | /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) | 390 | /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) |
383 | /// </summary> | 391 | /// </summary> |
384 | 392 | ||
385 | public string ServerURI | 393 | public string ServerURI |
386 | { | 394 | { |
387 | get { | 395 | get { |
388 | if ( m_serverURI != string.Empty ) { | 396 | if ( m_serverURI != string.Empty ) { |
389 | return m_serverURI; | 397 | return m_serverURI; |
390 | } else { | 398 | } else { |
391 | return "http://" + m_externalHostName + ":" + m_httpPort + "/"; | 399 | return "http://" + m_externalHostName + ":" + m_httpPort + "/"; |
392 | } | 400 | } |
393 | } | 401 | } |
394 | set { | 402 | set { |
395 | if ( value.EndsWith("/") ) { | 403 | if ( value.EndsWith("/") ) { |
396 | m_serverURI = value; | 404 | m_serverURI = value; |
397 | } else { | 405 | } else { |
@@ -412,6 +420,7 @@ namespace OpenSim.Framework | |||
412 | set { m_remotingPort = value; } | 420 | set { m_remotingPort = value; } |
413 | } | 421 | } |
414 | 422 | ||
423 | |||
415 | /// <value> | 424 | /// <value> |
416 | /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. | 425 | /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. |
417 | /// | 426 | /// |
@@ -419,42 +428,7 @@ namespace OpenSim.Framework | |||
419 | /// </value> | 428 | /// </value> |
420 | public IPEndPoint ExternalEndPoint | 429 | public IPEndPoint ExternalEndPoint |
421 | { | 430 | { |
422 | get | 431 | get { return Util.getEndPoint(m_externalHostName, m_internalEndPoint.Port); } |
423 | { | ||
424 | // Old one defaults to IPv6 | ||
425 | //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); | ||
426 | |||
427 | IPAddress ia = null; | ||
428 | // If it is already an IP, don't resolve it - just return directly | ||
429 | if (IPAddress.TryParse(m_externalHostName, out ia)) | ||
430 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
431 | |||
432 | // Reset for next check | ||
433 | ia = null; | ||
434 | try | ||
435 | { | ||
436 | foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) | ||
437 | { | ||
438 | if (ia == null) | ||
439 | ia = Adr; | ||
440 | |||
441 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
442 | { | ||
443 | ia = Adr; | ||
444 | break; | ||
445 | } | ||
446 | } | ||
447 | } | ||
448 | catch (SocketException e) | ||
449 | { | ||
450 | throw new Exception( | ||
451 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | ||
452 | e + "' attached to this exception", e); | ||
453 | } | ||
454 | |||
455 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
456 | } | ||
457 | |||
458 | set { m_externalHostName = value.ToString(); } | 432 | set { m_externalHostName = value.ToString(); } |
459 | } | 433 | } |
460 | 434 | ||
@@ -527,7 +501,7 @@ namespace OpenSim.Framework | |||
527 | return null; | 501 | return null; |
528 | } | 502 | } |
529 | 503 | ||
530 | private void SetExtraSetting(string key, string value) | 504 | public void SetExtraSetting(string key, string value) |
531 | { | 505 | { |
532 | string keylower = key.ToLower(); | 506 | string keylower = key.ToLower(); |
533 | m_extraSettings[keylower] = value; | 507 | m_extraSettings[keylower] = value; |
@@ -535,7 +509,7 @@ namespace OpenSim.Framework | |||
535 | 509 | ||
536 | private void ReadNiniConfig(IConfigSource source, string name) | 510 | private void ReadNiniConfig(IConfigSource source, string name) |
537 | { | 511 | { |
538 | // bool creatingNew = false; | 512 | bool creatingNew = false; |
539 | 513 | ||
540 | if (source.Configs.Count == 0) | 514 | if (source.Configs.Count == 0) |
541 | { | 515 | { |
@@ -559,7 +533,7 @@ namespace OpenSim.Framework | |||
559 | 533 | ||
560 | source.AddConfig(name); | 534 | source.AddConfig(name); |
561 | 535 | ||
562 | // creatingNew = true; | 536 | creatingNew = true; |
563 | } | 537 | } |
564 | 538 | ||
565 | if (name == String.Empty) | 539 | if (name == String.Empty) |
@@ -663,18 +637,19 @@ namespace OpenSim.Framework | |||
663 | } | 637 | } |
664 | m_internalEndPoint = new IPEndPoint(address, port); | 638 | m_internalEndPoint = new IPEndPoint(address, port); |
665 | 639 | ||
666 | // AllowAlternatePorts | 640 | // ResolveAddress |
667 | // | 641 | // |
668 | allKeys.Remove("AllowAlternatePorts"); | 642 | allKeys.Remove("ResolveAddress"); |
669 | if (config.Contains("AllowAlternatePorts")) | 643 | if (config.Contains("ResolveAddress")) |
670 | { | 644 | { |
671 | m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true); | 645 | m_resolveAddress = config.GetBoolean("ResolveAddress", false); |
672 | } | 646 | } |
673 | else | 647 | else |
674 | { | 648 | { |
675 | m_allow_alternate_ports = Convert.ToBoolean(MainConsole.Instance.CmdPrompt("Allow alternate ports", "False")); | 649 | if (creatingNew) |
650 | m_resolveAddress = Convert.ToBoolean(MainConsole.Instance.CmdPrompt("Resolve hostname to IP on start (for running inside Docker)", "False")); | ||
676 | 651 | ||
677 | config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString()); | 652 | config.Set("ResolveAddress", m_resolveAddress.ToString()); |
678 | } | 653 | } |
679 | 654 | ||
680 | // ExternalHostName | 655 | // ExternalHostName |
@@ -697,15 +672,36 @@ namespace OpenSim.Framework | |||
697 | "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}", | 672 | "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}", |
698 | m_externalHostName, name); | 673 | m_externalHostName, name); |
699 | } | 674 | } |
700 | else | 675 | else if (!m_resolveAddress) |
701 | { | 676 | { |
702 | m_externalHostName = externalName; | 677 | m_externalHostName = externalName; |
703 | } | 678 | } |
679 | else | ||
680 | { | ||
681 | IPAddress[] addrs = Dns.GetHostAddresses(externalName); | ||
682 | if (addrs.Length != 1) // If it is ambiguous or not resolveable, use it literally | ||
683 | m_externalHostName = externalName; | ||
684 | else | ||
685 | m_externalHostName = addrs[0].ToString(); | ||
686 | } | ||
704 | 687 | ||
705 | // RegionType | 688 | // RegionType |
706 | m_regionType = config.GetString("RegionType", String.Empty); | 689 | m_regionType = config.GetString("RegionType", String.Empty); |
707 | allKeys.Remove("RegionType"); | 690 | allKeys.Remove("RegionType"); |
708 | 691 | ||
692 | // Get Default Landing Location (Defaults to 128,128) | ||
693 | string temp_location = config.GetString("DefaultLanding", "<128, 128, 30>"); | ||
694 | Vector3 temp_vector; | ||
695 | |||
696 | if (Vector3.TryParse(temp_location, out temp_vector)) | ||
697 | DefaultLandingPoint = temp_vector; | ||
698 | else | ||
699 | m_log.ErrorFormat("[RegionInfo]: Unable to parse DefaultLanding for '{0}'. The value given was '{1}'", RegionName, temp_location); | ||
700 | |||
701 | allKeys.Remove("DefaultLanding"); | ||
702 | |||
703 | DoDefaultLandingSanityChecks(); | ||
704 | |||
709 | #region Prim and map stuff | 705 | #region Prim and map stuff |
710 | 706 | ||
711 | m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0); | 707 | m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0); |
@@ -719,11 +715,11 @@ namespace OpenSim.Framework | |||
719 | 715 | ||
720 | m_physPrimMax = config.GetInt("PhysicalPrimMax", 0); | 716 | m_physPrimMax = config.GetInt("PhysicalPrimMax", 0); |
721 | allKeys.Remove("PhysicalPrimMax"); | 717 | allKeys.Remove("PhysicalPrimMax"); |
722 | 718 | ||
723 | m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); | 719 | m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); |
724 | allKeys.Remove("ClampPrimSize"); | 720 | allKeys.Remove("ClampPrimSize"); |
725 | 721 | ||
726 | m_objectCapacity = config.GetInt("MaxPrims", 15000); | 722 | m_objectCapacity = config.GetInt("MaxPrims", m_objectCapacity); |
727 | allKeys.Remove("MaxPrims"); | 723 | allKeys.Remove("MaxPrims"); |
728 | 724 | ||
729 | m_maxPrimsPerUser = config.GetInt("MaxPrimsPerUser", -1); | 725 | m_maxPrimsPerUser = config.GetInt("MaxPrimsPerUser", -1); |
@@ -736,12 +732,12 @@ namespace OpenSim.Framework | |||
736 | string mapTileStaticUUID = config.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | 732 | string mapTileStaticUUID = config.GetString("MaptileStaticUUID", UUID.Zero.ToString()); |
737 | if (UUID.TryParse(mapTileStaticUUID.Trim(), out m_maptileStaticUUID)) | 733 | if (UUID.TryParse(mapTileStaticUUID.Trim(), out m_maptileStaticUUID)) |
738 | { | 734 | { |
739 | config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString()); | 735 | config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString()); |
740 | } | 736 | } |
741 | 737 | ||
742 | MaptileStaticFile = config.GetString("MaptileStaticFile", String.Empty); | 738 | MaptileStaticFile = config.GetString("MaptileStaticFile", String.Empty); |
743 | allKeys.Remove("MaptileStaticFile"); | 739 | allKeys.Remove("MaptileStaticFile"); |
744 | 740 | ||
745 | #endregion | 741 | #endregion |
746 | 742 | ||
747 | AgentCapacity = config.GetInt("MaxAgents", 100); | 743 | AgentCapacity = config.GetInt("MaxAgents", 100); |
@@ -758,6 +754,48 @@ namespace OpenSim.Framework | |||
758 | } | 754 | } |
759 | } | 755 | } |
760 | 756 | ||
757 | // Make sure DefaultLanding is within region borders with a buffer zone 5 meters from borders | ||
758 | private void DoDefaultLandingSanityChecks() | ||
759 | { | ||
760 | // Sanity Check Default Landing | ||
761 | float buffer_zone = 5f; | ||
762 | |||
763 | bool ValuesCapped = false; | ||
764 | |||
765 | // Minimum Positions | ||
766 | if (DefaultLandingPoint.X < buffer_zone) | ||
767 | { | ||
768 | DefaultLandingPoint.X = buffer_zone; | ||
769 | ValuesCapped = true; | ||
770 | } | ||
771 | |||
772 | if (DefaultLandingPoint.Y < buffer_zone) | ||
773 | { | ||
774 | DefaultLandingPoint.Y = buffer_zone; | ||
775 | ValuesCapped = true; | ||
776 | } | ||
777 | |||
778 | // Maximum Positions | ||
779 | if (DefaultLandingPoint.X > RegionSizeX - buffer_zone) | ||
780 | { | ||
781 | DefaultLandingPoint.X = RegionSizeX - buffer_zone; | ||
782 | ValuesCapped = true; | ||
783 | } | ||
784 | |||
785 | if (DefaultLandingPoint.Y > RegionSizeY - buffer_zone) | ||
786 | { | ||
787 | DefaultLandingPoint.Y = RegionSizeY - buffer_zone; | ||
788 | ValuesCapped = true; | ||
789 | } | ||
790 | |||
791 | // Height | ||
792 | if (DefaultLandingPoint.Z < 0f) | ||
793 | DefaultLandingPoint.Z = 0f; | ||
794 | |||
795 | if (ValuesCapped == true) | ||
796 | m_log.WarnFormat("[RegionInfo]: The default landing location for {0} has been capped to {1}", RegionName, DefaultLandingPoint); | ||
797 | } | ||
798 | |||
761 | // Make sure user specified region sizes are sane. | 799 | // Make sure user specified region sizes are sane. |
762 | // Must be multiples of legacy region size (256). | 800 | // Must be multiples of legacy region size (256). |
763 | private void DoRegionSizeSanityChecks() | 801 | private void DoRegionSizeSanityChecks() |
@@ -823,20 +861,20 @@ namespace OpenSim.Framework | |||
823 | string location = String.Format("{0},{1}", RegionLocX, RegionLocY); | 861 | string location = String.Format("{0},{1}", RegionLocX, RegionLocY); |
824 | config.Set("Location", location); | 862 | config.Set("Location", location); |
825 | 863 | ||
826 | if (RegionSizeX > 0) | 864 | if (DataStore != String.Empty) |
827 | config.Set("SizeX", RegionSizeX); | 865 | config.Set("Datastore", DataStore); |
828 | 866 | ||
829 | if (RegionSizeY > 0) | 867 | if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize) |
868 | { | ||
869 | config.Set("SizeX", RegionSizeX); | ||
830 | config.Set("SizeY", RegionSizeY); | 870 | config.Set("SizeY", RegionSizeY); |
831 | 871 | // if (RegionSizeZ > 0) | |
832 | // if (RegionSizeZ > 0) | 872 | // config.Set("SizeZ", RegionSizeZ); |
833 | // config.Set("SizeZ", RegionSizeZ); | 873 | } |
834 | 874 | ||
835 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); | 875 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); |
836 | config.Set("InternalPort", m_internalEndPoint.Port); | 876 | config.Set("InternalPort", m_internalEndPoint.Port); |
837 | 877 | ||
838 | config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString()); | ||
839 | |||
840 | config.Set("ExternalHostName", m_externalHostName); | 878 | config.Set("ExternalHostName", m_externalHostName); |
841 | 879 | ||
842 | if (m_nonphysPrimMin > 0) | 880 | if (m_nonphysPrimMin > 0) |
@@ -847,10 +885,10 @@ namespace OpenSim.Framework | |||
847 | 885 | ||
848 | if (m_physPrimMin > 0) | 886 | if (m_physPrimMin > 0) |
849 | config.Set("PhysicalPrimMax", m_physPrimMin); | 887 | config.Set("PhysicalPrimMax", m_physPrimMin); |
850 | 888 | ||
851 | if (m_physPrimMax > 0) | 889 | if (m_physPrimMax > 0) |
852 | config.Set("PhysicalPrimMax", m_physPrimMax); | 890 | config.Set("PhysicalPrimMax", m_physPrimMax); |
853 | 891 | ||
854 | config.Set("ClampPrimSize", m_clampPrimSize.ToString()); | 892 | config.Set("ClampPrimSize", m_clampPrimSize.ToString()); |
855 | 893 | ||
856 | if (m_objectCapacity > 0) | 894 | if (m_objectCapacity > 0) |
@@ -901,6 +939,222 @@ namespace OpenSim.Framework | |||
901 | throw new Exception("Invalid file type for region persistence."); | 939 | throw new Exception("Invalid file type for region persistence."); |
902 | } | 940 | } |
903 | 941 | ||
942 | public void loadConfigurationOptionsFromMe() | ||
943 | { | ||
944 | configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_UUID_NULL_FREE, | ||
945 | "UUID of Region (Default is recommended, random UUID)", | ||
946 | RegionID.ToString(), true); | ||
947 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
948 | "Region Name", RegionName, true); | ||
949 | |||
950 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
951 | "Grid Location (X Axis)", RegionLocX.ToString(), true); | ||
952 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
953 | "Grid Location (Y Axis)", RegionLocY.ToString(), true); | ||
954 | configMember.addConfigurationOption("sim_size_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
955 | "Size of region in X dimension", RegionSizeX.ToString(), true); | ||
956 | configMember.addConfigurationOption("sim_size_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
957 | "Size of region in Y dimension", RegionSizeY.ToString(), true); | ||
958 | configMember.addConfigurationOption("sim_size_z", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
959 | "Size of region in Z dimension", RegionSizeZ.ToString(), true); | ||
960 | |||
961 | //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); | ||
962 | configMember.addConfigurationOption("internal_ip_address", | ||
963 | ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, | ||
964 | "Internal IP Address for incoming UDP client connections", | ||
965 | m_internalEndPoint.Address.ToString(), | ||
966 | true); | ||
967 | configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
968 | "Internal IP Port for incoming UDP client connections", | ||
969 | m_internalEndPoint.Port.ToString(), true); | ||
970 | configMember.addConfigurationOption("external_host_name", | ||
971 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
972 | "External Host Name", m_externalHostName, true); | ||
973 | configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_UUID, | ||
974 | "Last Map UUID", lastMapUUID.ToString(), true); | ||
975 | configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
976 | "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); | ||
977 | |||
978 | configMember.addConfigurationOption("nonphysical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, | ||
979 | "Minimum size for nonphysical prims", m_nonphysPrimMin.ToString(), true); | ||
980 | |||
981 | configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
982 | "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true); | ||
983 | |||
984 | configMember.addConfigurationOption("physical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, | ||
985 | "Minimum size for nonphysical prims", m_physPrimMin.ToString(), true); | ||
986 | |||
987 | configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
988 | "Maximum size for physical prims", m_physPrimMax.ToString(), true); | ||
989 | |||
990 | configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, | ||
991 | "Clamp prims to max size", m_clampPrimSize.ToString(), true); | ||
992 | |||
993 | configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
994 | "Max objects this sim will hold", m_objectCapacity.ToString(), true); | ||
995 | |||
996 | configMember.addConfigurationOption("linkset_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
997 | "Max prims an object will hold", m_linksetCapacity.ToString(), true); | ||
998 | |||
999 | configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
1000 | "Max avatars this sim will hold",AgentCapacity.ToString(), true); | ||
1001 | |||
1002 | configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID, | ||
1003 | "Scope ID for this region", ScopeID.ToString(), true); | ||
1004 | |||
1005 | configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
1006 | "Free form string describing the type of region", String.Empty, true); | ||
1007 | |||
1008 | configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID, | ||
1009 | "UUID of a texture to use as the map for this region", m_maptileStaticUUID.ToString(), true); | ||
1010 | } | ||
1011 | |||
1012 | public void loadConfigurationOptions() | ||
1013 | { | ||
1014 | configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_UUID, | ||
1015 | "UUID of Region (Default is recommended, random UUID)", | ||
1016 | UUID.Random().ToString(), true); | ||
1017 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
1018 | "Region Name", "OpenSim Test", false); | ||
1019 | |||
1020 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
1021 | "Grid Location (X Axis)", "1000", false); | ||
1022 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
1023 | "Grid Location (Y Axis)", "1000", false); | ||
1024 | configMember.addConfigurationOption("sim_size_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
1025 | "Size of region in X dimension", Constants.RegionSize.ToString(), false); | ||
1026 | configMember.addConfigurationOption("sim_size_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
1027 | "Size of region in Y dimension", Constants.RegionSize.ToString(), false); | ||
1028 | configMember.addConfigurationOption("sim_size_z", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
1029 | "Size of region in Z dimension", Constants.RegionHeight.ToString(), false); | ||
1030 | |||
1031 | //m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); | ||
1032 | configMember.addConfigurationOption("internal_ip_address", | ||
1033 | ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, | ||
1034 | "Internal IP Address for incoming UDP client connections", "0.0.0.0", | ||
1035 | false); | ||
1036 | configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
1037 | "Internal IP Port for incoming UDP client connections", | ||
1038 | ConfigSettings.DefaultRegionHttpPort.ToString(), false); | ||
1039 | configMember.addConfigurationOption("external_host_name", | ||
1040 | ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
1041 | "External Host Name", "127.0.0.1", false); | ||
1042 | configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_UUID, | ||
1043 | "Last Map UUID", lastMapUUID.ToString(), true); | ||
1044 | |||
1045 | configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, | ||
1046 | "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); | ||
1047 | |||
1048 | configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
1049 | "Maximum size for nonphysical prims", "0", true); | ||
1050 | |||
1051 | configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
1052 | "Maximum size for physical prims", "0", true); | ||
1053 | |||
1054 | configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, | ||
1055 | "Clamp prims to max size", "false", true); | ||
1056 | |||
1057 | configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
1058 | "Max objects this sim will hold", "15000", true); | ||
1059 | |||
1060 | configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, | ||
1061 | "Max avatars this sim will hold", "100", true); | ||
1062 | |||
1063 | configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID, | ||
1064 | "Scope ID for this region", UUID.Zero.ToString(), true); | ||
1065 | |||
1066 | configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
1067 | "Region Type", String.Empty, true); | ||
1068 | |||
1069 | configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID, | ||
1070 | "UUID of a texture to use as the map for this region", String.Empty, true); | ||
1071 | } | ||
1072 | |||
1073 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | ||
1074 | { | ||
1075 | switch (configuration_key) | ||
1076 | { | ||
1077 | case "sim_UUID": | ||
1078 | RegionID = (UUID) configuration_result; | ||
1079 | originRegionID = (UUID) configuration_result; | ||
1080 | break; | ||
1081 | case "sim_name": | ||
1082 | RegionName = (string) configuration_result; | ||
1083 | break; | ||
1084 | case "sim_location_x": | ||
1085 | RegionLocX = (uint) configuration_result; | ||
1086 | break; | ||
1087 | case "sim_location_y": | ||
1088 | RegionLocY = (uint) configuration_result; | ||
1089 | break; | ||
1090 | case "sim_size_x": | ||
1091 | RegionSizeX = (uint) configuration_result; | ||
1092 | break; | ||
1093 | case "sim_size_y": | ||
1094 | RegionSizeY = (uint) configuration_result; | ||
1095 | break; | ||
1096 | case "sim_size_z": | ||
1097 | RegionSizeZ = (uint) configuration_result; | ||
1098 | break; | ||
1099 | case "datastore": | ||
1100 | DataStore = (string) configuration_result; | ||
1101 | break; | ||
1102 | case "internal_ip_address": | ||
1103 | IPAddress address = (IPAddress) configuration_result; | ||
1104 | m_internalEndPoint = new IPEndPoint(address, 0); | ||
1105 | break; | ||
1106 | case "internal_ip_port": | ||
1107 | m_internalEndPoint.Port = (int) configuration_result; | ||
1108 | break; | ||
1109 | case "external_host_name": | ||
1110 | if ((string) configuration_result != "SYSTEMIP") | ||
1111 | { | ||
1112 | m_externalHostName = (string) configuration_result; | ||
1113 | } | ||
1114 | else | ||
1115 | { | ||
1116 | m_externalHostName = Util.GetLocalHost().ToString(); | ||
1117 | } | ||
1118 | break; | ||
1119 | case "lastmap_uuid": | ||
1120 | lastMapUUID = (UUID)configuration_result; | ||
1121 | break; | ||
1122 | case "lastmap_refresh": | ||
1123 | lastMapRefresh = (string)configuration_result; | ||
1124 | break; | ||
1125 | case "nonphysical_prim_max": | ||
1126 | m_nonphysPrimMax = (int)configuration_result; | ||
1127 | break; | ||
1128 | case "physical_prim_max": | ||
1129 | m_physPrimMax = (int)configuration_result; | ||
1130 | break; | ||
1131 | case "clamp_prim_size": | ||
1132 | m_clampPrimSize = (bool)configuration_result; | ||
1133 | break; | ||
1134 | case "object_capacity": | ||
1135 | m_objectCapacity = (int)configuration_result; | ||
1136 | break; | ||
1137 | case "linkset_capacity": | ||
1138 | m_linksetCapacity = (int)configuration_result; | ||
1139 | break; | ||
1140 | case "agent_capacity": | ||
1141 | AgentCapacity = (int)configuration_result; | ||
1142 | break; | ||
1143 | case "scope_id": | ||
1144 | ScopeID = (UUID)configuration_result; | ||
1145 | break; | ||
1146 | case "region_type": | ||
1147 | m_regionType = (string)configuration_result; | ||
1148 | break; | ||
1149 | case "region_static_maptile": | ||
1150 | m_maptileStaticUUID = (UUID)configuration_result; | ||
1151 | break; | ||
1152 | } | ||
1153 | |||
1154 | return true; | ||
1155 | } | ||
1156 | |||
1157 | |||
904 | public void SaveLastMapUUID(UUID mapUUID) | 1158 | public void SaveLastMapUUID(UUID mapUUID) |
905 | { | 1159 | { |
906 | lastMapUUID = mapUUID; | 1160 | lastMapUUID = mapUUID; |
@@ -928,7 +1182,6 @@ namespace OpenSim.Framework | |||
928 | if ((RemotingAddress != null) && !RemotingAddress.Equals("")) | 1182 | if ((RemotingAddress != null) && !RemotingAddress.Equals("")) |
929 | args["remoting_address"] = OSD.FromString(RemotingAddress); | 1183 | args["remoting_address"] = OSD.FromString(RemotingAddress); |
930 | args["remoting_port"] = OSD.FromString(RemotingPort.ToString()); | 1184 | args["remoting_port"] = OSD.FromString(RemotingPort.ToString()); |
931 | args["allow_alt_ports"] = OSD.FromBoolean(m_allow_alternate_ports); | ||
932 | if ((proxyUrl != null) && !proxyUrl.Equals("")) | 1185 | if ((proxyUrl != null) && !proxyUrl.Equals("")) |
933 | args["proxy_url"] = OSD.FromString(proxyUrl); | 1186 | args["proxy_url"] = OSD.FromString(proxyUrl); |
934 | if (RegionType != String.Empty) | 1187 | if (RegionType != String.Empty) |
@@ -983,8 +1236,6 @@ namespace OpenSim.Framework | |||
983 | RemotingAddress = args["remoting_address"].AsString(); | 1236 | RemotingAddress = args["remoting_address"].AsString(); |
984 | if (args["remoting_port"] != null) | 1237 | if (args["remoting_port"] != null) |
985 | UInt32.TryParse(args["remoting_port"].AsString(), out m_remotingPort); | 1238 | UInt32.TryParse(args["remoting_port"].AsString(), out m_remotingPort); |
986 | if (args["allow_alt_ports"] != null) | ||
987 | m_allow_alternate_ports = args["allow_alt_ports"].AsBoolean(); | ||
988 | if (args["proxy_url"] != null) | 1239 | if (args["proxy_url"] != null) |
989 | proxyUrl = args["proxy_url"].AsString(); | 1240 | proxyUrl = args["proxy_url"].AsString(); |
990 | if (args["region_type"] != null) | 1241 | if (args["region_type"] != null) |
@@ -1004,5 +1255,29 @@ namespace OpenSim.Framework | |||
1004 | regionInfo.ServerURI = serverURI; | 1255 | regionInfo.ServerURI = serverURI; |
1005 | return regionInfo; | 1256 | return regionInfo; |
1006 | } | 1257 | } |
1258 | |||
1259 | public int getInternalEndPointPort() | ||
1260 | { | ||
1261 | return m_internalEndPoint.Port; | ||
1262 | } | ||
1263 | |||
1264 | public Dictionary<string, object> ToKeyValuePairs() | ||
1265 | { | ||
1266 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | ||
1267 | kvp["uuid"] = RegionID.ToString(); | ||
1268 | kvp["locX"] = RegionLocX.ToString(); | ||
1269 | kvp["locY"] = RegionLocY.ToString(); | ||
1270 | kvp["external_ip_address"] = ExternalEndPoint.Address.ToString(); | ||
1271 | kvp["external_port"] = ExternalEndPoint.Port.ToString(); | ||
1272 | kvp["external_host_name"] = ExternalHostName; | ||
1273 | kvp["http_port"] = HttpPort.ToString(); | ||
1274 | kvp["internal_ip_address"] = InternalEndPoint.Address.ToString(); | ||
1275 | kvp["internal_port"] = InternalEndPoint.Port.ToString(); | ||
1276 | // TODO: Remove in next major version | ||
1277 | kvp["alternate_ports"] = "False"; | ||
1278 | kvp["server_uri"] = ServerURI; | ||
1279 | |||
1280 | return kvp; | ||
1281 | } | ||
1007 | } | 1282 | } |
1008 | } | 1283 | } |