29 using System.Collections.Generic;
31 using System.Net.Sockets;
32 using System.Reflection;
38 using OpenMetaverse.StructuredData;
41 namespace OpenSim.Framework
46 public bool valid =
false;
47 public UUID regionID = UUID.Zero;
48 public Vector3 waterColor =
new Vector3(4.0f,38.0f,64.0f);
49 public float waterFogDensityExponent = 4.0f;
50 public float underwaterFogModifier = 0.25f;
51 public Vector3 reflectionWaveletScale =
new Vector3(2.0f,2.0f,2.0f);
52 public float fresnelScale = 0.40f;
53 public float fresnelOffset = 0.50f;
54 public float refractScaleAbove = 0.03f;
55 public float refractScaleBelow = 0.20f;
56 public float blurMultiplier = 0.040f;
57 public Vector2 bigWaveDirection =
new Vector2(1.05f,-0.42f);
58 public Vector2 littleWaveDirection =
new Vector2(1.11f,-1.16f);
59 public UUID normalMapTexture =
new UUID(
"822ded49-9a6c-f61c-cb89-6df54f42cdf4");
60 public Vector4 horizon =
new Vector4(0.25f, 0.25f, 0.32f, 0.32f);
61 public float hazeHorizon = 0.19f;
62 public Vector4 blueDensity =
new Vector4(0.12f, 0.22f, 0.38f, 0.38f);
63 public float hazeDensity = 0.70f;
64 public float densityMultiplier = 0.18f;
65 public float distanceMultiplier = 0.8f;
66 public UInt16 maxAltitude = 1605;
67 public Vector4 sunMoonColor =
new Vector4(0.24f, 0.26f, 0.30f, 0.30f);
68 public float sunMoonPosition = 0.317f;
69 public Vector4 ambient =
new Vector4(0.35f,0.35f,0.35f,0.35f);
70 public float eastAngle = 0.0f;
71 public float sunGlowFocus = 0.10f;
72 public float sunGlowSize = 1.75f;
73 public float sceneGamma = 1.0f;
74 public float starBrightness = 0.0f;
75 public Vector4 cloudColor =
new Vector4(0.41f, 0.41f, 0.41f, 0.41f);
76 public Vector3 cloudXYDensity =
new Vector3(1.00f, 0.53f, 1.00f);
77 public float cloudCoverage = 0.27f;
78 public float cloudScale = 0.42f;
79 public Vector3 cloudDetailXYDensity =
new Vector3(1.00f, 0.53f, 0.12f);
80 public float cloudScrollX = 0.20f;
81 public bool cloudScrollXLock =
false;
82 public float cloudScrollY = 0.01f;
83 public bool cloudScrollYLock =
false;
84 public bool drawClassicClouds =
true;
95 return this.MemberwiseClone();
102 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
103 private static readonly
string LogHeader =
"[REGION INFO]";
106 public bool commFailTF =
false;
108 public string DataStore = String.Empty;
110 public string RegionFile = String.Empty;
111 public bool isSandbox =
false;
118 public UUID originRegionID = UUID.Zero;
119 public string proxyUrl =
"";
120 public int ProxyOffset = 0;
121 public string regionSecret = UUID.Random().ToString();
125 public UUID lastMapUUID = UUID.Zero;
126 public string lastMapRefresh =
"0";
128 private float m_nonphysPrimMin = 0;
129 private int m_nonphysPrimMax = 0;
130 private float m_physPrimMin = 0;
131 private int m_physPrimMax = 0;
132 private bool m_clampPrimSize =
false;
133 private int m_objectCapacity = 0;
134 private int m_maxPrimsPerUser = -1;
135 private int m_linksetCapacity = 0;
136 private string m_regionType = String.Empty;
140 protected string m_regionName = String.Empty;
146 public UUID RegionID = UUID.Zero;
148 public UUID ScopeID = UUID.Zero;
149 private UUID m_maptileStaticUUID = UUID.Zero;
151 public uint WorldLocX = 0;
152 public uint WorldLocY = 0;
153 public uint WorldLocZ = 0;
161 public uint RegionSizeX = Constants.RegionSize;
169 public uint RegionSizeY = Constants.RegionSize;
177 public uint RegionSizeZ = Constants.RegionHeight;
179 private Dictionary<String, String> m_extraSettings =
new Dictionary<string, string>();
190 public RegionInfo(
string description,
string filename,
bool skipConsoleConfig, IConfigSource configSource) : this(description, filename, skipConsoleConfig, configSource, String.Empty)
194 public RegionInfo(
string description,
string filename,
bool skipConsoleConfig, IConfigSource configSource,
string configName)
198 if (filename.ToLower().EndsWith(
".ini"))
200 if (!
File.Exists(filename))
202 IniConfigSource newFile =
new IniConfigSource();
203 ReadNiniConfig(newFile, configName);
205 newFile.Save(filename);
207 RegionFile = filename;
212 IniConfigSource source =
new IniConfigSource(filename);
214 bool saveFile =
false;
215 if (source.Configs[configName] == null)
218 ReadNiniConfig(source, configName);
220 if (configName != String.Empty && saveFile)
221 source.Save(filename);
223 RegionFile = filename;
232 IConfigSource xmlsource =
new XmlConfigSource(filename);
234 ReadNiniConfig(xmlsource, configName);
236 RegionFile = filename;
247 public RegionInfo(
string description, XmlNode xmlNode,
bool skipConsoleConfig, IConfigSource configSource)
249 XmlElement elem = (XmlElement)xmlNode;
250 string name = elem.GetAttribute(
"Name");
251 string xmlstr =
"<Nini>" + xmlNode.OuterXml +
"</Nini>";
252 XmlConfigSource source =
new XmlConfigSource(XmlReader.Create(
new StringReader(xmlstr)));
253 ReadNiniConfig(source, name);
255 m_serverURI = string.Empty;
258 public RegionInfo(uint legacyRegionLocX, uint legacyRegionLocY, IPEndPoint internalEndPoint,
string externalUri)
260 RegionLocX = legacyRegionLocX;
261 RegionLocY = legacyRegionLocY;
262 RegionSizeX = Constants.RegionSize;
263 RegionSizeY = Constants.RegionSize;
264 m_internalEndPoint = internalEndPoint;
265 m_externalHostName = externalUri;
266 m_serverURI = string.Empty;
271 m_serverURI = string.Empty;
278 if (m_estateSettings == null)
283 return m_estateSettings;
286 set { m_estateSettings = value; }
293 if (m_regionSettings == null)
298 return m_regionSettings;
301 set { m_regionSettings = value; }
308 if (m_windlight == null)
316 set { m_windlight = value; }
319 public float NonphysPrimMin
321 get {
return m_nonphysPrimMin; }
324 public int NonphysPrimMax
326 get {
return m_nonphysPrimMax; }
329 public float PhysPrimMin
331 get {
return m_physPrimMin; }
334 public int PhysPrimMax
336 get {
return m_physPrimMax; }
339 public bool ClampPrimSize
341 get {
return m_clampPrimSize; }
344 public int ObjectCapacity
346 get {
return m_objectCapacity; }
349 public int MaxPrimsPerUser
351 get {
return m_maxPrimsPerUser; }
354 public int LinksetCapacity
356 get {
return m_linksetCapacity; }
359 public int AgentCapacity {
get; set; }
361 public byte AccessLevel
366 public string RegionType
368 get {
return m_regionType; }
371 public UUID MaptileStaticUUID
373 get {
return m_maptileStaticUUID; }
376 public string MaptileStaticFile {
get;
private set; }
383 get {
return m_httpPort; }
384 set { m_httpPort = value; }
391 public string ServerURI
394 if ( m_serverURI !=
string.Empty ) {
397 return "http://" + m_externalHostName +
":" + m_httpPort +
"/";
401 if ( value.EndsWith(
"/") ) {
404 m_serverURI = value +
'/';
409 public string RegionName
411 get {
return m_regionName; }
412 set { m_regionName = value; }
415 public uint RemotingPort
417 get {
return m_remotingPort; }
418 set { m_remotingPort = value; }
426 public IPEndPoint ExternalEndPoint
435 if (IPAddress.TryParse(m_externalHostName, out ia))
436 return new IPEndPoint(ia, m_internalEndPoint.Port);
442 foreach (IPAddress Adr
in Dns.GetHostAddresses(m_externalHostName))
447 if (Adr.AddressFamily == AddressFamily.InterNetwork)
454 catch (SocketException e)
457 "Unable to resolve local hostname " + m_externalHostName +
" innerException of type '" +
458 e +
"' attached to this exception", e);
461 return new IPEndPoint(ia, m_internalEndPoint.Port);
464 set { m_externalHostName = value.ToString(); }
467 public string ExternalHostName
469 get {
return m_externalHostName; }
470 set { m_externalHostName = value; }
473 public IPEndPoint InternalEndPoint
475 get {
return m_internalEndPoint; }
476 set { m_internalEndPoint = value; }
484 public uint RegionLocX
486 get {
return WorldLocX / Constants.RegionSize; }
487 set { WorldLocX = value * Constants.RegionSize; }
495 public uint RegionLocY
497 get {
return WorldLocY / Constants.RegionSize; }
498 set { WorldLocY = value * Constants.RegionSize; }
506 RegionSizeX = Constants.RegionSize;
507 RegionSizeY = Constants.RegionSize;
508 RegionSizeZ = Constants.RegionHeight;
514 public ulong RegionHandle
516 get {
return Util.UIntsToLong(WorldLocX, WorldLocY); }
521 IPAddress tmpIP = IPAddress.Parse(ipaddr);
522 IPEndPoint tmpEPE =
new IPEndPoint(tmpIP, port);
523 m_internalEndPoint = tmpEPE;
529 string keylower = key.ToLower();
530 if (m_extraSettings.TryGetValue(keylower, out val))
532 m_log.DebugFormat(
"[RegionInfo] Could not locate value for parameter {0}",
key);
538 string keylower = key.ToLower();
539 m_extraSettings[keylower] = value;
542 private void ReadNiniConfig(IConfigSource source,
string name)
546 if (source.Configs.Count == 0)
548 MainConsole.Instance.Output(
"=====================================\n");
549 MainConsole.Instance.Output(
"We are now going to ask a couple of questions about your region.\n");
550 MainConsole.Instance.Output(
"You can press 'enter' without typing anything to use the default\n");
551 MainConsole.Instance.Output(
"the default is displayed between [ ] brackets.\n");
552 MainConsole.Instance.Output(
"=====================================\n");
554 if (name == String.Empty)
556 while (name.Trim() == string.Empty)
558 name = MainConsole.Instance.CmdPrompt(
"New region name", name);
559 if (name.Trim() == string.Empty)
561 MainConsole.Instance.Output(
"Cannot interactively create region with no name");
566 source.AddConfig(name);
572 name = source.Configs[0].Name;
574 if (source.Configs[name] == null)
576 source.AddConfig(name);
580 IConfig config = source.Configs[name];
585 HashSet<String> allKeys =
new HashSet<String>();
586 foreach (
string s
in config.GetKeys())
593 allKeys.Remove(
"RegionUUID");
594 string regionUUID = config.GetString(
"RegionUUID", string.Empty);
595 if (!
UUID.TryParse(regionUUID.Trim(), out RegionID))
597 UUID newID = UUID.Random();
598 while (RegionID ==
UUID.Zero)
600 regionUUID = MainConsole.Instance.CmdPrompt(
"RegionUUID", newID.ToString());
601 if (!
UUID.TryParse(regionUUID.Trim(), out RegionID))
603 MainConsole.Instance.Output(
"RegionUUID must be a valid UUID");
606 config.Set(
"RegionUUID", regionUUID);
609 originRegionID = RegionID;
613 allKeys.Remove(
"Location");
614 string location = config.GetString(
"Location", String.Empty);
615 if (location ==
String.Empty)
617 location = MainConsole.Instance.CmdPrompt(
"Region Location",
"1000,1000");
618 config.Set(
"Location", location);
621 string[] locationElements = location.Split(
new char[] {
','});
623 RegionLocX = Convert.ToUInt32(locationElements[0]);
624 RegionLocY = Convert.ToUInt32(locationElements[1]);
628 allKeys.Remove(
"SizeX");
629 string configSizeX = config.GetString(
"SizeX", Constants.RegionSize.ToString());
630 config.Set(
"SizeX", configSizeX);
631 RegionSizeX = Convert.ToUInt32(configSizeX);
632 allKeys.Remove(
"SizeY");
633 string configSizeY = config.GetString(
"SizeY", Constants.RegionSize.ToString());
634 config.Set(
"SizeY", configSizeX);
635 RegionSizeY = Convert.ToUInt32(configSizeY);
636 allKeys.Remove(
"SizeZ");
637 string configSizeZ = config.GetString(
"SizeZ", Constants.RegionHeight.ToString());
638 config.Set(
"SizeZ", configSizeX);
639 RegionSizeZ = Convert.ToUInt32(configSizeZ);
641 DoRegionSizeSanityChecks();
646 allKeys.Remove(
"InternalAddress");
647 if (config.Contains(
"InternalAddress"))
649 address = IPAddress.Parse(config.GetString(
"InternalAddress", String.Empty));
653 address = IPAddress.Parse(MainConsole.Instance.CmdPrompt(
"Internal IP address",
"0.0.0.0"));
654 config.Set(
"InternalAddress", address.ToString());
660 allKeys.Remove(
"InternalPort");
661 if (config.Contains(
"InternalPort"))
663 port = config.GetInt(
"InternalPort", 9000);
667 port = Convert.ToInt32(MainConsole.Instance.CmdPrompt(
"Internal port",
"9000"));
668 config.Set(
"InternalPort", port);
670 m_internalEndPoint =
new IPEndPoint(address, port);
674 allKeys.Remove(
"AllowAlternatePorts");
675 if (config.Contains(
"AllowAlternatePorts"))
677 m_allow_alternate_ports = config.GetBoolean(
"AllowAlternatePorts",
true);
681 m_allow_alternate_ports = Convert.ToBoolean(MainConsole.Instance.CmdPrompt(
"Allow alternate ports",
"False"));
683 config.Set(
"AllowAlternatePorts", m_allow_alternate_ports.ToString());
688 allKeys.Remove(
"ExternalHostName");
690 if (config.Contains(
"ExternalHostName"))
692 externalName = config.GetString(
"ExternalHostName",
"SYSTEMIP");
696 externalName = MainConsole.Instance.CmdPrompt(
"External host name",
"SYSTEMIP");
697 config.Set(
"ExternalHostName", externalName);
699 if (externalName ==
"SYSTEMIP")
701 m_externalHostName = Util.GetLocalHost().ToString();
703 "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}",
704 m_externalHostName, name);
708 m_externalHostName = externalName;
712 m_regionType = config.GetString(
"RegionType", String.Empty);
713 allKeys.Remove(
"RegionType");
715 #region Prim and map stuff
717 m_nonphysPrimMin = config.GetFloat(
"NonPhysicalPrimMin", 0);
718 allKeys.Remove(
"NonPhysicalPrimMin");
720 m_nonphysPrimMax = config.GetInt(
"NonPhysicalPrimMax", 0);
721 allKeys.Remove(
"NonPhysicalPrimMax");
723 m_physPrimMin = config.GetFloat(
"PhysicalPrimMin", 0);
724 allKeys.Remove(
"PhysicalPrimMin");
726 m_physPrimMax = config.GetInt(
"PhysicalPrimMax", 0);
727 allKeys.Remove(
"PhysicalPrimMax");
729 m_clampPrimSize = config.GetBoolean(
"ClampPrimSize",
false);
730 allKeys.Remove(
"ClampPrimSize");
732 m_objectCapacity = config.GetInt(
"MaxPrims", 15000);
733 allKeys.Remove(
"MaxPrims");
735 m_maxPrimsPerUser = config.GetInt(
"MaxPrimsPerUser", -1);
736 allKeys.Remove(
"MaxPrimsPerUser");
738 m_linksetCapacity = config.GetInt(
"LinksetPrims", 0);
739 allKeys.Remove(
"LinksetPrims");
741 allKeys.Remove(
"MaptileStaticUUID");
742 string mapTileStaticUUID = config.GetString(
"MaptileStaticUUID", UUID.Zero.ToString());
743 if (
UUID.TryParse(mapTileStaticUUID.Trim(), out m_maptileStaticUUID))
745 config.Set(
"MaptileStaticUUID", m_maptileStaticUUID.ToString());
748 MaptileStaticFile = config.GetString(
"MaptileStaticFile", String.Empty);
749 allKeys.Remove(
"MaptileStaticFile");
753 AgentCapacity = config.GetInt(
"MaxAgents", 100);
754 allKeys.Remove(
"MaxAgents");
758 ScopeID =
new UUID(config.GetString(
"ScopeID",
UUID.Zero.ToString()));
759 allKeys.Remove(
"ScopeID");
761 foreach (String s
in allKeys)
763 SetExtraSetting(s, config.GetString(s));
769 private void DoRegionSizeSanityChecks()
771 if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize)
775 uint partial = RegionSizeX % Constants.RegionSize;
778 RegionSizeX -= partial;
779 if (RegionSizeX == 0)
780 RegionSizeX = Constants.RegionSize;
781 m_log.ErrorFormat(
"{0} Region size must be multiple of {1}. Enforcing {2}.RegionSizeX={3} instead of specified {4}",
782 LogHeader, Constants.RegionSize, m_regionName, RegionSizeX, RegionSizeX + partial);
784 partial = RegionSizeY % Constants.RegionSize;
787 RegionSizeY -= partial;
788 if (RegionSizeY == 0)
789 RegionSizeY = Constants.RegionSize;
790 m_log.ErrorFormat(
"{0} Region size must be multiple of {1}. Enforcing {2}.RegionSizeY={3} instead of specified {4}",
791 LogHeader, Constants.RegionSize, m_regionName, RegionSizeY, RegionSizeY + partial);
796 if (RegionSizeX != RegionSizeY)
798 uint minSize = Math.Min(RegionSizeX, RegionSizeY);
799 RegionSizeX = minSize;
800 RegionSizeY = minSize;
801 m_log.ErrorFormat(
"{0} Regions must be square until viewers are updated. Forcing region {1} size to <{2},{3}>",
802 LogHeader, m_regionName, RegionSizeX, RegionSizeY);
806 if (RegionSizeX > Constants.MaximumRegionSize || RegionSizeY > Constants.MaximumRegionSize)
808 RegionSizeX = Util.Clamp<uint>(RegionSizeX, Constants.RegionSize, Constants.MaximumRegionSize);
809 RegionSizeY = Util.Clamp<uint>(RegionSizeY, Constants.RegionSize, Constants.MaximumRegionSize);
810 m_log.ErrorFormat(
"{0} Region dimensions must be less than {1}. Clamping {2}'s size to <{3},{4}>",
811 LogHeader, Constants.MaximumRegionSize, m_regionName, RegionSizeX, RegionSizeY);
814 m_log.InfoFormat(
"{0} Region {1} size set to <{2},{3}>", LogHeader, m_regionName, RegionSizeX, RegionSizeY);
818 private void WriteNiniConfig(IConfigSource source)
820 IConfig config = source.Configs[RegionName];
823 source.Configs.Remove(config);
825 config = source.AddConfig(RegionName);
827 config.Set(
"RegionUUID", RegionID.ToString());
829 string location = String.Format(
"{0},{1}", RegionLocX, RegionLocY);
830 config.Set(
"Location", location);
832 if (DataStore !=
String.Empty)
833 config.Set(
"Datastore", DataStore);
835 if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize)
837 config.Set(
"SizeX", RegionSizeX);
838 config.Set(
"SizeY", RegionSizeY);
843 config.Set(
"InternalAddress", m_internalEndPoint.Address.ToString());
844 config.Set(
"InternalPort", m_internalEndPoint.Port);
846 config.Set(
"AllowAlternatePorts", m_allow_alternate_ports.ToString());
848 config.Set(
"ExternalHostName", m_externalHostName);
850 if (m_nonphysPrimMin > 0)
851 config.Set(
"NonphysicalPrimMax", m_nonphysPrimMin);
853 if (m_nonphysPrimMax > 0)
854 config.Set(
"NonphysicalPrimMax", m_nonphysPrimMax);
856 if (m_physPrimMin > 0)
857 config.Set(
"PhysicalPrimMax", m_physPrimMin);
859 if (m_physPrimMax > 0)
860 config.Set(
"PhysicalPrimMax", m_physPrimMax);
862 config.Set(
"ClampPrimSize", m_clampPrimSize.ToString());
864 if (m_objectCapacity > 0)
865 config.Set(
"MaxPrims", m_objectCapacity);
867 if (m_maxPrimsPerUser > -1)
868 config.Set(
"MaxPrimsPerUser", m_maxPrimsPerUser);
870 if (m_linksetCapacity > 0)
871 config.Set(
"LinksetPrims", m_linksetCapacity);
873 if (AgentCapacity > 0)
874 config.Set(
"MaxAgents", AgentCapacity);
876 if (ScopeID !=
UUID.Zero)
877 config.Set(
"ScopeID", ScopeID.ToString());
879 if (RegionType !=
String.Empty)
880 config.Set(
"RegionType", RegionType);
882 if (m_maptileStaticUUID !=
UUID.Zero)
883 config.Set(
"MaptileStaticUUID", m_maptileStaticUUID.ToString());
885 if (MaptileStaticFile != null && MaptileStaticFile !=
String.Empty)
886 config.Set(
"MaptileStaticFile", MaptileStaticFile);
891 if (filename.ToLower().EndsWith(
".ini"))
893 IniConfigSource source =
new IniConfigSource();
896 source =
new IniConfigSource(filename);
902 WriteNiniConfig(source);
904 source.Save(filename);
909 throw new Exception(
"Invalid file type for region persistence.");
914 configMember.addConfigurationOption(
"sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_UUID_NULL_FREE,
915 "UUID of Region (Default is recommended, random UUID)",
916 RegionID.ToString(),
true);
917 configMember.addConfigurationOption(
"sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
918 "Region Name", RegionName,
true);
920 configMember.addConfigurationOption(
"sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
921 "Grid Location (X Axis)", RegionLocX.ToString(),
true);
922 configMember.addConfigurationOption(
"sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
923 "Grid Location (Y Axis)", RegionLocY.ToString(),
true);
924 configMember.addConfigurationOption(
"sim_size_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
925 "Size of region in X dimension", RegionSizeX.ToString(),
true);
926 configMember.addConfigurationOption(
"sim_size_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
927 "Size of region in Y dimension", RegionSizeY.ToString(),
true);
928 configMember.addConfigurationOption(
"sim_size_z", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
929 "Size of region in Z dimension", RegionSizeZ.ToString(),
true);
932 configMember.addConfigurationOption(
"internal_ip_address",
933 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
934 "Internal IP Address for incoming UDP client connections",
935 m_internalEndPoint.Address.ToString(),
937 configMember.addConfigurationOption(
"internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
938 "Internal IP Port for incoming UDP client connections",
939 m_internalEndPoint.Port.ToString(),
true);
940 configMember.addConfigurationOption(
"allow_alternate_ports",
941 ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
942 "Allow sim to find alternate UDP ports when ports are in use?",
943 m_allow_alternate_ports.ToString(),
true);
944 configMember.addConfigurationOption(
"external_host_name",
945 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
946 "External Host Name", m_externalHostName,
true);
947 configMember.addConfigurationOption(
"lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
948 "Last Map UUID", lastMapUUID.ToString(),
true);
949 configMember.addConfigurationOption(
"lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
950 "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(),
true);
952 configMember.addConfigurationOption(
"nonphysical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
953 "Minimum size for nonphysical prims", m_nonphysPrimMin.ToString(),
true);
955 configMember.addConfigurationOption(
"nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
956 "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(),
true);
958 configMember.addConfigurationOption(
"physical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
959 "Minimum size for nonphysical prims", m_physPrimMin.ToString(),
true);
961 configMember.addConfigurationOption(
"physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
962 "Maximum size for physical prims", m_physPrimMax.ToString(),
true);
964 configMember.addConfigurationOption(
"clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
965 "Clamp prims to max size", m_clampPrimSize.ToString(),
true);
967 configMember.addConfigurationOption(
"object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
968 "Max objects this sim will hold", m_objectCapacity.ToString(),
true);
970 configMember.addConfigurationOption(
"linkset_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
971 "Max prims an object will hold", m_linksetCapacity.ToString(),
true);
973 configMember.addConfigurationOption(
"agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
974 "Max avatars this sim will hold",AgentCapacity.ToString(),
true);
976 configMember.addConfigurationOption(
"scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
977 "Scope ID for this region", ScopeID.ToString(),
true);
979 configMember.addConfigurationOption(
"region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
980 "Free form string describing the type of region", String.Empty,
true);
982 configMember.addConfigurationOption(
"region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
983 "UUID of a texture to use as the map for this region", m_maptileStaticUUID.ToString(),
true);
988 configMember.addConfigurationOption(
"sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
989 "UUID of Region (Default is recommended, random UUID)",
990 UUID.Random().ToString(),
true);
991 configMember.addConfigurationOption(
"sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
992 "Region Name",
"OpenSim Test",
false);
994 configMember.addConfigurationOption(
"sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
995 "Grid Location (X Axis)",
"1000",
false);
996 configMember.addConfigurationOption(
"sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
997 "Grid Location (Y Axis)",
"1000",
false);
998 configMember.addConfigurationOption(
"sim_size_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
999 "Size of region in X dimension", Constants.RegionSize.ToString(),
false);
1000 configMember.addConfigurationOption(
"sim_size_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
1001 "Size of region in Y dimension", Constants.RegionSize.ToString(),
false);
1002 configMember.addConfigurationOption(
"sim_size_z", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
1003 "Size of region in Z dimension", Constants.RegionHeight.ToString(),
false);
1006 configMember.addConfigurationOption(
"internal_ip_address",
1007 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
1008 "Internal IP Address for incoming UDP client connections",
"0.0.0.0",
1010 configMember.addConfigurationOption(
"internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
1011 "Internal IP Port for incoming UDP client connections",
1012 ConfigSettings.DefaultRegionHttpPort.ToString(),
false);
1013 configMember.addConfigurationOption(
"allow_alternate_ports", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
1014 "Allow sim to find alternate UDP ports when ports are in use?",
1016 configMember.addConfigurationOption(
"external_host_name",
1017 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
1018 "External Host Name",
"127.0.0.1",
false);
1019 configMember.addConfigurationOption(
"lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
1020 "Last Map UUID", lastMapUUID.ToString(),
true);
1022 configMember.addConfigurationOption(
"lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
1023 "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(),
true);
1025 configMember.addConfigurationOption(
"nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
1026 "Maximum size for nonphysical prims",
"0",
true);
1028 configMember.addConfigurationOption(
"physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
1029 "Maximum size for physical prims",
"0",
true);
1031 configMember.addConfigurationOption(
"clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
1032 "Clamp prims to max size",
"false",
true);
1034 configMember.addConfigurationOption(
"object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
1035 "Max objects this sim will hold",
"15000",
true);
1037 configMember.addConfigurationOption(
"agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
1038 "Max avatars this sim will hold",
"100",
true);
1040 configMember.addConfigurationOption(
"scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
1041 "Scope ID for this region", UUID.Zero.ToString(),
true);
1043 configMember.addConfigurationOption(
"region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
1044 "Region Type", String.Empty,
true);
1046 configMember.addConfigurationOption(
"region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
1047 "UUID of a texture to use as the map for this region", String.Empty,
true);
1052 switch (configuration_key)
1055 RegionID = (UUID) configuration_result;
1056 originRegionID = (UUID) configuration_result;
1059 RegionName = (string) configuration_result;
1061 case "sim_location_x":
1062 RegionLocX = (uint) configuration_result;
1064 case "sim_location_y":
1065 RegionLocY = (uint) configuration_result;
1068 RegionSizeX = (uint) configuration_result;
1071 RegionSizeY = (uint) configuration_result;
1074 RegionSizeZ = (uint) configuration_result;
1077 DataStore = (string) configuration_result;
1079 case "internal_ip_address":
1080 IPAddress address = (IPAddress) configuration_result;
1081 m_internalEndPoint =
new IPEndPoint(address, 0);
1083 case "internal_ip_port":
1084 m_internalEndPoint.Port = (int) configuration_result;
1086 case "allow_alternate_ports":
1087 m_allow_alternate_ports = (bool) configuration_result;
1089 case "external_host_name":
1090 if ((
string) configuration_result !=
"SYSTEMIP")
1092 m_externalHostName = (string) configuration_result;
1096 m_externalHostName = Util.GetLocalHost().ToString();
1099 case "lastmap_uuid":
1100 lastMapUUID = (UUID)configuration_result;
1102 case "lastmap_refresh":
1103 lastMapRefresh = (string)configuration_result;
1105 case "nonphysical_prim_max":
1106 m_nonphysPrimMax = (int)configuration_result;
1108 case "physical_prim_max":
1109 m_physPrimMax = (int)configuration_result;
1111 case "clamp_prim_size":
1112 m_clampPrimSize = (bool)configuration_result;
1114 case "object_capacity":
1115 m_objectCapacity = (int)configuration_result;
1117 case "linkset_capacity":
1118 m_linksetCapacity = (int)configuration_result;
1120 case "agent_capacity":
1121 AgentCapacity = (int)configuration_result;
1124 ScopeID = (UUID)configuration_result;
1127 m_regionType = (string)configuration_result;
1129 case "region_static_maptile":
1130 m_maptileStaticUUID = (UUID)configuration_result;
1140 lastMapUUID = mapUUID;
1141 lastMapRefresh = Util.UnixTimeSinceEpoch().ToString();
1147 args[
"region_id"] = OSD.FromUUID(RegionID);
1148 if ((RegionName != null) && !RegionName.Equals(
""))
1149 args[
"region_name"] = OSD.FromString(RegionName);
1150 args[
"external_host_name"] = OSD.FromString(ExternalHostName);
1151 args[
"http_port"] = OSD.FromString(HttpPort.ToString());
1152 args[
"server_uri"] = OSD.FromString(ServerURI);
1154 args[
"region_xloc"] = OSD.FromString(RegionLocX.ToString());
1155 args[
"region_yloc"] = OSD.FromString(RegionLocY.ToString());
1156 args[
"region_size_x"] = OSD.FromString(RegionSizeX.ToString());
1157 args[
"region_size_y"] = OSD.FromString(RegionSizeY.ToString());
1158 args[
"region_size_z"] = OSD.FromString(RegionSizeZ.ToString());
1160 args[
"internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString());
1161 args[
"internal_ep_port"] = OSD.FromString(InternalEndPoint.Port.ToString());
1162 if ((RemotingAddress != null) && !RemotingAddress.Equals(
""))
1163 args[
"remoting_address"] =
OSD.FromString(RemotingAddress);
1164 args[
"remoting_port"] = OSD.FromString(RemotingPort.ToString());
1165 args[
"allow_alt_ports"] = OSD.FromBoolean(m_allow_alternate_ports);
1166 if ((proxyUrl != null) && !proxyUrl.Equals(
""))
1167 args[
"proxy_url"] = OSD.FromString(proxyUrl);
1168 if (RegionType != String.Empty)
1169 args[
"region_type"] = OSD.FromString(RegionType);
1176 if (args[
"region_id"] != null)
1177 RegionID = args[
"region_id"].AsUUID();
1178 if (args[
"region_name"] != null)
1179 RegionName = args[
"region_name"].AsString();
1180 if (args[
"external_host_name"] != null)
1181 ExternalHostName = args[
"external_host_name"].AsString();
1182 if (args[
"http_port"] != null)
1183 UInt32.TryParse(args[
"http_port"].AsString(), out m_httpPort);
1184 if (args[
"server_uri"] != null)
1185 ServerURI = args[
"server_uri"].AsString();
1186 if (args[
"region_xloc"] != null)
1189 UInt32.TryParse(args[
"region_xloc"].AsString(), out locx);
1192 if (args[
"region_yloc"] != null)
1195 UInt32.TryParse(args[
"region_yloc"].AsString(), out locy);
1198 if (args.ContainsKey(
"region_size_x"))
1199 RegionSizeX = (uint)args[
"region_size_x"].AsInteger();
1200 if (args.ContainsKey(
"region_size_y"))
1201 RegionSizeY = (uint)args[
"region_size_y"].AsInteger();
1202 if (args.ContainsKey(
"region_size_z"))
1203 RegionSizeZ = (uint)args[
"region_size_z"].AsInteger();
1205 IPAddress ip_addr = null;
1206 if (args[
"internal_ep_address"] != null)
1208 IPAddress.TryParse(args[
"internal_ep_address"].AsString(), out ip_addr);
1211 if (args[
"internal_ep_port"] != null)
1213 Int32.TryParse(args[
"internal_ep_port"].AsString(), out port);
1215 InternalEndPoint =
new IPEndPoint(ip_addr, port);
1216 if (args[
"remoting_address"] != null)
1217 RemotingAddress = args[
"remoting_address"].AsString();
1218 if (args[
"remoting_port"] != null)
1219 UInt32.TryParse(args[
"remoting_port"].AsString(), out m_remotingPort);
1220 if (args[
"allow_alt_ports"] != null)
1221 m_allow_alternate_ports = args[
"allow_alt_ports"].AsBoolean();
1222 if (args[
"proxy_url"] != null)
1223 proxyUrl = args[
"proxy_url"].AsString();
1224 if (args[
"region_type"] != null)
1225 m_regionType = args[
"region_type"].AsString();
1228 public static RegionInfo Create(UUID regionID,
string regionName, uint regX, uint regY,
string externalHostName, uint httpPort, uint simPort, uint remotingPort,
string serverURI)
1231 IPEndPoint neighbourInternalEndPoint =
new IPEndPoint(Util.GetHostFromDNS(externalHostName), (int)simPort);
1232 regionInfo =
new RegionInfo(regX, regY, neighbourInternalEndPoint, externalHostName);
1233 regionInfo.RemotingPort = remotingPort;
1234 regionInfo.RemotingAddress = externalHostName;
1235 regionInfo.HttpPort = httpPort;
1236 regionInfo.RegionID = regionID;
1237 regionInfo.RegionName = regionName;
1238 regionInfo.ServerURI = serverURI;
1244 return m_internalEndPoint.Port;
1249 Dictionary<string, object> kvp =
new Dictionary<string, object>();
1250 kvp[
"uuid"] = RegionID.ToString();
1251 kvp[
"locX"] = RegionLocX.ToString();
1252 kvp[
"locY"] = RegionLocY.ToString();
1253 kvp[
"external_ip_address"] = ExternalEndPoint.Address.ToString();
1254 kvp[
"external_port"] = ExternalEndPoint.Port.ToString();
1255 kvp[
"external_host_name"] = ExternalHostName;
1256 kvp[
"http_port"] = HttpPort.ToString();
1257 kvp[
"internal_ip_address"] = InternalEndPoint.Address.ToString();
1258 kvp[
"internal_port"] = InternalEndPoint.Port.ToString();
1259 kvp[
"alternate_ports"] = m_allow_alternate_ports.ToString();
1260 kvp[
"server_uri"] = ServerURI;
void SetDefaultRegionSize()
OpenSim.Framework.RegionInfo RegionInfo
void UnpackRegionInfoData(OSDMap args)
int getInternalEndPointPort()
OSDMap PackRegionInfoData()
void SaveRegionToFile(string description, string filename)
RegionInfo(uint legacyRegionLocX, uint legacyRegionLocY, IPEndPoint internalEndPoint, string externalUri)
ConfigurationMember configMember
OpenMetaverse.StructuredData.OSDMap OSDMap
void loadConfigurationOptionsFromMe()
OpenSim.Framework.RegionSettings RegionSettings
string GetSetting(string key)
void loadConfigurationOptions()
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString key
void SetEndPoint(string ipaddr, int port)
void SaveLastMapUUID(UUID mapUUID)
RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource, string configName)
IPEndPoint m_internalEndPoint
void SetExtraSetting(string key, string value)
bool Allow_Alternate_Ports
OpenMetaverse.StructuredData.OSD OSD
string m_externalHostName
RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource)
static RegionInfo Create(UUID regionID, string regionName, uint regX, uint regY, string externalHostName, uint httpPort, uint simPort, uint remotingPort, string serverURI)
bool handleIncomingConfiguration(string configuration_key, object configuration_result)
bool m_allow_alternate_ports
RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource)
Dictionary< string, object > ToKeyValuePairs()