Merge branch 'master' of ssh://MyConnection/var/git/opensim
commit
35961caec6
|
@ -304,7 +304,7 @@ namespace OpenSim.Client.Linden
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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();
|
Hashtable respdata = new Hashtable();
|
||||||
respdata["success"] = "FALSE";
|
respdata["success"] = "FALSE";
|
||||||
respdata["reason"] = "Exception occurred";
|
respdata["reason"] = "Exception occurred";
|
||||||
|
|
|
@ -480,8 +480,8 @@ namespace OpenSim.Data.MySQL
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.WarnFormat(
|
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.",
|
"[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, prim.AbsolutePosition, regionID, prim.ParentUUID);
|
prim.Name, prim.UUID, regionID, prim.ParentUUID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// AssetConfig -- For Asset Server Configuration
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -141,7 +141,14 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname);
|
UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname);
|
||||||
|
|
||||||
if (userProfile != null)
|
if (userProfile != null)
|
||||||
|
{
|
||||||
|
if ((userProfile.UserAssetURI == null || userProfile.UserAssetURI == "") && m_commsManager.NetworkServersInfo != null)
|
||||||
|
userProfile.UserAssetURI = m_commsManager.NetworkServersInfo.AssetURL;
|
||||||
|
if ((userProfile.UserInventoryURI == null || userProfile.UserInventoryURI == "") && m_commsManager.NetworkServersInfo != null)
|
||||||
|
userProfile.UserInventoryURI = m_commsManager.NetworkServersInfo.InventoryURL;
|
||||||
|
|
||||||
return AddToCaches(userProfile);
|
return AddToCaches(userProfile);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +176,14 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID);
|
UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID);
|
||||||
if (userProfile != null)
|
if (userProfile != null)
|
||||||
|
{
|
||||||
|
if ((userProfile.UserAssetURI == null || userProfile.UserAssetURI == "") && m_commsManager.NetworkServersInfo != null)
|
||||||
|
userProfile.UserAssetURI = m_commsManager.NetworkServersInfo.AssetURL;
|
||||||
|
if ((userProfile.UserInventoryURI == null || userProfile.UserInventoryURI == "") && m_commsManager.NetworkServersInfo != null)
|
||||||
|
userProfile.UserInventoryURI = m_commsManager.NetworkServersInfo.InventoryURL;
|
||||||
|
|
||||||
return AddToCaches(userProfile);
|
return AddToCaches(userProfile);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ namespace OpenSim.Framework.Communications.Clients
|
||||||
}
|
}
|
||||||
|
|
||||||
Hashtable responseData = (Hashtable)UserResp.Value;
|
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);
|
//System.Console.WriteLine("[Authorization]: userserver reported authorized session for user " + userID);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Interface to the local asset cache. This is the mechanism through which assets can be added and requested.
|
|
||||||
/// </summary>
|
|
||||||
public interface IAssetCache : IPlugin
|
|
||||||
{
|
|
||||||
/// <value>
|
|
||||||
/// The 'server' from which assets can be requested and to which assets are persisted.
|
|
||||||
/// </value>
|
|
||||||
|
|
||||||
void Initialise(ConfigSettings cs);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Report statistical data to the log.
|
|
||||||
/// </summary>
|
|
||||||
void ShowState();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clear the asset cache.
|
|
||||||
/// </summary>
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get an asset only if it's already in the cache.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="assetId"></param>
|
|
||||||
/// <param name="asset"></param>
|
|
||||||
/// <returns>true if the asset was in the cache, false if it was not</returns>
|
|
||||||
bool TryGetCachedAsset(UUID assetID, out AssetBase asset);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Asynchronously retrieve an asset.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="assetId"></param>
|
|
||||||
/// <param name="callback">
|
|
||||||
/// <param name="isTexture"></param>
|
|
||||||
/// 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</param>
|
|
||||||
void GetAsset(UUID assetID, AssetRequestCallback callback, bool isTexture);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 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.
|
|
||||||
/// </summary>
|
|
||||||
///
|
|
||||||
/// 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()
|
|
||||||
///
|
|
||||||
/// <param name="assetID"></param>
|
|
||||||
/// <param name="isTexture"></param>
|
|
||||||
/// <returns>null if the asset could not be retrieved</returns>
|
|
||||||
AssetBase GetAsset(UUID assetID, bool isTexture);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add an asset to both the persistent store and the cache.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="asset"></param>
|
|
||||||
void AddAsset(AssetBase asset);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Expire an asset from the cache
|
|
||||||
/// </summary>
|
|
||||||
/// 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);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handle an asset request from the client. The result will be sent back asynchronously.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userInfo"></param>
|
|
||||||
/// <param name="transferRequest"></param>
|
|
||||||
void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Defines and handles inventory grid server configuration
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Provides helper methods for parallelizing loops
|
|
||||||
/// </summary>
|
|
||||||
public static class Parallel
|
|
||||||
{
|
|
||||||
public static readonly int ProcessorCount = System.Environment.ProcessorCount;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Executes a for loop in which iterations may run in parallel
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fromInclusive">The loop will be started at this index</param>
|
|
||||||
/// <param name="toExclusive">The loop will be terminated before this index is reached</param>
|
|
||||||
/// <param name="body">Method body to run for each iteration of the loop</param>
|
|
||||||
public static void For(int fromInclusive, int toExclusive, Action<int> body)
|
|
||||||
{
|
|
||||||
For(ProcessorCount, fromInclusive, toExclusive, body);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Executes a for loop in which iterations may run in parallel
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="threadCount">The number of concurrent execution threads to run</param>
|
|
||||||
/// <param name="fromInclusive">The loop will be started at this index</param>
|
|
||||||
/// <param name="toExclusive">The loop will be terminated before this index is reached</param>
|
|
||||||
/// <param name="body">Method body to run for each iteration of the loop</param>
|
|
||||||
public static void For(int threadCount, int fromInclusive, int toExclusive, Action<int> 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Executes a foreach loop in which iterations may run in parallel
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">Object type that the collection wraps</typeparam>
|
|
||||||
/// <param name="enumerable">An enumerable collection to iterate over</param>
|
|
||||||
/// <param name="body">Method body to run for each object in the collection</param>
|
|
||||||
public static void ForEach<T>(IEnumerable<T> enumerable, Action<T> body)
|
|
||||||
{
|
|
||||||
ForEach<T>(ProcessorCount, enumerable, body);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Executes a foreach loop in which iterations may run in parallel
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">Object type that the collection wraps</typeparam>
|
|
||||||
/// <param name="threadCount">The number of concurrent execution threads to run</param>
|
|
||||||
/// <param name="enumerable">An enumerable collection to iterate over</param>
|
|
||||||
/// <param name="body">Method body to run for each object in the collection</param>
|
|
||||||
public static void ForEach<T>(int threadCount, IEnumerable<T> enumerable, Action<T> body)
|
|
||||||
{
|
|
||||||
int counter = threadCount;
|
|
||||||
AutoResetEvent threadFinishEvent = new AutoResetEvent(false);
|
|
||||||
IEnumerator<T> 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Executes a series of tasks in parallel
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="actions">A series of method bodies to execute</param>
|
|
||||||
public static void Invoke(params Action[] actions)
|
|
||||||
{
|
|
||||||
Invoke(ProcessorCount, actions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Executes a series of tasks in parallel
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="threadCount">The number of concurrent execution threads to run</param>
|
|
||||||
/// <param name="actions">A series of method bodies to execute</param>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -38,238 +38,7 @@ using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
[Serializable]
|
public class RegionInfo
|
||||||
public class SimpleRegionInfo
|
|
||||||
{
|
|
||||||
// private static readonly log4net.ILog m_log
|
|
||||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The port by which http communication occurs with the region (most noticeably, CAPS communication)
|
|
||||||
/// </summary>
|
|
||||||
public uint HttpPort
|
|
||||||
{
|
|
||||||
get { return m_httpPort; }
|
|
||||||
set { m_httpPort = value; }
|
|
||||||
}
|
|
||||||
protected uint m_httpPort;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
|
|
||||||
/// </summary>
|
|
||||||
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; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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?
|
|
||||||
/// </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;
|
|
||||||
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<string, object> ToKeyValuePairs()
|
|
||||||
{
|
|
||||||
Dictionary<string, object> kvp = new Dictionary<string, object>();
|
|
||||||
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<string, object> 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
|
|
||||||
{
|
{
|
||||||
// private static readonly log4net.ILog m_log
|
// private static readonly log4net.ILog m_log
|
||||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
@ -304,6 +73,19 @@ namespace OpenSim.Framework
|
||||||
private bool m_clampPrimSize = false;
|
private bool m_clampPrimSize = false;
|
||||||
private int m_objectCapacity = 0;
|
private int m_objectCapacity = 0;
|
||||||
private string m_regionType = String.Empty;
|
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.
|
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
|
||||||
|
@ -386,44 +168,19 @@ namespace OpenSim.Framework
|
||||||
configMember.performConfigurationRetrieve();
|
configMember.performConfigurationRetrieve();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) :
|
public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
||||||
base(regionLocX, regionLocY, internalEndPoint, externalUri)
|
|
||||||
{
|
{
|
||||||
|
m_regionLocX = regionLocX;
|
||||||
|
m_regionLocY = regionLocY;
|
||||||
|
|
||||||
|
m_internalEndPoint = internalEndPoint;
|
||||||
|
m_externalHostName = externalUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionInfo()
|
public RegionInfo()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RegionInfo(SimpleRegionInfo 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;
|
|
||||||
ServerURI = ConvertFrom.ServerURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EstateSettings EstateSettings
|
public EstateSettings EstateSettings
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -484,6 +241,111 @@ namespace OpenSim.Framework
|
||||||
get { return m_regionType; }
|
get { return m_regionType; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The port by which http communication occurs with the region (most noticeably, CAPS communication)
|
||||||
|
/// </summary>
|
||||||
|
public uint HttpPort
|
||||||
|
{
|
||||||
|
get { return m_httpPort; }
|
||||||
|
set { m_httpPort = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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?
|
||||||
|
/// </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;
|
||||||
|
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)
|
public void SetEndPoint(string ipaddr, int port)
|
||||||
{
|
{
|
||||||
IPAddress tmpIP = IPAddress.Parse(ipaddr);
|
IPAddress tmpIP = IPAddress.Parse(ipaddr);
|
||||||
|
@ -1074,5 +936,27 @@ namespace OpenSim.Framework
|
||||||
return regionInfo;
|
return regionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getInternalEndPointPort()
|
||||||
|
{
|
||||||
|
return m_internalEndPoint.Port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<string, object> ToKeyValuePairs()
|
||||||
|
{
|
||||||
|
Dictionary<string, object> kvp = new Dictionary<string, object>();
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// NEEDS AUDIT.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// Suggested implementation
|
|
||||||
/// <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>
|
|
||||||
/// <para>When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message.</para>
|
|
||||||
/// <para>When receiving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para>
|
|
||||||
/// <para>Both hosts should be performing these operations for this to be effective.</para>
|
|
||||||
/// </remarks>
|
|
||||||
internal class RemoteDigest
|
|
||||||
{
|
|
||||||
private byte[] currentHash;
|
|
||||||
private byte[] secret;
|
|
||||||
|
|
||||||
private SHA512Managed SHA512;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initialises a new RemoteDigest authentication mechanism
|
|
||||||
/// </summary>
|
|
||||||
/// <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>
|
|
||||||
/// <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>
|
|
||||||
/// <param name="salt">Binary salt - some common value - to be decided what</param>
|
|
||||||
/// <param name="challenge">The challenge key provided by the third party</param>
|
|
||||||
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)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Authenticates a piece of incoming data against the local digest. Upon successful authentication, digest string is incremented.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The incoming data</param>
|
|
||||||
/// <param name="digest">The remote digest</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
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.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 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.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">The outgoing data</param>
|
|
||||||
/// <returns>The local digest</returns>
|
|
||||||
public byte[] Sign(byte[] data)
|
|
||||||
{
|
|
||||||
currentHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
|
|
||||||
return currentHash;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 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.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A 128-character hexadecimal string containing the challenge.</returns>
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Helper function, merges two byte arrays
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>Sourced from MSDN Forum</remarks>
|
|
||||||
/// <param name="a">A</param>
|
|
||||||
/// <param name="b">B</param>
|
|
||||||
/// <returns>C</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
|
|
||||||
/// <value>
|
|
||||||
/// 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.
|
|
||||||
/// </value>
|
|
||||||
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;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This is a serializable version of RegionInfo
|
|
||||||
/// </summary>
|
|
||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<int, VisualSetting> VisualSettings = new SortedList<int, VisualSetting>();
|
|
||||||
// public LLObject.TextureEntry TextureEntry = null;
|
|
||||||
//public byte[] TextureEntry = null;
|
|
||||||
|
|
||||||
public List<string> TextureStrings = new List<string>();
|
|
||||||
|
|
||||||
//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<int, VisualSetting> 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<VisualParam> FindParamsForWearable(string wearableName)
|
|
||||||
{
|
|
||||||
List<VisualParam> wearableParams = new List<VisualParam>();
|
|
||||||
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<VisualParam> 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
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -655,8 +655,11 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
userData.Email = (string)data["email"];
|
userData.Email = (string)data["email"];
|
||||||
userData.ID = new UUID((string)data["uuid"]);
|
userData.ID = new UUID((string)data["uuid"]);
|
||||||
userData.Created = Convert.ToInt32(data["profile_created"]);
|
userData.Created = Convert.ToInt32(data["profile_created"]);
|
||||||
|
if (data.Contains("server_inventory") && data["server_inventory"] != null)
|
||||||
userData.UserInventoryURI = (string)data["server_inventory"];
|
userData.UserInventoryURI = (string)data["server_inventory"];
|
||||||
|
if (data.Contains("server_asset") && data["server_asset"] != null)
|
||||||
userData.UserAssetURI = (string)data["server_asset"];
|
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.FirstLifeAboutText = (string)data["profile_firstlife_about"];
|
||||||
userData.FirstLifeImage = new UUID((string)data["profile_firstlife_image"]);
|
userData.FirstLifeImage = new UUID((string)data["profile_firstlife_image"]);
|
||||||
userData.CanDoMask = Convert.ToUInt32((string)data["profile_can_do"]);
|
userData.CanDoMask = Convert.ToUInt32((string)data["profile_can_do"]);
|
||||||
|
|
|
@ -155,7 +155,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene);
|
((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene);
|
||||||
|
|
||||||
// Yikes!! Remove this as soon as user services get refactored
|
// 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;
|
LocalInventoryServerURI = scene.CommsManager.NetworkServersInfo.InventoryURL;
|
||||||
LocalUserServerURI = scene.CommsManager.NetworkServersInfo.UserURL;
|
LocalUserServerURI = scene.CommsManager.NetworkServersInfo.UserURL;
|
||||||
HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI);
|
HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI);
|
||||||
|
|
|
@ -45,6 +45,10 @@ namespace OpenSim.Region.DataSnapshot.Providers
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private bool m_stale = true;
|
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)
|
public void Initialize(Scene scene, DataSnapshotManager parent)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
|
@ -142,6 +146,19 @@ namespace OpenSim.Region.DataSnapshot.Providers
|
||||||
node.InnerText = land.LandData.GlobalID.ToString();
|
node.InnerText = land.LandData.GlobalID.ToString();
|
||||||
xmlobject.AppendChild(node);
|
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);
|
parent.AppendChild(xmlobject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,5 +190,58 @@ namespace OpenSim.Region.DataSnapshot.Providers
|
||||||
}
|
}
|
||||||
|
|
||||||
public event ProviderStale OnStale;
|
public event ProviderStale OnStale;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sog"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private string GuessImage(SceneObjectGroup sog)
|
||||||
|
{
|
||||||
|
string bestguess = string.Empty;
|
||||||
|
Dictionary<UUID, int> counts = new Dictionary<UUID, int>();
|
||||||
|
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<UUID, int> kv in counts)
|
||||||
|
{
|
||||||
|
if (kv.Value < min && kv.Value >= 1)
|
||||||
|
{
|
||||||
|
bestguess = kv.Key.ToString();
|
||||||
|
min = kv.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bestguess;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,8 +356,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
|
neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
|
||||||
|
|
||||||
return neighbours;
|
return neighbours;
|
||||||
//SimpleRegionInfo regionData = m_commsProvider.GridService.RequestNeighbourInfo()
|
|
||||||
//return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,20 +365,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours)
|
public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours)
|
||||||
{
|
{
|
||||||
//List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
|
|
||||||
List<GridRegion> neighbours = new List<GridRegion>();
|
List<GridRegion> neighbours = new List<GridRegion>();
|
||||||
|
|
||||||
////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)
|
if (m_regionInfo != null)
|
||||||
{
|
{
|
||||||
neighbours = RequestNeighbours(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
|
neighbours = RequestNeighbours(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
|
||||||
|
@ -431,7 +417,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
/// Create the necessary child agents
|
/// Create the necessary child agents
|
||||||
List<AgentCircuitData> cagents = new List<AgentCircuitData>();
|
List<AgentCircuitData> cagents = new List<AgentCircuitData>();
|
||||||
//foreach (SimpleRegionInfo neighbour in neighbours)
|
|
||||||
foreach (GridRegion neighbour in neighbours)
|
foreach (GridRegion neighbour in neighbours)
|
||||||
{
|
{
|
||||||
if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle)
|
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);
|
//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 x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++)
|
||||||
|
{
|
||||||
for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++)
|
for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++)
|
||||||
|
{
|
||||||
if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region
|
if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region
|
||||||
{
|
{
|
||||||
ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize);
|
ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize);
|
||||||
|
@ -593,24 +580,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
InformNeighborsThatRegionisUpCompleted,
|
InformNeighborsThatRegionisUpCompleted,
|
||||||
d);
|
d);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//List<GridRegion> neighbours = new List<GridRegion>();
|
}
|
||||||
//// 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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue