From 6d7c10b2b4bfa9c5b9b953951db08370764a20d5 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Fri, 11 Dec 2009 13:19:32 +1100 Subject: * Diagnosing a connection issue. --- OpenSim/Client/Linden/LLProxyLoginModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 } catch (Exception e) { - m_log.WarnFormat("[CLIENT]: Unable to receive user. Reason: {0}", e); + m_log.WarnFormat("[CLIENT]: Unable to receive user. Reason: {0} ({1})", e, e.StackTrace); Hashtable respdata = new Hashtable(); respdata["success"] = "FALSE"; respdata["reason"] = "Exception occurred"; -- cgit v1.1 From d68b6642439d70178f367ef2cac5aa7b573fea44 Mon Sep 17 00:00:00 2001 From: grid Date: Thu, 10 Dec 2009 22:09:16 -0500 Subject: Kill a NRE caused by an error message trying to print unavailable data --- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index aecfaa3..c33dc52 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -480,8 +480,8 @@ namespace OpenSim.Data.MySQL else { m_log.WarnFormat( - "[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.", - prim.Name, prim.UUID, prim.AbsolutePosition, regionID, prim.ParentUUID); + "[REGION DB]: Database contains an orphan child prim {0} {1} in region {3} pointing to missing parent {4}. This prim will not be loaded.", + prim.Name, prim.UUID, regionID, prim.ParentUUID); } } } -- cgit v1.1 From 204c59c5acc79b30f90a0de9e69350bcd0de06c3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 11 Dec 2009 02:40:33 +0000 Subject: Refix the fix --- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index c33dc52..9a4a4bb 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -480,7 +480,7 @@ namespace OpenSim.Data.MySQL else { m_log.WarnFormat( - "[REGION DB]: Database contains an orphan child prim {0} {1} in region {3} pointing to missing parent {4}. This prim will not be loaded.", + "[REGION DB]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.", prim.Name, prim.UUID, regionID, prim.ParentUUID); } } -- cgit v1.1 From decd51f0811639169d63cb80fcc7dec931ea9530 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 11 Dec 2009 08:11:26 -0800 Subject: Attempt at fixing mantis #4411. --- .../Communications/Cache/UserProfileCacheService.cs | 16 +++++++++++++++- .../ServiceConnectorsOut/Grid/HGGridConnector.cs | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 9e12d948..cebd571 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -139,9 +139,16 @@ namespace OpenSim.Framework.Communications.Cache else { UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname); - + if (userProfile != null) + { + if (userProfile.UserAssetURI == null || userProfile.UserAssetURI == "") + userProfile.UserAssetURI = m_commsManager.NetworkServersInfo.AssetURL; + if (userProfile.UserInventoryURI == null || userProfile.UserInventoryURI == "") + userProfile.UserInventoryURI = m_commsManager.NetworkServersInfo.InventoryURL; + return AddToCaches(userProfile); + } else return null; } @@ -169,7 +176,14 @@ namespace OpenSim.Framework.Communications.Cache { UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID); if (userProfile != null) + { + if (userProfile.UserAssetURI == null || userProfile.UserAssetURI == "") + userProfile.UserAssetURI = m_commsManager.NetworkServersInfo.AssetURL; + if (userProfile.UserInventoryURI == null || userProfile.UserInventoryURI == "") + userProfile.UserInventoryURI = m_commsManager.NetworkServersInfo.InventoryURL; + return AddToCaches(userProfile); + } else return null; } 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 ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene); // Yikes!! Remove this as soon as user services get refactored - LocalAssetServerURI = scene.CommsManager.NetworkServersInfo.UserURL; + LocalAssetServerURI = scene.CommsManager.NetworkServersInfo.AssetURL; LocalInventoryServerURI = scene.CommsManager.NetworkServersInfo.InventoryURL; LocalUserServerURI = scene.CommsManager.NetworkServersInfo.UserURL; HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI); -- cgit v1.1 From 5f0478c4c445cf049f8668bb82468fa30d783baf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 11 Dec 2009 08:28:24 -0800 Subject: Fix to make [bad] tests happy. --- OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index cebd571..29a9e14 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -142,9 +142,9 @@ namespace OpenSim.Framework.Communications.Cache if (userProfile != null) { - if (userProfile.UserAssetURI == null || userProfile.UserAssetURI == "") + if ((userProfile.UserAssetURI == null || userProfile.UserAssetURI == "") && m_commsManager.NetworkServersInfo != null) userProfile.UserAssetURI = m_commsManager.NetworkServersInfo.AssetURL; - if (userProfile.UserInventoryURI == null || userProfile.UserInventoryURI == "") + if ((userProfile.UserInventoryURI == null || userProfile.UserInventoryURI == "") && m_commsManager.NetworkServersInfo != null) userProfile.UserInventoryURI = m_commsManager.NetworkServersInfo.InventoryURL; return AddToCaches(userProfile); @@ -177,9 +177,9 @@ namespace OpenSim.Framework.Communications.Cache UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID); if (userProfile != null) { - if (userProfile.UserAssetURI == null || userProfile.UserAssetURI == "") + if ((userProfile.UserAssetURI == null || userProfile.UserAssetURI == "") && m_commsManager.NetworkServersInfo != null) userProfile.UserAssetURI = m_commsManager.NetworkServersInfo.AssetURL; - if (userProfile.UserInventoryURI == null || userProfile.UserInventoryURI == "") + if ((userProfile.UserInventoryURI == null || userProfile.UserInventoryURI == "") && m_commsManager.NetworkServersInfo != null) userProfile.UserInventoryURI = m_commsManager.NetworkServersInfo.InventoryURL; return AddToCaches(userProfile); -- cgit v1.1 From 4bbe9a51ac8c4412b41c4e271a0d2652ca52e118 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 11 Dec 2009 09:09:36 -0800 Subject: Added an image uuid to objects marked "Show in search". Only works for boxes. --- OpenSim/Region/DataSnapshot/ObjectSnapshot.cs | 70 +++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) 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 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private bool m_stale = true; + private static UUID m_DefaultImage = new UUID("89556747-24cb-43ed-920b-47caed15465f"); + private static UUID m_BlankImage = new UUID("5748decc-f629-461c-9a36-a35a221fe21f"); + + public void Initialize(Scene scene, DataSnapshotManager parent) { m_scene = scene; @@ -142,6 +146,19 @@ namespace OpenSim.Region.DataSnapshot.Providers node.InnerText = land.LandData.GlobalID.ToString(); xmlobject.AppendChild(node); + node = nodeFactory.CreateNode(XmlNodeType.Element, "location", ""); + Vector3 loc = obj.AbsolutePosition; + node.InnerText = loc.X.ToString() + "/" + loc.Y.ToString() + "/" + loc.Z.ToString(); + xmlobject.AppendChild(node); + + string bestImage = GuessImage(obj); + if (bestImage != string.Empty) + { + node = nodeFactory.CreateNode(XmlNodeType.Element, "image", ""); + node.InnerText = bestImage; + xmlobject.AppendChild(node); + } + parent.AppendChild(xmlobject); } } @@ -173,5 +190,58 @@ namespace OpenSim.Region.DataSnapshot.Providers } public event ProviderStale OnStale; + + /// + /// Guesses the best image, based on a simple heuristic. It guesses only for boxes. + /// We're optimizing for boxes, because those are the most common objects + /// marked "Show in search" -- boxes with content inside.For other shapes, + /// it's really hard to tell which texture should be grabbed. + /// + /// + /// + private string GuessImage(SceneObjectGroup sog) + { + string bestguess = string.Empty; + Dictionary counts = new Dictionary(); + if (sog.RootPart.Shape != null && sog.RootPart.Shape.ProfileShape == ProfileShape.Square && + sog.RootPart.Shape.Textures != null && sog.RootPart.Shape.Textures.FaceTextures != null) + { + if (sog.RootPart.Shape.Textures.DefaultTexture.TextureID != UUID.Zero && + sog.RootPart.Shape.Textures.DefaultTexture.TextureID != m_DefaultImage && + sog.RootPart.Shape.Textures.DefaultTexture.TextureID != m_BlankImage && + sog.RootPart.Shape.Textures.DefaultTexture.RGBA.A < 50) + { + counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] = 8; + } + + foreach (Primitive.TextureEntryFace tentry in sog.RootPart.Shape.Textures.FaceTextures) + { + if (tentry != null) + { + if (tentry.TextureID != UUID.Zero && tentry.TextureID != m_DefaultImage && tentry.TextureID != m_BlankImage && tentry.RGBA.A < 50) + { + int c = 0; + counts.TryGetValue(tentry.TextureID, out c); + counts[tentry.TextureID] = c + 1; + // decrease the default texture count + if (counts.ContainsKey(sog.RootPart.Shape.Textures.DefaultTexture.TextureID)) + counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] = counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] - 1; + } + } + } + + // Let's pick the most unique texture + int min = 9999; + foreach (KeyValuePair kv in counts) + { + if (kv.Value < min && kv.Value >= 1) + { + bestguess = kv.Key.ToString(); + min = kv.Value; + } + } + } + return bestguess; + } } } -- cgit v1.1 From d20fe7bfdd41e3526e03a384b14b84a0fd92a1c2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 11 Dec 2009 20:06:42 -0800 Subject: A couple of more sanity guards, but this won't fix things when user profile fetching is borked. --- OpenSim/Framework/Communications/Clients/AuthClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 } Hashtable responseData = (Hashtable)UserResp.Value; - if (responseData.ContainsKey("auth_session") && responseData["auth_session"].ToString() == "TRUE") + if (responseData != null && responseData.ContainsKey("auth_session") && responseData["auth_session"] != null && responseData["auth_session"].ToString() == "TRUE") { //System.Console.WriteLine("[Authorization]: userserver reported authorized session for user " + userID); return true; -- cgit v1.1 From 62ec60ca76e2331b6dd91b4ab68420fd859ea76c Mon Sep 17 00:00:00 2001 From: Kunnis Date: Sun, 6 Dec 2009 17:56:29 -0600 Subject: Getting rid of a bunch of old classes, that are likely left over from the ROBUST change. Signed-off-by: Melanie --- OpenSim/Framework/AssetConfig.cs | 87 ------- OpenSim/Framework/AssetRequest.cs | 37 --- OpenSim/Framework/AssetStorage.cs | 48 ---- OpenSim/Framework/IAssetCache.cs | 114 --------- OpenSim/Framework/InventoryConfig.cs | 113 --------- OpenSim/Framework/NeighbourInfo.cs | 42 ---- OpenSim/Framework/Parallel.cs | 211 ----------------- OpenSim/Framework/ProxyCodec.cs | 68 ------ OpenSim/Framework/RegionUpData.cs | 68 ------ OpenSim/Framework/Remoting.cs | 134 ----------- OpenSim/Framework/SerializableInventory.cs | 58 ----- OpenSim/Framework/WearableItem.cs | 355 ----------------------------- 12 files changed, 1335 deletions(-) delete mode 100644 OpenSim/Framework/AssetConfig.cs delete mode 100644 OpenSim/Framework/AssetRequest.cs delete mode 100644 OpenSim/Framework/AssetStorage.cs delete mode 100644 OpenSim/Framework/IAssetCache.cs delete mode 100644 OpenSim/Framework/InventoryConfig.cs delete mode 100644 OpenSim/Framework/NeighbourInfo.cs delete mode 100644 OpenSim/Framework/Parallel.cs delete mode 100644 OpenSim/Framework/ProxyCodec.cs delete mode 100644 OpenSim/Framework/RegionUpData.cs delete mode 100644 OpenSim/Framework/Remoting.cs delete mode 100644 OpenSim/Framework/SerializableInventory.cs delete mode 100644 OpenSim/Framework/WearableItem.cs 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.IO; - -namespace OpenSim.Framework -{ - /// - /// AssetConfig -- For Asset Server Configuration - /// - public class AssetConfig:ConfigBase - { - public string DatabaseConnect = String.Empty; - public string DatabaseProvider = String.Empty; - public uint HttpPort = ConfigSettings.DefaultAssetServerHttpPort; - public string AssetSetsLocation = string.Empty; - - public AssetConfig(string description, string filename) - { - m_configMember = - new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true); - m_configMember.performConfigurationRetrieve(); - } - - public void loadConfigurationOptions() - { - m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "DLL for database provider", "OpenSim.Data.MySQL.dll", false); - - m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "Database connection string", "", false); - - m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, - "Http Listener port", ConfigSettings.DefaultAssetServerHttpPort.ToString(), false); - - m_configMember.addConfigurationOption("assetset_location", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "Location of 'AssetSets.xml'", - string.Format(".{0}assets{0}AssetSets.xml", Path.DirectorySeparatorChar), false); - } - - public bool handleIncomingConfiguration(string configuration_key, object configuration_result) - { - switch (configuration_key) - { - case "database_provider": - DatabaseProvider = (string) configuration_result; - break; - case "database_connect": - DatabaseConnect = (string) configuration_result; - break; - case "assetset_location": - AssetSetsLocation = (string) configuration_result; - break; - case "http_port": - HttpPort = (uint) configuration_result; - break; - } - - return true; - } - } -} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using OpenMetaverse; - -namespace OpenSim.Framework -{ - public struct AssetRequest - { - public UUID AssetID; - public bool IsTexture; - } -} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using OpenMetaverse; - -namespace OpenSim.Framework -{ - public class AssetStorage - { - public byte[] Data; - public string Name; - public sbyte Type; - public UUID UUID; - - public AssetStorage() - { - } - - public AssetStorage(UUID assetUUID) - { - UUID = assetUUID; - } - } -} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using OpenMetaverse; -using OpenMetaverse.Packets; - -namespace OpenSim.Framework -{ - public delegate void AssetRequestCallback(UUID assetId, AssetBase asset); - - /// - /// Interface to the local asset cache. This is the mechanism through which assets can be added and requested. - /// - public interface IAssetCache : IPlugin - { - /// - /// The 'server' from which assets can be requested and to which assets are persisted. - /// - - void Initialise(ConfigSettings cs); - - /// - /// Report statistical data to the log. - /// - void ShowState(); - - /// - /// Clear the asset cache. - /// - void Clear(); - - /// - /// Get an asset only if it's already in the cache. - /// - /// - /// - /// true if the asset was in the cache, false if it was not - bool TryGetCachedAsset(UUID assetID, out AssetBase asset); - - /// - /// Asynchronously retrieve an asset. - /// - /// - /// - /// - /// A callback invoked when the asset has either been found or not found. - /// If the asset was found this is called with the asset UUID and the asset data - /// If the asset was not found this is still called with the asset UUID but with a null asset data reference - void GetAsset(UUID assetID, AssetRequestCallback callback, bool isTexture); - - /// - /// Synchronously retreive an asset. If the asset isn't in the cache, a request will be made to the persistent store to - /// load it into the cache. - /// - /// - /// XXX We'll keep polling the cache until we get the asset or we exceed - /// the allowed number of polls. This isn't a very good way of doing things since a single thread - /// is processing inbound packets, so if the asset server is slow, we could block this for up to - /// the timeout period. Whereever possible we want to use the asynchronous callback GetAsset() - /// - /// - /// - /// null if the asset could not be retrieved - AssetBase GetAsset(UUID assetID, bool isTexture); - - /// - /// Add an asset to both the persistent store and the cache. - /// - /// - void AddAsset(AssetBase asset); - - /// - /// Expire an asset from the cache - /// - /// Allows you to clear a specific asset by uuid out - /// of the asset cache. This is needed because the osdynamic - /// texture code grows the asset cache without bounds. The - /// real solution here is a much better cache archicture, but - /// this is a stop gap measure until we have such a thing. - void ExpireAsset(UUID assetID); - - /// - /// Handle an asset request from the client. The result will be sent back asynchronously. - /// - /// - /// - void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest); - } - -} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; - -namespace OpenSim.Framework -{ - /// - /// Defines and handles inventory grid server configuration - /// - public class InventoryConfig:ConfigBase - { - public string DatabaseConnect = String.Empty; - public string DatabaseProvider = String.Empty; - public string DefaultStartupMsg = String.Empty; - public uint HttpPort = ConfigSettings.DefaultInventoryServerHttpPort; - public string InventoryServerURL = String.Empty; - public string UserServerURL = String.Empty; - public string AssetServerURL = String.Empty; - public bool SessionLookUp = true; - public bool RegionAccessToAgentsInventory = true; - - public InventoryConfig(string description, string filename) - { - m_configMember = - new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true); - m_configMember.performConfigurationRetrieve(); - } - - public void loadConfigurationOptions() - { - m_configMember.addConfigurationOption("default_inventory_server", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "Default Inventory Server URI (this server's external name)", - "http://127.0.0.1:8004", false); - m_configMember.addConfigurationOption("default_user_server", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "Default User Server URI", - "http://127.0.0.1:8002", false); - m_configMember.addConfigurationOption("default_asset_server", - ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, - "Default Asset Server URI", - "http://127.0.0.1:8003", false); - m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "DLL for database provider", "OpenSim.Data.MySQL.dll", false); - m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING, - "Database Connect String", "", false); - m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, - "Http Listener port", ConfigSettings.DefaultInventoryServerHttpPort.ToString(), false); - m_configMember.addConfigurationOption("session_lookup", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, - "Enable session lookup security", "False", false); - m_configMember.addConfigurationOption("region_access", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, - "Allow direct region access to users inventories? (Keep True if you don't know what this is about)", "True", false); - } - - public bool handleIncomingConfiguration(string configuration_key, object configuration_result) - { - switch (configuration_key) - { - case "default_inventory_server": - InventoryServerURL = (string)configuration_result; - break; - case "default_user_server": - UserServerURL = (string) configuration_result; - break; - case "default_asset_server": - AssetServerURL = (string)configuration_result; - break; - case "database_provider": - DatabaseProvider = (string) configuration_result; - break; - case "database_connect": - DatabaseConnect = (string) configuration_result; - break; - case "http_port": - HttpPort = (uint) configuration_result; - break; - case "session_lookup": - SessionLookUp = (bool)configuration_result; - break; - case "region_access": - RegionAccessToAgentsInventory = (bool)configuration_result; - break; - } - - return true; - } - } -} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -namespace OpenSim.Framework -{ - public class NeighbourInfo - { - public ulong regionhandle; - public uint RegionLocX; - public uint RegionLocY; - public string sim_ip; - public uint sim_port; - - public NeighbourInfo() - { - } - } -} \ 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Threading; - -namespace OpenSim.Framework -{ - /// - /// Provides helper methods for parallelizing loops - /// - public static class Parallel - { - public static readonly int ProcessorCount = System.Environment.ProcessorCount; - - /// - /// Executes a for loop in which iterations may run in parallel - /// - /// The loop will be started at this index - /// The loop will be terminated before this index is reached - /// Method body to run for each iteration of the loop - public static void For(int fromInclusive, int toExclusive, Action body) - { - For(ProcessorCount, fromInclusive, toExclusive, body); - } - - /// - /// Executes a for loop in which iterations may run in parallel - /// - /// The number of concurrent execution threads to run - /// The loop will be started at this index - /// The loop will be terminated before this index is reached - /// Method body to run for each iteration of the loop - public static void For(int threadCount, int fromInclusive, int toExclusive, Action body) - { - int counter = threadCount; - AutoResetEvent threadFinishEvent = new AutoResetEvent(false); - Exception exception = null; - - --fromInclusive; - - for (int i = 0; i < threadCount; i++) - { - Util.FireAndForget( - delegate(object o) - { -// int threadIndex = (int)o; - - while (exception == null) - { - int currentIndex = Interlocked.Increment(ref fromInclusive); - - if (currentIndex >= toExclusive) - break; - - try { body(currentIndex); } - catch (Exception ex) { exception = ex; break; } - } - - if (Interlocked.Decrement(ref counter) == 0) - threadFinishEvent.Set(); - }, i - ); - } - - threadFinishEvent.WaitOne(); - threadFinishEvent.Close(); - - if (exception != null) - throw new Exception(exception.Message, exception); - } - - /// - /// Executes a foreach loop in which iterations may run in parallel - /// - /// Object type that the collection wraps - /// An enumerable collection to iterate over - /// Method body to run for each object in the collection - public static void ForEach(IEnumerable enumerable, Action body) - { - ForEach(ProcessorCount, enumerable, body); - } - - /// - /// Executes a foreach loop in which iterations may run in parallel - /// - /// Object type that the collection wraps - /// The number of concurrent execution threads to run - /// An enumerable collection to iterate over - /// Method body to run for each object in the collection - public static void ForEach(int threadCount, IEnumerable enumerable, Action body) - { - int counter = threadCount; - AutoResetEvent threadFinishEvent = new AutoResetEvent(false); - IEnumerator enumerator = enumerable.GetEnumerator(); - object syncRoot = new object(); - Exception exception = null; - - for (int i = 0; i < threadCount; i++) - { - Util.FireAndForget( - delegate(object o) - { -// int threadIndex = (int)o; - - while (exception == null) - { - T entry; - - lock (syncRoot) - { - if (!enumerator.MoveNext()) - break; - entry = (T)enumerator.Current; // Explicit typecast for Mono's sake - } - - try { body(entry); } - catch (Exception ex) { exception = ex; break; } - } - - if (Interlocked.Decrement(ref counter) == 0) - threadFinishEvent.Set(); - }, i - ); - } - - threadFinishEvent.WaitOne(); - threadFinishEvent.Close(); - - if (exception != null) - throw new Exception(exception.Message, exception); - } - - /// - /// Executes a series of tasks in parallel - /// - /// A series of method bodies to execute - public static void Invoke(params Action[] actions) - { - Invoke(ProcessorCount, actions); - } - - /// - /// Executes a series of tasks in parallel - /// - /// The number of concurrent execution threads to run - /// A series of method bodies to execute - public static void Invoke(int threadCount, params Action[] actions) - { - int counter = threadCount; - AutoResetEvent threadFinishEvent = new AutoResetEvent(false); - int index = -1; - Exception exception = null; - - for (int i = 0; i < threadCount; i++) - { - Util.FireAndForget( - delegate(object o) - { -// int threadIndex = (int)o; - - while (exception == null) - { - int currentIndex = Interlocked.Increment(ref index); - - if (currentIndex >= actions.Length) - break; - - try { actions[currentIndex](); } - catch (Exception ex) { exception = ex; break; } - } - - if (Interlocked.Decrement(ref counter) == 0) - threadFinishEvent.Set(); - }, i - ); - } - - threadFinishEvent.WaitOne(); - threadFinishEvent.Close(); - - if (exception != null) - throw new Exception(exception.Message, exception); - } - } -} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Net; - -namespace OpenSim.Framework -{ - public sealed class ProxyCodec - { - public static void EncodeProxyMessage(byte[] bytes, ref int numBytes, EndPoint trueEP) - { - if (numBytes > 4090) // max UPD size = 4096 - { - throw new Exception("ERROR: No space to encode the proxy EP"); - } - - ushort port = (ushort) ((IPEndPoint) trueEP).Port; - bytes[numBytes++] = (byte) (port % 256); - bytes[numBytes++] = (byte) (port / 256); - - foreach (byte b in ((IPEndPoint) trueEP).Address.GetAddressBytes()) - { - bytes[numBytes++] = b; - } - } - - public static IPEndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes) - { - // IPv4 Only - byte[] addr = new byte[4]; - - addr[3] = bytes[--numBytes]; - addr[2] = bytes[--numBytes]; - addr[1] = bytes[--numBytes]; - addr[0] = bytes[--numBytes]; - - ushort port = (ushort) (bytes[--numBytes] * 256); - port += (ushort) bytes[--numBytes]; - - return new IPEndPoint(new IPAddress(addr), (int) port); - } - } -} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; - -namespace OpenSim.Framework -{ - [Serializable] - public class RegionUpData - { - private string m_ipaddr = ""; - private int m_port = 0; - private uint m_X = 0; - private uint m_Y = 0; - - public RegionUpData(uint X, uint Y, string ipaddr, int port) - { - m_X = X; - m_Y = Y; - m_ipaddr = ipaddr; - m_port = port; - } - - public uint X - { - get { return m_X; } - } - - public uint Y - { - get { return m_Y; } - } - - public string IPADDR - { - get { return m_ipaddr; } - } - - public int PORT - { - get { return m_port; } - } - } -} \ 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Security.Cryptography; -using System.Text; - -namespace OpenSim.Framework -{ - /// - /// NEEDS AUDIT. - /// - /// - /// Suggested implementation - /// 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. - /// When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message. - /// When receiving data from the foreign host - run 'Authenticate' against the data and the attached byte[]. - /// Both hosts should be performing these operations for this to be effective. - /// - internal class RemoteDigest - { - private byte[] currentHash; - private byte[] secret; - - private SHA512Managed SHA512; - - /// - /// Initialises a new RemoteDigest authentication mechanism - /// - /// 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 - /// The shared secret between systems (for inter-sim, this is provided in encrypted form during connection, for grid this is input manually in setup) - /// Binary salt - some common value - to be decided what - /// The challenge key provided by the third party - public RemoteDigest(string sharedSecret, byte[] salt, string challenge) - { - SHA512 = new SHA512Managed(); - Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret, salt); - secret = RFC2898.GetBytes(512); - ASCIIEncoding ASCII = new ASCIIEncoding(); - - currentHash = SHA512.ComputeHash(AppendArrays(secret, ASCII.GetBytes(challenge))); - } - - /// - /// Authenticates a piece of incoming data against the local digest. Upon successful authentication, digest string is incremented. - /// - /// The incoming data - /// The remote digest - /// - public bool Authenticate(byte[] data, byte[] digest) - { - byte[] newHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data)); - if (digest == newHash) - { - currentHash = newHash; - return true; - } - else - { - throw new Exception("Hash comparison failed. Key resync required."); - } - } - - /// - /// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message. - /// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the - /// hashes will get out of sync and throw an exception when validation is attempted. - /// - /// The outgoing data - /// The local digest - public byte[] Sign(byte[] data) - { - currentHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data)); - return currentHash; - } - - /// - /// 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. - /// - /// A 128-character hexadecimal string containing the challenge. - public static string GenerateChallenge() - { - RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider(); - byte[] bytes = new byte[64]; - RNG.GetBytes(bytes); - - StringBuilder sb = new StringBuilder(bytes.Length * 2); - foreach (byte b in bytes) - { - sb.AppendFormat("{0:x2}", b); - } - return sb.ToString(); - } - - /// - /// Helper function, merges two byte arrays - /// - /// Sourced from MSDN Forum - /// A - /// B - /// C - private static byte[] AppendArrays(byte[] a, byte[] b) - { - byte[] c = new byte[a.Length + b.Length]; - Buffer.BlockCopy(a, 0, c, 0, a.Length); - Buffer.BlockCopy(b, 0, c, a.Length, b.Length); - return c; - } - } -} \ 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections; -using System.Xml.Serialization; - -namespace OpenSim.Framework -{ - /* - * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder - * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize - * into this simpler class, and then use that. - */ - - [XmlRoot(ElementName = "inventory", IsNullable = true)] - public class SerializableInventory - { - [XmlElement(ElementName = "folder", IsNullable = true)] public SerializableFolder root; - - #region Nested type: SerializableFolder - - [XmlRoot(ElementName = "folder", IsNullable = true)] - public class SerializableFolder : InventoryFolderBase - { - [XmlArray(ElementName = "items", IsNullable = true)] [XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof (InventoryItemBase))] public ArrayList - Items; - - [XmlArray(ElementName = "folders", IsNullable = true)] [XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof (SerializableFolder))] public - ArrayList SubFolders; - } - - #endregion - } -} \ 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Text.RegularExpressions; -using OpenMetaverse; - -namespace OpenSim.Framework -{ - public class WearableItem - { - public string WearableName = ""; - public WearableType WearType = WearableType.Invalid; - - public string ItemInfo = "Created Wearable"; - - public SortedList VisualSettings = new SortedList(); - // public LLObject.TextureEntry TextureEntry = null; - //public byte[] TextureEntry = null; - - public List TextureStrings = new List(); - - //permissions - public uint BaseMask = 0; - public uint OwnerMask = 0; - public uint GroupMask = 0; - public uint EveryoneMask = 0; - public uint NextOwnerMask = 0; - - public UUID CreatorID = UUID.Zero; - public UUID OwnerID = UUID.Zero; - public UUID LastOwnerID = UUID.Zero; - public UUID GroupID = UUID.Zero; - - //sale - public string SaleType = "not"; - public int SalePrice = 10; - - private string BuildString = ""; - - - public WearableItem(string wearableName, WearableType type) - { - WearableName = wearableName; - WearType = type; - } - - public WearableItem(string wearableName) - { - WearableName = wearableName; - WearType = ConvertNameToType(WearableName); - } - - public WearableItem(WearableType type) - { - WearType = type; - WearableName = Enum.GetName(typeof(WearableType), type).ToLower(); - } - - public WearableItem() - { - } - - public void AddVisualSetting(VisualSetting setting) - { - if (!VisualSettings.ContainsKey(setting.VisualParam.ParamID)) - { - VisualSettings.Add(setting.VisualParam.ParamID, setting); - } - } - - public bool TryGetSetting(string paramName, out VisualSetting paramSetting) - { - foreach (VisualSetting setting in VisualSettings.Values) - { - if (setting.VisualParam.Name == paramName) - { - paramSetting = setting; - return true; - } - } - - paramSetting = null; - return false; - } - - public bool SetParamValue(string paramName, float value) - { - VisualSetting paramSetting; - if (TryGetSetting(paramName, out paramSetting)) - { - if ((value >= paramSetting.VisualParam.MinValue) && (value <= paramSetting.VisualParam.MaxValue)) - { - paramSetting.Value = value; - return true; - } - } - return false; - } - - public void RandomiseValues() - { - foreach (VisualSetting setting in VisualSettings.Values) - { - //int randNum = Util.RandomClass.Next(0, 1000); - float range = setting.VisualParam.MaxValue - setting.VisualParam.MinValue; - // float val = ((float) randNum) / ((float)(1000.0f / range)); - float val = (float)Util.RandomClass.NextDouble() * range * 0.2f; - setting.Value = setting.VisualParam.MinValue + (range / 2) + val; - } - } - - public WearableType ConvertNameToType(string name) - { - return (WearableType)Enum.Parse(typeof(WearableType), name, true); - } - - public string ToAssetFormat() - { - BuildString = "LLWearable version 22\n"; - BuildString += "New Item \n"; - BuildString += ItemInfo + "\n"; - - - AddSectionStart("permissions"); - AddTabbedNameValueLine("base_mask", BaseMask.ToString("00000000")); - AddTabbedNameValueLine("owner_mask", OwnerMask.ToString("00000000")); - AddTabbedNameValueLine("group_mask", GroupMask.ToString("00000000")); - AddTabbedNameValueLine("everyone_mask", EveryoneMask.ToString("00000000")); - AddTabbedNameValueLine("next_owner_mask", NextOwnerMask.ToString("00000000")); - AddTabbedNameValueLine("creator_id", CreatorID.ToString()); - AddTabbedNameValueLine("owner_id", OwnerID.ToString()); - AddTabbedNameValueLine("last_owner_id", LastOwnerID.ToString()); - AddTabbedNameValueLine("group_id", GroupID.ToString()); - AddSectionEnd(); - - AddSectionStart("sale_info"); - AddTabbedNameValueLine("sale_type", SaleType.ToString()); - AddTabbedNameValueLine("sale_price", SalePrice.ToString()); - AddSectionEnd(); - - AddNameValueLine("type", ((byte)WearType).ToString()); - AddNameValueLine("parameters", VisualSettings.Count.ToString()); - - foreach (KeyValuePair kp in VisualSettings) - { - AddNameValueLine(kp.Key.ToString(), kp.Value.Value.ToString(CultureInfo.InvariantCulture)); - } - if (TextureStrings.Count == 0) - { - AddNameValueLine("textures", "0"); //todo output texture entry - } - else - { - AddNameValueLine("textures", TextureStrings.Count.ToString()); - for (int i = 0; i < TextureStrings.Count; i++) - { - BuildString += TextureStrings[i] + "\n"; - } - BuildString += "\n"; - - } - - return BuildString; - } - - public void SaveToFile(string fileName) - { - File.WriteAllText(fileName, this.ToAssetFormat()); - } - - public void AddSectionStart(string sectionName) - { - BuildString += "\t" + sectionName + " 0\n"; - BuildString += "\t{\n"; - } - - public void AddSectionEnd() - { - BuildString += "\t}\n"; - } - - private void AddTabbedNameValueLine(string name, string value) - { - BuildString += "\t\t"; - BuildString += name + "\t"; - BuildString += value + "\n"; - } - - private void AddNameValueLine(string name, string value) - { - // BuildString += "\t\t"; - BuildString += name + " "; - BuildString += value + "\n"; - } - - #region Static Methods - public static List FindParamsForWearable(string wearableName) - { - List wearableParams = new List(); - foreach (VisualParam param in VisualParams.Params.Values) - { - if (param.Wearable == wearableName) - { - wearableParams.Add(param); - } - } - - return wearableParams; - } - - public static WearableItem Create(string wearableTypeName) - { - WearableItem wearableItem = new WearableItem(wearableTypeName); - List typeParams = FindParamsForWearable(wearableTypeName); - foreach (VisualParam param in typeParams) - { - wearableItem.AddVisualSetting(new VisualSetting(param)); - } - return wearableItem; - } - - public static WearableItem CreateFromAsset(string assetData) - { - UUID creatorID = UUID.Zero; - UUID ownerID = UUID.Zero; - UUID lastOwnerID = UUID.Zero; - UUID groupID = UUID.Zero; - - char[] newlineDelimiter = { '\n' }; - string[] lines = assetData.Split(newlineDelimiter); - - WearableItem wearableObject = null; - Regex r = new Regex("[\t ]+"); - bool reachedParams = false; - bool reachedTextures = false; - foreach (string line in lines) - { - string trimLine = line.Trim(); - // m_log.Debug("line : " + trimLine); - - string[] splitLine = r.Split(trimLine); - if (splitLine.Length > 1) - { - switch (splitLine[0]) - { - case "textures": - reachedParams = false; - reachedTextures = true; - break; - - case "type": - string wearableTypeName = Enum.GetName(typeof(WearableType), (WearableType)Convert.ToInt32(splitLine[1])); - wearableObject = Create(wearableTypeName.ToLower()); - break; - - case "parameters": - reachedParams = true; - break; - - case "creator_id": - creatorID = new UUID(splitLine[1]); - break; - - case "owner_id": - ownerID = new UUID(splitLine[1]); - break; - - case "last_owner_id": - lastOwnerID = new UUID(splitLine[1]); - break; - - case "group_id": - groupID = new UUID(splitLine[1]); - break; - - default: - if ((wearableObject != null) && (reachedParams)) - { - int id = Convert.ToInt32(splitLine[0]); - if (wearableObject.VisualSettings.ContainsKey(id)) - { - - wearableObject.VisualSettings[id].Value = Convert.ToSingle(splitLine[1], CultureInfo.InvariantCulture); - } - } - else if ((wearableObject != null) && (reachedTextures)) - { - wearableObject.TextureStrings.Add(line); - } - break; - } - } - } - - if (wearableObject != null) - { - wearableObject.CreatorID = creatorID; - wearableObject.OwnerID = ownerID; - wearableObject.LastOwnerID = lastOwnerID; - wearableObject.GroupID = groupID; - } - - return wearableObject; - } - #endregion - - #region Nested Class - public class VisualSetting - { - public VisualParam VisualParam; - public float Value = 0; - - public VisualSetting(VisualParam param, float value) - { - VisualParam = param; - Value = value; - } - - public VisualSetting(VisualParam param) - { - VisualParam = param; - Value = param.DefaultValue; - } - } - #endregion - } -} -- cgit v1.1 From 81debdfebe21bf7bd28a62dc3468151729d2e6c1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 11 Dec 2009 20:20:18 -0800 Subject: A few more guards along the path to user server. --- OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 userData.Email = (string)data["email"]; userData.ID = new UUID((string)data["uuid"]); userData.Created = Convert.ToInt32(data["profile_created"]); - userData.UserInventoryURI = (string)data["server_inventory"]; - userData.UserAssetURI = (string)data["server_asset"]; - userData.FirstLifeAboutText = (string)data["profile_firstlife_about"]; + if (data.Contains("server_inventory") && data["server_inventory"] != null) + userData.UserInventoryURI = (string)data["server_inventory"]; + if (data.Contains("server_asset") && data["server_asset"] != null) + userData.UserAssetURI = (string)data["server_asset"]; + if (data.Contains("profile_firstlife_about") && data["profile_firstlife_about"] != null) + userData.FirstLifeAboutText = (string)data["profile_firstlife_about"]; userData.FirstLifeImage = new UUID((string)data["profile_firstlife_image"]); userData.CanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); userData.WantDoMask = Convert.ToUInt32(data["profile_want_do"]); -- cgit v1.1 From d89f3e98111c7d228ab6196093eb308445429b72 Mon Sep 17 00:00:00 2001 From: Kunnis Date: Fri, 11 Dec 2009 23:14:01 -0600 Subject: Getting rid of SimpleRegionInfo and SerializableRegionInfo per Mel Signed-off-by: Melanie --- OpenSim/Framework/RegionInfo.cs | 410 ++++++++------------- OpenSim/Framework/SerializableRegionInfo.cs | 202 ---------- .../Framework/Scenes/SceneCommunicationService.cs | 37 +- 3 files changed, 151 insertions(+), 498 deletions(-) delete mode 100644 OpenSim/Framework/SerializableRegionInfo.cs 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; namespace OpenSim.Framework { - [Serializable] - public class SimpleRegionInfo - { - // private static readonly log4net.ILog m_log - // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - /// - /// The port by which http communication occurs with the region (most noticeably, CAPS communication) - /// - public uint HttpPort - { - get { return m_httpPort; } - set { m_httpPort = value; } - } - protected uint m_httpPort; - - /// - /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) - /// - public string ServerURI - { - get { return m_serverURI; } - set { m_serverURI = value; } - } - protected string m_serverURI; - - public string RegionName - { - get { return m_regionName; } - set { m_regionName = value; } - } - protected string m_regionName = String.Empty; - - protected bool Allow_Alternate_Ports; - public bool m_allow_alternate_ports; - protected string m_externalHostName; - - protected IPEndPoint m_internalEndPoint; - protected uint? m_regionLocX; - protected uint? m_regionLocY; - protected uint m_remotingPort; - public UUID RegionID = UUID.Zero; - public string RemotingAddress; - public UUID ScopeID = UUID.Zero; - - public SimpleRegionInfo() - { - } - - public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) - { - m_regionLocX = regionLocX; - m_regionLocY = regionLocY; - - m_internalEndPoint = internalEndPoint; - m_externalHostName = externalUri; - } - - public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) - { - m_regionLocX = regionLocX; - m_regionLocY = regionLocY; - - m_externalHostName = externalUri; - - m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); - } - - public SimpleRegionInfo(RegionInfo ConvertFrom) - { - m_regionName = ConvertFrom.RegionName; - m_regionLocX = ConvertFrom.RegionLocX; - m_regionLocY = ConvertFrom.RegionLocY; - m_internalEndPoint = ConvertFrom.InternalEndPoint; - m_externalHostName = ConvertFrom.ExternalHostName; - m_remotingPort = ConvertFrom.RemotingPort; - m_httpPort = ConvertFrom.HttpPort; - m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; - RemotingAddress = ConvertFrom.RemotingAddress; - RegionID = UUID.Zero; - ServerURI = ConvertFrom.ServerURI; - } - - public uint RemotingPort - { - get { return m_remotingPort; } - set { m_remotingPort = value; } - } - - /// - /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. - /// - /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method? - /// - public IPEndPoint ExternalEndPoint - { - get - { - // Old one defaults to IPv6 - //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); - - IPAddress ia = null; - // If it is already an IP, don't resolve it - just return directly - if (IPAddress.TryParse(m_externalHostName, out ia)) - return new IPEndPoint(ia, m_internalEndPoint.Port); - - // Reset for next check - ia = null; - try - { - foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) - { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } - } - } - catch (SocketException e) - { - throw new Exception( - "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + - e + "' attached to this exception", e); - } - - return new IPEndPoint(ia, m_internalEndPoint.Port); - } - - set { m_externalHostName = value.ToString(); } - } - - public string ExternalHostName - { - get { return m_externalHostName; } - set { m_externalHostName = value; } - } - - public IPEndPoint InternalEndPoint - { - get { return m_internalEndPoint; } - set { m_internalEndPoint = value; } - } - - public uint RegionLocX - { - get { return m_regionLocX.Value; } - set { m_regionLocX = value; } - } - - public uint RegionLocY - { - get { return m_regionLocY.Value; } - set { m_regionLocY = value; } - } - - public ulong RegionHandle - { - get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } - } - - public int getInternalEndPointPort() - { - return m_internalEndPoint.Port; - } - - public Dictionary ToKeyValuePairs() - { - Dictionary kvp = new Dictionary(); - kvp["uuid"] = RegionID.ToString(); - kvp["locX"] = RegionLocX.ToString(); - kvp["locY"] = RegionLocY.ToString(); - kvp["external_ip_address"] = ExternalEndPoint.Address.ToString(); - kvp["external_port"] = ExternalEndPoint.Port.ToString(); - kvp["external_host_name"] = ExternalHostName; - kvp["http_port"] = HttpPort.ToString(); - kvp["internal_ip_address"] = InternalEndPoint.Address.ToString(); - kvp["internal_port"] = InternalEndPoint.Port.ToString(); - kvp["alternate_ports"] = m_allow_alternate_ports.ToString(); - kvp["server_uri"] = ServerURI; - - return kvp; - } - - public SimpleRegionInfo(Dictionary kvp) - { - if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null)) - { - int port = 0; - Int32.TryParse((string)kvp["external_port"], out port); - IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port); - ExternalEndPoint = ep; - } - else - ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); - - if (kvp["external_host_name"] != null) - ExternalHostName = (string)kvp["external_host_name"]; - - if (kvp["http_port"] != null) - { - UInt32 port = 0; - UInt32.TryParse((string)kvp["http_port"], out port); - HttpPort = port; - } - - if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null)) - { - int port = 0; - Int32.TryParse((string)kvp["internal_port"], out port); - IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port); - InternalEndPoint = ep; - } - else - InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); - - if (kvp["alternate_ports"] != null) - { - bool alts = false; - Boolean.TryParse((string)kvp["alternate_ports"], out alts); - m_allow_alternate_ports = alts; - } - - if (kvp["server_uri"] != null) - ServerURI = (string)kvp["server_uri"]; - } - } - - public class RegionInfo : SimpleRegionInfo + public class RegionInfo { // private static readonly log4net.ILog m_log // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); @@ -304,6 +73,19 @@ namespace OpenSim.Framework private bool m_clampPrimSize = false; private int m_objectCapacity = 0; private string m_regionType = String.Empty; + protected uint m_httpPort; + protected string m_serverURI; + protected string m_regionName = String.Empty; + protected bool Allow_Alternate_Ports; + public bool m_allow_alternate_ports; + protected string m_externalHostName; + protected IPEndPoint m_internalEndPoint; + protected uint? m_regionLocX; + protected uint? m_regionLocY; + protected uint m_remotingPort; + public UUID RegionID = UUID.Zero; + public string RemotingAddress; + public UUID ScopeID = UUID.Zero; // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. @@ -386,42 +168,17 @@ namespace OpenSim.Framework configMember.performConfigurationRetrieve(); } - public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : - base(regionLocX, regionLocY, internalEndPoint, externalUri) + public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) { - } - - public RegionInfo() - { - } + m_regionLocX = regionLocX; + m_regionLocY = regionLocY; - public RegionInfo(SerializableRegionInfo ConvertFrom) - { - m_regionLocX = ConvertFrom.RegionLocX; - m_regionLocY = ConvertFrom.RegionLocY; - m_internalEndPoint = ConvertFrom.InternalEndPoint; - m_externalHostName = ConvertFrom.ExternalHostName; - m_remotingPort = ConvertFrom.RemotingPort; - m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; - RemotingAddress = ConvertFrom.RemotingAddress; - RegionID = UUID.Zero; - proxyUrl = ConvertFrom.ProxyUrl; - originRegionID = ConvertFrom.OriginRegionID; - RegionName = ConvertFrom.RegionName; - ServerURI = ConvertFrom.ServerURI; + m_internalEndPoint = internalEndPoint; + m_externalHostName = externalUri; } - public RegionInfo(SimpleRegionInfo ConvertFrom) + public RegionInfo() { - m_regionLocX = ConvertFrom.RegionLocX; - m_regionLocY = ConvertFrom.RegionLocY; - m_internalEndPoint = ConvertFrom.InternalEndPoint; - m_externalHostName = ConvertFrom.ExternalHostName; - m_remotingPort = ConvertFrom.RemotingPort; - m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; - RemotingAddress = ConvertFrom.RemotingAddress; - RegionID = UUID.Zero; - ServerURI = ConvertFrom.ServerURI; } public EstateSettings EstateSettings @@ -484,6 +241,111 @@ namespace OpenSim.Framework get { return m_regionType; } } + /// + /// The port by which http communication occurs with the region (most noticeably, CAPS communication) + /// + public uint HttpPort + { + get { return m_httpPort; } + set { m_httpPort = value; } + } + + /// + /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) + /// + public string ServerURI + { + get { return m_serverURI; } + set { m_serverURI = value; } + } + + public string RegionName + { + get { return m_regionName; } + set { m_regionName = value; } + } + + public uint RemotingPort + { + get { return m_remotingPort; } + set { m_remotingPort = value; } + } + + /// + /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. + /// + /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method? + /// + public IPEndPoint ExternalEndPoint + { + get + { + // Old one defaults to IPv6 + //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); + + IPAddress ia = null; + // If it is already an IP, don't resolve it - just return directly + if (IPAddress.TryParse(m_externalHostName, out ia)) + return new IPEndPoint(ia, m_internalEndPoint.Port); + + // Reset for next check + ia = null; + try + { + foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) + { + if (ia == null) + ia = Adr; + + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } + } + } + catch (SocketException e) + { + throw new Exception( + "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + + e + "' attached to this exception", e); + } + + return new IPEndPoint(ia, m_internalEndPoint.Port); + } + + set { m_externalHostName = value.ToString(); } + } + + public string ExternalHostName + { + get { return m_externalHostName; } + set { m_externalHostName = value; } + } + + public IPEndPoint InternalEndPoint + { + get { return m_internalEndPoint; } + set { m_internalEndPoint = value; } + } + + public uint RegionLocX + { + get { return m_regionLocX.Value; } + set { m_regionLocX = value; } + } + + public uint RegionLocY + { + get { return m_regionLocY.Value; } + set { m_regionLocY = value; } + } + + public ulong RegionHandle + { + get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } + } + public void SetEndPoint(string ipaddr, int port) { IPAddress tmpIP = IPAddress.Parse(ipaddr); @@ -1074,5 +936,27 @@ namespace OpenSim.Framework return regionInfo; } + public int getInternalEndPointPort() + { + return m_internalEndPoint.Port; + } + + public Dictionary ToKeyValuePairs() + { + Dictionary kvp = new Dictionary(); + kvp["uuid"] = RegionID.ToString(); + kvp["locX"] = RegionLocX.ToString(); + kvp["locY"] = RegionLocY.ToString(); + kvp["external_ip_address"] = ExternalEndPoint.Address.ToString(); + kvp["external_port"] = ExternalEndPoint.Port.ToString(); + kvp["external_host_name"] = ExternalHostName; + kvp["http_port"] = HttpPort.ToString(); + kvp["internal_ip_address"] = InternalEndPoint.Address.ToString(); + kvp["internal_port"] = InternalEndPoint.Port.ToString(); + kvp["alternate_ports"] = m_allow_alternate_ports.ToString(); + kvp["server_uri"] = ServerURI; + + return kvp; + } } } 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Net; -using System.Net.Sockets; -using OpenMetaverse; - -namespace OpenSim.Framework -{ - [Serializable] - public class SerializableRegionInfo - { - public bool m_allow_alternate_ports; - protected string m_externalHostName; - - /// - /// The port by which http communication occurs with the region (most noticeably, CAPS communication) - /// - /// FIXME: Defaulting to 9000 temporarily (on the basis that this is the http port most region - /// servers are running) until the revision in which this change is made propogates around grids. - /// - protected uint m_httpPort = 9000; - - protected IPEndPoint m_internalEndPoint; - protected Guid m_originRegionID = UUID.Zero.Guid; - protected string m_proxyUrl; - protected uint? m_regionLocX; - protected uint? m_regionLocY; - protected string m_regionName; - public uint m_remotingPort; - protected string m_serverURI; - public Guid RegionID = UUID.Zero.Guid; - public string RemotingAddress; - - /// - /// This is a serializable version of RegionInfo - /// - public SerializableRegionInfo() - { - } - - public SerializableRegionInfo(RegionInfo ConvertFrom) - { - m_regionLocX = ConvertFrom.RegionLocX; - m_regionLocY = ConvertFrom.RegionLocY; - m_internalEndPoint = ConvertFrom.InternalEndPoint; - m_externalHostName = ConvertFrom.ExternalHostName; - m_remotingPort = ConvertFrom.RemotingPort; - m_httpPort = ConvertFrom.HttpPort; - m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; - RemotingAddress = ConvertFrom.RemotingAddress; - m_proxyUrl = ConvertFrom.proxyUrl; - OriginRegionID = ConvertFrom.originRegionID; - RegionName = ConvertFrom.RegionName; - ServerURI = ConvertFrom.ServerURI; - } - - public SerializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) - { - m_regionLocX = regionLocX; - m_regionLocY = regionLocY; - - m_internalEndPoint = internalEndPoint; - m_externalHostName = externalUri; - } - - public SerializableRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) - { - m_regionLocX = regionLocX; - m_regionLocY = regionLocY; - - m_externalHostName = externalUri; - - m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); - } - - public uint RemotingPort - { - get { return m_remotingPort; } - set { m_remotingPort = value; } - } - - public uint HttpPort - { - get { return m_httpPort; } - set { m_httpPort = value; } - } - - public IPEndPoint ExternalEndPoint - { - get - { - // Old one defaults to IPv6 - //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); - - IPAddress ia = null; - // If it is already an IP, don't resolve it - just return directly - if (IPAddress.TryParse(m_externalHostName, out ia)) - return new IPEndPoint(ia, m_internalEndPoint.Port); - - // Reset for next check - ia = null; - - - // New method favors IPv4 - foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) - { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } - } - - return new IPEndPoint(ia, m_internalEndPoint.Port); - } - - set { m_externalHostName = value.ToString(); } - } - - public string ExternalHostName - { - get { return m_externalHostName; } - set { m_externalHostName = value; } - } - - public IPEndPoint InternalEndPoint - { - get { return m_internalEndPoint; } - set { m_internalEndPoint = value; } - } - - public uint RegionLocX - { - get { return m_regionLocX.Value; } - set { m_regionLocX = value; } - } - - public uint RegionLocY - { - get { return m_regionLocY.Value; } - set { m_regionLocY = value; } - } - - public ulong RegionHandle - { - get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } - } - - public string ProxyUrl - { - get { return m_proxyUrl; } - set { m_proxyUrl = value; } - } - - public UUID OriginRegionID - { - get { return new UUID(m_originRegionID); } - set { m_originRegionID = value.Guid; } - } - - public string RegionName - { - get { return m_regionName; } - set { m_regionName = value; } - } - - public string ServerURI - { - get { return m_serverURI; } - set { m_serverURI = value; } - } - } -} 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 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); return neighbours; - //SimpleRegionInfo regionData = m_commsProvider.GridService.RequestNeighbourInfo() - //return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY); } } @@ -367,20 +365,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void EnableNeighbourChildAgents(ScenePresence avatar, List lstneighbours) { - //List neighbours = new List(); List neighbours = new List(); - ////m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); - //for (int i = 0; i < lstneighbours.Count; i++) - //{ - // // We don't want to keep sending to regions that consistently fail on comms. - // if (!(lstneighbours[i].commFailTF)) - // { - // neighbours.Add(new SimpleRegionInfo(lstneighbours[i])); - // } - //} - // we're going to be using the above code once neighbour cache is correct. Currently it doesn't appear to be - // So we're temporarily going back to the old method of grabbing it from the Grid Server Every time :/ if (m_regionInfo != null) { neighbours = RequestNeighbours(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); @@ -431,7 +417,6 @@ namespace OpenSim.Region.Framework.Scenes /// Create the necessary child agents List cagents = new List(); - //foreach (SimpleRegionInfo neighbour in neighbours) foreach (GridRegion neighbour in neighbours) { if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle) @@ -583,7 +568,9 @@ namespace OpenSim.Region.Framework.Scenes //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++) + { for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++) + { if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region { ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize); @@ -593,24 +580,8 @@ namespace OpenSim.Region.Framework.Scenes InformNeighborsThatRegionisUpCompleted, d); } - - //List neighbours = new List(); - //// This stays uncached because we don't already know about our neighbors at this point. - - //neighbours = m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID); - //if (neighbours != null) - //{ - // for (int i = 0; i < neighbours.Count; i++) - // { - // InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; - - // d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle, - // InformNeighborsThatRegionisUpCompleted, - // d); - // } - //} - - //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region)); + } + } } -- cgit v1.1