aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Client/Linden/LLProxyLoginModule.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLLegacyRegionData.cs4
-rw-r--r--OpenSim/Framework/AssetConfig.cs87
-rw-r--r--OpenSim/Framework/AssetRequest.cs37
-rw-r--r--OpenSim/Framework/AssetStorage.cs48
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs16
-rw-r--r--OpenSim/Framework/Communications/Clients/AuthClient.cs2
-rw-r--r--OpenSim/Framework/IAssetCache.cs114
-rw-r--r--OpenSim/Framework/InventoryConfig.cs113
-rw-r--r--OpenSim/Framework/NeighbourInfo.cs42
-rw-r--r--OpenSim/Framework/Parallel.cs211
-rw-r--r--OpenSim/Framework/ProxyCodec.cs68
-rw-r--r--OpenSim/Framework/RegionInfo.cs410
-rw-r--r--OpenSim/Framework/RegionUpData.cs68
-rw-r--r--OpenSim/Framework/Remoting.cs134
-rw-r--r--OpenSim/Framework/SerializableInventory.cs58
-rw-r--r--OpenSim/Framework/SerializableRegionInfo.cs202
-rw-r--r--OpenSim/Framework/WearableItem.cs355
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs2
-rw-r--r--OpenSim/Region/DataSnapshot/ObjectSnapshot.cs70
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs37
22 files changed, 247 insertions, 1842 deletions
diff --git a/OpenSim/Client/Linden/LLProxyLoginModule.cs b/OpenSim/Client/Linden/LLProxyLoginModule.cs
index ad67c44..efae234 100644
--- a/OpenSim/Client/Linden/LLProxyLoginModule.cs
+++ b/OpenSim/Client/Linden/LLProxyLoginModule.cs
@@ -304,7 +304,7 @@ namespace OpenSim.Client.Linden
304 } 304 }
305 catch (Exception e) 305 catch (Exception e)
306 { 306 {
307 m_log.WarnFormat("[CLIENT]: Unable to receive user. Reason: {0}", e); 307 m_log.WarnFormat("[CLIENT]: Unable to receive user. Reason: {0} ({1})", e, e.StackTrace);
308 Hashtable respdata = new Hashtable(); 308 Hashtable respdata = new Hashtable();
309 respdata["success"] = "FALSE"; 309 respdata["success"] = "FALSE";
310 respdata["reason"] = "Exception occurred"; 310 respdata["reason"] = "Exception occurred";
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index aecfaa3..9a4a4bb 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -480,8 +480,8 @@ namespace OpenSim.Data.MySQL
480 else 480 else
481 { 481 {
482 m_log.WarnFormat( 482 m_log.WarnFormat(
483 "[REGION DB]: Database contains an orphan child prim {0} {1} at {2} in region {3} pointing to missing parent {4}. This prim will not be loaded.", 483 "[REGION DB]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.",
484 prim.Name, prim.UUID, prim.AbsolutePosition, regionID, prim.ParentUUID); 484 prim.Name, prim.UUID, regionID, prim.ParentUUID);
485 } 485 }
486 } 486 }
487 } 487 }
diff --git a/OpenSim/Framework/AssetConfig.cs b/OpenSim/Framework/AssetConfig.cs
deleted file mode 100644
index 9ee41a1..0000000
--- a/OpenSim/Framework/AssetConfig.cs
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.IO;
30
31namespace OpenSim.Framework
32{
33 /// <summary>
34 /// AssetConfig -- For Asset Server Configuration
35 /// </summary>
36 public class AssetConfig:ConfigBase
37 {
38 public string DatabaseConnect = String.Empty;
39 public string DatabaseProvider = String.Empty;
40 public uint HttpPort = ConfigSettings.DefaultAssetServerHttpPort;
41 public string AssetSetsLocation = string.Empty;
42
43 public AssetConfig(string description, string filename)
44 {
45 m_configMember =
46 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
47 m_configMember.performConfigurationRetrieve();
48 }
49
50 public void loadConfigurationOptions()
51 {
52 m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
53 "DLL for database provider", "OpenSim.Data.MySQL.dll", false);
54
55 m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
56 "Database connection string", "", false);
57
58 m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
59 "Http Listener port", ConfigSettings.DefaultAssetServerHttpPort.ToString(), false);
60
61 m_configMember.addConfigurationOption("assetset_location", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
62 "Location of 'AssetSets.xml'",
63 string.Format(".{0}assets{0}AssetSets.xml", Path.DirectorySeparatorChar), false);
64 }
65
66 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
67 {
68 switch (configuration_key)
69 {
70 case "database_provider":
71 DatabaseProvider = (string) configuration_result;
72 break;
73 case "database_connect":
74 DatabaseConnect = (string) configuration_result;
75 break;
76 case "assetset_location":
77 AssetSetsLocation = (string) configuration_result;
78 break;
79 case "http_port":
80 HttpPort = (uint) configuration_result;
81 break;
82 }
83
84 return true;
85 }
86 }
87}
diff --git a/OpenSim/Framework/AssetRequest.cs b/OpenSim/Framework/AssetRequest.cs
deleted file mode 100644
index fa4e2f9..0000000
--- a/OpenSim/Framework/AssetRequest.cs
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework
31{
32 public struct AssetRequest
33 {
34 public UUID AssetID;
35 public bool IsTexture;
36 }
37}
diff --git a/OpenSim/Framework/AssetStorage.cs b/OpenSim/Framework/AssetStorage.cs
deleted file mode 100644
index 7dab2f2..0000000
--- a/OpenSim/Framework/AssetStorage.cs
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework
31{
32 public class AssetStorage
33 {
34 public byte[] Data;
35 public string Name;
36 public sbyte Type;
37 public UUID UUID;
38
39 public AssetStorage()
40 {
41 }
42
43 public AssetStorage(UUID assetUUID)
44 {
45 UUID = assetUUID;
46 }
47 }
48}
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 9e12d948..29a9e14 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -139,9 +139,16 @@ namespace OpenSim.Framework.Communications.Cache
139 else 139 else
140 { 140 {
141 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname); 141 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname);
142 142
143 if (userProfile != null) 143 if (userProfile != null)
144 {
145 if ((userProfile.UserAssetURI == null || userProfile.UserAssetURI == "") && m_commsManager.NetworkServersInfo != null)
146 userProfile.UserAssetURI = m_commsManager.NetworkServersInfo.AssetURL;
147 if ((userProfile.UserInventoryURI == null || userProfile.UserInventoryURI == "") && m_commsManager.NetworkServersInfo != null)
148 userProfile.UserInventoryURI = m_commsManager.NetworkServersInfo.InventoryURL;
149
144 return AddToCaches(userProfile); 150 return AddToCaches(userProfile);
151 }
145 else 152 else
146 return null; 153 return null;
147 } 154 }
@@ -169,7 +176,14 @@ namespace OpenSim.Framework.Communications.Cache
169 { 176 {
170 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID); 177 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID);
171 if (userProfile != null) 178 if (userProfile != null)
179 {
180 if ((userProfile.UserAssetURI == null || userProfile.UserAssetURI == "") && m_commsManager.NetworkServersInfo != null)
181 userProfile.UserAssetURI = m_commsManager.NetworkServersInfo.AssetURL;
182 if ((userProfile.UserInventoryURI == null || userProfile.UserInventoryURI == "") && m_commsManager.NetworkServersInfo != null)
183 userProfile.UserInventoryURI = m_commsManager.NetworkServersInfo.InventoryURL;
184
172 return AddToCaches(userProfile); 185 return AddToCaches(userProfile);
186 }
173 else 187 else
174 return null; 188 return null;
175 } 189 }
diff --git a/OpenSim/Framework/Communications/Clients/AuthClient.cs b/OpenSim/Framework/Communications/Clients/AuthClient.cs
index 6b4bfec..adae637 100644
--- a/OpenSim/Framework/Communications/Clients/AuthClient.cs
+++ b/OpenSim/Framework/Communications/Clients/AuthClient.cs
@@ -136,7 +136,7 @@ namespace OpenSim.Framework.Communications.Clients
136 } 136 }
137 137
138 Hashtable responseData = (Hashtable)UserResp.Value; 138 Hashtable responseData = (Hashtable)UserResp.Value;
139 if (responseData.ContainsKey("auth_session") && responseData["auth_session"].ToString() == "TRUE") 139 if (responseData != null && responseData.ContainsKey("auth_session") && responseData["auth_session"] != null && responseData["auth_session"].ToString() == "TRUE")
140 { 140 {
141 //System.Console.WriteLine("[Authorization]: userserver reported authorized session for user " + userID); 141 //System.Console.WriteLine("[Authorization]: userserver reported authorized session for user " + userID);
142 return true; 142 return true;
diff --git a/OpenSim/Framework/IAssetCache.cs b/OpenSim/Framework/IAssetCache.cs
deleted file mode 100644
index 654180d..0000000
--- a/OpenSim/Framework/IAssetCache.cs
+++ /dev/null
@@ -1,114 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenMetaverse.Packets;
30
31namespace OpenSim.Framework
32{
33 public delegate void AssetRequestCallback(UUID assetId, AssetBase asset);
34
35 /// <summary>
36 /// Interface to the local asset cache. This is the mechanism through which assets can be added and requested.
37 /// </summary>
38 public interface IAssetCache : IPlugin
39 {
40 /// <value>
41 /// The 'server' from which assets can be requested and to which assets are persisted.
42 /// </value>
43
44 void Initialise(ConfigSettings cs);
45
46 /// <summary>
47 /// Report statistical data to the log.
48 /// </summary>
49 void ShowState();
50
51 /// <summary>
52 /// Clear the asset cache.
53 /// </summary>
54 void Clear();
55
56 /// <summary>
57 /// Get an asset only if it's already in the cache.
58 /// </summary>
59 /// <param name="assetId"></param>
60 /// <param name="asset"></param>
61 /// <returns>true if the asset was in the cache, false if it was not</returns>
62 bool TryGetCachedAsset(UUID assetID, out AssetBase asset);
63
64 /// <summary>
65 /// Asynchronously retrieve an asset.
66 /// </summary>
67 /// <param name="assetId"></param>
68 /// <param name="callback">
69 /// <param name="isTexture"></param>
70 /// A callback invoked when the asset has either been found or not found.
71 /// If the asset was found this is called with the asset UUID and the asset data
72 /// If the asset was not found this is still called with the asset UUID but with a null asset data reference</param>
73 void GetAsset(UUID assetID, AssetRequestCallback callback, bool isTexture);
74
75 /// <summary>
76 /// Synchronously retreive an asset. If the asset isn't in the cache, a request will be made to the persistent store to
77 /// load it into the cache.
78 /// </summary>
79 ///
80 /// XXX We'll keep polling the cache until we get the asset or we exceed
81 /// the allowed number of polls. This isn't a very good way of doing things since a single thread
82 /// is processing inbound packets, so if the asset server is slow, we could block this for up to
83 /// the timeout period. Whereever possible we want to use the asynchronous callback GetAsset()
84 ///
85 /// <param name="assetID"></param>
86 /// <param name="isTexture"></param>
87 /// <returns>null if the asset could not be retrieved</returns>
88 AssetBase GetAsset(UUID assetID, bool isTexture);
89
90 /// <summary>
91 /// Add an asset to both the persistent store and the cache.
92 /// </summary>
93 /// <param name="asset"></param>
94 void AddAsset(AssetBase asset);
95
96 /// <summary>
97 /// Expire an asset from the cache
98 /// </summary>
99 /// Allows you to clear a specific asset by uuid out
100 /// of the asset cache. This is needed because the osdynamic
101 /// texture code grows the asset cache without bounds. The
102 /// real solution here is a much better cache archicture, but
103 /// this is a stop gap measure until we have such a thing.
104 void ExpireAsset(UUID assetID);
105
106 /// <summary>
107 /// Handle an asset request from the client. The result will be sent back asynchronously.
108 /// </summary>
109 /// <param name="userInfo"></param>
110 /// <param name="transferRequest"></param>
111 void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest);
112 }
113
114}
diff --git a/OpenSim/Framework/InventoryConfig.cs b/OpenSim/Framework/InventoryConfig.cs
deleted file mode 100644
index f539d55..0000000
--- a/OpenSim/Framework/InventoryConfig.cs
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenSim.Framework
31{
32 /// <summary>
33 /// Defines and handles inventory grid server configuration
34 /// </summary>
35 public class InventoryConfig:ConfigBase
36 {
37 public string DatabaseConnect = String.Empty;
38 public string DatabaseProvider = String.Empty;
39 public string DefaultStartupMsg = String.Empty;
40 public uint HttpPort = ConfigSettings.DefaultInventoryServerHttpPort;
41 public string InventoryServerURL = String.Empty;
42 public string UserServerURL = String.Empty;
43 public string AssetServerURL = String.Empty;
44 public bool SessionLookUp = true;
45 public bool RegionAccessToAgentsInventory = true;
46
47 public InventoryConfig(string description, string filename)
48 {
49 m_configMember =
50 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
51 m_configMember.performConfigurationRetrieve();
52 }
53
54 public void loadConfigurationOptions()
55 {
56 m_configMember.addConfigurationOption("default_inventory_server",
57 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
58 "Default Inventory Server URI (this server's external name)",
59 "http://127.0.0.1:8004", false);
60 m_configMember.addConfigurationOption("default_user_server",
61 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
62 "Default User Server URI",
63 "http://127.0.0.1:8002", false);
64 m_configMember.addConfigurationOption("default_asset_server",
65 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
66 "Default Asset Server URI",
67 "http://127.0.0.1:8003", false);
68 m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
69 "DLL for database provider", "OpenSim.Data.MySQL.dll", false);
70 m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
71 "Database Connect String", "", false);
72 m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
73 "Http Listener port", ConfigSettings.DefaultInventoryServerHttpPort.ToString(), false);
74 m_configMember.addConfigurationOption("session_lookup", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
75 "Enable session lookup security", "False", false);
76 m_configMember.addConfigurationOption("region_access", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
77 "Allow direct region access to users inventories? (Keep True if you don't know what this is about)", "True", false);
78 }
79
80 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
81 {
82 switch (configuration_key)
83 {
84 case "default_inventory_server":
85 InventoryServerURL = (string)configuration_result;
86 break;
87 case "default_user_server":
88 UserServerURL = (string) configuration_result;
89 break;
90 case "default_asset_server":
91 AssetServerURL = (string)configuration_result;
92 break;
93 case "database_provider":
94 DatabaseProvider = (string) configuration_result;
95 break;
96 case "database_connect":
97 DatabaseConnect = (string) configuration_result;
98 break;
99 case "http_port":
100 HttpPort = (uint) configuration_result;
101 break;
102 case "session_lookup":
103 SessionLookUp = (bool)configuration_result;
104 break;
105 case "region_access":
106 RegionAccessToAgentsInventory = (bool)configuration_result;
107 break;
108 }
109
110 return true;
111 }
112 }
113}
diff --git a/OpenSim/Framework/NeighbourInfo.cs b/OpenSim/Framework/NeighbourInfo.cs
deleted file mode 100644
index 3a46fbb..0000000
--- a/OpenSim/Framework/NeighbourInfo.cs
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Framework
29{
30 public class NeighbourInfo
31 {
32 public ulong regionhandle;
33 public uint RegionLocX;
34 public uint RegionLocY;
35 public string sim_ip;
36 public uint sim_port;
37
38 public NeighbourInfo()
39 {
40 }
41 }
42} \ No newline at end of file
diff --git a/OpenSim/Framework/Parallel.cs b/OpenSim/Framework/Parallel.cs
deleted file mode 100644
index a0394f2..0000000
--- a/OpenSim/Framework/Parallel.cs
+++ /dev/null
@@ -1,211 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Threading;
31
32namespace OpenSim.Framework
33{
34 /// <summary>
35 /// Provides helper methods for parallelizing loops
36 /// </summary>
37 public static class Parallel
38 {
39 public static readonly int ProcessorCount = System.Environment.ProcessorCount;
40
41 /// <summary>
42 /// Executes a for loop in which iterations may run in parallel
43 /// </summary>
44 /// <param name="fromInclusive">The loop will be started at this index</param>
45 /// <param name="toExclusive">The loop will be terminated before this index is reached</param>
46 /// <param name="body">Method body to run for each iteration of the loop</param>
47 public static void For(int fromInclusive, int toExclusive, Action<int> body)
48 {
49 For(ProcessorCount, fromInclusive, toExclusive, body);
50 }
51
52 /// <summary>
53 /// Executes a for loop in which iterations may run in parallel
54 /// </summary>
55 /// <param name="threadCount">The number of concurrent execution threads to run</param>
56 /// <param name="fromInclusive">The loop will be started at this index</param>
57 /// <param name="toExclusive">The loop will be terminated before this index is reached</param>
58 /// <param name="body">Method body to run for each iteration of the loop</param>
59 public static void For(int threadCount, int fromInclusive, int toExclusive, Action<int> body)
60 {
61 int counter = threadCount;
62 AutoResetEvent threadFinishEvent = new AutoResetEvent(false);
63 Exception exception = null;
64
65 --fromInclusive;
66
67 for (int i = 0; i < threadCount; i++)
68 {
69 Util.FireAndForget(
70 delegate(object o)
71 {
72// int threadIndex = (int)o;
73
74 while (exception == null)
75 {
76 int currentIndex = Interlocked.Increment(ref fromInclusive);
77
78 if (currentIndex >= toExclusive)
79 break;
80
81 try { body(currentIndex); }
82 catch (Exception ex) { exception = ex; break; }
83 }
84
85 if (Interlocked.Decrement(ref counter) == 0)
86 threadFinishEvent.Set();
87 }, i
88 );
89 }
90
91 threadFinishEvent.WaitOne();
92 threadFinishEvent.Close();
93
94 if (exception != null)
95 throw new Exception(exception.Message, exception);
96 }
97
98 /// <summary>
99 /// Executes a foreach loop in which iterations may run in parallel
100 /// </summary>
101 /// <typeparam name="T">Object type that the collection wraps</typeparam>
102 /// <param name="enumerable">An enumerable collection to iterate over</param>
103 /// <param name="body">Method body to run for each object in the collection</param>
104 public static void ForEach<T>(IEnumerable<T> enumerable, Action<T> body)
105 {
106 ForEach<T>(ProcessorCount, enumerable, body);
107 }
108
109 /// <summary>
110 /// Executes a foreach loop in which iterations may run in parallel
111 /// </summary>
112 /// <typeparam name="T">Object type that the collection wraps</typeparam>
113 /// <param name="threadCount">The number of concurrent execution threads to run</param>
114 /// <param name="enumerable">An enumerable collection to iterate over</param>
115 /// <param name="body">Method body to run for each object in the collection</param>
116 public static void ForEach<T>(int threadCount, IEnumerable<T> enumerable, Action<T> body)
117 {
118 int counter = threadCount;
119 AutoResetEvent threadFinishEvent = new AutoResetEvent(false);
120 IEnumerator<T> enumerator = enumerable.GetEnumerator();
121 object syncRoot = new object();
122 Exception exception = null;
123
124 for (int i = 0; i < threadCount; i++)
125 {
126 Util.FireAndForget(
127 delegate(object o)
128 {
129// int threadIndex = (int)o;
130
131 while (exception == null)
132 {
133 T entry;
134
135 lock (syncRoot)
136 {
137 if (!enumerator.MoveNext())
138 break;
139 entry = (T)enumerator.Current; // Explicit typecast for Mono's sake
140 }
141
142 try { body(entry); }
143 catch (Exception ex) { exception = ex; break; }
144 }
145
146 if (Interlocked.Decrement(ref counter) == 0)
147 threadFinishEvent.Set();
148 }, i
149 );
150 }
151
152 threadFinishEvent.WaitOne();
153 threadFinishEvent.Close();
154
155 if (exception != null)
156 throw new Exception(exception.Message, exception);
157 }
158
159 /// <summary>
160 /// Executes a series of tasks in parallel
161 /// </summary>
162 /// <param name="actions">A series of method bodies to execute</param>
163 public static void Invoke(params Action[] actions)
164 {
165 Invoke(ProcessorCount, actions);
166 }
167
168 /// <summary>
169 /// Executes a series of tasks in parallel
170 /// </summary>
171 /// <param name="threadCount">The number of concurrent execution threads to run</param>
172 /// <param name="actions">A series of method bodies to execute</param>
173 public static void Invoke(int threadCount, params Action[] actions)
174 {
175 int counter = threadCount;
176 AutoResetEvent threadFinishEvent = new AutoResetEvent(false);
177 int index = -1;
178 Exception exception = null;
179
180 for (int i = 0; i < threadCount; i++)
181 {
182 Util.FireAndForget(
183 delegate(object o)
184 {
185// int threadIndex = (int)o;
186
187 while (exception == null)
188 {
189 int currentIndex = Interlocked.Increment(ref index);
190
191 if (currentIndex >= actions.Length)
192 break;
193
194 try { actions[currentIndex](); }
195 catch (Exception ex) { exception = ex; break; }
196 }
197
198 if (Interlocked.Decrement(ref counter) == 0)
199 threadFinishEvent.Set();
200 }, i
201 );
202 }
203
204 threadFinishEvent.WaitOne();
205 threadFinishEvent.Close();
206
207 if (exception != null)
208 throw new Exception(exception.Message, exception);
209 }
210 }
211}
diff --git a/OpenSim/Framework/ProxyCodec.cs b/OpenSim/Framework/ProxyCodec.cs
deleted file mode 100644
index 130581a..0000000
--- a/OpenSim/Framework/ProxyCodec.cs
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Net;
30
31namespace OpenSim.Framework
32{
33 public sealed class ProxyCodec
34 {
35 public static void EncodeProxyMessage(byte[] bytes, ref int numBytes, EndPoint trueEP)
36 {
37 if (numBytes > 4090) // max UPD size = 4096
38 {
39 throw new Exception("ERROR: No space to encode the proxy EP");
40 }
41
42 ushort port = (ushort) ((IPEndPoint) trueEP).Port;
43 bytes[numBytes++] = (byte) (port % 256);
44 bytes[numBytes++] = (byte) (port / 256);
45
46 foreach (byte b in ((IPEndPoint) trueEP).Address.GetAddressBytes())
47 {
48 bytes[numBytes++] = b;
49 }
50 }
51
52 public static IPEndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes)
53 {
54 // IPv4 Only
55 byte[] addr = new byte[4];
56
57 addr[3] = bytes[--numBytes];
58 addr[2] = bytes[--numBytes];
59 addr[1] = bytes[--numBytes];
60 addr[0] = bytes[--numBytes];
61
62 ushort port = (ushort) (bytes[--numBytes] * 256);
63 port += (ushort) bytes[--numBytes];
64
65 return new IPEndPoint(new IPAddress(addr), (int) port);
66 }
67 }
68}
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 721233d..88b62e0 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -38,238 +38,7 @@ using OpenSim.Framework.Console;
38 38
39namespace OpenSim.Framework 39namespace OpenSim.Framework
40{ 40{
41 [Serializable] 41 public class RegionInfo
42 public class SimpleRegionInfo
43 {
44 // private static readonly log4net.ILog m_log
45 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
46
47 /// <summary>
48 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
49 /// </summary>
50 public uint HttpPort
51 {
52 get { return m_httpPort; }
53 set { m_httpPort = value; }
54 }
55 protected uint m_httpPort;
56
57 /// <summary>
58 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
59 /// </summary>
60 public string ServerURI
61 {
62 get { return m_serverURI; }
63 set { m_serverURI = value; }
64 }
65 protected string m_serverURI;
66
67 public string RegionName
68 {
69 get { return m_regionName; }
70 set { m_regionName = value; }
71 }
72 protected string m_regionName = String.Empty;
73
74 protected bool Allow_Alternate_Ports;
75 public bool m_allow_alternate_ports;
76 protected string m_externalHostName;
77
78 protected IPEndPoint m_internalEndPoint;
79 protected uint? m_regionLocX;
80 protected uint? m_regionLocY;
81 protected uint m_remotingPort;
82 public UUID RegionID = UUID.Zero;
83 public string RemotingAddress;
84 public UUID ScopeID = UUID.Zero;
85
86 public SimpleRegionInfo()
87 {
88 }
89
90 public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
91 {
92 m_regionLocX = regionLocX;
93 m_regionLocY = regionLocY;
94
95 m_internalEndPoint = internalEndPoint;
96 m_externalHostName = externalUri;
97 }
98
99 public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port)
100 {
101 m_regionLocX = regionLocX;
102 m_regionLocY = regionLocY;
103
104 m_externalHostName = externalUri;
105
106 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
107 }
108
109 public SimpleRegionInfo(RegionInfo ConvertFrom)
110 {
111 m_regionName = ConvertFrom.RegionName;
112 m_regionLocX = ConvertFrom.RegionLocX;
113 m_regionLocY = ConvertFrom.RegionLocY;
114 m_internalEndPoint = ConvertFrom.InternalEndPoint;
115 m_externalHostName = ConvertFrom.ExternalHostName;
116 m_remotingPort = ConvertFrom.RemotingPort;
117 m_httpPort = ConvertFrom.HttpPort;
118 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
119 RemotingAddress = ConvertFrom.RemotingAddress;
120 RegionID = UUID.Zero;
121 ServerURI = ConvertFrom.ServerURI;
122 }
123
124 public uint RemotingPort
125 {
126 get { return m_remotingPort; }
127 set { m_remotingPort = value; }
128 }
129
130 /// <value>
131 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
132 ///
133 /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method?
134 /// </value>
135 public IPEndPoint ExternalEndPoint
136 {
137 get
138 {
139 // Old one defaults to IPv6
140 //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
141
142 IPAddress ia = null;
143 // If it is already an IP, don't resolve it - just return directly
144 if (IPAddress.TryParse(m_externalHostName, out ia))
145 return new IPEndPoint(ia, m_internalEndPoint.Port);
146
147 // Reset for next check
148 ia = null;
149 try
150 {
151 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
152 {
153 if (ia == null)
154 ia = Adr;
155
156 if (Adr.AddressFamily == AddressFamily.InterNetwork)
157 {
158 ia = Adr;
159 break;
160 }
161 }
162 }
163 catch (SocketException e)
164 {
165 throw new Exception(
166 "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
167 e + "' attached to this exception", e);
168 }
169
170 return new IPEndPoint(ia, m_internalEndPoint.Port);
171 }
172
173 set { m_externalHostName = value.ToString(); }
174 }
175
176 public string ExternalHostName
177 {
178 get { return m_externalHostName; }
179 set { m_externalHostName = value; }
180 }
181
182 public IPEndPoint InternalEndPoint
183 {
184 get { return m_internalEndPoint; }
185 set { m_internalEndPoint = value; }
186 }
187
188 public uint RegionLocX
189 {
190 get { return m_regionLocX.Value; }
191 set { m_regionLocX = value; }
192 }
193
194 public uint RegionLocY
195 {
196 get { return m_regionLocY.Value; }
197 set { m_regionLocY = value; }
198 }
199
200 public ulong RegionHandle
201 {
202 get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
203 }
204
205 public int getInternalEndPointPort()
206 {
207 return m_internalEndPoint.Port;
208 }
209
210 public Dictionary<string, object> ToKeyValuePairs()
211 {
212 Dictionary<string, object> kvp = new Dictionary<string, object>();
213 kvp["uuid"] = RegionID.ToString();
214 kvp["locX"] = RegionLocX.ToString();
215 kvp["locY"] = RegionLocY.ToString();
216 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
217 kvp["external_port"] = ExternalEndPoint.Port.ToString();
218 kvp["external_host_name"] = ExternalHostName;
219 kvp["http_port"] = HttpPort.ToString();
220 kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
221 kvp["internal_port"] = InternalEndPoint.Port.ToString();
222 kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
223 kvp["server_uri"] = ServerURI;
224
225 return kvp;
226 }
227
228 public SimpleRegionInfo(Dictionary<string, object> kvp)
229 {
230 if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null))
231 {
232 int port = 0;
233 Int32.TryParse((string)kvp["external_port"], out port);
234 IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port);
235 ExternalEndPoint = ep;
236 }
237 else
238 ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
239
240 if (kvp["external_host_name"] != null)
241 ExternalHostName = (string)kvp["external_host_name"];
242
243 if (kvp["http_port"] != null)
244 {
245 UInt32 port = 0;
246 UInt32.TryParse((string)kvp["http_port"], out port);
247 HttpPort = port;
248 }
249
250 if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null))
251 {
252 int port = 0;
253 Int32.TryParse((string)kvp["internal_port"], out port);
254 IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port);
255 InternalEndPoint = ep;
256 }
257 else
258 InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
259
260 if (kvp["alternate_ports"] != null)
261 {
262 bool alts = false;
263 Boolean.TryParse((string)kvp["alternate_ports"], out alts);
264 m_allow_alternate_ports = alts;
265 }
266
267 if (kvp["server_uri"] != null)
268 ServerURI = (string)kvp["server_uri"];
269 }
270 }
271
272 public class RegionInfo : SimpleRegionInfo
273 { 42 {
274 // private static readonly log4net.ILog m_log 43 // private static readonly log4net.ILog m_log
275 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 44 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -304,6 +73,19 @@ namespace OpenSim.Framework
304 private bool m_clampPrimSize = false; 73 private bool m_clampPrimSize = false;
305 private int m_objectCapacity = 0; 74 private int m_objectCapacity = 0;
306 private string m_regionType = String.Empty; 75 private string m_regionType = String.Empty;
76 protected uint m_httpPort;
77 protected string m_serverURI;
78 protected string m_regionName = String.Empty;
79 protected bool Allow_Alternate_Ports;
80 public bool m_allow_alternate_ports;
81 protected string m_externalHostName;
82 protected IPEndPoint m_internalEndPoint;
83 protected uint? m_regionLocX;
84 protected uint? m_regionLocY;
85 protected uint m_remotingPort;
86 public UUID RegionID = UUID.Zero;
87 public string RemotingAddress;
88 public UUID ScopeID = UUID.Zero;
307 89
308 90
309 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. 91 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
@@ -386,42 +168,17 @@ namespace OpenSim.Framework
386 configMember.performConfigurationRetrieve(); 168 configMember.performConfigurationRetrieve();
387 } 169 }
388 170
389 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : 171 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
390 base(regionLocX, regionLocY, internalEndPoint, externalUri)
391 { 172 {
392 } 173 m_regionLocX = regionLocX;
393 174 m_regionLocY = regionLocY;
394 public RegionInfo()
395 {
396 }
397 175
398 public RegionInfo(SerializableRegionInfo ConvertFrom) 176 m_internalEndPoint = internalEndPoint;
399 { 177 m_externalHostName = externalUri;
400 m_regionLocX = ConvertFrom.RegionLocX;
401 m_regionLocY = ConvertFrom.RegionLocY;
402 m_internalEndPoint = ConvertFrom.InternalEndPoint;
403 m_externalHostName = ConvertFrom.ExternalHostName;
404 m_remotingPort = ConvertFrom.RemotingPort;
405 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
406 RemotingAddress = ConvertFrom.RemotingAddress;
407 RegionID = UUID.Zero;
408 proxyUrl = ConvertFrom.ProxyUrl;
409 originRegionID = ConvertFrom.OriginRegionID;
410 RegionName = ConvertFrom.RegionName;
411 ServerURI = ConvertFrom.ServerURI;
412 } 178 }
413 179
414 public RegionInfo(SimpleRegionInfo ConvertFrom) 180 public RegionInfo()
415 { 181 {
416 m_regionLocX = ConvertFrom.RegionLocX;
417 m_regionLocY = ConvertFrom.RegionLocY;
418 m_internalEndPoint = ConvertFrom.InternalEndPoint;
419 m_externalHostName = ConvertFrom.ExternalHostName;
420 m_remotingPort = ConvertFrom.RemotingPort;
421 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
422 RemotingAddress = ConvertFrom.RemotingAddress;
423 RegionID = UUID.Zero;
424 ServerURI = ConvertFrom.ServerURI;
425 } 182 }
426 183
427 public EstateSettings EstateSettings 184 public EstateSettings EstateSettings
@@ -484,6 +241,111 @@ namespace OpenSim.Framework
484 get { return m_regionType; } 241 get { return m_regionType; }
485 } 242 }
486 243
244 /// <summary>
245 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
246 /// </summary>
247 public uint HttpPort
248 {
249 get { return m_httpPort; }
250 set { m_httpPort = value; }
251 }
252
253 /// <summary>
254 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
255 /// </summary>
256 public string ServerURI
257 {
258 get { return m_serverURI; }
259 set { m_serverURI = value; }
260 }
261
262 public string RegionName
263 {
264 get { return m_regionName; }
265 set { m_regionName = value; }
266 }
267
268 public uint RemotingPort
269 {
270 get { return m_remotingPort; }
271 set { m_remotingPort = value; }
272 }
273
274 /// <value>
275 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
276 ///
277 /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method?
278 /// </value>
279 public IPEndPoint ExternalEndPoint
280 {
281 get
282 {
283 // Old one defaults to IPv6
284 //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
285
286 IPAddress ia = null;
287 // If it is already an IP, don't resolve it - just return directly
288 if (IPAddress.TryParse(m_externalHostName, out ia))
289 return new IPEndPoint(ia, m_internalEndPoint.Port);
290
291 // Reset for next check
292 ia = null;
293 try
294 {
295 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
296 {
297 if (ia == null)
298 ia = Adr;
299
300 if (Adr.AddressFamily == AddressFamily.InterNetwork)
301 {
302 ia = Adr;
303 break;
304 }
305 }
306 }
307 catch (SocketException e)
308 {
309 throw new Exception(
310 "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
311 e + "' attached to this exception", e);
312 }
313
314 return new IPEndPoint(ia, m_internalEndPoint.Port);
315 }
316
317 set { m_externalHostName = value.ToString(); }
318 }
319
320 public string ExternalHostName
321 {
322 get { return m_externalHostName; }
323 set { m_externalHostName = value; }
324 }
325
326 public IPEndPoint InternalEndPoint
327 {
328 get { return m_internalEndPoint; }
329 set { m_internalEndPoint = value; }
330 }
331
332 public uint RegionLocX
333 {
334 get { return m_regionLocX.Value; }
335 set { m_regionLocX = value; }
336 }
337
338 public uint RegionLocY
339 {
340 get { return m_regionLocY.Value; }
341 set { m_regionLocY = value; }
342 }
343
344 public ulong RegionHandle
345 {
346 get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
347 }
348
487 public void SetEndPoint(string ipaddr, int port) 349 public void SetEndPoint(string ipaddr, int port)
488 { 350 {
489 IPAddress tmpIP = IPAddress.Parse(ipaddr); 351 IPAddress tmpIP = IPAddress.Parse(ipaddr);
@@ -1074,5 +936,27 @@ namespace OpenSim.Framework
1074 return regionInfo; 936 return regionInfo;
1075 } 937 }
1076 938
939 public int getInternalEndPointPort()
940 {
941 return m_internalEndPoint.Port;
942 }
943
944 public Dictionary<string, object> ToKeyValuePairs()
945 {
946 Dictionary<string, object> kvp = new Dictionary<string, object>();
947 kvp["uuid"] = RegionID.ToString();
948 kvp["locX"] = RegionLocX.ToString();
949 kvp["locY"] = RegionLocY.ToString();
950 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
951 kvp["external_port"] = ExternalEndPoint.Port.ToString();
952 kvp["external_host_name"] = ExternalHostName;
953 kvp["http_port"] = HttpPort.ToString();
954 kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
955 kvp["internal_port"] = InternalEndPoint.Port.ToString();
956 kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
957 kvp["server_uri"] = ServerURI;
958
959 return kvp;
960 }
1077 } 961 }
1078} 962}
diff --git a/OpenSim/Framework/RegionUpData.cs b/OpenSim/Framework/RegionUpData.cs
deleted file mode 100644
index 12e4442..0000000
--- a/OpenSim/Framework/RegionUpData.cs
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenSim.Framework
31{
32 [Serializable]
33 public class RegionUpData
34 {
35 private string m_ipaddr = "";
36 private int m_port = 0;
37 private uint m_X = 0;
38 private uint m_Y = 0;
39
40 public RegionUpData(uint X, uint Y, string ipaddr, int port)
41 {
42 m_X = X;
43 m_Y = Y;
44 m_ipaddr = ipaddr;
45 m_port = port;
46 }
47
48 public uint X
49 {
50 get { return m_X; }
51 }
52
53 public uint Y
54 {
55 get { return m_Y; }
56 }
57
58 public string IPADDR
59 {
60 get { return m_ipaddr; }
61 }
62
63 public int PORT
64 {
65 get { return m_port; }
66 }
67 }
68} \ No newline at end of file
diff --git a/OpenSim/Framework/Remoting.cs b/OpenSim/Framework/Remoting.cs
deleted file mode 100644
index 75024ef..0000000
--- a/OpenSim/Framework/Remoting.cs
+++ /dev/null
@@ -1,134 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Security.Cryptography;
30using System.Text;
31
32namespace OpenSim.Framework
33{
34 /// <summary>
35 /// NEEDS AUDIT.
36 /// </summary>
37 /// <remarks>
38 /// Suggested implementation
39 /// <para>Store two digests for each foreign host. A local copy of the local hash using the local challenge (when issued), and a local copy of the remote hash using the remote challenge.</para>
40 /// <para>When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message.</para>
41 /// <para>When receiving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para>
42 /// <para>Both hosts should be performing these operations for this to be effective.</para>
43 /// </remarks>
44 internal class RemoteDigest
45 {
46 private byte[] currentHash;
47 private byte[] secret;
48
49 private SHA512Managed SHA512;
50
51 /// <summary>
52 /// Initialises a new RemoteDigest authentication mechanism
53 /// </summary>
54 /// <remarks>Needs an audit by a cryptographic professional - was not "roll your own"'d by choice but rather a serious lack of decent authentication mechanisms in .NET remoting</remarks>
55 /// <param name="sharedSecret">The shared secret between systems (for inter-sim, this is provided in encrypted form during connection, for grid this is input manually in setup)</param>
56 /// <param name="salt">Binary salt - some common value - to be decided what</param>
57 /// <param name="challenge">The challenge key provided by the third party</param>
58 public RemoteDigest(string sharedSecret, byte[] salt, string challenge)
59 {
60 SHA512 = new SHA512Managed();
61 Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret, salt);
62 secret = RFC2898.GetBytes(512);
63 ASCIIEncoding ASCII = new ASCIIEncoding();
64
65 currentHash = SHA512.ComputeHash(AppendArrays(secret, ASCII.GetBytes(challenge)));
66 }
67
68 /// <summary>
69 /// Authenticates a piece of incoming data against the local digest. Upon successful authentication, digest string is incremented.
70 /// </summary>
71 /// <param name="data">The incoming data</param>
72 /// <param name="digest">The remote digest</param>
73 /// <returns></returns>
74 public bool Authenticate(byte[] data, byte[] digest)
75 {
76 byte[] newHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
77 if (digest == newHash)
78 {
79 currentHash = newHash;
80 return true;
81 }
82 else
83 {
84 throw new Exception("Hash comparison failed. Key resync required.");
85 }
86 }
87
88 /// <summary>
89 /// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message.
90 /// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the
91 /// hashes will get out of sync and throw an exception when validation is attempted.
92 /// </summary>
93 /// <param name="data">The outgoing data</param>
94 /// <returns>The local digest</returns>
95 public byte[] Sign(byte[] data)
96 {
97 currentHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
98 return currentHash;
99 }
100
101 /// <summary>
102 /// Generates a new challenge string to be issued to a foreign host. Challenges are 1024-bit (effective strength of less than 512-bits) messages generated using the Crytographic Random Number Generator.
103 /// </summary>
104 /// <returns>A 128-character hexadecimal string containing the challenge.</returns>
105 public static string GenerateChallenge()
106 {
107 RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider();
108 byte[] bytes = new byte[64];
109 RNG.GetBytes(bytes);
110
111 StringBuilder sb = new StringBuilder(bytes.Length * 2);
112 foreach (byte b in bytes)
113 {
114 sb.AppendFormat("{0:x2}", b);
115 }
116 return sb.ToString();
117 }
118
119 /// <summary>
120 /// Helper function, merges two byte arrays
121 /// </summary>
122 /// <remarks>Sourced from MSDN Forum</remarks>
123 /// <param name="a">A</param>
124 /// <param name="b">B</param>
125 /// <returns>C</returns>
126 private static byte[] AppendArrays(byte[] a, byte[] b)
127 {
128 byte[] c = new byte[a.Length + b.Length];
129 Buffer.BlockCopy(a, 0, c, 0, a.Length);
130 Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
131 return c;
132 }
133 }
134} \ No newline at end of file
diff --git a/OpenSim/Framework/SerializableInventory.cs b/OpenSim/Framework/SerializableInventory.cs
deleted file mode 100644
index 6c7f3ff..0000000
--- a/OpenSim/Framework/SerializableInventory.cs
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections;
29using System.Xml.Serialization;
30
31namespace OpenSim.Framework
32{
33 /*
34 * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder
35 * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize
36 * into this simpler class, and then use that.
37 */
38
39 [XmlRoot(ElementName = "inventory", IsNullable = true)]
40 public class SerializableInventory
41 {
42 [XmlElement(ElementName = "folder", IsNullable = true)] public SerializableFolder root;
43
44 #region Nested type: SerializableFolder
45
46 [XmlRoot(ElementName = "folder", IsNullable = true)]
47 public class SerializableFolder : InventoryFolderBase
48 {
49 [XmlArray(ElementName = "items", IsNullable = true)] [XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof (InventoryItemBase))] public ArrayList
50 Items;
51
52 [XmlArray(ElementName = "folders", IsNullable = true)] [XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof (SerializableFolder))] public
53 ArrayList SubFolders;
54 }
55
56 #endregion
57 }
58} \ No newline at end of file
diff --git a/OpenSim/Framework/SerializableRegionInfo.cs b/OpenSim/Framework/SerializableRegionInfo.cs
deleted file mode 100644
index c3731b2..0000000
--- a/OpenSim/Framework/SerializableRegionInfo.cs
+++ /dev/null
@@ -1,202 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Net;
30using System.Net.Sockets;
31using OpenMetaverse;
32
33namespace OpenSim.Framework
34{
35 [Serializable]
36 public class SerializableRegionInfo
37 {
38 public bool m_allow_alternate_ports;
39 protected string m_externalHostName;
40
41 /// <value>
42 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
43 ///
44 /// FIXME: Defaulting to 9000 temporarily (on the basis that this is the http port most region
45 /// servers are running) until the revision in which this change is made propogates around grids.
46 /// </value>
47 protected uint m_httpPort = 9000;
48
49 protected IPEndPoint m_internalEndPoint;
50 protected Guid m_originRegionID = UUID.Zero.Guid;
51 protected string m_proxyUrl;
52 protected uint? m_regionLocX;
53 protected uint? m_regionLocY;
54 protected string m_regionName;
55 public uint m_remotingPort;
56 protected string m_serverURI;
57 public Guid RegionID = UUID.Zero.Guid;
58 public string RemotingAddress;
59
60 /// <summary>
61 /// This is a serializable version of RegionInfo
62 /// </summary>
63 public SerializableRegionInfo()
64 {
65 }
66
67 public SerializableRegionInfo(RegionInfo ConvertFrom)
68 {
69 m_regionLocX = ConvertFrom.RegionLocX;
70 m_regionLocY = ConvertFrom.RegionLocY;
71 m_internalEndPoint = ConvertFrom.InternalEndPoint;
72 m_externalHostName = ConvertFrom.ExternalHostName;
73 m_remotingPort = ConvertFrom.RemotingPort;
74 m_httpPort = ConvertFrom.HttpPort;
75 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
76 RemotingAddress = ConvertFrom.RemotingAddress;
77 m_proxyUrl = ConvertFrom.proxyUrl;
78 OriginRegionID = ConvertFrom.originRegionID;
79 RegionName = ConvertFrom.RegionName;
80 ServerURI = ConvertFrom.ServerURI;
81 }
82
83 public SerializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
84 {
85 m_regionLocX = regionLocX;
86 m_regionLocY = regionLocY;
87
88 m_internalEndPoint = internalEndPoint;
89 m_externalHostName = externalUri;
90 }
91
92 public SerializableRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port)
93 {
94 m_regionLocX = regionLocX;
95 m_regionLocY = regionLocY;
96
97 m_externalHostName = externalUri;
98
99 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
100 }
101
102 public uint RemotingPort
103 {
104 get { return m_remotingPort; }
105 set { m_remotingPort = value; }
106 }
107
108 public uint HttpPort
109 {
110 get { return m_httpPort; }
111 set { m_httpPort = value; }
112 }
113
114 public IPEndPoint ExternalEndPoint
115 {
116 get
117 {
118 // Old one defaults to IPv6
119 //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
120
121 IPAddress ia = null;
122 // If it is already an IP, don't resolve it - just return directly
123 if (IPAddress.TryParse(m_externalHostName, out ia))
124 return new IPEndPoint(ia, m_internalEndPoint.Port);
125
126 // Reset for next check
127 ia = null;
128
129
130 // New method favors IPv4
131 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
132 {
133 if (ia == null)
134 ia = Adr;
135
136 if (Adr.AddressFamily == AddressFamily.InterNetwork)
137 {
138 ia = Adr;
139 break;
140 }
141 }
142
143 return new IPEndPoint(ia, m_internalEndPoint.Port);
144 }
145
146 set { m_externalHostName = value.ToString(); }
147 }
148
149 public string ExternalHostName
150 {
151 get { return m_externalHostName; }
152 set { m_externalHostName = value; }
153 }
154
155 public IPEndPoint InternalEndPoint
156 {
157 get { return m_internalEndPoint; }
158 set { m_internalEndPoint = value; }
159 }
160
161 public uint RegionLocX
162 {
163 get { return m_regionLocX.Value; }
164 set { m_regionLocX = value; }
165 }
166
167 public uint RegionLocY
168 {
169 get { return m_regionLocY.Value; }
170 set { m_regionLocY = value; }
171 }
172
173 public ulong RegionHandle
174 {
175 get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
176 }
177
178 public string ProxyUrl
179 {
180 get { return m_proxyUrl; }
181 set { m_proxyUrl = value; }
182 }
183
184 public UUID OriginRegionID
185 {
186 get { return new UUID(m_originRegionID); }
187 set { m_originRegionID = value.Guid; }
188 }
189
190 public string RegionName
191 {
192 get { return m_regionName; }
193 set { m_regionName = value; }
194 }
195
196 public string ServerURI
197 {
198 get { return m_serverURI; }
199 set { m_serverURI = value; }
200 }
201 }
202}
diff --git a/OpenSim/Framework/WearableItem.cs b/OpenSim/Framework/WearableItem.cs
deleted file mode 100644
index 159306a..0000000
--- a/OpenSim/Framework/WearableItem.cs
+++ /dev/null
@@ -1,355 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Globalization;
31using System.IO;
32using System.Text.RegularExpressions;
33using OpenMetaverse;
34
35namespace OpenSim.Framework
36{
37 public class WearableItem
38 {
39 public string WearableName = "";
40 public WearableType WearType = WearableType.Invalid;
41
42 public string ItemInfo = "Created Wearable";
43
44 public SortedList<int, VisualSetting> VisualSettings = new SortedList<int, VisualSetting>();
45 // public LLObject.TextureEntry TextureEntry = null;
46 //public byte[] TextureEntry = null;
47
48 public List<string> TextureStrings = new List<string>();
49
50 //permissions
51 public uint BaseMask = 0;
52 public uint OwnerMask = 0;
53 public uint GroupMask = 0;
54 public uint EveryoneMask = 0;
55 public uint NextOwnerMask = 0;
56
57 public UUID CreatorID = UUID.Zero;
58 public UUID OwnerID = UUID.Zero;
59 public UUID LastOwnerID = UUID.Zero;
60 public UUID GroupID = UUID.Zero;
61
62 //sale
63 public string SaleType = "not";
64 public int SalePrice = 10;
65
66 private string BuildString = "";
67
68
69 public WearableItem(string wearableName, WearableType type)
70 {
71 WearableName = wearableName;
72 WearType = type;
73 }
74
75 public WearableItem(string wearableName)
76 {
77 WearableName = wearableName;
78 WearType = ConvertNameToType(WearableName);
79 }
80
81 public WearableItem(WearableType type)
82 {
83 WearType = type;
84 WearableName = Enum.GetName(typeof(WearableType), type).ToLower();
85 }
86
87 public WearableItem()
88 {
89 }
90
91 public void AddVisualSetting(VisualSetting setting)
92 {
93 if (!VisualSettings.ContainsKey(setting.VisualParam.ParamID))
94 {
95 VisualSettings.Add(setting.VisualParam.ParamID, setting);
96 }
97 }
98
99 public bool TryGetSetting(string paramName, out VisualSetting paramSetting)
100 {
101 foreach (VisualSetting setting in VisualSettings.Values)
102 {
103 if (setting.VisualParam.Name == paramName)
104 {
105 paramSetting = setting;
106 return true;
107 }
108 }
109
110 paramSetting = null;
111 return false;
112 }
113
114 public bool SetParamValue(string paramName, float value)
115 {
116 VisualSetting paramSetting;
117 if (TryGetSetting(paramName, out paramSetting))
118 {
119 if ((value >= paramSetting.VisualParam.MinValue) && (value <= paramSetting.VisualParam.MaxValue))
120 {
121 paramSetting.Value = value;
122 return true;
123 }
124 }
125 return false;
126 }
127
128 public void RandomiseValues()
129 {
130 foreach (VisualSetting setting in VisualSettings.Values)
131 {
132 //int randNum = Util.RandomClass.Next(0, 1000);
133 float range = setting.VisualParam.MaxValue - setting.VisualParam.MinValue;
134 // float val = ((float) randNum) / ((float)(1000.0f / range));
135 float val = (float)Util.RandomClass.NextDouble() * range * 0.2f;
136 setting.Value = setting.VisualParam.MinValue + (range / 2) + val;
137 }
138 }
139
140 public WearableType ConvertNameToType(string name)
141 {
142 return (WearableType)Enum.Parse(typeof(WearableType), name, true);
143 }
144
145 public string ToAssetFormat()
146 {
147 BuildString = "LLWearable version 22\n";
148 BuildString += "New Item \n";
149 BuildString += ItemInfo + "\n";
150
151
152 AddSectionStart("permissions");
153 AddTabbedNameValueLine("base_mask", BaseMask.ToString("00000000"));
154 AddTabbedNameValueLine("owner_mask", OwnerMask.ToString("00000000"));
155 AddTabbedNameValueLine("group_mask", GroupMask.ToString("00000000"));
156 AddTabbedNameValueLine("everyone_mask", EveryoneMask.ToString("00000000"));
157 AddTabbedNameValueLine("next_owner_mask", NextOwnerMask.ToString("00000000"));
158 AddTabbedNameValueLine("creator_id", CreatorID.ToString());
159 AddTabbedNameValueLine("owner_id", OwnerID.ToString());
160 AddTabbedNameValueLine("last_owner_id", LastOwnerID.ToString());
161 AddTabbedNameValueLine("group_id", GroupID.ToString());
162 AddSectionEnd();
163
164 AddSectionStart("sale_info");
165 AddTabbedNameValueLine("sale_type", SaleType.ToString());
166 AddTabbedNameValueLine("sale_price", SalePrice.ToString());
167 AddSectionEnd();
168
169 AddNameValueLine("type", ((byte)WearType).ToString());
170 AddNameValueLine("parameters", VisualSettings.Count.ToString());
171
172 foreach (KeyValuePair<int, VisualSetting> kp in VisualSettings)
173 {
174 AddNameValueLine(kp.Key.ToString(), kp.Value.Value.ToString(CultureInfo.InvariantCulture));
175 }
176 if (TextureStrings.Count == 0)
177 {
178 AddNameValueLine("textures", "0"); //todo output texture entry
179 }
180 else
181 {
182 AddNameValueLine("textures", TextureStrings.Count.ToString());
183 for (int i = 0; i < TextureStrings.Count; i++)
184 {
185 BuildString += TextureStrings[i] + "\n";
186 }
187 BuildString += "\n";
188
189 }
190
191 return BuildString;
192 }
193
194 public void SaveToFile(string fileName)
195 {
196 File.WriteAllText(fileName, this.ToAssetFormat());
197 }
198
199 public void AddSectionStart(string sectionName)
200 {
201 BuildString += "\t" + sectionName + " 0\n";
202 BuildString += "\t{\n";
203 }
204
205 public void AddSectionEnd()
206 {
207 BuildString += "\t}\n";
208 }
209
210 private void AddTabbedNameValueLine(string name, string value)
211 {
212 BuildString += "\t\t";
213 BuildString += name + "\t";
214 BuildString += value + "\n";
215 }
216
217 private void AddNameValueLine(string name, string value)
218 {
219 // BuildString += "\t\t";
220 BuildString += name + " ";
221 BuildString += value + "\n";
222 }
223
224 #region Static Methods
225 public static List<VisualParam> FindParamsForWearable(string wearableName)
226 {
227 List<VisualParam> wearableParams = new List<VisualParam>();
228 foreach (VisualParam param in VisualParams.Params.Values)
229 {
230 if (param.Wearable == wearableName)
231 {
232 wearableParams.Add(param);
233 }
234 }
235
236 return wearableParams;
237 }
238
239 public static WearableItem Create(string wearableTypeName)
240 {
241 WearableItem wearableItem = new WearableItem(wearableTypeName);
242 List<VisualParam> typeParams = FindParamsForWearable(wearableTypeName);
243 foreach (VisualParam param in typeParams)
244 {
245 wearableItem.AddVisualSetting(new VisualSetting(param));
246 }
247 return wearableItem;
248 }
249
250 public static WearableItem CreateFromAsset(string assetData)
251 {
252 UUID creatorID = UUID.Zero;
253 UUID ownerID = UUID.Zero;
254 UUID lastOwnerID = UUID.Zero;
255 UUID groupID = UUID.Zero;
256
257 char[] newlineDelimiter = { '\n' };
258 string[] lines = assetData.Split(newlineDelimiter);
259
260 WearableItem wearableObject = null;
261 Regex r = new Regex("[\t ]+");
262 bool reachedParams = false;
263 bool reachedTextures = false;
264 foreach (string line in lines)
265 {
266 string trimLine = line.Trim();
267 // m_log.Debug("line : " + trimLine);
268
269 string[] splitLine = r.Split(trimLine);
270 if (splitLine.Length > 1)
271 {
272 switch (splitLine[0])
273 {
274 case "textures":
275 reachedParams = false;
276 reachedTextures = true;
277 break;
278
279 case "type":
280 string wearableTypeName = Enum.GetName(typeof(WearableType), (WearableType)Convert.ToInt32(splitLine[1]));
281 wearableObject = Create(wearableTypeName.ToLower());
282 break;
283
284 case "parameters":
285 reachedParams = true;
286 break;
287
288 case "creator_id":
289 creatorID = new UUID(splitLine[1]);
290 break;
291
292 case "owner_id":
293 ownerID = new UUID(splitLine[1]);
294 break;
295
296 case "last_owner_id":
297 lastOwnerID = new UUID(splitLine[1]);
298 break;
299
300 case "group_id":
301 groupID = new UUID(splitLine[1]);
302 break;
303
304 default:
305 if ((wearableObject != null) && (reachedParams))
306 {
307 int id = Convert.ToInt32(splitLine[0]);
308 if (wearableObject.VisualSettings.ContainsKey(id))
309 {
310
311 wearableObject.VisualSettings[id].Value = Convert.ToSingle(splitLine[1], CultureInfo.InvariantCulture);
312 }
313 }
314 else if ((wearableObject != null) && (reachedTextures))
315 {
316 wearableObject.TextureStrings.Add(line);
317 }
318 break;
319 }
320 }
321 }
322
323 if (wearableObject != null)
324 {
325 wearableObject.CreatorID = creatorID;
326 wearableObject.OwnerID = ownerID;
327 wearableObject.LastOwnerID = lastOwnerID;
328 wearableObject.GroupID = groupID;
329 }
330
331 return wearableObject;
332 }
333 #endregion
334
335 #region Nested Class
336 public class VisualSetting
337 {
338 public VisualParam VisualParam;
339 public float Value = 0;
340
341 public VisualSetting(VisualParam param, float value)
342 {
343 VisualParam = param;
344 Value = value;
345 }
346
347 public VisualSetting(VisualParam param)
348 {
349 VisualParam = param;
350 Value = param.DefaultValue;
351 }
352 }
353 #endregion
354 }
355}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
index 2f9a45f..776d5d1 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
@@ -655,9 +655,12 @@ namespace OpenSim.Region.Communications.OGS1
655 userData.Email = (string)data["email"]; 655 userData.Email = (string)data["email"];
656 userData.ID = new UUID((string)data["uuid"]); 656 userData.ID = new UUID((string)data["uuid"]);
657 userData.Created = Convert.ToInt32(data["profile_created"]); 657 userData.Created = Convert.ToInt32(data["profile_created"]);
658 userData.UserInventoryURI = (string)data["server_inventory"]; 658 if (data.Contains("server_inventory") && data["server_inventory"] != null)
659 userData.UserAssetURI = (string)data["server_asset"]; 659 userData.UserInventoryURI = (string)data["server_inventory"];
660 userData.FirstLifeAboutText = (string)data["profile_firstlife_about"]; 660 if (data.Contains("server_asset") && data["server_asset"] != null)
661 userData.UserAssetURI = (string)data["server_asset"];
662 if (data.Contains("profile_firstlife_about") && data["profile_firstlife_about"] != null)
663 userData.FirstLifeAboutText = (string)data["profile_firstlife_about"];
661 userData.FirstLifeImage = new UUID((string)data["profile_firstlife_image"]); 664 userData.FirstLifeImage = new UUID((string)data["profile_firstlife_image"]);
662 userData.CanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); 665 userData.CanDoMask = Convert.ToUInt32((string)data["profile_can_do"]);
663 userData.WantDoMask = Convert.ToUInt32(data["profile_want_do"]); 666 userData.WantDoMask = Convert.ToUInt32(data["profile_want_do"]);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
index f2d8579..4d347cd 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
@@ -155,7 +155,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
155 ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene); 155 ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene);
156 156
157 // Yikes!! Remove this as soon as user services get refactored 157 // Yikes!! Remove this as soon as user services get refactored
158 LocalAssetServerURI = scene.CommsManager.NetworkServersInfo.UserURL; 158 LocalAssetServerURI = scene.CommsManager.NetworkServersInfo.AssetURL;
159 LocalInventoryServerURI = scene.CommsManager.NetworkServersInfo.InventoryURL; 159 LocalInventoryServerURI = scene.CommsManager.NetworkServersInfo.InventoryURL;
160 LocalUserServerURI = scene.CommsManager.NetworkServersInfo.UserURL; 160 LocalUserServerURI = scene.CommsManager.NetworkServersInfo.UserURL;
161 HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI); 161 HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI);
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
index 9639095..76dac61 100644
--- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
@@ -45,6 +45,10 @@ namespace OpenSim.Region.DataSnapshot.Providers
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 private bool m_stale = true; 46 private bool m_stale = true;
47 47
48 private static UUID m_DefaultImage = new UUID("89556747-24cb-43ed-920b-47caed15465f");
49 private static UUID m_BlankImage = new UUID("5748decc-f629-461c-9a36-a35a221fe21f");
50
51
48 public void Initialize(Scene scene, DataSnapshotManager parent) 52 public void Initialize(Scene scene, DataSnapshotManager parent)
49 { 53 {
50 m_scene = scene; 54 m_scene = scene;
@@ -142,6 +146,19 @@ namespace OpenSim.Region.DataSnapshot.Providers
142 node.InnerText = land.LandData.GlobalID.ToString(); 146 node.InnerText = land.LandData.GlobalID.ToString();
143 xmlobject.AppendChild(node); 147 xmlobject.AppendChild(node);
144 148
149 node = nodeFactory.CreateNode(XmlNodeType.Element, "location", "");
150 Vector3 loc = obj.AbsolutePosition;
151 node.InnerText = loc.X.ToString() + "/" + loc.Y.ToString() + "/" + loc.Z.ToString();
152 xmlobject.AppendChild(node);
153
154 string bestImage = GuessImage(obj);
155 if (bestImage != string.Empty)
156 {
157 node = nodeFactory.CreateNode(XmlNodeType.Element, "image", "");
158 node.InnerText = bestImage;
159 xmlobject.AppendChild(node);
160 }
161
145 parent.AppendChild(xmlobject); 162 parent.AppendChild(xmlobject);
146 } 163 }
147 } 164 }
@@ -173,5 +190,58 @@ namespace OpenSim.Region.DataSnapshot.Providers
173 } 190 }
174 191
175 public event ProviderStale OnStale; 192 public event ProviderStale OnStale;
193
194 /// <summary>
195 /// Guesses the best image, based on a simple heuristic. It guesses only for boxes.
196 /// We're optimizing for boxes, because those are the most common objects
197 /// marked "Show in search" -- boxes with content inside.For other shapes,
198 /// it's really hard to tell which texture should be grabbed.
199 /// </summary>
200 /// <param name="sog"></param>
201 /// <returns></returns>
202 private string GuessImage(SceneObjectGroup sog)
203 {
204 string bestguess = string.Empty;
205 Dictionary<UUID, int> counts = new Dictionary<UUID, int>();
206 if (sog.RootPart.Shape != null && sog.RootPart.Shape.ProfileShape == ProfileShape.Square &&
207 sog.RootPart.Shape.Textures != null && sog.RootPart.Shape.Textures.FaceTextures != null)
208 {
209 if (sog.RootPart.Shape.Textures.DefaultTexture.TextureID != UUID.Zero &&
210 sog.RootPart.Shape.Textures.DefaultTexture.TextureID != m_DefaultImage &&
211 sog.RootPart.Shape.Textures.DefaultTexture.TextureID != m_BlankImage &&
212 sog.RootPart.Shape.Textures.DefaultTexture.RGBA.A < 50)
213 {
214 counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] = 8;
215 }
216
217 foreach (Primitive.TextureEntryFace tentry in sog.RootPart.Shape.Textures.FaceTextures)
218 {
219 if (tentry != null)
220 {
221 if (tentry.TextureID != UUID.Zero && tentry.TextureID != m_DefaultImage && tentry.TextureID != m_BlankImage && tentry.RGBA.A < 50)
222 {
223 int c = 0;
224 counts.TryGetValue(tentry.TextureID, out c);
225 counts[tentry.TextureID] = c + 1;
226 // decrease the default texture count
227 if (counts.ContainsKey(sog.RootPart.Shape.Textures.DefaultTexture.TextureID))
228 counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] = counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] - 1;
229 }
230 }
231 }
232
233 // Let's pick the most unique texture
234 int min = 9999;
235 foreach (KeyValuePair<UUID, int> kv in counts)
236 {
237 if (kv.Value < min && kv.Value >= 1)
238 {
239 bestguess = kv.Key.ToString();
240 min = kv.Value;
241 }
242 }
243 }
244 return bestguess;
245 }
176 } 246 }
177} 247}
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 3892769..e649139 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -356,8 +356,6 @@ namespace OpenSim.Region.Framework.Scenes
356 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); 356 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
357 357
358 return neighbours; 358 return neighbours;
359 //SimpleRegionInfo regionData = m_commsProvider.GridService.RequestNeighbourInfo()
360 //return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY);
361 } 359 }
362 } 360 }
363 361
@@ -367,20 +365,8 @@ namespace OpenSim.Region.Framework.Scenes
367 /// </summary> 365 /// </summary>
368 public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours) 366 public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours)
369 { 367 {
370 //List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
371 List<GridRegion> neighbours = new List<GridRegion>(); 368 List<GridRegion> neighbours = new List<GridRegion>();
372 369
373 ////m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
374 //for (int i = 0; i < lstneighbours.Count; i++)
375 //{
376 // // We don't want to keep sending to regions that consistently fail on comms.
377 // if (!(lstneighbours[i].commFailTF))
378 // {
379 // neighbours.Add(new SimpleRegionInfo(lstneighbours[i]));
380 // }
381 //}
382 // we're going to be using the above code once neighbour cache is correct. Currently it doesn't appear to be
383 // So we're temporarily going back to the old method of grabbing it from the Grid Server Every time :/
384 if (m_regionInfo != null) 370 if (m_regionInfo != null)
385 { 371 {
386 neighbours = RequestNeighbours(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 372 neighbours = RequestNeighbours(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
@@ -431,7 +417,6 @@ namespace OpenSim.Region.Framework.Scenes
431 417
432 /// Create the necessary child agents 418 /// Create the necessary child agents
433 List<AgentCircuitData> cagents = new List<AgentCircuitData>(); 419 List<AgentCircuitData> cagents = new List<AgentCircuitData>();
434 //foreach (SimpleRegionInfo neighbour in neighbours)
435 foreach (GridRegion neighbour in neighbours) 420 foreach (GridRegion neighbour in neighbours)
436 { 421 {
437 if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle) 422 if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle)
@@ -583,7 +568,9 @@ namespace OpenSim.Region.Framework.Scenes
583 //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); 568 //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
584 569
585 for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++) 570 for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++)
571 {
586 for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++) 572 for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++)
573 {
587 if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region 574 if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region
588 { 575 {
589 ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize); 576 ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize);
@@ -593,24 +580,8 @@ namespace OpenSim.Region.Framework.Scenes
593 InformNeighborsThatRegionisUpCompleted, 580 InformNeighborsThatRegionisUpCompleted,
594 d); 581 d);
595 } 582 }
596 583 }
597 //List<GridRegion> neighbours = new List<GridRegion>(); 584 }
598 //// This stays uncached because we don't already know about our neighbors at this point.
599
600 //neighbours = m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID);
601 //if (neighbours != null)
602 //{
603 // for (int i = 0; i < neighbours.Count; i++)
604 // {
605 // InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
606
607 // d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle,
608 // InformNeighborsThatRegionisUpCompleted,
609 // d);
610 // }
611 //}
612
613 //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
614 } 585 }
615 586
616 587