Should allow multiple worlds (and UDP servers) to be ran in one instance, just missing backend comms and working Avatar/primitives classes.

This commit is contained in:
MW
2007-05-27 18:52:42 +00:00
parent 06387d0344
commit c746a2f9f4
62 changed files with 1623 additions and 1784 deletions

View File

@@ -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<libsecondlife.LLUUID, AssetInfo>();
Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>();
this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
this._assetCacheThread.IsBackground = true;
this._assetCacheThread.Start();
}
/// <summary>
///
/// </summary>
@@ -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

View File

@@ -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

View File

@@ -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
}
}

View File

@@ -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

View File

@@ -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;

View File

@@ -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();

View File

@@ -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<uint, ClientView> 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<uint, ClientView> clientThreads, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions)
{
get
{
return startpos;
}
set
{
startpos = value;
}
}
public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, ClientView> 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<QueItem>();
@@ -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

View File

@@ -29,7 +29,7 @@ namespace OpenSim
public uint CircuitCode;
public EndPoint userEP;
protected OpenSimNetworkHandler m_networkServer;
protected PacketServer m_networkServer;
public ClientViewBase()
{

View File

@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim
{
public class CommsManager
{
}
}

View File

@@ -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
{
}
}

View File

@@ -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());
}
}
}
}

View File

@@ -1,4 +1,4 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
<ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon></ApplicationIcon>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>OpenSim.RegionServer</AssemblyName>
@@ -15,9 +16,11 @@
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<AppDesignerFolder></AppDesignerFolder>
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim.RegionServer</RootNamespace>
<StartupObject></StartupObject>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
</PropertyGroup>
@@ -28,7 +31,8 @@
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile></DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize>
@@ -37,7 +41,8 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn></NoWarn>
<NoWarn>
</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile></DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
@@ -55,26 +61,28 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn></NoWarn>
<NoWarn>
</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" >
<Reference Include="System">
<HintPath>System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml" >
<Reference Include="System.Data" />
<Reference Include="System.Xml">
<HintPath>System.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="libsecondlife.dll" >
<Reference Include="libsecondlife.dll">
<HintPath>..\..\bin\libsecondlife.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Axiom.MathLib.dll" >
<Reference Include="Axiom.MathLib.dll">
<HintPath>..\..\bin\Axiom.MathLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Db4objects.Db4o.dll" >
<Reference Include="Db4objects.Db4o.dll">
<HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
<Private>False</Private>
</Reference>
@@ -84,43 +92,43 @@
<Name>OpenSim.Terrain.BasicTerrain</Name>
<Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
<Name>OpenSim.Framework</Name>
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
<Name>OpenSim.Framework.Console</Name>
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj">
<Name>OpenSim.GenericConfig.Xml</Name>
<Project>{E88EF749-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
<Name>OpenSim.Physics.Manager</Name>
<Project>{8BE16150-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj">
<Name>OpenSim.Servers</Name>
<Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj">
<Name>XMLRPC</Name>
<Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
@@ -157,30 +165,17 @@
<Compile Include="CommsManager.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Grid.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="OpenSimMain.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="OpenSimNetworkHandler.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="OpenSimNetworkHandler.cs" />
<Compile Include="PacketServer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="RegionInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="RegionInfoBase.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="RegionServerBase.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="UDPServer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="UserConfigUtility.cs" />
<Compile Include="VersionInfo.cs">
<SubType>Code</SubType>
</Compile>
@@ -193,66 +188,6 @@
<Compile Include="CAPS\AdminWebFront.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="types\Mesh.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="types\Triangle.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\Avatar.Client.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\Avatar.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\Avatar.Update.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\AvatarAnimations.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\Entity.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\Primitive.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\Primitive2.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\SceneObject.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\World.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\World.PacketHandlers.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\World.Scripting.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\WorldBase.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\scripting\IScriptContext.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\scripting\IScriptEntity.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\scripting\IScriptHandler.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\scripting\Script.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\scripting\ScriptFactory.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\scripting\Scripts\FollowRandomAvatar.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<PropertyGroup>
@@ -261,4 +196,4 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>

View File

@@ -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 <organization> 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 <copyright holder> ``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 <copyright holder> 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;
}
/// <summary>
/// Performs initialisation of the world, such as loading configuration from disk.
/// </summary>
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);
}
}
/// <summary>
/// Performs any last-minute sanity checking and shuts down the region server
/// </summary>
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);
}
/// <summary>
/// Performs per-frame updates regularly
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Heartbeat(object sender, System.EventArgs e)
{
LocalWorld.Update();
}
#region Console Commands
/// <summary>
/// Runs commands issued by the server console from the operator
/// </summary>
/// <param name="command">The first argument of the parameter (the command)</param>
/// <param name="cmdparams">Additional arguments passed to the command</param>
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;
}
}
/// <summary>
/// Outputs to the console information about the region
/// </summary>
/// <param name="ShowWhat">What information to display (valid arguments are "uptime", "users")</param>
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
}
*/
}

View File

@@ -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);
}
}

View File

@@ -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<uint, ClientView> ClientThreads = new Dictionary<uint, ClientView>();
public Dictionary<uint, IClientAPI> ClientAPIs = new Dictionary<uint, IClientAPI>();
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);
}
}
}

View File

@@ -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();

View File

@@ -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()
{
}
}
}

View File

@@ -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<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
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<UDPServer> m_udpServer = new List<UDPServer>();
protected List<RegionInfo> regionData = new List<RegionInfo>();
protected List<IWorld> m_localWorld = new List<IWorld>();
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; }
}
}*/
/// <summary>
/// Performs initialisation of the world, such as loading configuration from disk.

View File

@@ -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);
}
}
}

View File

@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim
{
public class UserConfigUtility
{
}
}

View File

@@ -32,6 +32,6 @@ namespace OpenSim
/// </summary>
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 ";
}
}