aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-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/RegionUpData.cs68
-rw-r--r--OpenSim/Framework/Remoting.cs134
-rw-r--r--OpenSim/Framework/SerializableInventory.cs58
-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
17 files changed, 93 insertions, 1341 deletions
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/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/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}