From c746a2f9f4f0b1e7eea564effdae63472f79ab22 Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 27 May 2007 18:52:42 +0000 Subject: Should allow multiple worlds (and UDP servers) to be ran in one instance, just missing backend comms and working Avatar/primitives classes. --- Common/OpenSim.Framework/AgentInventory.cs | 10 +- Common/OpenSim.Framework/HeightMapGenHills.cs | 149 ------ .../Interfaces/Config/IGenericConfig.cs | 15 + .../Interfaces/Config/IGridConfig.cs | 64 +++ .../Interfaces/Config/IUserConfig.cs | 58 +++ Common/OpenSim.Framework/Interfaces/IClientAPI.cs | 8 +- Common/OpenSim.Framework/Interfaces/IConfig.cs | 76 --- .../OpenSim.Framework/Interfaces/IGenericConfig.cs | 15 - Common/OpenSim.Framework/Interfaces/IGridConfig.cs | 64 --- Common/OpenSim.Framework/Interfaces/IScriptAPI.cs | 14 - .../OpenSim.Framework/Interfaces/IScriptEngine.cs | 14 - Common/OpenSim.Framework/Interfaces/IUserConfig.cs | 58 --- Common/OpenSim.Framework/Interfaces/IWorld.cs | 15 + .../Interfaces/Remoting/IGridServerHost.cs | 12 + .../Interfaces/Remoting/IProxyServerClient.cs | 10 + .../Interfaces/Remoting/IProxyServerHost.cs | 10 + .../Interfaces/Remoting/IRegionGridClient.cs | 11 + .../Interfaces/Remoting/IRegionSimHost.cs | 12 + .../Interfaces/Remoting/RegionGridClientBase.cs | 11 + .../Interfaces/Scripting/IScriptAPI.cs | 14 + .../Interfaces/Scripting/IScriptEngine.cs | 14 + Common/OpenSim.Framework/OpenSim.Framework.csproj | 95 ++-- Common/OpenSim.Framework/SimProfile.cs | 4 +- Common/OpenSim.Framework/Types/NeighbourInfo.cs | 4 + .../OpenSim.Framework/Types/NetworkServersInfo.cs | 91 ++++ Common/OpenSim.Framework/Types/RegionInfo.cs | 198 ++++++++ Common/OpenSim.Framework/UserProfileManager.cs | 8 +- Common/OpenSim.Framework/UserProfileManagerBase.cs | 10 +- OpenGridServices.suo | Bin 137216 -> 130542 bytes OpenSim.sln | 218 ++++----- OpenSim.suo | Bin 331264 -> 331264 bytes OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs | 43 ++ OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs | 2 - OpenSim/OpenSim.RegionServer/ClientView.API.cs | 96 ++++ OpenSim/OpenSim.RegionServer/ClientView.Grid.cs | 1 - .../ClientView.PacketHandlers.cs | 18 +- .../ClientView.ProcessPackets.cs | 17 +- OpenSim/OpenSim.RegionServer/ClientView.cs | 97 +--- OpenSim/OpenSim.RegionServer/ClientViewBase.cs | 2 +- OpenSim/OpenSim.RegionServer/CommsManager.cs | 10 + OpenSim/OpenSim.RegionServer/Grid.cs | 14 - OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs | 91 ++++ .../OpenSim.RegionServer.csproj | 127 ++--- OpenSim/OpenSim.RegionServer/OpenSimMain.cs | 531 --------------------- .../OpenSim.RegionServer/OpenSimNetworkHandler.cs | 5 +- OpenSim/OpenSim.RegionServer/PacketServer.cs | 40 +- OpenSim/OpenSim.RegionServer/RegionInfo.cs | 70 +-- OpenSim/OpenSim.RegionServer/RegionInfoBase.cs | 32 -- OpenSim/OpenSim.RegionServer/RegionServerBase.cs | 13 +- OpenSim/OpenSim.RegionServer/UDPServer.cs | 34 +- OpenSim/OpenSim.RegionServer/UserConfigUtility.cs | 10 + OpenSim/OpenSim.RegionServer/VersionInfo.cs | 2 +- .../LocalStorageBerkeleyDB/BDBLocalStorage.cs | 1 - .../LocalStorageDb4o/Db4LocalStorage.cs | 2 +- .../LocalStorageSQLite/SQLiteLocalStorage.cs | 2 +- OpenSim/OpenSim.World/Avatar.Update.cs | 7 +- OpenSim/OpenSim.World/Avatar.cs | 18 +- OpenSim/OpenSim.World/OpenSim.World.csproj | 52 +- OpenSim/OpenSim.World/Primitive.cs | 476 +++++++++++++++++- OpenSim/OpenSim.World/SceneObject.cs | 6 +- OpenSim/OpenSim.World/World.PacketHandlers.cs | 175 +------ OpenSim/OpenSim.World/World.Scripting.cs | 2 +- OpenSim/OpenSim.World/World.cs | 110 ++--- OpenSim/OpenSim.World/WorldBase.cs | 45 +- OpenSim/OpenSim.World/scripting/IScriptHandler.cs | 2 +- OpenSim/OpenSim/OpenSim.csproj | 55 ++- OpenSim/OpenSim/OpenSimMain.cs | 225 +++------ 67 files changed, 1777 insertions(+), 1938 deletions(-) delete mode 100644 Common/OpenSim.Framework/HeightMapGenHills.cs create mode 100644 Common/OpenSim.Framework/Interfaces/Config/IGenericConfig.cs create mode 100644 Common/OpenSim.Framework/Interfaces/Config/IGridConfig.cs create mode 100644 Common/OpenSim.Framework/Interfaces/Config/IUserConfig.cs delete mode 100644 Common/OpenSim.Framework/Interfaces/IConfig.cs delete mode 100644 Common/OpenSim.Framework/Interfaces/IGenericConfig.cs delete mode 100644 Common/OpenSim.Framework/Interfaces/IGridConfig.cs delete mode 100644 Common/OpenSim.Framework/Interfaces/IScriptAPI.cs delete mode 100644 Common/OpenSim.Framework/Interfaces/IScriptEngine.cs delete mode 100644 Common/OpenSim.Framework/Interfaces/IUserConfig.cs create mode 100644 Common/OpenSim.Framework/Interfaces/IWorld.cs create mode 100644 Common/OpenSim.Framework/Interfaces/Remoting/IGridServerHost.cs create mode 100644 Common/OpenSim.Framework/Interfaces/Remoting/IProxyServerClient.cs create mode 100644 Common/OpenSim.Framework/Interfaces/Remoting/IProxyServerHost.cs create mode 100644 Common/OpenSim.Framework/Interfaces/Remoting/IRegionGridClient.cs create mode 100644 Common/OpenSim.Framework/Interfaces/Remoting/IRegionSimHost.cs create mode 100644 Common/OpenSim.Framework/Interfaces/Remoting/RegionGridClientBase.cs create mode 100644 Common/OpenSim.Framework/Interfaces/Scripting/IScriptAPI.cs create mode 100644 Common/OpenSim.Framework/Interfaces/Scripting/IScriptEngine.cs create mode 100644 Common/OpenSim.Framework/Types/NetworkServersInfo.cs create mode 100644 Common/OpenSim.Framework/Types/RegionInfo.cs create mode 100644 OpenSim/OpenSim.RegionServer/ClientView.API.cs create mode 100644 OpenSim/OpenSim.RegionServer/CommsManager.cs delete mode 100644 OpenSim/OpenSim.RegionServer/Grid.cs create mode 100644 OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs delete mode 100644 OpenSim/OpenSim.RegionServer/OpenSimMain.cs delete mode 100644 OpenSim/OpenSim.RegionServer/RegionInfoBase.cs create mode 100644 OpenSim/OpenSim.RegionServer/UserConfigUtility.cs diff --git a/Common/OpenSim.Framework/AgentInventory.cs b/Common/OpenSim.Framework/AgentInventory.cs index b28645e..6fdd6c5 100644 --- a/Common/OpenSim.Framework/AgentInventory.cs +++ b/Common/OpenSim.Framework/AgentInventory.cs @@ -79,7 +79,7 @@ namespace OpenSim.Framework.Inventory { if (!this.InventoryFolders.ContainsKey(folderID)) { - Console.WriteLine("creating new folder called " + folderName + " in agents inventory"); + System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory"); InventoryFolder Folder = new InventoryFolder(); Folder.FolderID = folderID; Folder.OwnerID = this.AgentID; @@ -120,7 +120,7 @@ namespace OpenSim.Framework.Inventory { InventoryItem Item = this.InventoryItems[itemID]; Item.AssetID = asset.FullID; - Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated()); + System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated()); //TODO need to update the rest of the info } return true; @@ -128,13 +128,13 @@ namespace OpenSim.Framework.Inventory public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) { - Console.WriteLine("updating inventory item details"); + System.Console.WriteLine("updating inventory item details"); if (this.InventoryItems.ContainsKey(itemID)) { - Console.WriteLine("changing name to "+ Util.FieldToString(packet.Name)); + System.Console.WriteLine("changing name to "+ Util.FieldToString(packet.Name)); InventoryItem Item = this.InventoryItems[itemID]; Item.Name = Util.FieldToString(packet.Name); - Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated()); + System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated()); //TODO need to update the rest of the info } return true; diff --git a/Common/OpenSim.Framework/HeightMapGenHills.cs b/Common/OpenSim.Framework/HeightMapGenHills.cs deleted file mode 100644 index 6a729da..0000000 --- a/Common/OpenSim.Framework/HeightMapGenHills.cs +++ /dev/null @@ -1,149 +0,0 @@ -/* -* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ -* -* 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 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 ``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 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.Terrain -{ - public class HeightmapGenHills - { - private Random Rand = new Random(); - private int NumHills; - private float HillMin; - private float HillMax; - private bool Island; - private float[] heightmap; - - public float[] GenerateHeightmap(int numHills, float hillMin, float hillMax, bool island) - { - NumHills = numHills; - HillMin = hillMin; - HillMax = hillMax; - Island = island; - - heightmap = new float[256 * 256]; - - for (int i = 0; i < numHills; i++) - { - AddHill(); - } - - Normalize(); - - return heightmap; - } - - private void AddHill() - { - float x, y; - float radius = RandomRange(HillMin, HillMax); - - if (Island) - { - // Which direction from the center of the map the hill is placed - float theta = RandomRange(0, 6.28f); - - // How far from the center of the map to place the hill. The radius - // is subtracted from the range to prevent any part of the hill from - // reaching the edge of the map - float distance = RandomRange(radius / 2.0f, 128.0f - radius); - - x = 128.0f + (float)Math.Cos(theta) * distance; - y = 128.0f + (float)Math.Sin(theta) * distance; - } - else - { - x = RandomRange(-radius, 256.0f + radius); - y = RandomRange(-radius, 256.0f + radius); - } - - float radiusSq = radius * radius; - float distSq; - float height; - - int xMin = (int)(x - radius) - 1; - int xMax = (int)(x + radius) + 1; - if (xMin < 0) xMin = 0; - if (xMax > 255) xMax = 255; - - int yMin = (int)(y - radius) - 1; - int yMax = (int)(y + radius) + 1; - if (yMin < 0) yMin = 0; - if (yMax > 255) yMax = 255; - - // Loop through each affected cell and determine the height at that point - for (int v = yMin; v <= yMax; ++v) - { - float fv = (float)v; - - for (int h = xMin; h <= xMax; ++h) - { - float fh = (float)h; - - // Determine how far from the center of this hill this point is - distSq = (x - fh) * (x - fh) + (y - fv) * (y - fv); - height = radiusSq - distSq; - - // Don't add negative hill values - if (height > 0.0f) heightmap[h + v * 256] += height; - } - } - } - - private void Normalize() - { - float min = heightmap[0]; - float max = heightmap[0]; - - for (int x = 0; x < 256; x++) - { - for (int y = 0; y < 256; y++) - { - if (heightmap[x + y * 256] < min) min = heightmap[x + y * 256]; - if (heightmap[x + y * 256] > max) max = heightmap[x + y * 256]; - } - } - - // Avoid a rare divide by zero - if (min != max) - { - for (int x = 0; x < 256; x++) - { - for (int y = 0; y < 256; y++) - { - heightmap[x + y * 256] = ((heightmap[x + y * 256] - min) / (max - min)) * (HillMax - HillMin); - } - } - } - } - - private float RandomRange(float min, float max) - { - return (float)Rand.NextDouble() * (max - min) + min; - } - } -} diff --git a/Common/OpenSim.Framework/Interfaces/Config/IGenericConfig.cs b/Common/OpenSim.Framework/Interfaces/Config/IGenericConfig.cs new file mode 100644 index 0000000..a853fe4 --- /dev/null +++ b/Common/OpenSim.Framework/Interfaces/Config/IGenericConfig.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Interfaces +{ + public interface IGenericConfig + { + void LoadData(); + string GetAttribute(string attributeName); + bool SetAttribute(string attributeName, string attributeValue); + void Commit(); + void Close(); + } +} diff --git a/Common/OpenSim.Framework/Interfaces/Config/IGridConfig.cs b/Common/OpenSim.Framework/Interfaces/Config/IGridConfig.cs new file mode 100644 index 0000000..b2f26da --- /dev/null +++ b/Common/OpenSim.Framework/Interfaces/Config/IGridConfig.cs @@ -0,0 +1,64 @@ +/* +Copyright (c) OpenSim project, http://osgrid.org/ + +* Copyright (c) , +* All rights reserved. +* +* 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 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 ``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 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.IO; +using libsecondlife; +//using OpenSim.world; + +namespace OpenSim.Framework.Interfaces +{ + /// + /// + + + public abstract class GridConfig + { + public string GridOwner; + public string DefaultStartupMsg; + public string DefaultAssetServer; + public string AssetSendKey; + public string AssetRecvKey; + public string DefaultUserServer; + public string UserSendKey; + public string UserRecvKey; + public string SimSendKey; + public string SimRecvKey; + + + public abstract void InitConfig(); + + } + + public interface IGridConfig + { + GridConfig GetConfigObject(); + } +} diff --git a/Common/OpenSim.Framework/Interfaces/Config/IUserConfig.cs b/Common/OpenSim.Framework/Interfaces/Config/IUserConfig.cs new file mode 100644 index 0000000..e15867d --- /dev/null +++ b/Common/OpenSim.Framework/Interfaces/Config/IUserConfig.cs @@ -0,0 +1,58 @@ +/* +Copyright (c) OpenSim project, http://osgrid.org/ + +* Copyright (c) , +* All rights reserved. +* +* 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 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 ``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 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.IO; +using libsecondlife; +//using OpenSim.world; + +namespace OpenSim.Framework.Interfaces +{ + /// + /// + + + public abstract class UserConfig + { + public string DefaultStartupMsg; + public string GridServerURL; + public string GridSendKey; + public string GridRecvKey; + + + public abstract void InitConfig(); + + } + + public interface IUserConfig + { + UserConfig GetConfigObject(); + } +} diff --git a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs index b6ae232..add6c00 100644 --- a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs +++ b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs @@ -35,7 +35,6 @@ namespace OpenSim.Framework.Interfaces event StartAnim OnStartAnim; event LinkObjects OnLinkObjects; event GenericCall4 OnDeRezObject; - event ModifyTerrain OnModifyTerrain; event GenericCall OnRegionHandShakeReply; event GenericCall OnRequestWearables; event GenericCall2 OnCompleteMovementToRegion; @@ -57,6 +56,13 @@ namespace OpenSim.Framework.Interfaces get; set; } + + LLUUID AgentId + { + get; + } + + void OutPacket(Packet newPack); void SendAppearance(AvatarWearable[] wearables); void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); } diff --git a/Common/OpenSim.Framework/Interfaces/IConfig.cs b/Common/OpenSim.Framework/Interfaces/IConfig.cs deleted file mode 100644 index 7b4c040..0000000 --- a/Common/OpenSim.Framework/Interfaces/IConfig.cs +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright (c) OpenSim project, http://osgrid.org/ - -* Copyright (c) , -* All rights reserved. -* -* 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 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 ``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 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.IO; -using libsecondlife; -//using OpenSim.world; - -namespace OpenSim.Framework.Interfaces -{ - /// - /// This class handles connection to the underlying database used for configuration of the region. - /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate - /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from - /// what is hardcoded here and then saved into opensim.yap for future startups. - /// - - - public abstract class SimConfig - { - public string RegionName; - - public uint RegionLocX; - public uint RegionLocY; - public ulong RegionHandle; - - public int IPListenPort; - public string IPListenAddr; - - public string AssetURL; - public string AssetSendKey; - - public string GridURL; - public string GridSendKey; - public string GridRecvKey; - public string UserURL; - public string UserSendKey; - public string UserRecvKey; - - public abstract void InitConfig(bool sandboxMode); - public abstract void LoadFromGrid(); - - } - - public interface ISimConfig - { - SimConfig GetConfigObject(); - } -} diff --git a/Common/OpenSim.Framework/Interfaces/IGenericConfig.cs b/Common/OpenSim.Framework/Interfaces/IGenericConfig.cs deleted file mode 100644 index a853fe4..0000000 --- a/Common/OpenSim.Framework/Interfaces/IGenericConfig.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Framework.Interfaces -{ - public interface IGenericConfig - { - void LoadData(); - string GetAttribute(string attributeName); - bool SetAttribute(string attributeName, string attributeValue); - void Commit(); - void Close(); - } -} diff --git a/Common/OpenSim.Framework/Interfaces/IGridConfig.cs b/Common/OpenSim.Framework/Interfaces/IGridConfig.cs deleted file mode 100644 index b2f26da..0000000 --- a/Common/OpenSim.Framework/Interfaces/IGridConfig.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright (c) OpenSim project, http://osgrid.org/ - -* Copyright (c) , -* All rights reserved. -* -* 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 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 ``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 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.IO; -using libsecondlife; -//using OpenSim.world; - -namespace OpenSim.Framework.Interfaces -{ - /// - /// - - - public abstract class GridConfig - { - public string GridOwner; - public string DefaultStartupMsg; - public string DefaultAssetServer; - public string AssetSendKey; - public string AssetRecvKey; - public string DefaultUserServer; - public string UserSendKey; - public string UserRecvKey; - public string SimSendKey; - public string SimRecvKey; - - - public abstract void InitConfig(); - - } - - public interface IGridConfig - { - GridConfig GetConfigObject(); - } -} diff --git a/Common/OpenSim.Framework/Interfaces/IScriptAPI.cs b/Common/OpenSim.Framework/Interfaces/IScriptAPI.cs deleted file mode 100644 index 3ad0f06..0000000 --- a/Common/OpenSim.Framework/Interfaces/IScriptAPI.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Framework.Types; - -namespace OpenSim.Framework.Interfaces -{ - public interface IScriptAPI - { - OSVector3 GetEntityPosition(uint localID); - void SetEntityPosition(uint localID, float x, float y, float z); - uint GetRandomAvatarID(); - } -} diff --git a/Common/OpenSim.Framework/Interfaces/IScriptEngine.cs b/Common/OpenSim.Framework/Interfaces/IScriptEngine.cs deleted file mode 100644 index ed8974c..0000000 --- a/Common/OpenSim.Framework/Interfaces/IScriptEngine.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Framework.Interfaces -{ - public interface IScriptEngine - { - bool Init(IScriptAPI api); - string GetName(); - void LoadScript(string script, string scriptName, uint entityID); - void OnFrame(); - } -} diff --git a/Common/OpenSim.Framework/Interfaces/IUserConfig.cs b/Common/OpenSim.Framework/Interfaces/IUserConfig.cs deleted file mode 100644 index e15867d..0000000 --- a/Common/OpenSim.Framework/Interfaces/IUserConfig.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright (c) OpenSim project, http://osgrid.org/ - -* Copyright (c) , -* All rights reserved. -* -* 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 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 ``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 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.IO; -using libsecondlife; -//using OpenSim.world; - -namespace OpenSim.Framework.Interfaces -{ - /// - /// - - - public abstract class UserConfig - { - public string DefaultStartupMsg; - public string GridServerURL; - public string GridSendKey; - public string GridRecvKey; - - - public abstract void InitConfig(); - - } - - public interface IUserConfig - { - UserConfig GetConfigObject(); - } -} diff --git a/Common/OpenSim.Framework/Interfaces/IWorld.cs b/Common/OpenSim.Framework/Interfaces/IWorld.cs new file mode 100644 index 0000000..433e540 --- /dev/null +++ b/Common/OpenSim.Framework/Interfaces/IWorld.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Framework.Types; + +namespace OpenSim.Framework.Interfaces +{ + public interface IWorld + { + bool AddNewAvatar(IClientAPI remoteClient, bool childAgent); + bool RemoveAvatar(LLUUID agentID); + RegionInfo GetRegionInfo(); + } +} diff --git a/Common/OpenSim.Framework/Interfaces/Remoting/IGridServerHost.cs b/Common/OpenSim.Framework/Interfaces/Remoting/IGridServerHost.cs new file mode 100644 index 0000000..1569cb2 --- /dev/null +++ b/Common/OpenSim.Framework/Interfaces/Remoting/IGridServerHost.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Interfaces +{ + public interface IGridServerHost + { + void ConnectSim(string name); + string RequestSimURL(uint regionHandle); + } +} diff --git a/Common/OpenSim.Framework/Interfaces/Remoting/IProxyServerClient.cs b/Common/OpenSim.Framework/Interfaces/Remoting/IProxyServerClient.cs new file mode 100644 index 0000000..b58bcba --- /dev/null +++ b/Common/OpenSim.Framework/Interfaces/Remoting/IProxyServerClient.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Interfaces +{ + public interface IProxyServerClient + { + } +} diff --git a/Common/OpenSim.Framework/Interfaces/Remoting/IProxyServerHost.cs b/Common/OpenSim.Framework/Interfaces/Remoting/IProxyServerHost.cs new file mode 100644 index 0000000..381d53b --- /dev/null +++ b/Common/OpenSim.Framework/Interfaces/Remoting/IProxyServerHost.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Interfaces +{ + public interface IProxyServerHost + { + } +} diff --git a/Common/OpenSim.Framework/Interfaces/Remoting/IRegionGridClient.cs b/Common/OpenSim.Framework/Interfaces/Remoting/IRegionGridClient.cs new file mode 100644 index 0000000..7f8ecaf --- /dev/null +++ b/Common/OpenSim.Framework/Interfaces/Remoting/IRegionGridClient.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Interfaces +{ + public interface IRegionGridClient + { + bool ExpectUser(string toRegionID, string name); + } +} diff --git a/Common/OpenSim.Framework/Interfaces/Remoting/IRegionSimHost.cs b/Common/OpenSim.Framework/Interfaces/Remoting/IRegionSimHost.cs new file mode 100644 index 0000000..c22fe29 --- /dev/null +++ b/Common/OpenSim.Framework/Interfaces/Remoting/IRegionSimHost.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Interfaces +{ + public interface IRegionSimHost + { + bool ExpectUser(string name); + bool AgentCrossing(string name); + } +} diff --git a/Common/OpenSim.Framework/Interfaces/Remoting/RegionGridClientBase.cs b/Common/OpenSim.Framework/Interfaces/Remoting/RegionGridClientBase.cs new file mode 100644 index 0000000..28b3128 --- /dev/null +++ b/Common/OpenSim.Framework/Interfaces/Remoting/RegionGridClientBase.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Interfaces +{ + public abstract class RegionGridClientBase :IRegionGridClient + { + public abstract bool ExpectUser(string toRegionID, string name); + } +} diff --git a/Common/OpenSim.Framework/Interfaces/Scripting/IScriptAPI.cs b/Common/OpenSim.Framework/Interfaces/Scripting/IScriptAPI.cs new file mode 100644 index 0000000..3ad0f06 --- /dev/null +++ b/Common/OpenSim.Framework/Interfaces/Scripting/IScriptAPI.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Types; + +namespace OpenSim.Framework.Interfaces +{ + public interface IScriptAPI + { + OSVector3 GetEntityPosition(uint localID); + void SetEntityPosition(uint localID, float x, float y, float z); + uint GetRandomAvatarID(); + } +} diff --git a/Common/OpenSim.Framework/Interfaces/Scripting/IScriptEngine.cs b/Common/OpenSim.Framework/Interfaces/Scripting/IScriptEngine.cs new file mode 100644 index 0000000..ed8974c --- /dev/null +++ b/Common/OpenSim.Framework/Interfaces/Scripting/IScriptEngine.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Interfaces +{ + public interface IScriptEngine + { + bool Init(IScriptAPI api); + string GetName(); + void LoadScript(string script, string scriptName, uint entityID); + void OnFrame(); + } +} diff --git a/Common/OpenSim.Framework/OpenSim.Framework.csproj b/Common/OpenSim.Framework/OpenSim.Framework.csproj index f58a2d7..519d5a8 100644 --- a/Common/OpenSim.Framework/OpenSim.Framework.csproj +++ b/Common/OpenSim.Framework/OpenSim.Framework.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {8ACA2445-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim.Framework @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.Framework - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,32 +61,38 @@ False False 4 - + + - + System.dll False - + + System.Xml.dll False - + ..\..\bin\libsecondlife.dll False - + ..\..\bin\Db4objects.Db4o.dll False + + {A7CD0630-0000-0000-0000-000000000000} + OpenSim.Framework.Console + XMLRPC {8E81D43C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -90,21 +102,15 @@ Code - - Code - Code Code - - Code - - - Code - + + + Code @@ -123,37 +129,55 @@ Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + Code @@ -183,6 +207,9 @@ Code + + Code + @@ -191,4 +218,4 @@ - + \ No newline at end of file diff --git a/Common/OpenSim.Framework/SimProfile.cs b/Common/OpenSim.Framework/SimProfile.cs index 8acb20b..6b3742a 100644 --- a/Common/OpenSim.Framework/SimProfile.cs +++ b/Common/OpenSim.Framework/SimProfile.cs @@ -37,7 +37,7 @@ namespace OpenSim.Framework.Sims } catch (Exception e) { - Console.WriteLine(e.ToString()); + System.Console.WriteLine(e.ToString()); } return this; } @@ -69,7 +69,7 @@ namespace OpenSim.Framework.Sims } catch (Exception e) { - Console.WriteLine(e.ToString()); + System.Console.WriteLine(e.ToString()); } return this; } diff --git a/Common/OpenSim.Framework/Types/NeighbourInfo.cs b/Common/OpenSim.Framework/Types/NeighbourInfo.cs index 58b6cb1..ed252fb 100644 --- a/Common/OpenSim.Framework/Types/NeighbourInfo.cs +++ b/Common/OpenSim.Framework/Types/NeighbourInfo.cs @@ -1,6 +1,10 @@ using System; using System.Collections.Generic; using System.Text; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Utilities; +using OpenSim.Framework.Console; +using libsecondlife; namespace OpenSim.Framework.Types { diff --git a/Common/OpenSim.Framework/Types/NetworkServersInfo.cs b/Common/OpenSim.Framework/Types/NetworkServersInfo.cs new file mode 100644 index 0000000..84943aa --- /dev/null +++ b/Common/OpenSim.Framework/Types/NetworkServersInfo.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Interfaces; + +namespace OpenSim.Framework.Types +{ + public class NetworkServersInfo + { + public string AssetURL = "http://127.0.0.1:8003/"; + public string AssetSendKey = ""; + + public string GridURL = ""; + public string GridSendKey = ""; + public string GridRecvKey = ""; + public string UserURL = ""; + public string UserSendKey = ""; + public string UserRecvKey = ""; + public bool isSandbox; + + public void InitConfig(bool sandboxMode, IGenericConfig configData) + { + this.isSandbox = sandboxMode; + + try + { + if (!isSandbox) + { + string attri = ""; + //Grid Server URL + attri = ""; + attri = configData.GetAttribute("GridServerURL"); + if (attri == "") + { + this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/"); + configData.SetAttribute("GridServerURL", this.GridURL); + } + else + { + this.GridURL = attri; + } + + //Grid Send Key + attri = ""; + attri = configData.GetAttribute("GridSendKey"); + if (attri == "") + { + this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server", "null"); + configData.SetAttribute("GridSendKey", this.GridSendKey); + } + else + { + this.GridSendKey = attri; + } + + //Grid Receive Key + attri = ""; + attri = configData.GetAttribute("GridRecvKey"); + if (attri == "") + { + this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server", "null"); + configData.SetAttribute("GridRecvKey", this.GridRecvKey); + } + else + { + this.GridRecvKey = attri; + } + + attri = ""; + attri = configData.GetAttribute("AssetServerURL"); + if (attri == "") + { + this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/"); + configData.SetAttribute("AssetServerURL", this.GridURL); + } + else + { + this.AssetURL = attri; + } + + } + configData.Commit(); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Config.cs:InitConfig() - Exception occured"); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, e.ToString()); + } + } + } +} diff --git a/Common/OpenSim.Framework/Types/RegionInfo.cs b/Common/OpenSim.Framework/Types/RegionInfo.cs new file mode 100644 index 0000000..fd3b24f --- /dev/null +++ b/Common/OpenSim.Framework/Types/RegionInfo.cs @@ -0,0 +1,198 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Utilities; +using OpenSim.Framework.Console; +using libsecondlife; + +namespace OpenSim.Framework.Types +{ + public class RegionInfo + { + public LLUUID SimUUID; + public string RegionName; + public uint RegionLocX; + public uint RegionLocY; + public ulong RegionHandle; + public ushort RegionWaterHeight = 20; + public bool RegionTerraform = true; + + public int IPListenPort; + public string IPListenAddr; + + private bool isSandbox; + public string DataStore; + + // Region Information + // Low resolution 'base' textures. No longer used. + public LLUUID TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); // Default + public LLUUID TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); // Default + public LLUUID TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); // Default + public LLUUID TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); // Default + // Higher resolution terrain textures + public LLUUID TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000"); + public LLUUID TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000"); + public LLUUID TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000"); + public LLUUID TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000"); + // First quad - each point is bilinearly interpolated at each meter of terrain + public float TerrainStartHeight00 = 10.0f; // NW Corner ( I think ) + public float TerrainStartHeight01 = 10.0f; // NE Corner ( I think ) + public float TerrainStartHeight10 = 10.0f; // SW Corner ( I think ) + public float TerrainStartHeight11 = 10.0f; // SE Corner ( I think ) + // Second quad - also bilinearly interpolated. + // Terrain texturing is done that: + // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y] + public float TerrainHeightRange00 = 60.0f; + public float TerrainHeightRange01 = 60.0f; + public float TerrainHeightRange10 = 60.0f; + public float TerrainHeightRange11 = 60.0f; + + // Terrain Default (Must be in F32 Format!) + public string TerrainFile = "default.r32"; + public double TerrainMultiplier = 60.0; + + public RegionInfo() + { + + } + + + public void InitConfig(bool sandboxMode, IGenericConfig configData) + { + this.isSandbox = sandboxMode; + try + { + // Sim UUID + string attri = ""; + attri = configData.GetAttribute("SimUUID"); + if (attri == "") + { + this.SimUUID = LLUUID.Random(); + configData.SetAttribute("SimUUID", this.SimUUID.ToString()); + } + else + { + this.SimUUID = new LLUUID(attri); + } + + // Sim name + attri = ""; + attri = configData.GetAttribute("SimName"); + if (attri == "") + { + this.RegionName = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Name", "OpenSim test"); + configData.SetAttribute("SimName", this.RegionName); + } + else + { + this.RegionName = attri; + } + // Sim/Grid location X + attri = ""; + attri = configData.GetAttribute("SimLocationX"); + if (attri == "") + { + string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location X", "997"); + configData.SetAttribute("SimLocationX", location); + this.RegionLocX = (uint)Convert.ToUInt32(location); + } + else + { + this.RegionLocX = (uint)Convert.ToUInt32(attri); + } + // Sim/Grid location Y + attri = ""; + attri = configData.GetAttribute("SimLocationY"); + if (attri == "") + { + string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location Y", "996"); + configData.SetAttribute("SimLocationY", location); + this.RegionLocY = (uint)Convert.ToUInt32(location); + } + else + { + this.RegionLocY = (uint)Convert.ToUInt32(attri); + } + + // Local storage datastore + attri = ""; + attri = configData.GetAttribute("Datastore"); + if (attri == "") + { + string datastore = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Filename for local storage", "localworld.yap"); + configData.SetAttribute("Datastore", datastore); + this.DataStore = datastore; + } + else + { + this.DataStore = attri; + } + + //Sim Listen Port + attri = ""; + attri = configData.GetAttribute("SimListenPort"); + if (attri == "") + { + string port = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("UDP port for client connections", "9000"); + configData.SetAttribute("SimListenPort", port); + this.IPListenPort = Convert.ToInt32(port); + } + else + { + this.IPListenPort = Convert.ToInt32(attri); + } + + //Sim Listen Address + attri = ""; + attri = configData.GetAttribute("SimListenAddress"); + if (attri == "") + { + this.IPListenAddr = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections", "127.0.0.1"); + configData.SetAttribute("SimListenAddress", this.IPListenAddr); + } + else + { + // Probably belongs elsewhere, but oh well. + if (attri.Trim().StartsWith("SYSTEMIP")) + { + string localhostname = System.Net.Dns.GetHostName(); + System.Net.IPAddress[] ips = System.Net.Dns.GetHostAddresses(localhostname); + try + { + this.IPListenAddr = ips[0].ToString(); + } + catch (Exception e) + { + e.ToString(); + this.IPListenAddr = "127.0.0.1"; // Use the default if we fail + } + } + else + { + this.IPListenAddr = attri; + } + } + + + this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); + + configData.Commit(); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"Config.cs:InitConfig() - Exception occured"); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,e.ToString()); + } + + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Sim settings loaded:"); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "UUID: " + this.SimUUID.ToStringHyphenated()); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Name: " + this.RegionName); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Region Handle: " + this.RegionHandle.ToString()); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Sandbox Mode? " + isSandbox.ToString()); + + } + } +} diff --git a/Common/OpenSim.Framework/UserProfileManager.cs b/Common/OpenSim.Framework/UserProfileManager.cs index 18b3513..739c54c 100644 --- a/Common/OpenSim.Framework/UserProfileManager.cs +++ b/Common/OpenSim.Framework/UserProfileManager.cs @@ -139,12 +139,12 @@ namespace OpenSim.Framework.User ClassifiedCategories.Add(ClassifiedCategoriesHash); ArrayList AgentInventory = new ArrayList(); - Console.WriteLine("adding inventory to response"); + System.Console.WriteLine("adding inventory to response"); Hashtable TempHash; foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values) { TempHash = new Hashtable(); - Console.WriteLine("adding folder " + InvFolder.FolderName + ", ID: " + InvFolder.FolderID.ToStringHyphenated() + " with parent: " + InvFolder.ParentID.ToStringHyphenated()); + System.Console.WriteLine("adding folder " + InvFolder.FolderName + ", ID: " + InvFolder.FolderID.ToStringHyphenated() + " with parent: " + InvFolder.ParentID.ToStringHyphenated()); TempHash["name"] = InvFolder.FolderName; TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); TempHash["version"] = (Int32)InvFolder.Version; @@ -206,7 +206,7 @@ namespace OpenSim.Framework.User } catch (Exception E) { - Console.WriteLine(E.ToString()); + System.Console.WriteLine(E.ToString()); } //} } @@ -251,7 +251,7 @@ namespace OpenSim.Framework.User response["region_x"] = (Int32)SimInfo.RegionLocX * 256; //default is ogs user server, so let the sim know about the user via a XmlRpcRequest - Console.WriteLine(SimInfo.caps_url); + System.Console.WriteLine(SimInfo.caps_url); Hashtable SimParams = new Hashtable(); SimParams["session_id"] = theUser.CurrentSessionID.ToString(); SimParams["secure_session_id"] = theUser.CurrentSecureSessionID.ToString(); diff --git a/Common/OpenSim.Framework/UserProfileManagerBase.cs b/Common/OpenSim.Framework/UserProfileManagerBase.cs index d1307a5..477de1b 100644 --- a/Common/OpenSim.Framework/UserProfileManagerBase.cs +++ b/Common/OpenSim.Framework/UserProfileManagerBase.cs @@ -26,7 +26,7 @@ namespace OpenSim.Framework.User { UserProfiles.Add(userprof.UUID, userprof); } - Console.WriteLine("UserProfiles.Cs:InitUserProfiles() - Successfully loaded " + result.Count.ToString() + " from database"); + System.Console.WriteLine("UserProfiles.Cs:InitUserProfiles() - Successfully loaded " + result.Count.ToString() + " from database"); db.Close(); } @@ -73,18 +73,18 @@ namespace OpenSim.Framework.User { if (TheUser.MD5passwd == passwd) { - Console.WriteLine("UserProfile - authorised " + firstname + " " + lastname); + System.Console.WriteLine("UserProfile - authorised " + firstname + " " + lastname); return true; } else { - Console.WriteLine("UserProfile - not authorised, password not match " + TheUser.MD5passwd + " and " + passwd); + System.Console.WriteLine("UserProfile - not authorised, password not match " + TheUser.MD5passwd + " and " + passwd); return false; } } else { - Console.WriteLine("UserProfile - not authorised , unkown: " + firstname + " , " + lastname); + System.Console.WriteLine("UserProfile - not authorised , unkown: " + firstname + " , " + lastname); return false; } @@ -97,7 +97,7 @@ namespace OpenSim.Framework.User public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd) { - Console.WriteLine("creating new profile for : " + firstname + " , " + lastname); + System.Console.WriteLine("creating new profile for : " + firstname + " , " + lastname); UserProfile newprofile = new UserProfile(); newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); newprofile.firstname = firstname; diff --git a/OpenGridServices.suo b/OpenGridServices.suo index 9a93215..18d72f4 100644 Binary files a/OpenGridServices.suo and b/OpenGridServices.suo differ diff --git a/OpenSim.sln b/OpenSim.sln index 2c63df5..0d4074b 100644 --- a/OpenSim.sln +++ b/OpenSim.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 +# Visual C# Express 2005 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Terrain.BasicTerrain", "OpenSim\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj", "{2270B8FE-0000-0000-0000-000000000000}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Storage.LocalStorageBerkeleyDB", "OpenSim\OpenSim.Storage\LocalStorageBerkeleyDB\OpenSim.Storage.LocalStorageBerkeleyDB.csproj", "{EE9E5D96-0000-0000-0000-000000000000}" @@ -39,135 +39,89 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XMLRPC", "Common\XmlRpcCS\XMLRPC.csproj", "{8E81D43C-0000-0000-0000-000000000000}" EndProject Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - ({EE9E5D96-0000-0000-0000-000000000000}).6 = ({8ACA2445-0000-0000-0000-000000000000}) - ({EE9E5D96-0000-0000-0000-000000000000}).7 = ({A7CD0630-0000-0000-0000-000000000000}) - ({63A05FE9-0000-0000-0000-000000000000}).2 = ({8BE16150-0000-0000-0000-000000000000}) - ({642A14A8-0000-0000-0000-000000000000}).5 = ({2270B8FE-0000-0000-0000-000000000000}) - ({642A14A8-0000-0000-0000-000000000000}).6 = ({8ACA2445-0000-0000-0000-000000000000}) - ({642A14A8-0000-0000-0000-000000000000}).7 = ({A7CD0630-0000-0000-0000-000000000000}) - ({642A14A8-0000-0000-0000-000000000000}).8 = ({E88EF749-0000-0000-0000-000000000000}) - ({642A14A8-0000-0000-0000-000000000000}).9 = ({8BE16150-0000-0000-0000-000000000000}) - ({642A14A8-0000-0000-0000-000000000000}).10 = ({8BB20F0A-0000-0000-0000-000000000000}) - ({642A14A8-0000-0000-0000-000000000000}).11 = ({8E81D43C-0000-0000-0000-000000000000}) - ({438A9556-0000-0000-0000-000000000000}).5 = ({2270B8FE-0000-0000-0000-000000000000}) - ({438A9556-0000-0000-0000-000000000000}).6 = ({8ACA2445-0000-0000-0000-000000000000}) - ({438A9556-0000-0000-0000-000000000000}).7 = ({A7CD0630-0000-0000-0000-000000000000}) - ({438A9556-0000-0000-0000-000000000000}).8 = ({8BE16150-0000-0000-0000-000000000000}) - ({438A9556-0000-0000-0000-000000000000}).9 = ({8BB20F0A-0000-0000-0000-000000000000}) - ({438A9556-0000-0000-0000-000000000000}).10 = ({632E1BFD-0000-0000-0000-000000000000}) - ({438A9556-0000-0000-0000-000000000000}).11 = ({E88EF749-0000-0000-0000-000000000000}) - ({438A9556-0000-0000-0000-000000000000}).12 = ({8E81D43C-0000-0000-0000-000000000000}) - ({632E1BFD-0000-0000-0000-000000000000}).5 = ({2270B8FE-0000-0000-0000-000000000000}) - ({632E1BFD-0000-0000-0000-000000000000}).6 = ({8ACA2445-0000-0000-0000-000000000000}) - ({632E1BFD-0000-0000-0000-000000000000}).7 = ({A7CD0630-0000-0000-0000-000000000000}) - ({632E1BFD-0000-0000-0000-000000000000}).8 = ({E88EF749-0000-0000-0000-000000000000}) - ({632E1BFD-0000-0000-0000-000000000000}).9 = ({8BE16150-0000-0000-0000-000000000000}) - ({632E1BFD-0000-0000-0000-000000000000}).10 = ({8BB20F0A-0000-0000-0000-000000000000}) - ({632E1BFD-0000-0000-0000-000000000000}).11 = ({8E81D43C-0000-0000-0000-000000000000}) - ({E88EF749-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000}) - ({8BE16150-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000}) - ({8BE16150-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000}) - ({4F874463-0000-0000-0000-000000000000}).2 = ({8BE16150-0000-0000-0000-000000000000}) - ({988F0AC4-0000-0000-0000-000000000000}).3 = ({8BE16150-0000-0000-0000-000000000000}) - ({B55C0B5D-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000}) - ({B55C0B5D-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000}) - ({B55C0B5D-0000-0000-0000-000000000000}).5 = ({8E81D43C-0000-0000-0000-000000000000}) - ({8ACA2445-0000-0000-0000-000000000000}).4 = ({8E81D43C-0000-0000-0000-000000000000}) - ({8BB20F0A-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000}) - ({8BB20F0A-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000}) - ({8BB20F0A-0000-0000-0000-000000000000}).5 = ({8E81D43C-0000-0000-0000-000000000000}) - ({E1B79ECF-0000-0000-0000-000000000000}).4 = ({8ACA2445-0000-0000-0000-000000000000}) - ({E1B79ECF-0000-0000-0000-000000000000}).5 = ({A7CD0630-0000-0000-0000-000000000000}) - ({6B20B603-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000}) - ({6B20B603-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000}) - ({97A82740-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000}) - ({546099CD-0000-0000-0000-000000000000}).4 = ({8ACA2445-0000-0000-0000-000000000000}) - ({546099CD-0000-0000-0000-000000000000}).5 = ({A7CD0630-0000-0000-0000-000000000000}) - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2270B8FE-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2270B8FE-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2270B8FE-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2270B8FE-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {EE9E5D96-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EE9E5D96-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EE9E5D96-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EE9E5D96-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {63A05FE9-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {63A05FE9-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {63A05FE9-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {63A05FE9-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {A7CD0630-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A7CD0630-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A7CD0630-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A7CD0630-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {642A14A8-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {642A14A8-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {642A14A8-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {642A14A8-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {438A9556-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {438A9556-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {438A9556-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {438A9556-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {632E1BFD-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {632E1BFD-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {632E1BFD-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {632E1BFD-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {E88EF749-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E88EF749-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E88EF749-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E88EF749-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {8BE16150-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8BE16150-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8BE16150-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8BE16150-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {4F874463-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4F874463-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4F874463-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4F874463-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {988F0AC4-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {988F0AC4-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {988F0AC4-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {988F0AC4-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {B55C0B5D-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B55C0B5D-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B55C0B5D-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B55C0B5D-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {8ACA2445-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8ACA2445-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8ACA2445-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8ACA2445-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {8BB20F0A-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8BB20F0A-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8BB20F0A-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8BB20F0A-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {E1B79ECF-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E1B79ECF-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E1B79ECF-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E1B79ECF-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {6B20B603-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6B20B603-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6B20B603-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6B20B603-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {97A82740-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {97A82740-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {97A82740-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {97A82740-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {546099CD-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {546099CD-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {546099CD-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {546099CD-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {8E81D43C-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8E81D43C-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8E81D43C-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8E81D43C-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2270B8FE-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2270B8FE-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2270B8FE-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2270B8FE-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {EE9E5D96-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE9E5D96-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE9E5D96-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE9E5D96-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {63A05FE9-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {63A05FE9-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {63A05FE9-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {63A05FE9-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {A7CD0630-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A7CD0630-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A7CD0630-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A7CD0630-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {642A14A8-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {642A14A8-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {642A14A8-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {642A14A8-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {438A9556-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {438A9556-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {438A9556-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {438A9556-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {632E1BFD-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {632E1BFD-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {632E1BFD-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {632E1BFD-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {E88EF749-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E88EF749-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E88EF749-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E88EF749-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {8BE16150-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8BE16150-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8BE16150-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8BE16150-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {4F874463-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F874463-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F874463-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F874463-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {988F0AC4-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {988F0AC4-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {988F0AC4-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {988F0AC4-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {B55C0B5D-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B55C0B5D-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B55C0B5D-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B55C0B5D-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {8ACA2445-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8ACA2445-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8ACA2445-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8ACA2445-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {8BB20F0A-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8BB20F0A-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8BB20F0A-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8BB20F0A-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {E1B79ECF-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1B79ECF-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1B79ECF-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1B79ECF-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {6B20B603-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B20B603-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B20B603-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B20B603-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {97A82740-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {97A82740-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {97A82740-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {97A82740-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {546099CD-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {546099CD-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {546099CD-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {546099CD-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {8E81D43C-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E81D43C-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E81D43C-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E81D43C-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection EndGlobal diff --git a/OpenSim.suo b/OpenSim.suo index 2234af6..eed9502 100644 Binary files a/OpenSim.suo and b/OpenSim.suo differ diff --git a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs index ccebb24..f82418d 100644 --- a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs +++ b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using System.Threading; +using System.Reflection; using libsecondlife; using libsecondlife.Packets; using OpenSim; @@ -71,6 +72,20 @@ namespace OpenSim.Assets } + public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey) + { + Console.WriteLine("Creating Asset cache"); + _assetServer = this.LoadAssetDll(assetServerDLLName); + _assetServer.SetServerInfo(assetServerURL, assetServerKey); + _assetServer.SetReceiver(this); + Assets = new Dictionary(); + Textures = new Dictionary(); + this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); + this._assetCacheThread.IsBackground = true; + this._assetCacheThread.Start(); + + } + /// /// /// @@ -513,6 +528,34 @@ namespace OpenSim.Assets } #endregion + private IAssetServer LoadAssetDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + IAssetServer server = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IAssetPlugin", true); + + if (typeInterface != null) + { + IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + server = plug.GetAssetServer(); + break; + } + + typeInterface = null; + } + } + } + pluginAssembly = null; + return server; + } + } public class AssetRequest diff --git a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs index 1f508ce..c5d5dc2 100644 --- a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs +++ b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs @@ -2,13 +2,11 @@ using System; using System.Collections.Generic; using System.Text; using System.IO; -using OpenSim.world; using OpenSim.UserServer; using OpenSim.Servers; using OpenSim.Assets; using OpenSim.Framework.Inventory; using libsecondlife; -using OpenSim.RegionServer.world.scripting; using Avatar=libsecondlife.Avatar; namespace OpenSim.CAPS diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs new file mode 100644 index 0000000..579928c --- /dev/null +++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Inventory; +using libsecondlife; +using libsecondlife.Packets; + +namespace OpenSim +{ + partial class ClientView + { + public event ChatFromViewer OnChatFromViewer; + public event RezObject OnRezObject; + public event GenericCall4 OnDeRezObject; + public event ModifyTerrain OnModifyTerrain; + public event GenericCall OnRegionHandShakeReply; + public event GenericCall OnRequestWearables; + public event SetAppearance OnSetAppearance; + public event GenericCall2 OnCompleteMovementToRegion; + public event GenericCall3 OnAgentUpdate; + public event StartAnim OnStartAnim; + public event GenericCall OnRequestAvatarsData; + public event LinkObjects OnLinkObjects; + public event GenericCall4 OnAddPrim; + public event UpdateShape OnUpdatePrimShape; + public event ObjectSelect OnObjectSelect; + public event UpdatePrimFlags OnUpdatePrimFlags; + public event UpdatePrimTexture OnUpdatePrimTexture; + public event UpdatePrimVector OnUpdatePrimPosition; + public event UpdatePrimRotation OnUpdatePrimRotation; + public event UpdatePrimVector OnUpdatePrimScale; + public event StatusChange OnChildAgentStatus; + public event GenericCall2 OnStopMovement; + + public LLVector3 StartPos + { + get + { + return startpos; + } + set + { + startpos = value; + } + } + + public LLUUID AgentId + { + get + { + return this.AgentID; + } + } + + #region World/Avatar to Client + public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) + { + System.Text.Encoding enc = System.Text.Encoding.ASCII; + libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); + reply.ChatData.Audible = 1; + reply.ChatData.Message = message; + reply.ChatData.ChatType = type; + reply.ChatData.SourceType = 1; + reply.ChatData.Position = fromPos; + reply.ChatData.FromName = enc.GetBytes(fromName + "\0"); + reply.ChatData.OwnerID = fromAgentID; + reply.ChatData.SourceID = fromAgentID; + + this.OutPacket(reply); + } + + public void SendAppearance(AvatarWearable[] wearables) + { + AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); + aw.AgentData.AgentID = this.AgentID; + aw.AgentData.SerialNum = 0; + aw.AgentData.SessionID = this.SessionID; + + aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; + AgentWearablesUpdatePacket.WearableDataBlock awb; + for (int i = 0; i < wearables.Length; i++) + { + awb = new AgentWearablesUpdatePacket.WearableDataBlock(); + awb.WearableType = (byte)i; + awb.AssetID = wearables[i].AssetID; + awb.ItemID = wearables[i].ItemID; + aw.WearableData[i] = awb; + } + + this.OutPacket(aw); + } + #endregion + + } +} diff --git a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs b/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs index b4e4b5f..9545db8 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs @@ -13,7 +13,6 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; using OpenSim.Framework.Utilities; -using OpenSim.world; using OpenSim.Assets; namespace OpenSim diff --git a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs index 75fcf18..3c39781 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs @@ -13,7 +13,6 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; using OpenSim.Framework.Utilities; -using OpenSim.world; using OpenSim.Assets; namespace OpenSim @@ -42,26 +41,21 @@ namespace OpenSim KillObjectPacket kill = new KillObjectPacket(); kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); - kill.ObjectData[0].ID = this.ClientAvatar.localid; + // kill.ObjectData[0].ID = this.ClientAvatar.localid; foreach (ClientView client in m_clientThreads.Values) { client.OutPacket(kill); } - if (this.m_userServer != null) - { - this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); - } - else - { - this.m_inventoryCache.ClientLeaving(this.AgentID, null); - } + + this.m_inventoryCache.ClientLeaving(this.AgentID, null); + m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); /*lock (m_world.Entities) { m_world.Entities.Remove(this.AgentID); }*/ - m_world.RemoveViewerAgent(this); + // m_world.RemoveViewerAgent(this); //need to do other cleaning up here too m_clientThreads.Remove(this.CircuitCode); m_networkServer.RemoveClientCircuit(this.CircuitCode); @@ -109,7 +103,7 @@ namespace OpenSim else if (multipleupdate.ObjectData[i].Type == 13)//scale { libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); + OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); } } return true; diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs index 6a33432..54cb662 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs @@ -13,15 +13,12 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; using OpenSim.Framework.Utilities; -using OpenSim.world; using OpenSim.Assets; namespace OpenSim { public partial class ClientView { - - protected override void ProcessInPacket(Packet Pack) { ack_pack(Pack); @@ -65,10 +62,10 @@ namespace OpenSim //empty message so don't bother with it break; } - string fromName = ClientAvatar.firstname + " " + ClientAvatar.lastname; + string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname; byte[] message = inchatpack.ChatData.Message; byte type = inchatpack.ChatData.Type; - LLVector3 fromPos = ClientAvatar.Pos; + LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos; LLUUID fromAgentID = AgentID; this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); break; @@ -151,7 +148,7 @@ namespace OpenSim OnLinkObjects(parentprimid, childrenprims); break; case PacketType.ObjectAdd: - m_world.AddNewPrim((ObjectAddPacket)Pack, this); + // m_world.AddNewPrim((ObjectAddPacket)Pack, this); OnAddPrim(Pack, this); break; case PacketType.ObjectShape: @@ -270,7 +267,7 @@ namespace OpenSim RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); bool foundent = false; - foreach (Entity ent in m_world.Entities.Values) + /* foreach (Entity ent in m_world.Entities.Values) { if (ent.localid == requesttask.InventoryData.LocalID) { @@ -283,13 +280,13 @@ namespace OpenSim if (foundent) { this.OutPacket(replytask); - } + }*/ break; case PacketType.UpdateTaskInventory: // Console.WriteLine(Pack.ToString()); UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID); - if (myinventory != null) + /*if (myinventory != null) { if (updatetask.UpdateData.Key == 0) { @@ -315,7 +312,7 @@ namespace OpenSim } } } - } + }*/ break; case PacketType.MapLayerRequest: this.RequestMapLayer(); diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs index a422102..0419b7a 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.cs @@ -35,11 +35,11 @@ using System.Net.Sockets; using System.IO; using System.Threading; using System.Timers; +using OpenSim.Framework; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; using OpenSim.Framework.Utilities; -using OpenSim.world; using OpenSim.Assets; namespace OpenSim @@ -58,73 +58,40 @@ namespace OpenSim public LLUUID AgentID; public LLUUID SessionID; public LLUUID SecureSessionID = LLUUID.Zero; - public bool m_child; - public world.Avatar ClientAvatar; + public bool m_child = false; private UseCircuitCodePacket cirpack; public Thread ClientThread; public LLVector3 startpos; - + private AgentAssetUpload UploadAssets; private LLUUID newAssetFolder = LLUUID.Zero; private bool debug = false; - private World m_world; + private IWorld m_world; private Dictionary m_clientThreads; private AssetCache m_assetCache; private IGridServer m_gridServer; - private IUserServer m_userServer = null; private InventoryCache m_inventoryCache; - public bool m_sandboxMode; private int cachedtextureserial = 0; private RegionInfo m_regionData; protected AuthenticateSessionsBase m_authenticateSessionsHandler; - public IUserServer UserServer - { - set - { - this.m_userServer = value; - } - } - public LLVector3 StartPos + public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions) { - get - { - return startpos; - } - set - { - startpos = value; - } - } - public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child, RegionInfo regionDat, AuthenticateSessionsBase authenSessions) - { - m_world = world; m_clientThreads = clientThreads; m_assetCache = assetCache; - m_gridServer = gridServer; - m_networkServer = application; + + m_networkServer = packServer; m_inventoryCache = inventoryCache; - m_sandboxMode = sandboxMode; - m_child = child; - m_regionData = regionDat; m_authenticateSessionsHandler = authenSessions; OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs - Started up new client thread to handle incoming request"); cirpack = initialcirpack; userEP = remoteEP; - if (m_gridServer.GetName() == "Remote") - { - this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code); - this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); - //Console.WriteLine("start pos is " + this.startpos.X + " , " + this.startpos.Y + " , " + this.startpos.Z); - } - else - { - this.startpos = new LLVector3(128, 128, m_world.Terrain[(int)128, (int)128] + 15.0f); // new LLVector3(128.0f, 128.0f, 60f); - } + this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code); + this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); PacketQueue = new BlockingQueue(); @@ -146,11 +113,10 @@ namespace OpenSim OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent"); this.m_child = false; //this.m_world.RemoveViewerAgent(this); - if (!this.m_sandboxMode) - { - this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode); - m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false); - } + + this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode); + m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false); + OnChildAgentStatus(this.m_child); //this.InitNewClient(); } @@ -169,21 +135,16 @@ namespace OpenSim KillObjectPacket kill = new KillObjectPacket(); kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); - kill.ObjectData[0].ID = this.ClientAvatar.localid; + //kill.ObjectData[0].ID = this.ClientAvatar.localid; foreach (ClientView client in m_clientThreads.Values) { client.OutPacket(kill); } - if (this.m_userServer != null) - { - this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); - } - else - { - this.m_inventoryCache.ClientLeaving(this.AgentID, null); - } - m_world.RemoveViewerAgent(this); + this.m_inventoryCache.ClientLeaving(this.AgentID, null); + + + // m_world.RemoveViewerAgent(this); m_clientThreads.Remove(this.CircuitCode); m_networkServer.RemoveClientCircuit(this.CircuitCode); @@ -270,13 +231,13 @@ namespace OpenSim protected virtual void InitNewClient() { OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); - this.ClientAvatar = m_world.AddViewerAgent(this); + // this.ClientAvatar = m_world.AddViewerAgent(this); } protected virtual void AuthUser() { // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); - AuthenticateResponse sessionInfo = this.m_networkServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); + AuthenticateResponse sessionInfo = this.m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); if (!sessionInfo.Authorised) { //session/circuit not authorised @@ -290,20 +251,14 @@ namespace OpenSim this.AgentID = cirpack.CircuitCode.ID; this.SessionID = cirpack.CircuitCode.SessionID; this.CircuitCode = cirpack.CircuitCode.Code; - InitNewClient(); - this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; - this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; + InitNewClient(); + //this.ClientAvatar.firstname = sessionInfo.LoginInfo.First; + // this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) { this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; } - // Create Inventory, currently only works for sandbox mode - if (m_sandboxMode) - { - this.SetupInventory(sessionInfo); - } - ClientLoop(); } } @@ -318,18 +273,18 @@ namespace OpenSim #region Inventory Creation private void SetupInventory(AuthenticateResponse sessionInfo) { - + } private AgentInventory CreateInventory(LLUUID baseFolder) { AgentInventory inventory = null; - + return inventory; } private void CreateInventoryItem(CreateInventoryItemPacket packet) { - + } #endregion diff --git a/OpenSim/OpenSim.RegionServer/ClientViewBase.cs b/OpenSim/OpenSim.RegionServer/ClientViewBase.cs index 572dbce..eb21b80 100644 --- a/OpenSim/OpenSim.RegionServer/ClientViewBase.cs +++ b/OpenSim/OpenSim.RegionServer/ClientViewBase.cs @@ -29,7 +29,7 @@ namespace OpenSim public uint CircuitCode; public EndPoint userEP; - protected OpenSimNetworkHandler m_networkServer; + protected PacketServer m_networkServer; public ClientViewBase() { diff --git a/OpenSim/OpenSim.RegionServer/CommsManager.cs b/OpenSim/OpenSim.RegionServer/CommsManager.cs new file mode 100644 index 0000000..5cd9a9b --- /dev/null +++ b/OpenSim/OpenSim.RegionServer/CommsManager.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim +{ + public class CommsManager + { + } +} diff --git a/OpenSim/OpenSim.RegionServer/Grid.cs b/OpenSim/OpenSim.RegionServer/Grid.cs deleted file mode 100644 index 0b8db4d..0000000 --- a/OpenSim/OpenSim.RegionServer/Grid.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Reflection; -using OpenSim.Framework.Interfaces; -using OpenSim.UserServer; - -namespace OpenSim -{ - public class Grid - { - - } -} diff --git a/OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs b/OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs new file mode 100644 index 0000000..a607909 --- /dev/null +++ b/OpenSim/OpenSim.RegionServer/NetworkServersInfo.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Interfaces; + +namespace OpenSim +{ + public class NetworkServersInfo + { + public string AssetURL = "http://127.0.0.1:8003/"; + public string AssetSendKey = ""; + + public string GridURL = ""; + public string GridSendKey = ""; + public string GridRecvKey = ""; + public string UserURL = ""; + public string UserSendKey = ""; + public string UserRecvKey = ""; + public bool isSandbox; + + public void InitConfig(bool sandboxMode, IGenericConfig configData) + { + this.isSandbox = sandboxMode; + + try + { + if (!isSandbox) + { + string attri = ""; + //Grid Server URL + attri = ""; + attri = configData.GetAttribute("GridServerURL"); + if (attri == "") + { + this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/"); + configData.SetAttribute("GridServerURL", this.GridURL); + } + else + { + this.GridURL = attri; + } + + //Grid Send Key + attri = ""; + attri = configData.GetAttribute("GridSendKey"); + if (attri == "") + { + this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server", "null"); + configData.SetAttribute("GridSendKey", this.GridSendKey); + } + else + { + this.GridSendKey = attri; + } + + //Grid Receive Key + attri = ""; + attri = configData.GetAttribute("GridRecvKey"); + if (attri == "") + { + this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server", "null"); + configData.SetAttribute("GridRecvKey", this.GridRecvKey); + } + else + { + this.GridRecvKey = attri; + } + + attri = ""; + attri = configData.GetAttribute("AssetServerURL"); + if (attri == "") + { + this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/"); + configData.SetAttribute("AssetServerURL", this.GridURL); + } + else + { + this.AssetURL = attri; + } + + } + configData.Commit(); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Config.cs:InitConfig() - Exception occured"); + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, e.ToString()); + } + } + } +} diff --git a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj index a6bc5ae..73116ee 100644 --- a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj +++ b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {632E1BFD-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim.RegionServer @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.RegionServer - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,26 +61,28 @@ False False 4 - + + - + System.dll False - + + System.Xml.dll False - + ..\..\bin\libsecondlife.dll False - + ..\..\bin\Axiom.MathLib.dll False - + ..\..\bin\Db4objects.Db4o.dll False @@ -84,43 +92,43 @@ OpenSim.Terrain.BasicTerrain {2270B8FE-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.GenericConfig.Xml {E88EF749-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Physics.Manager {8BE16150-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Servers {8BB20F0A-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False XMLRPC {8E81D43C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -157,30 +165,17 @@ Code - - Code - - - Code - - - Code - + Code - - Code - - - Code - Code Code + Code @@ -193,66 +188,6 @@ Code - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - @@ -261,4 +196,4 @@ - + \ No newline at end of file diff --git a/OpenSim/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim/OpenSim.RegionServer/OpenSimMain.cs deleted file mode 100644 index 003412d..0000000 --- a/OpenSim/OpenSim.RegionServer/OpenSimMain.cs +++ /dev/null @@ -1,531 +0,0 @@ -/* -Copyright (c) OpenSim project, http://osgrid.org/ - -* All rights reserved. -* -* 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 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 ``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 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.Text; -using System.IO; -using System.Threading; -using System.Net; -using System.Net.Sockets; -using System.Timers; -using System.Reflection; -using System.Collections; -using System.Collections.Generic; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.world; -using OpenSim.Terrain; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.UserServer; -using OpenSim.Assets; -using OpenSim.CAPS; -using OpenSim.Framework.Console; -using OpenSim.Physics.Manager; -using Nwc.XmlRpc; -using OpenSim.Servers; -using OpenSim.GenericConfig; - -namespace OpenSim -{ - //moved to the opensim main application project (do we want it there or here?) -/* - public class OpenSimMain : OpenSimApplicationBase , conscmd_callback - { - - public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) - { - this.configFileSetup = useConfigFile; - m_sandbox = sandBoxMode; - m_loginserver = startLoginServer; - m_physicsEngine = physicsEngine; - m_config = configFile; - - m_console = new ConsoleBase("region-console-" + Guid.NewGuid().ToString() + ".log", "Region", this, silent); - OpenSim.Framework.Console.MainConsole.Instance = m_console; - } - - /// - /// Performs initialisation of the world, such as loading configuration from disk. - /// - public override void StartUp() - { - this.regionData = new RegionInfo(); - try - { - this.localConfig = new XmlConfig(m_config); - this.localConfig.LoadData(); - } - catch (Exception e) - { - Console.WriteLine(e.Message); - } - if (this.configFileSetup) - { - this.SetupFromConfigFile(this.localConfig); - } - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Loading configuration"); - this.regionData.InitConfig(this.m_sandbox, this.localConfig); - this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change - - GridServers = new Grid(); - if (m_sandbox) - { - this.SetupLocalGridServers(); - //Authenticate Session Handler - AuthenticateSessionsLocal authen = new AuthenticateSessionsLocal(); - this.AuthenticateSessionsHandler = authen; - } - else - { - this.SetupRemoteGridServers(); - //Authenticate Session Handler - AuthenticateSessionsRemote authen = new AuthenticateSessionsRemote(); - this.AuthenticateSessionsHandler = authen; - } - - startuptime = DateTime.Now; - - try - { - AssetCache = new AssetCache(GridServers.AssetServer); - InventoryCache = new InventoryCache(); - } - catch (Exception e) - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup local cache"); - Environment.Exit(1); - } - - m_udpServer = new UDPServer(this.regionData.IPListenPort, this.GridServers, this.AssetCache, this.InventoryCache, this.regionData, this.m_sandbox, this.user_accounts, this.m_console, this.AuthenticateSessionsHandler); - - //should be passing a IGenericConfig object to these so they can read the config data they want from it - GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey); - IGridServer gridServer = GridServers.GridServer; - gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey); - - if (!m_sandbox) - { - this.ConnectToRemoteGridServer(); - } - - this.SetupLocalWorld(); - - if (m_sandbox) - { - AssetCache.LoadDefaultTextureSet(); - } - - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Initialising HTTP server"); - - this.SetupHttpListener(); - - LoginServer loginServer = null; - LoginServer adminLoginServer = null; - - bool sandBoxWithLoginServer = m_loginserver && m_sandbox; - if (sandBoxWithLoginServer) - { - loginServer = new LoginServer( regionData.IPListenAddr, regionData.IPListenPort, regionData.RegionLocX, regionData.RegionLocY, this.user_accounts); - loginServer.Startup(); - loginServer.SetSessionHandler(((AuthenticateSessionsLocal) this.AuthenticateSessionsHandler).AddNewSession); - - if (user_accounts) - { - //sandbox mode with loginserver using accounts - this.GridServers.UserServer = loginServer; - adminLoginServer = loginServer; - - httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod); - } - else - { - //sandbox mode with loginserver not using accounts - httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); - } - } - - AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer); - adminWebFront.LoadMethods(httpServer); - - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting HTTP server"); - httpServer.Start(); - - //MainServerListener(); - this.m_udpServer.ServerListener(); - - m_heartbeatTimer.Enabled = true; - m_heartbeatTimer.Interval = 100; - m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); - } - - # region Setup methods - protected virtual void SetupLocalGridServers() - { - GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; - GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll"; - - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Starting in Sandbox mode"); - - try - { - GridServers.Initialise(); - } - catch (Exception e) - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup the grid interface"); - Environment.Exit(1); - } - } - - protected virtual void SetupRemoteGridServers() - { - if (this.gridLocalAsset) - { - GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; - } - else - { - GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll"; - } - GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll"; - - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Starting in Grid mode"); - - try - { - GridServers.Initialise(); - } - catch (Exception e) - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup the grid interface"); - Environment.Exit(1); - } - } - - protected virtual void SetupLocalWorld() - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString()); - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Initialising world"); - m_console.componentname = "Region " + regionData.RegionName; - - m_localWorld = new World(this.m_udpServer.PacketServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName); - LocalWorld.InventoryCache = InventoryCache; - LocalWorld.AssetCache = AssetCache; - - this.m_udpServer.LocalWorld = LocalWorld; - this.m_udpServer.PacketServer.RegisterClientPacketHandlers(); - - this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); - this.physManager.LoadPlugins(); - - LocalWorld.m_datastore = this.regionData.DataStore; - - LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. - LocalWorld.LoadWorldMap(); - - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting up messaging system"); - LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); - LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); - LocalWorld.LoadPrimsFromStorage(); - } - - protected virtual void SetupHttpListener() - { - httpServer = new BaseHttpServer(regionData.IPListenPort); - - if (this.GridServers.GridServer.GetName() == "Remote") - { - - // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server - httpServer.AddXmlRPCHandler("expect_user", ((AuthenticateSessionsRemote)this.AuthenticateSessionsHandler).ExpectUser ); - - httpServer.AddXmlRPCHandler("agent_crossing", - delegate(XmlRpcRequest request) - { - Hashtable requestData = (Hashtable)request.Params[0]; - AgentCircuitData agent_data = new AgentCircuitData(); - agent_data.firstname = (string)requestData["firstname"]; - agent_data.lastname = (string)requestData["lastname"]; - agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); - agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]), Single.Parse((string)requestData["pos_y"]), Single.Parse((string)requestData["pos_z"])); - - if (((RemoteGridBase)this.GridServers.GridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) - { - ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].firstname = agent_data.firstname; - ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].lastname = agent_data.lastname; - ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos; - } - - return new XmlRpcResponse(); - }); - - httpServer.AddRestHandler("GET", "/simstatus/", - delegate(string request, string path, string param) - { - return "OK"; - }); - } - } - - protected virtual void ConnectToRemoteGridServer() - { - if (GridServers.GridServer.RequestConnection(regionData.SimUUID, regionData.IPListenAddr, (uint)regionData.IPListenPort)) - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Success: Got a grid connection OK!"); - } - else - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, "Main.cs:Startup() - FAILED: Unable to get connection to grid. Shutting down."); - Shutdown(); - } - - GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]); - - // If we are being told to load a file, load it. - string dataUri = (string)((RemoteGridBase)GridServers.GridServer).GridData["data_uri"]; - - if (!String.IsNullOrEmpty(dataUri)) - { - this.LocalWorld.m_datastore = dataUri; - } - - if (((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString() != "") - { - // The grid server has told us who we are - // We must obey the grid server. - try - { - regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString()); - regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString()); - regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString(); - } - catch (Exception e) - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, e.Message + "\nBAD ERROR! THIS SHOULD NOT HAPPEN! Bad GridData from the grid interface!!!! ZOMG!!!"); - Environment.Exit(1); - } - } - } - - #endregion - - private void SetupFromConfigFile(IGenericConfig configData) - { - try - { - // SandBoxMode - string attri = ""; - attri = configData.GetAttribute("SandBox"); - if ((attri == "") || ((attri != "false") && (attri != "true"))) - { - this.m_sandbox = false; - configData.SetAttribute("SandBox", "false"); - } - else - { - this.m_sandbox = Convert.ToBoolean(attri); - } - - // LoginServer - attri = ""; - attri = configData.GetAttribute("LoginServer"); - if ((attri == "") || ((attri != "false") && (attri != "true"))) - { - this.m_loginserver = false; - configData.SetAttribute("LoginServer", "false"); - } - else - { - this.m_loginserver = Convert.ToBoolean(attri); - } - - // Sandbox User accounts - attri = ""; - attri = configData.GetAttribute("UserAccount"); - if ((attri == "") || ((attri != "false") && (attri != "true"))) - { - this.user_accounts = false; - configData.SetAttribute("UserAccounts", "false"); - } - else if (attri == "true") - { - this.user_accounts = Convert.ToBoolean(attri); - } - - // Grid mode hack to use local asset server - attri = ""; - attri = configData.GetAttribute("LocalAssets"); - if ((attri == "") || ((attri != "false") && (attri != "true"))) - { - this.gridLocalAsset = false; - configData.SetAttribute("LocalAssets", "false"); - } - else if (attri == "true") - { - this.gridLocalAsset = Convert.ToBoolean(attri); - } - - - attri = ""; - attri = configData.GetAttribute("PhysicsEngine"); - switch (attri) - { - default: - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); - Environment.Exit(1); - break; - - case "": - this.m_physicsEngine = "basicphysics"; - configData.SetAttribute("PhysicsEngine", "basicphysics"); - OpenSim.world.Avatar.PhysicsEngineFlying = false; - break; - - case "basicphysics": - this.m_physicsEngine = "basicphysics"; - configData.SetAttribute("PhysicsEngine", "basicphysics"); - OpenSim.world.Avatar.PhysicsEngineFlying = false; - break; - - case "RealPhysX": - this.m_physicsEngine = "RealPhysX"; - OpenSim.world.Avatar.PhysicsEngineFlying = true; - break; - - case "OpenDynamicsEngine": - this.m_physicsEngine = "OpenDynamicsEngine"; - OpenSim.world.Avatar.PhysicsEngineFlying = true; - break; - } - - configData.Commit(); - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine("\nSorry, a fatal error occurred while trying to initialise the configuration data"); - Console.WriteLine("Can not continue starting up"); - Environment.Exit(1); - } - } - - /// - /// Performs any last-minute sanity checking and shuts down the region server - /// - public virtual void Shutdown() - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Closing all threads"); - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Killing listener thread"); - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Killing clients"); - // IMPLEMENT THIS - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Closing console and terminating"); - LocalWorld.Close(); - GridServers.Close(); - m_console.Close(); - Environment.Exit(0); - } - - /// - /// Performs per-frame updates regularly - /// - /// - /// - void Heartbeat(object sender, System.EventArgs e) - { - LocalWorld.Update(); - } - - #region Console Commands - /// - /// Runs commands issued by the server console from the operator - /// - /// The first argument of the parameter (the command) - /// Additional arguments passed to the command - public void RunCmd(string command, string[] cmdparams) - { - switch (command) - { - case "help": - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "show users - show info about connected users"); - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "shutdown - disconnect all clients and shutdown"); - break; - - case "show": - Show(cmdparams[0]); - break; - - case "terrain": - string result = ""; - if (!LocalWorld.Terrain.RunTerrainCmd(cmdparams, ref result)) - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, result); - } - break; - - case "shutdown": - Shutdown(); - break; - - default: - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "Unknown command"); - break; - } - } - - /// - /// Outputs to the console information about the region - /// - /// What information to display (valid arguments are "uptime", "users") - public void Show(string ShowWhat) - { - switch (ShowWhat) - { - case "uptime": - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "OpenSim has been running since " + startuptime.ToString()); - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "That is " + (DateTime.Now - startuptime).ToString()); - break; - case "users": - OpenSim.world.Avatar TempAv; - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); - foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) - { - if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") - { - TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID]; - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); - } - } - break; - } - } - #endregion - } - - */ -} diff --git a/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs b/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs index 15ee740..202b7f7 100644 --- a/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs +++ b/OpenSim/OpenSim.RegionServer/OpenSimNetworkHandler.cs @@ -4,15 +4,16 @@ using System.Text; using System.Net; using System.Net.Sockets; using libsecondlife; -using OpenSim.Framework.Interfaces; + namespace OpenSim { + public interface OpenSimNetworkHandler { void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); void RemoveClientCircuit(uint circuitcode); void RegisterPacketServer(PacketServer server); - AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode); } + } diff --git a/OpenSim/OpenSim.RegionServer/PacketServer.cs b/OpenSim/OpenSim.RegionServer/PacketServer.cs index 6c6f4ca..dd8de4c 100644 --- a/OpenSim/OpenSim.RegionServer/PacketServer.cs +++ b/OpenSim/OpenSim.RegionServer/PacketServer.cs @@ -1,16 +1,20 @@ using System; using System.Collections.Generic; using System.Text; -using OpenSim.world; using libsecondlife.Packets; +using OpenSim.Framework.Interfaces; +using System.Net; +using System.Net.Sockets; +using OpenSim.Assets; namespace OpenSim { public class PacketServer { private OpenSimNetworkHandler _networkHandler; - private World _localWorld; + private IWorld _localWorld; public Dictionary ClientThreads = new Dictionary(); + public Dictionary ClientAPIs = new Dictionary(); public PacketServer(OpenSimNetworkHandler networkHandler) { @@ -18,7 +22,7 @@ namespace OpenSim _networkHandler.RegisterPacketServer(this); } - public World LocalWorld + public IWorld LocalWorld { set { @@ -59,27 +63,23 @@ namespace OpenSim } - #region Client Packet Handlers - - public bool RequestUUIDName(ClientView simClient, Packet packet) + public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, InventoryCache inventoryCache, AuthenticateSessionsBase authenticateSessionsClass) { - System.Text.Encoding enc = System.Text.Encoding.ASCII; - Console.WriteLine(packet.ToString()); - UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket)packet; - UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket(); - nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length]; + ClientView newuser = new ClientView(epSender, useCircuit, this.ClientThreads, assetCache, this, inventoryCache, authenticateSessionsClass); + this.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); + this.ClientAPIs.Add(useCircuit.CircuitCode.Code, (IClientAPI)newuser); - for (int i = 0; i < nameRequest.UUIDNameBlock.Length; i++) - { - nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); - nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID; - nameReply.UUIDNameBlock[i].FirstName = enc.GetBytes("Who\0"); //for now send any name - nameReply.UUIDNameBlock[i].LastName = enc.GetBytes("Knows\0"); //in future need to look it up - } - simClient.OutPacket(nameReply); return true; } - #endregion + public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) + { + this._networkHandler.SendPacketTo(buffer, size, flags, circuitcode); + } + + public virtual void RemoveClientCircuit(uint circuitcode) + { + this._networkHandler.RemoveClientCircuit(circuitcode); + } } } diff --git a/OpenSim/OpenSim.RegionServer/RegionInfo.cs b/OpenSim/OpenSim.RegionServer/RegionInfo.cs index 76f05b6..d148d0f 100644 --- a/OpenSim/OpenSim.RegionServer/RegionInfo.cs +++ b/OpenSim/OpenSim.RegionServer/RegionInfo.cs @@ -7,22 +7,13 @@ using System.IO; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Utilities; using libsecondlife; +using OpenSim.Framework.Types; namespace OpenSim { public class RegionInfo : RegionInfoBase { - //following should be removed and the GenericConfig object passed around, - //so each class (AssetServer, GridServer etc) can access what config data they want - public string AssetURL = "http://127.0.0.1:8003/"; - public string AssetSendKey = ""; - - public string GridURL = ""; - public string GridSendKey = ""; - public string GridRecvKey = ""; - public string UserURL = ""; - public string UserSendKey = ""; - public string UserRecvKey = ""; + private bool isSandbox; public string DataStore; @@ -129,62 +120,7 @@ namespace OpenSim this.IPListenAddr = attri; } - if (!isSandbox) - { - //shouldn't be reading this data in here, it should be up to the classes implementing the server interfaces to read what they need from the config object - - //Grid Server URL - attri = ""; - attri = configData.GetAttribute("GridServerURL"); - if (attri == "") - { - this.GridURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/"); - configData.SetAttribute("GridServerURL", this.GridURL); - } - else - { - this.GridURL = attri; - } - - //Grid Send Key - attri = ""; - attri = configData.GetAttribute("GridSendKey"); - if (attri == "") - { - this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server","null"); - configData.SetAttribute("GridSendKey", this.GridSendKey); - } - else - { - this.GridSendKey = attri; - } - - //Grid Receive Key - attri = ""; - attri = configData.GetAttribute("GridRecvKey"); - if (attri == "") - { - this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server","null"); - configData.SetAttribute("GridRecvKey", this.GridRecvKey); - } - else - { - this.GridRecvKey = attri; - } - - attri = ""; - attri = configData.GetAttribute("AssetServerURL"); - if (attri == "") - { - this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/"); - configData.SetAttribute("AssetServerURL", this.GridURL); - } - else - { - this.AssetURL = attri; - } - - } + this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); configData.Commit(); diff --git a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs b/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs deleted file mode 100644 index 42d3030..0000000 --- a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Net; -using System.Web; -using System.IO; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Utilities; -using libsecondlife; - -namespace OpenSim -{ - public class RegionInfoBase - { - public LLUUID SimUUID; - public string RegionName; - public uint RegionLocX; - public uint RegionLocY; - public ulong RegionHandle; - public ushort RegionWaterHeight = 20; - public bool RegionTerraform = true; - - public int IPListenPort; - public string IPListenAddr; - - public RegionInfoBase() - { - - } - } - -} diff --git a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs index 69a8748..7f18d34 100644 --- a/OpenSim/OpenSim.RegionServer/RegionServerBase.cs +++ b/OpenSim/OpenSim.RegionServer/RegionServerBase.cs @@ -10,7 +10,6 @@ using System.Collections; using System.Collections.Generic; using libsecondlife; using libsecondlife.Packets; -using OpenSim.world; using OpenSim.Terrain; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; @@ -29,14 +28,12 @@ namespace OpenSim { protected IGenericConfig localConfig; protected PhysicsManager physManager; - protected Grid GridServers; protected AssetCache AssetCache; protected InventoryCache InventoryCache; protected Dictionary clientCircuits = new Dictionary(); protected DateTime startuptime; - protected RegionInfo regionData; + protected NetworkServersInfo serversData; - protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); public string m_physicsEngine; public bool m_sandbox = false; public bool m_loginserver; @@ -45,7 +42,9 @@ namespace OpenSim protected bool configFileSetup = false; public string m_config; - protected UDPServer m_udpServer; + protected List m_udpServer = new List(); + protected List regionData = new List(); + protected List m_localWorld = new List(); protected BaseHttpServer httpServer; protected AuthenticateSessionsBase AuthenticateSessionsHandler; @@ -65,11 +64,11 @@ namespace OpenSim m_config = configFile; } - protected World m_localWorld; + /*protected World m_localWorld; public World LocalWorld { get { return m_localWorld; } - } + }*/ /// /// Performs initialisation of the world, such as loading configuration from disk. diff --git a/OpenSim/OpenSim.RegionServer/UDPServer.cs b/OpenSim/OpenSim.RegionServer/UDPServer.cs index 3a93e66..8ec5af1 100644 --- a/OpenSim/OpenSim.RegionServer/UDPServer.cs +++ b/OpenSim/OpenSim.RegionServer/UDPServer.cs @@ -10,7 +10,6 @@ using System.Collections; using System.Collections.Generic; using libsecondlife; using libsecondlife.Packets; -using OpenSim.world; using OpenSim.Terrain; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; @@ -24,7 +23,6 @@ using OpenSim.GenericConfig; namespace OpenSim { - public delegate AuthenticateResponse AuthenticateSessionHandler(LLUUID sessionID, LLUUID agentID, uint circuitCode); public class UDPServer : OpenSimNetworkHandler { @@ -39,18 +37,12 @@ namespace OpenSim protected PacketServer _packetServer; protected int listenPort; - protected Grid m_gridServers; - protected World m_localWorld; + protected IWorld m_localWorld; protected AssetCache m_assetCache; protected InventoryCache m_inventoryCache; - protected RegionInfo m_regionData; - protected bool m_sandbox = false; - protected bool user_accounts = false; protected ConsoleBase m_console; protected AuthenticateSessionsBase m_authenticateSessionsClass; - public AuthenticateSessionHandler AuthenticateHandler; - public PacketServer PacketServer { get @@ -63,7 +55,7 @@ namespace OpenSim } } - public World LocalWorld + public IWorld LocalWorld { set { @@ -76,21 +68,15 @@ namespace OpenSim { } - public UDPServer(int port, Grid gridServers, AssetCache assetCache, InventoryCache inventoryCache, RegionInfo _regionData, bool sandbox, bool accounts, ConsoleBase console, AuthenticateSessionsBase authenticateClass) + public UDPServer(int port, AssetCache assetCache, InventoryCache inventoryCache, ConsoleBase console, AuthenticateSessionsBase authenticateClass) { listenPort = port; - this.m_gridServers = gridServers; this.m_assetCache = assetCache; this.m_inventoryCache = inventoryCache; - this.m_regionData = _regionData; - this.m_sandbox = sandbox; - this.user_accounts = accounts; this.m_console = console; this.m_authenticateSessionsClass = authenticateClass; this.CreatePacketServer(); - //set up delegate for authenticate sessions - this.AuthenticateHandler = new AuthenticateSessionHandler(this.m_authenticateSessionsClass.AuthenticateSession); } protected virtual void CreatePacketServer() @@ -131,15 +117,8 @@ namespace OpenSim { UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); - bool isChildAgent = false; - ClientView newuser = new ClientView(epSender, useCircuit, m_localWorld, _packetServer.ClientThreads, m_assetCache, m_gridServers.GridServer, this, m_inventoryCache, m_sandbox, isChildAgent, this.m_regionData, m_authenticateSessionsClass); - if ((this.m_gridServers.UserServer != null) && (user_accounts)) - { - newuser.UserServer = this.m_gridServers.UserServer; - } - //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); - this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); + this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_inventoryCache, m_authenticateSessionsClass); } public void ServerListener() @@ -197,9 +176,6 @@ namespace OpenSim } } - public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) - { - return this.AuthenticateHandler(sessionID, agentID, circuitCode); - } + } } \ No newline at end of file diff --git a/OpenSim/OpenSim.RegionServer/UserConfigUtility.cs b/OpenSim/OpenSim.RegionServer/UserConfigUtility.cs new file mode 100644 index 0000000..9f6abe9 --- /dev/null +++ b/OpenSim/OpenSim.RegionServer/UserConfigUtility.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim +{ + public class UserConfigUtility + { + } +} diff --git a/OpenSim/OpenSim.RegionServer/VersionInfo.cs b/OpenSim/OpenSim.RegionServer/VersionInfo.cs index 49cc6a5..38b6685 100644 --- a/OpenSim/OpenSim.RegionServer/VersionInfo.cs +++ b/OpenSim/OpenSim.RegionServer/VersionInfo.cs @@ -32,6 +32,6 @@ namespace OpenSim /// public class VersionInfo { - public static string Version = "0.2, SVN build - please use releng if you desire any form of support"; + public static string Version = "0.2, SVN build "; } } diff --git a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs index d4db8c0..30abd84 100644 --- a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs +++ b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs @@ -34,7 +34,6 @@ using System.Data; using libsecondlife; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using OpenSim.Framework.Terrain; using BerkeleyDb; using Kds.Serialization; using Kds.Serialization.Buffer; diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs index 5dceb7f..a50795a 100644 --- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs +++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs @@ -31,7 +31,7 @@ using Db4objects.Db4o.Query; using libsecondlife; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using OpenSim.Framework.Terrain; + namespace OpenSim.Storage.LocalStorageDb4o { diff --git a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs index 368405b..11eca0f 100644 --- a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs +++ b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs @@ -35,7 +35,7 @@ using System.Data.SQLite; using libsecondlife; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using OpenSim.Framework.Terrain; + namespace OpenSim.Storage.LocalStorageSQLite { diff --git a/OpenSim/OpenSim.World/Avatar.Update.cs b/OpenSim/OpenSim.World/Avatar.Update.cs index 33132cf..13a480a 100644 --- a/OpenSim/OpenSim.World/Avatar.Update.cs +++ b/OpenSim/OpenSim.World/Avatar.Update.cs @@ -4,6 +4,7 @@ using System.Text; using libsecondlife; using libsecondlife.Packets; using OpenSim.Physics.Manager; +using OpenSim.Framework.Interfaces; namespace OpenSim.world { @@ -22,7 +23,7 @@ namespace OpenSim.world public ObjectUpdatePacket CreateUpdatePacket() { - + return null; } public void SendInitialPosition() @@ -35,7 +36,7 @@ namespace OpenSim.world } - public void SendOurAppearance(ClientView OurClient) + public void SendOurAppearance(IClientAPI OurClient) { } @@ -57,7 +58,7 @@ namespace OpenSim.world public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() { - + return null; } // Sends animation update diff --git a/OpenSim/OpenSim.World/Avatar.cs b/OpenSim/OpenSim.World/Avatar.cs index cca266b..551283a 100644 --- a/OpenSim/OpenSim.World/Avatar.cs +++ b/OpenSim/OpenSim.World/Avatar.cs @@ -17,7 +17,7 @@ namespace OpenSim.world public static AvatarAnimations Animations; public string firstname; public string lastname; - public ClientView ControllingClient; + public IClientAPI ControllingClient; public LLUUID current_anim; public int anim_seq; private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; @@ -37,7 +37,7 @@ namespace OpenSim.world private bool m_regionTerraform; private bool childAvatar = false; - public Avatar(ClientView TheClient, World world, string regionName, Dictionary clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) + public Avatar(IClientAPI TheClient, World world, string regionName, Dictionary clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) { m_world = world; // m_clientThreads = clientThreads; @@ -49,7 +49,7 @@ namespace OpenSim.world OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Avatar.cs - Loading details from grid (DUMMY)"); ControllingClient = TheClient; localid = 8880000 + (this.m_world._localNumber++); - Pos = ControllingClient.startpos; + Pos = ControllingClient.StartPos; visualParams = new byte[218]; for (int i = 0; i < 218; i++) { @@ -66,14 +66,14 @@ namespace OpenSim.world this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); //register for events - ControllingClient.OnRequestWearables += new ClientView.GenericCall(this.SendOurAppearance); + ControllingClient.OnRequestWearables += new GenericCall(this.SendOurAppearance); ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); - ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.CompleteMovement); - ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.SendInitialPosition); - ControllingClient.OnAgentUpdate += new ClientView.GenericCall3(this.HandleAgentUpdate); + ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.CompleteMovement); + ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition); + ControllingClient.OnAgentUpdate += new GenericCall3(this.HandleAgentUpdate); ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); - ControllingClient.OnChildAgentStatus += new ClientView.StatusChange(this.ChildStatusChange); - ControllingClient.OnStopMovement += new ClientView.GenericCall2(this.StopMovement); + ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); + ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); } public PhysicsActor PhysActor diff --git a/OpenSim/OpenSim.World/OpenSim.World.csproj b/OpenSim/OpenSim.World/OpenSim.World.csproj index 471f148..37293e1 100644 --- a/OpenSim/OpenSim.World/OpenSim.World.csproj +++ b/OpenSim/OpenSim.World/OpenSim.World.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {642A14A8-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim.World @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.World - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,26 +61,27 @@ False False 4 - + + - + System.dll False - + System.Xml.dll False - + ..\..\bin\libsecondlife.dll False - + ..\..\bin\Axiom.MathLib.dll False - + ..\..\bin\Db4objects.Db4o.dll False @@ -84,43 +91,43 @@ OpenSim.Terrain.BasicTerrain {2270B8FE-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.GenericConfig.Xml {E88EF749-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Physics.Manager {8BE16150-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Servers {8BB20F0A-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False XMLRPC {8E81D43C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -142,9 +149,6 @@ Code - - Code - Code @@ -192,4 +196,4 @@ - + \ No newline at end of file diff --git a/OpenSim/OpenSim.World/Primitive.cs b/OpenSim/OpenSim.World/Primitive.cs index 433ea9e..492341a 100644 --- a/OpenSim/OpenSim.World/Primitive.cs +++ b/OpenSim/OpenSim.World/Primitive.cs @@ -7,11 +7,485 @@ using libsecondlife.Packets; using OpenSim.Framework.Interfaces; using OpenSim.Physics.Manager; using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; namespace OpenSim.world { public class Primitive : Entity { - + protected PrimData primData; + //private ObjectUpdatePacket OurPacket; + private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); + private Dictionary m_clientThreads; + private ulong m_regionHandle; + private const uint FULL_MASK_PERMISSIONS = 2147483647; + private bool physicsEnabled = false; + + private Dictionary inventoryItems; + + #region Properties + + public LLVector3 Scale + { + set + { + this.primData.Scale = value; + //this.dirtyFlag = true; + } + get + { + return this.primData.Scale; + } + } + + public PhysicsActor PhysActor + { + set + { + this._physActor = value; + } + } + public override LLVector3 Pos + { + get + { + return base.Pos; + } + set + { + base.Pos = value; + } + } + #endregion + + public Primitive(Dictionary clientThreads, ulong regionHandle, World world) + { + m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + } + + public Primitive(Dictionary clientThreads, ulong regionHandle, World world, LLUUID owner) + { + m_clientThreads = clientThreads; + m_regionHandle = regionHandle; + m_world = world; + inventoryItems = new Dictionary(); + this.primData = new PrimData(); + this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + this.primData.OwnerID = owner; + } + + public byte[] GetByteArray() + { + byte[] result = null; + List dataArrays = new List(); + dataArrays.Add(primData.ToBytes()); + foreach (Entity child in children) + { + if (child is OpenSim.world.Primitive) + { + dataArrays.Add(((OpenSim.world.Primitive)child).GetByteArray()); + } + } + byte[] primstart = Helpers.StringToField(""); + byte[] primend = Helpers.StringToField(""); + int totalLength = primstart.Length + primend.Length; + for (int i = 0; i < dataArrays.Count; i++) + { + totalLength += dataArrays[i].Length; + } + + result = new byte[totalLength]; + int arraypos = 0; + Array.Copy(primstart, 0, result, 0, primstart.Length); + arraypos += primstart.Length; + for (int i = 0; i < dataArrays.Count; i++) + { + Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length); + arraypos += dataArrays[i].Length; + } + Array.Copy(primend, 0, result, arraypos, primend.Length); + + return result; + } + + #region Overridden Methods + + public override void update() + { + LLVector3 pos2 = new LLVector3(0, 0, 0); + } + + public override void BackUp() + { + + } + + #endregion + + #region Packet handlers + + public void UpdatePosition(LLVector3 pos) + { + + } + + public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) + { + this.primData.PathBegin = addPacket.PathBegin; + this.primData.PathEnd = addPacket.PathEnd; + this.primData.PathScaleX = addPacket.PathScaleX; + this.primData.PathScaleY = addPacket.PathScaleY; + this.primData.PathShearX = addPacket.PathShearX; + this.primData.PathShearY = addPacket.PathShearY; + this.primData.PathSkew = addPacket.PathSkew; + this.primData.ProfileBegin = addPacket.ProfileBegin; + this.primData.ProfileEnd = addPacket.ProfileEnd; + this.primData.PathCurve = addPacket.PathCurve; + this.primData.ProfileCurve = addPacket.ProfileCurve; + this.primData.ProfileHollow = addPacket.ProfileHollow; + this.primData.PathRadiusOffset = addPacket.PathRadiusOffset; + this.primData.PathRevolutions = addPacket.PathRevolutions; + this.primData.PathTaperX = addPacket.PathTaperX; + this.primData.PathTaperY = addPacket.PathTaperY; + this.primData.PathTwist = addPacket.PathTwist; + this.primData.PathTwistBegin = addPacket.PathTwistBegin; + } + + public void UpdateTexture(byte[] tex) + { + this.primData.Texture = tex; + //this.dirtyFlag = true; + } + + public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) + { + + } + + public void AssignToParent(Primitive prim) + { + + } + + public void GetProperites(IClientAPI client) + { + ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); + proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; + proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); + proper.ObjectData[0].ItemID = LLUUID.Zero; + proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate; + proper.ObjectData[0].CreatorID = this.primData.OwnerID; + proper.ObjectData[0].FolderID = LLUUID.Zero; + proper.ObjectData[0].FromTaskID = LLUUID.Zero; + proper.ObjectData[0].GroupID = LLUUID.Zero; + proper.ObjectData[0].InventorySerial = 0; + proper.ObjectData[0].LastOwnerID = LLUUID.Zero; + proper.ObjectData[0].ObjectID = this.uuid; + proper.ObjectData[0].OwnerID = primData.OwnerID; + proper.ObjectData[0].TouchName = new byte[0]; + proper.ObjectData[0].TextureID = new byte[0]; + proper.ObjectData[0].SitName = new byte[0]; + proper.ObjectData[0].Name = new byte[0]; + proper.ObjectData[0].Description = new byte[0]; + proper.ObjectData[0].OwnerMask = this.primData.OwnerMask; + proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask; + proper.ObjectData[0].GroupMask = this.primData.GroupMask; + proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask; + proper.ObjectData[0].BaseMask = this.primData.BaseMask; + + client.OutPacket(proper); + } + + #endregion + + # region Inventory Methods + + public bool AddToInventory(InventoryItem item) + { + return false; + } + + public InventoryItem RemoveFromInventory(LLUUID itemID) + { + return null; + } + + public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet) + { + + } + + public void RequestXferInventory(IClientAPI simClient, ulong xferID) + { + //will only currently work if the total size of the inventory data array is under about 1000 bytes + SendXferPacketPacket send = new SendXferPacketPacket(); + + send.XferID.ID = xferID; + send.XferID.Packet = 1 + 2147483648; + send.DataPacket.Data = this.ConvertInventoryToBytes(); + + simClient.OutPacket(send); + } + + public byte[] ConvertInventoryToBytes() + { + System.Text.Encoding enc = System.Text.Encoding.ASCII; + byte[] result = new byte[0]; + List inventoryData = new List(); + int totallength = 0; + foreach (InventoryItem invItem in inventoryItems.Values) + { + byte[] data = enc.GetBytes(invItem.ExportString()); + inventoryData.Add(data); + totallength += data.Length; + } + //TODO: copy arrays into the single result array + + return result; + } + + public void CreateInventoryFromBytes(byte[] data) + { + + } + + #endregion + + #region Update viewers Methods + + //should change these mehtods, so that outgoing packets are sent through the avatar class + public void SendFullUpdateToClient(IClientAPI remoteClient) + { + LLVector3 lPos; + if (this._physActor != null && this.physicsEnabled) + { + PhysicsVector pPos = this._physActor.Position; + lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); + } + else + { + lPos = this.Pos; + } + + ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); + outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; + outPacket.ObjectData[0] = this.CreateUpdateBlock(); + byte[] pb = lPos.GetBytes(); + Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); + + remoteClient.OutPacket(outPacket); + } + + public void SendFullUpdateToAllClients() + { + + } + + public void SendTerseUpdateToClient(IClientAPI RemoteClient) + { + + } + + public void SendTerseUpdateToALLClients() + { + + } + + #endregion + + #region Create Methods + + public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) + { + PrimData PData = new PrimData(); + this.primData = PData; + this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + + PData.OwnerID = ownerID; + PData.PCode = addPacket.ObjectData.PCode; + PData.PathBegin = addPacket.ObjectData.PathBegin; + PData.PathEnd = addPacket.ObjectData.PathEnd; + PData.PathScaleX = addPacket.ObjectData.PathScaleX; + PData.PathScaleY = addPacket.ObjectData.PathScaleY; + PData.PathShearX = addPacket.ObjectData.PathShearX; + PData.PathShearY = addPacket.ObjectData.PathShearY; + PData.PathSkew = addPacket.ObjectData.PathSkew; + PData.ProfileBegin = addPacket.ObjectData.ProfileBegin; + PData.ProfileEnd = addPacket.ObjectData.ProfileEnd; + PData.Scale = addPacket.ObjectData.Scale; + PData.PathCurve = addPacket.ObjectData.PathCurve; + PData.ProfileCurve = addPacket.ObjectData.ProfileCurve; + PData.ParentID = 0; + PData.ProfileHollow = addPacket.ObjectData.ProfileHollow; + PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; + PData.PathRevolutions = addPacket.ObjectData.PathRevolutions; + PData.PathTaperX = addPacket.ObjectData.PathTaperX; + PData.PathTaperY = addPacket.ObjectData.PathTaperY; + PData.PathTwist = addPacket.ObjectData.PathTwist; + PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; + LLVector3 pos1 = addPacket.ObjectData.RayEnd; + this.primData.FullID = this.uuid = LLUUID.Random(); + this.localid = (uint)(localID); + this.primData.Position = this.Pos = pos1; + } + + public void CreateFromBytes(byte[] data) + { + + } + + public void CreateFromPrimData(PrimData primData) + { + this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); + } + + public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim) + { + + } + + #endregion + + #region Packet Update Methods + protected void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) + { + objdata.PSBlock = new byte[0]; + objdata.ExtraParams = new byte[1]; + objdata.MediaURL = new byte[0]; + objdata.NameValue = new byte[0]; + objdata.Text = new byte[0]; + objdata.TextColor = new byte[4]; + objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0); + objdata.JointPivot = new LLVector3(0, 0, 0); + objdata.Material = 3; + objdata.TextureAnim = new byte[0]; + objdata.Sound = LLUUID.Zero; + LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); + this.primData.Texture = objdata.TextureEntry = ntex.ToBytes(); + objdata.State = 0; + objdata.Data = new byte[0]; + + objdata.ObjectData = new byte[60]; + objdata.ObjectData[46] = 128; + objdata.ObjectData[47] = 63; + } + + protected void SetPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData) + { + objectData.OwnerID = this.primData.OwnerID; + objectData.PCode = this.primData.PCode; + objectData.PathBegin = this.primData.PathBegin; + objectData.PathEnd = this.primData.PathEnd; + objectData.PathScaleX = this.primData.PathScaleX; + objectData.PathScaleY = this.primData.PathScaleY; + objectData.PathShearX = this.primData.PathShearX; + objectData.PathShearY = this.primData.PathShearY; + objectData.PathSkew = this.primData.PathSkew; + objectData.ProfileBegin = this.primData.ProfileBegin; + objectData.ProfileEnd = this.primData.ProfileEnd; + objectData.Scale = this.primData.Scale; + objectData.PathCurve = this.primData.PathCurve; + objectData.ProfileCurve = this.primData.ProfileCurve; + objectData.ParentID = this.primData.ParentID; + objectData.ProfileHollow = this.primData.ProfileHollow; + objectData.PathRadiusOffset = this.primData.PathRadiusOffset; + objectData.PathRevolutions = this.primData.PathRevolutions; + objectData.PathTaperX = this.primData.PathTaperX; + objectData.PathTaperY = this.primData.PathTaperY; + objectData.PathTwist = this.primData.PathTwist; + objectData.PathTwistBegin = this.primData.PathTwistBegin; + } + + #endregion + protected ObjectUpdatePacket.ObjectDataBlock CreateUpdateBlock() + { + ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); + this.SetDefaultPacketValues(objupdate); + objupdate.UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; + this.SetPacketShapeData(objupdate); + byte[] pb = this.Pos.GetBytes(); + Array.Copy(pb, 0, objupdate.ObjectData, 0, pb.Length); + return objupdate; + } + + protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() + { + uint ID = this.localid; + byte[] bytes = new byte[60]; + + int i = 0; + ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); + dat.TextureEntry = new byte[0]; + bytes[i++] = (byte)(ID % 256); + bytes[i++] = (byte)((ID >> 8) % 256); + bytes[i++] = (byte)((ID >> 16) % 256); + bytes[i++] = (byte)((ID >> 24) % 256); + bytes[i++] = 0; + bytes[i++] = 0; + + LLVector3 lPos; + Axiom.MathLib.Quaternion lRot; + if (this._physActor != null && this.physicsEnabled) + { + PhysicsVector pPos = this._physActor.Position; + lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); + lRot = this._physActor.Orientation; + } + else + { + lPos = this.Pos; + lRot = this.rotation; + } + byte[] pb = lPos.GetBytes(); + Array.Copy(pb, 0, bytes, i, pb.Length); + i += 12; + ushort ac = 32767; + + //vel + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + + //accel + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + + ushort rw, rx, ry, rz; + rw = (ushort)(32768 * (lRot.w + 1)); + rx = (ushort)(32768 * (lRot.x + 1)); + ry = (ushort)(32768 * (lRot.y + 1)); + rz = (ushort)(32768 * (lRot.z + 1)); + + //rot + bytes[i++] = (byte)(rx % 256); + bytes[i++] = (byte)((rx >> 8) % 256); + bytes[i++] = (byte)(ry % 256); + bytes[i++] = (byte)((ry >> 8) % 256); + bytes[i++] = (byte)(rz % 256); + bytes[i++] = (byte)((rz >> 8) % 256); + bytes[i++] = (byte)(rw % 256); + bytes[i++] = (byte)((rw >> 8) % 256); + + //rotation vel + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)(ac % 256); + bytes[i++] = (byte)((ac >> 8) % 256); + + dat.Data = bytes; + return dat; + } } } diff --git a/OpenSim/OpenSim.World/SceneObject.cs b/OpenSim/OpenSim.World/SceneObject.cs index a846fb5..d78c7a2 100644 --- a/OpenSim/OpenSim.World/SceneObject.cs +++ b/OpenSim/OpenSim.World/SceneObject.cs @@ -14,8 +14,8 @@ namespace OpenSim.world public class SceneObject : Entity { private LLUUID rootUUID; - private Dictionary ChildPrimitives = new Dictionary(); - private Dictionary m_clientThreads; + private Dictionary ChildPrimitives = new Dictionary(); + private Dictionary m_clientThreads; private World m_world; public SceneObject() @@ -42,7 +42,7 @@ namespace OpenSim.world } - public void GetProperites(ClientView client) + public void GetProperites(IClientAPI client) { /* ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); diff --git a/OpenSim/OpenSim.World/World.PacketHandlers.cs b/OpenSim/OpenSim.World/World.PacketHandlers.cs index ee5a23a..3357536 100644 --- a/OpenSim/OpenSim.World/World.PacketHandlers.cs +++ b/OpenSim/OpenSim.World/World.PacketHandlers.cs @@ -6,10 +6,8 @@ using libsecondlife.Packets; using OpenSim.Physics.Manager; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using OpenSim.Framework.Terrain; using OpenSim.Framework.Inventory; using OpenSim.Framework.Utilities; -using OpenSim.Assets; namespace OpenSim.world { @@ -35,10 +33,10 @@ namespace OpenSim.world public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { - foreach (ClientView client in m_clientThreads.Values) + foreach (IClientAPI client in m_clientThreads.Values) { // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); - int dis = (int)client.ClientAvatar.Pos.GetDistanceTo(fromPos); + int dis = 0; // (int)client.ClientAvatar.Pos.GetDistanceTo(fromPos); switch (type) { @@ -72,190 +70,57 @@ namespace OpenSim.world public void RezObject(AssetBase primAsset, LLVector3 pos) { - PrimData primd = new PrimData(primAsset.Data); - Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); - nPrim.CreateFromStorage(primd, pos, this._primCount, true); - this.Entities.Add(nPrim.uuid, nPrim); - this._primCount++; + } - public void DeRezObject(Packet packet, ClientView simClient) + public void DeRezObject(Packet packet, IClientAPI simClient) { - DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; - - //Needs to delete object from physics at a later date - if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) - { - //currently following code not used (or don't know of any case of destination being zero - - } - else - { - foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) - { - Entity selectedEnt = null; - //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); - foreach (Entity ent in this.Entities.Values) - { - if (ent.localid == Data.ObjectLocalID) - { - AssetBase primAsset = new AssetBase(); - primAsset.FullID = LLUUID.Random();//DeRezPacket.AgentBlock.TransactionID.Combine(LLUUID.Zero); //should be combining with securesessionid - primAsset.InvType = 6; - primAsset.Type = 6; - primAsset.Name = "Prim"; - primAsset.Description = ""; - primAsset.Data = ((Primitive)ent).GetByteArray(); - this._assetCache.AddAsset(primAsset); - this._inventoryCache.AddNewInventoryItem(simClient, DeRezPacket.AgentBlock.DestinationID, primAsset); - selectedEnt = ent; - break; - } - } - if (selectedEnt != null) - { - this.localStorage.RemovePrim(selectedEnt.uuid); - KillObjectPacket kill = new KillObjectPacket(); - kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; - kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); - kill.ObjectData[0].ID = selectedEnt.localid; - foreach (ClientView client in m_clientThreads.Values) - { - client.OutPacket(kill); - } - lock (Entities) - { - Entities.Remove(selectedEnt.uuid); - } - } - } - } - + } - public void SendAvatarsToClient(ClientView remoteClient) + public void SendAvatarsToClient(IClientAPI remoteClient) { - foreach (ClientView client in m_clientThreads.Values) - { - if (client.AgentID != remoteClient.AgentID) - { - // ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket(); - // RemoteClient.OutPacket(objupdate); - client.ClientAvatar.SendUpdateToOtherClient(remoteClient.ClientAvatar); - client.ClientAvatar.SendAppearanceToOtherAgent(remoteClient.ClientAvatar); - } - } + } public void LinkObjects(uint parentPrim, List childPrims) { - Primitive parentprim = null; - foreach (Entity ent in Entities.Values) - { - if (ent.localid == parentPrim) - { - parentprim = (OpenSim.world.Primitive)ent; - - } - } - - for (int i = 0; i < childPrims.Count; i++) - { - uint childId = childPrims[i]; - foreach (Entity ent in Entities.Values) - { - if (ent.localid == childId) - { - ((OpenSim.world.Primitive)ent).MakeParent(parentprim); - } - } - } + } public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == primLocalID) - { - ((OpenSim.world.Primitive)ent).UpdateShape(shapeBlock); - break; - } - } + } - public void SelectPrim(uint primLocalID, ClientView remoteClient) + public void SelectPrim(uint primLocalID, IClientAPI remoteClient) { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == primLocalID) - { - ((OpenSim.world.Primitive)ent).GetProperites(remoteClient); - break; - } - } + } - public void UpdatePrimFlags(uint localID, Packet packet, ClientView remoteClient) + public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == localID) - { - ((OpenSim.world.Primitive)ent).UpdateObjectFlags((ObjectFlagUpdatePacket) packet); - break; - } - } + } - public void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient) + public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == localID) - { - ((OpenSim.world.Primitive)ent).UpdateTexture(texture); - break; - } - } + } - public void UpdatePrimPosition(uint localID, LLVector3 pos, ClientView remoteClient) + public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == localID) - { - ((OpenSim.world.Primitive)ent).UpdatePosition(pos); - break; - } - } + } - public void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient) + public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == localID) - { - ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); - ((OpenSim.world.Primitive)ent).UpdateFlag = true; - break; - } - } + } - public void UpdatePrimScale(uint localID, LLVector3 scale, ClientView remoteClient) + public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == localID) - { - ((OpenSim.world.Primitive)ent).Scale = scale; - break; - } - } } } } diff --git a/OpenSim/OpenSim.World/World.Scripting.cs b/OpenSim/OpenSim.World/World.Scripting.cs index 44ef05a..24d887c 100644 --- a/OpenSim/OpenSim.World/World.Scripting.cs +++ b/OpenSim/OpenSim.World/World.Scripting.cs @@ -96,7 +96,7 @@ namespace OpenSim.world pos.Y = y; Primitive prim = entity as Primitive; // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. - prim.UpdatePosition(pos); + //prim.UpdatePosition(pos); // Console.WriteLine("script- setting entity " + localID + " positon"); } } diff --git a/OpenSim/OpenSim.World/World.cs b/OpenSim/OpenSim.World/World.cs index d840d10..2580761 100644 --- a/OpenSim/OpenSim.World/World.cs +++ b/OpenSim/OpenSim.World/World.cs @@ -6,13 +6,11 @@ using System.Text; using System.Reflection; using System.IO; using System.Threading; +using System.Timers; using OpenSim.Physics.Manager; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using OpenSim.Framework.Terrain; using OpenSim.Framework.Inventory; -using OpenSim.Assets; -//using OpenSim.world.scripting; using OpenSim.RegionServer.world.scripting; using OpenSim.Terrain; @@ -20,6 +18,7 @@ namespace OpenSim.world { public partial class World : WorldBase, ILocalStorageReceiver, IScriptAPI { + protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); public object LockPhysicsEngine = new object(); public Dictionary Avatars; public Dictionary Prims; @@ -57,15 +56,16 @@ namespace OpenSim.world /// Dictionary to contain client threads /// Region Handle for this region /// Region Name for this region - public World(Dictionary clientThreads, RegionInfo regInfo, ulong regionHandle, string regionName) + public World(Dictionary clientThreads, RegionInfo regInfo) { try { updateLock = new Mutex(false); m_clientThreads = clientThreads; - m_regionHandle = regionHandle; - m_regionName = regionName; m_regInfo = regInfo; + m_regionHandle = m_regInfo.RegionHandle; + m_regionName = m_regInfo.RegionName; + this.m_datastore = m_regInfo.DataStore; m_scriptHandlers = new Dictionary(); m_scripts = new Dictionary(); @@ -85,6 +85,8 @@ namespace OpenSim.world Avatar.LoadAnims(); this.SetDefaultScripts(); this.LoadScriptEngines(); + + } catch (Exception e) { @@ -93,6 +95,13 @@ namespace OpenSim.world } #endregion + public void StartTimer() + { + m_heartbeatTimer.Enabled = true; + m_heartbeatTimer.Interval = 100; + m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); + } + #region Script Methods /// /// Loads a new script into the specified entity @@ -167,6 +176,18 @@ namespace OpenSim.world #endregion #region Update Methods + + + /// + /// Performs per-frame updates regularly + /// + /// + /// + void Heartbeat(object sender, System.EventArgs e) + { + this.Update(); + } + /// /// Performs per-frame updates on the world, this should be the central world loop /// @@ -327,7 +348,7 @@ namespace OpenSim.world } this.localStorage.SaveMap(this.Terrain.getHeights1D()); - foreach (ClientView client in m_clientThreads.Values) + foreach (IClientAPI client in m_clientThreads.Values) { this.SendLayerData(client); } @@ -358,7 +379,7 @@ namespace OpenSim.world } this.localStorage.SaveMap(this.Terrain.getHeights1D()); - foreach (ClientView client in m_clientThreads.Values) + foreach (IClientAPI client in m_clientThreads.Values) { this.SendLayerData(client); } @@ -388,7 +409,7 @@ namespace OpenSim.world { /* Dont save here, rely on tainting system instead */ - foreach (ClientView client in m_clientThreads.Values) + foreach (IClientAPI client in m_clientThreads.Values) { this.SendLayerData(pointx, pointy, client); } @@ -436,23 +457,9 @@ namespace OpenSim.world /// Sends prims to a client /// /// Client to send to - public void GetInitialPrims(ClientView RemoteClient) + public void GetInitialPrims(IClientAPI RemoteClient) { - try - { - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - if (Entities[UUID] is Primitive) - { - Primitive primitive = Entities[UUID] as Primitive; - primitive.UpdateClient(RemoteClient); - } - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: GetInitialPrims() - Failed with exception " + e.ToString()); - } + } /// @@ -477,67 +484,32 @@ namespace OpenSim.world /// The object to load public void PrimFromStorage(PrimData prim) { - try - { - if (prim.LocalID >= this._primCount) - { - _primCount = prim.LocalID + 1; - } - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: PrimFromStorage() - Reloading prim (localId " + prim.LocalID + " ) from storage"); - Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); - nPrim.CreateFromStorage(prim); - this.Entities.Add(nPrim.uuid, nPrim); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: PrimFromStorage() - Failed with exception " + e.ToString()); - } + } - public void AddNewPrim(Packet addPacket, ClientView agentClient) + public void AddNewPrim(Packet addPacket, IClientAPI agentClient) { - AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentID); + AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentId); } public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) { - try - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: AddNewPrim() - Creating new prim"); - Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this); - prim.CreateFromPacket(addPacket, ownerID, this._primCount); - PhysicsVector pVec = new PhysicsVector(prim.Pos.X, prim.Pos.Y, prim.Pos.Z); - PhysicsVector pSize = new PhysicsVector(0.255f, 0.255f, 0.255f); - if (OpenSim.world.Avatar.PhysicsEngineFlying) - { - lock (this.LockPhysicsEngine) - { - prim.PhysActor = this.phyScene.AddPrim(pVec, pSize); - } - } - - this.Entities.Add(prim.uuid, prim); - this._primCount++; - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddNewPrim() - Failed with exception " + e.ToString()); - } + } #endregion #region Add/Remove Avatar Methods - public override Avatar AddViewerAgent(ClientView agentClient) + public override bool AddNewAvatar(IClientAPI agentClient, bool child) { - Avatar newAvatar = null; - return newAvatar; + + return false; } - public override void RemoveViewerAgent(ClientView agentClient) + public override bool RemoveAvatar(LLUUID agentID) { - + return false; } #endregion diff --git a/OpenSim/OpenSim.World/WorldBase.cs b/OpenSim/OpenSim.World/WorldBase.cs index 8fe98d3..33952bf 100644 --- a/OpenSim/OpenSim.World/WorldBase.cs +++ b/OpenSim/OpenSim.World/WorldBase.cs @@ -9,28 +9,27 @@ using System.Threading; using OpenSim.Physics.Manager; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; -using OpenSim.Framework.Terrain; using OpenSim.Framework.Inventory; -using OpenSim.Assets; using OpenSim.RegionServer.world.scripting; using OpenSim.Terrain; namespace OpenSim.world { - public class WorldBase + public class WorldBase : IWorld { public Dictionary Entities; protected Dictionary m_clientThreads; protected ulong m_regionHandle; protected string m_regionName; - protected InventoryCache _inventoryCache; - protected AssetCache _assetCache; + // protected InventoryCache _inventoryCache; + // protected AssetCache _assetCache; protected RegionInfo m_regInfo; public TerrainEngine Terrain; //TODO: Replace TerrainManager with this. protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine #region Properties + /* public InventoryCache InventoryCache { set @@ -46,6 +45,7 @@ namespace OpenSim.world this._assetCache = value; } } + */ #endregion #region Constructors @@ -56,14 +56,7 @@ namespace OpenSim.world #endregion #region Setup Methods - /// - /// Register Packet handler Methods with the packet server (which will register them with the SimClient) - /// - /// - public virtual void RegisterPacketHandlers(PacketServer packetServer) - { - - } + #endregion #region Update Methods @@ -90,7 +83,7 @@ namespace OpenSim.world /// Send the region heightmap to the client /// /// Client to send to - public virtual void SendLayerData(ClientView RemoteClient) + public virtual void SendLayerData(IClientAPI RemoteClient) { try { @@ -122,7 +115,7 @@ namespace OpenSim.world /// Patch coordinate (x) 0..16 /// Patch coordinate (y) 0..16 /// The client to send to - public void SendLayerData(int px, int py, ClientView RemoteClient) + public void SendLayerData(int px, int py, IClientAPI RemoteClient) { try { @@ -144,25 +137,23 @@ namespace OpenSim.world #endregion #region Add/Remove Agent/Avatar - /// - /// Add a new Agent's avatar - /// - /// - public virtual Avatar AddViewerAgent(ClientView agentClient) + public virtual bool AddNewAvatar(IClientAPI remoteClient, bool child) { - return null; + return false; } - /// - /// Remove a Agent's avatar - /// - /// - public virtual void RemoveViewerAgent(ClientView agentClient) + public virtual bool RemoveAvatar(LLUUID agentID) { - + return false; } + #endregion + public virtual RegionInfo GetRegionInfo() + { + return null; + } + #region Shutdown /// /// Tidy before shutdown diff --git a/OpenSim/OpenSim.World/scripting/IScriptHandler.cs b/OpenSim/OpenSim.World/scripting/IScriptHandler.cs index 15efc49..efd67b1 100644 --- a/OpenSim/OpenSim.World/scripting/IScriptHandler.cs +++ b/OpenSim/OpenSim.World/scripting/IScriptHandler.cs @@ -87,7 +87,7 @@ namespace OpenSim.RegionServer.world.scripting { Primitive prim = m_entity as Primitive; // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. - prim.UpdatePosition( value ); + // prim.UpdatePosition( value ); } } } diff --git a/OpenSim/OpenSim/OpenSim.csproj b/OpenSim/OpenSim/OpenSim.csproj index 069c5c6..79abd9e 100644 --- a/OpenSim/OpenSim/OpenSim.csproj +++ b/OpenSim/OpenSim/OpenSim.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {438A9556-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim @@ -15,9 +16,11 @@ IE50 false Exe - + + OpenSim - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,26 +61,27 @@ False False 4 - + + - + System.dll False - + System.Xml.dll False - + ..\..\bin\libsecondlife.dll False - + ..\..\bin\Axiom.MathLib.dll False - + ..\..\bin\Db4objects.Db4o.dll False @@ -84,49 +91,53 @@ OpenSim.Terrain.BasicTerrain {2270B8FE-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Physics.Manager {8BE16150-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Servers {8BB20F0A-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.RegionServer {632E1BFD-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.GenericConfig.Xml {E88EF749-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False XMLRPC {8E81D43C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False + + + {642A14A8-0000-0000-0000-000000000000} + OpenSim.World @@ -144,4 +155,4 @@ - + \ No newline at end of file diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index 9025316..aa41aeb 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs @@ -75,7 +75,7 @@ namespace OpenSim /// public override void StartUp() { - this.regionData = new RegionInfo(); + this.serversData = new NetworkServersInfo(); try { this.localConfig = new XmlConfig(m_config); @@ -90,10 +90,9 @@ namespace OpenSim this.SetupFromConfigFile(this.localConfig); } m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Loading configuration"); - this.regionData.InitConfig(this.m_sandbox, this.localConfig); + this.serversData.InitConfig(this.m_sandbox, this.localConfig); this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change - GridServers = new Grid(); if (m_sandbox) { this.SetupLocalGridServers(); @@ -113,36 +112,11 @@ namespace OpenSim startuptime = DateTime.Now; - try - { - AssetCache = new AssetCache(GridServers.AssetServer); - InventoryCache = new InventoryCache(); - } - catch (Exception e) - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup local cache"); - Environment.Exit(1); - } - - m_udpServer = new UDPServer(this.regionData.IPListenPort, this.GridServers, this.AssetCache, this.InventoryCache, this.regionData, this.m_sandbox, this.user_accounts, this.m_console, this.AuthenticateSessionsHandler); - - //should be passing a IGenericConfig object to these so they can read the config data they want from it - GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey); - IGridServer gridServer = GridServers.GridServer; - gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey); - - if (!m_sandbox) - { - this.ConnectToRemoteGridServer(); - } + this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); + this.physManager.LoadPlugins(); this.SetupLocalWorld(); - if (m_sandbox) - { - AssetCache.LoadDefaultTextureSet(); - } - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Initialising HTTP server"); this.SetupHttpListener(); @@ -151,30 +125,18 @@ namespace OpenSim LoginServer loginServer = null; LoginServer adminLoginServer = null; - bool sandBoxWithLoginServer = m_loginserver && m_sandbox; - if (sandBoxWithLoginServer) + if (m_sandbox) { - loginServer = new LoginServer(regionData.IPListenAddr, regionData.IPListenPort, regionData.RegionLocX, regionData.RegionLocY, this.user_accounts); + loginServer = new LoginServer(regionData[0].IPListenAddr, regionData[0].IPListenPort, regionData[0].RegionLocX, regionData[0].RegionLocY, this.user_accounts); loginServer.Startup(); loginServer.SetSessionHandler(((AuthenticateSessionsLocal)this.AuthenticateSessionsHandler).AddNewSession); - if (user_accounts) - { - //sandbox mode with loginserver using accounts - this.GridServers.UserServer = loginServer; - adminLoginServer = loginServer; - - httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod); - } - else - { - //sandbox mode with loginserver not using accounts - httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); - } + //sandbox mode with loginserver not using accounts + httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); } //Web front end setup - AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer); + AdminWebFront adminWebFront = new AdminWebFront("Admin"); adminWebFront.LoadMethods(httpServer); //Start http server @@ -182,89 +144,93 @@ namespace OpenSim httpServer.Start(); // Start UDP server - this.m_udpServer.ServerListener(); + for (int i = 0; i < m_udpServer.Count; i++) + { + this.m_udpServer[i].ServerListener(); + } - m_heartbeatTimer.Enabled = true; - m_heartbeatTimer.Interval = 100; - m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); } # region Setup methods protected override void SetupLocalGridServers() { - GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; - GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll"; - - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Starting in Sandbox mode"); - try { - GridServers.Initialise(); + AssetCache = new AssetCache("OpenSim.GridInterfaces.Local.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); + InventoryCache = new InventoryCache(); } catch (Exception e) { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup the grid interface"); + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup local cache"); Environment.Exit(1); } + } protected override void SetupRemoteGridServers() { - if (this.gridLocalAsset) - { - GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; - } - else - { - GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll"; - } - GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll"; - - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Starting in Grid mode"); - try { - GridServers.Initialise(); + AssetCache = new AssetCache("OpenSim.GridInterfaces.Remote.dll", this.serversData.AssetURL, this.serversData.AssetSendKey); + InventoryCache = new InventoryCache(); } catch (Exception e) { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup the grid interface"); + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup remote cache"); Environment.Exit(1); } } protected override void SetupLocalWorld() { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString()); - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Initialising world"); - m_console.componentname = "Region " + regionData.RegionName; + IGenericConfig regionConfig; + World LocalWorld; + UDPServer udpServer; + RegionInfo regionDat = new RegionInfo(); + + string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Regions"); + string[] pluginFiles = Directory.GetFiles(path, "*.xml"); - m_localWorld = new World(this.m_udpServer.PacketServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName); - LocalWorld.InventoryCache = InventoryCache; - LocalWorld.AssetCache = AssetCache; + for (int i = 0; i < pluginFiles.Length; i++) + { + regionConfig = new XmlConfig(pluginFiles[i]); + regionConfig.LoadData(); + regionDat.InitConfig(this.m_sandbox, regionConfig); + regionConfig.Close(); - this.m_udpServer.LocalWorld = LocalWorld; - this.m_udpServer.PacketServer.RegisterClientPacketHandlers(); + udpServer = new UDPServer(regionDat.IPListenPort, this.AssetCache, this.InventoryCache, this.m_console, this.AuthenticateSessionsHandler); - this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); - this.physManager.LoadPlugins(); + m_udpServer.Add(udpServer); + this.regionData.Add(regionDat); + + /* + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString()); + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Initialising world"); + m_console.componentname = "Region " + regionData.RegionName; + */ + + LocalWorld = new World(udpServer.PacketServer.ClientAPIs, regionDat); + this.m_localWorld.Add(LocalWorld); + //LocalWorld.InventoryCache = InventoryCache; + //LocalWorld.AssetCache = AssetCache; - LocalWorld.m_datastore = this.regionData.DataStore; + udpServer.LocalWorld = LocalWorld; - LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. - LocalWorld.LoadWorldMap(); + LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. + LocalWorld.LoadWorldMap(); - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting up messaging system"); - LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); - LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); - LocalWorld.LoadPrimsFromStorage(); + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting up messaging system"); + LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); + LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); + LocalWorld.LoadPrimsFromStorage(); + } } protected override void SetupHttpListener() { - httpServer = new BaseHttpServer(regionData.IPListenPort); + httpServer = new BaseHttpServer(regionData[0].IPListenPort); - if (this.GridServers.GridServer.GetName() == "Remote") + if (!this.m_sandbox) { // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server @@ -275,7 +241,7 @@ namespace OpenSim { Hashtable requestData = (Hashtable)request.Params[0]; uint circuitcode = Convert.ToUInt32(requestData["circuit_code"]); - + AgentCircuitData agent_data = new AgentCircuitData(); agent_data.firstname = (string)requestData["firstname"]; agent_data.lastname = (string)requestData["lastname"]; @@ -297,42 +263,7 @@ namespace OpenSim protected override void ConnectToRemoteGridServer() { - if (GridServers.GridServer.RequestConnection(regionData.SimUUID, regionData.IPListenAddr, (uint)regionData.IPListenPort)) - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Success: Got a grid connection OK!"); - } - else - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, "Main.cs:Startup() - FAILED: Unable to get connection to grid. Shutting down."); - Shutdown(); - } - - GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]); - - // If we are being told to load a file, load it. - string dataUri = (string)((RemoteGridBase)GridServers.GridServer).GridData["data_uri"]; - if (!String.IsNullOrEmpty(dataUri)) - { - this.LocalWorld.m_datastore = dataUri; - } - - if (((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString() != "") - { - // The grid server has told us who we are - // We must obey the grid server. - try - { - regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString()); - regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString()); - regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString(); - } - catch (Exception e) - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, e.Message + "\nBAD ERROR! THIS SHOULD NOT HAPPEN! Bad GridData from the grid interface!!!! ZOMG!!!"); - Environment.Exit(1); - } - } } #endregion @@ -447,22 +378,14 @@ namespace OpenSim m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Killing clients"); // IMPLEMENT THIS m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Closing console and terminating"); - LocalWorld.Close(); - GridServers.Close(); + for (int i = 0; i < m_localWorld.Count; i++) + { + ((World)m_localWorld[i]).Close(); + } m_console.Close(); Environment.Exit(0); } - /// - /// Performs per-frame updates regularly - /// - /// - /// - void Heartbeat(object sender, System.EventArgs e) - { - LocalWorld.Update(); - } - #region Console Commands /// /// Runs commands issued by the server console from the operator @@ -484,10 +407,10 @@ namespace OpenSim case "terrain": string result = ""; - if (!LocalWorld.Terrain.RunTerrainCmd(cmdparams, ref result)) - { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, result); - } + /* if (!((World)m_localWorld).Terrain.RunTerrainCmd(cmdparams, ref result)) + { + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, result); + }*/ break; case "shutdown": @@ -515,14 +438,14 @@ namespace OpenSim case "users": OpenSim.world.Avatar TempAv; m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); - foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) - { - if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") - { - TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID]; - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); - } - } + /* foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) + { + if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") + { + TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID]; + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); + } + }*/ break; } } -- cgit v1.1