*Added some missing files I forgot to add...OpenSim.sln should compile now

Sugilite
mingchen 2007-06-27 16:55:27 +00:00
parent e41eedc9ae
commit e392e222a8
12 changed files with 1096 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Communications;
namespace OpenSim.Region.Communications.Local
{
public class CommunicationsLocal : CommunicationsManager
{
public LocalBackEndServices SandBoxServices = new LocalBackEndServices();
public LocalUserServices UserServices;
public CommunicationsLocal(NetworkServersInfo serversInfo)
: base(serversInfo)
{
UserServices = new LocalUserServices(this , serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY);
UserServices.AddPlugin("OpenGrid.Framework.Data.DB4o.dll");
UserServer = UserServices;
GridServer = SandBoxServices;
InterRegion = SandBoxServices;
}
internal void InformRegionOfLogin(ulong regionHandle, Login login)
{
this.SandBoxServices.AddNewSession(regionHandle, login);
}
}
}

View File

@ -0,0 +1,209 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Types;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
namespace OpenSim.Region.Communications.Local
{
public class LocalBackEndServices : IGridServices, IInterRegionCommunications
{
protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>();
protected Dictionary<ulong, RegionCommsListener> regionHosts = new Dictionary<ulong, RegionCommsListener>();
public LocalBackEndServices()
{
}
/// <summary>
/// Register a region method with the BackEnd Services.
/// </summary>
/// <param name="regionInfo"></param>
/// <returns></returns>
public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo)
{
//Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle))
{
//Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle );
this.regions.Add(regionInfo.RegionHandle, regionInfo);
RegionCommsListener regionHost = new RegionCommsListener();
this.regionHosts.Add(regionInfo.RegionHandle, regionHost);
return regionHost;
}
//already in our list of regions so for now lets return null
return null;
}
/// <summary>
/// </summary>
/// <param name="regionInfo"></param>
/// <returns></returns>
public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo)
{
// Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle);
List<RegionInfo> neighbours = new List<RegionInfo>();
foreach (RegionInfo reg in this.regions.Values)
{
// Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY);
if (reg.RegionHandle != regionInfo.RegionHandle)
{
//Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location");
if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2)))
{
if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2)))
{
neighbours.Add(reg);
}
}
}
}
return neighbours;
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <returns></returns>
public RegionInfo RequestNeighbourInfo(ulong regionHandle)
{
if (this.regions.ContainsKey(regionHandle))
{
return this.regions[regionHandle];
}
return null;
}
/// <summary>
///
/// </summary>
/// <param name="minX"></param>
/// <param name="minY"></param>
/// <param name="maxX"></param>
/// <param name="maxY"></param>
/// <returns></returns>
public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
{
List<MapBlockData> mapBlocks = new List<MapBlockData>();
foreach(RegionInfo regInfo in this.regions.Values)
{
if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY)))
{
MapBlockData map = new MapBlockData();
map.Name = regInfo.RegionName;
map.X = (ushort)regInfo.RegionLocX;
map.Y = (ushort)regInfo.RegionLocY;
map.WaterHeight =(byte) regInfo.estateSettings.waterHeight;
map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007");
map.Agents = 1;
map.RegionFlags = 72458694;
map.Access = 13;
mapBlocks.Add(map);
}
}
return mapBlocks;
}
/// <summary>
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData
{
//Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
if (this.regionHosts.ContainsKey(regionHandle))
{
// Console.WriteLine("CommsManager- Informing a region to expect child agent");
this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData);
return true;
}
return false;
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
/// <returns></returns>
public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
{
if (this.regionHosts.ContainsKey(regionHandle))
{
// Console.WriteLine("CommsManager- Informing a region to expect avatar crossing");
this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position);
return true;
}
return false;
}
/// <summary>
/// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="loginData"></param>
/// <returns></returns>
public bool AddNewSession(ulong regionHandle, Login loginData)
{
//Console.WriteLine(" comms manager been told to expect new user");
AgentCircuitData agent = new AgentCircuitData();
agent.AgentID = loginData.Agent;
agent.firstname = loginData.First;
agent.lastname = loginData.Last;
agent.SessionID = loginData.Session;
agent.SecureSessionID = loginData.SecureSession;
agent.circuitcode = loginData.CircuitCode;
agent.BaseFolder = loginData.BaseFolder;
agent.InventoryFolder = loginData.InventoryFolder;
agent.startpos = new LLVector3(128, 128, 70);
agent.CapsPath = loginData.CapsPath;
if (this.regionHosts.ContainsKey(regionHandle))
{
this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent);
return true;
}
// region not found
return false;
}
}
}

View File

@ -0,0 +1,118 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Communications;
//using OpenSim.Framework.User;
using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Data;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using libsecondlife;
namespace OpenSim.Region.Communications.Local
{
public class LocalUserServices : UserManagerBase, IUserServices
{
private CommunicationsLocal m_Parent;
private uint defaultHomeX ;
private uint defaultHomeY;
public LocalUserServices(CommunicationsLocal parent, uint defHomeX, uint defHomeY)
{
m_Parent = parent;
defaultHomeX = defHomeX;
defaultHomeY = defHomeY;
}
public UserProfileData GetUserProfile(string firstName, string lastName)
{
return GetUserProfile(firstName + " " + lastName);
}
public UserProfileData GetUserProfile(string name)
{
return this.getUserProfile(name);
}
public UserProfileData GetUserProfile(LLUUID avatarID)
{
return this.getUserProfile(avatarID);
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public override string GetMessage()
{
return "Welcome to OpenSim";
}
public override UserProfileData GetTheUser(string firstname, string lastname)
{
UserProfileData profile = getUserProfile(firstname, lastname);
if (profile != null)
{
return profile;
}
//no current user account so make one
Console.WriteLine("No User account found so creating a new one ");
this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
profile = getUserProfile(firstname, lastname);
return profile;
}
public override bool AuthenticateUser(ref UserProfileData profile, string password)
{
//for now we will accept any password in sandbox mode
Console.WriteLine("authorising user");
return true;
}
public override void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser)
{
ulong currentRegion = theUser.currentAgent.currentHandle;
RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion);
if (reg != null)
{
response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " +
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
string capsPath = Util.GetRandomCapsPath();
response.SimAddress = reg.CommsIPListenAddr;
response.SimPort = (Int32)reg.CommsIPListenPort;
response.RegionX = reg.RegionLocX ;
response.RegionY = reg.RegionLocY ;
response.SeedCapability = "http://" + reg.CommsIPListenAddr + ":" + "9000" + "/CAPS/" + capsPath + "0000/";
theUser.currentAgent.currentRegion = reg.SimUUID;
theUser.currentAgent.currentHandle = reg.RegionHandle;
Login _login = new Login();
//copy data to login object
_login.First = response.Firstname;
_login.Last = response.Lastname;
_login.Agent = response.AgentID;
_login.Session = response.SessionID;
_login.SecureSession = response.SecureSessionID;
_login.CircuitCode = (uint)response.CircuitCode;
_login.CapsPath = capsPath;
m_Parent.InformRegionOfLogin(currentRegion, _login);
}
else
{
Console.WriteLine("not found region " + currentRegion);
}
}
}
}

View File

@ -0,0 +1,128 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{EB3A1BA8-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>OpenSim.Region.Communications.Local</AssemblyName>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim.Region.Communications.Local</RootNamespace>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize>
<OutputPath>..\..\..\bin\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
<OutputPath>..\..\..\..\bin\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="libsecondlife.dll">
<HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System">
<HintPath>System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml">
<HintPath>System.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Framework\General\OpenSim.Framework.csproj">
<Name>OpenSim.Framework</Name>
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Framework\Communications\OpenSim.Framework.Communications.csproj">
<Name>OpenSim.Framework.Communications</Name>
<Project>{CB52B7E7-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Framework\Data\OpenSim.Framework.Data.csproj">
<Name>OpenSim.Framework.Data</Name>
<Project>{36B72A9B-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Framework\UserManager\OpenSim.Framework.UserManagement.csproj">
<Name>OpenSim.Framework.UserManagement</Name>
<Project>{586E2916-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="CommunicationsLocal.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="LocalBackEndServices.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="LocalUserServices.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Region.Communications.Local")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenSim.Region.Communications.Local")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Types;
using OpenSim.Framework.Communications;
namespace OpenSim.Region.Communications.OGS1
{
public class GridCommsManager : CommunicationsManager
{
private OGS1GridServices gridInterComms = new OGS1GridServices();
public GridCommsManager(NetworkServersInfo serversInfo) :base(serversInfo)
{
GridServer = gridInterComms;
InterRegion = gridInterComms;
UserServer = new OGSUserServices();
}
}
}

View File

@ -0,0 +1,248 @@
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using OpenSim.Framework.Servers;
using OpenSim.Framework;
using OpenSim.Framework.Types;
using OpenSim.Framework.Communications;
using Nwc.XmlRpc;
using libsecondlife;
namespace OpenSim.Region.Communications.OGS1
{
public class OGS1GridServices : IGridServices, IInterRegionCommunications
{
public Dictionary<ulong, RegionCommsListener> listeners = new Dictionary<ulong, RegionCommsListener>();
public GridInfo grid;
public BaseHttpServer httpListener;
private bool initialised = false;
public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo)
{
Hashtable GridParams = new Hashtable();
grid = gridInfo;
// Login / Authentication
GridParams["authkey"] = gridInfo.GridServerSendKey;
GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated();
GridParams["sim_ip"] = regionInfo.CommsExternalAddress;
GridParams["sim_port"] = regionInfo.CommsIPListenPort.ToString();
// Package into an XMLRPC Request
ArrayList SendParams = new ArrayList();
SendParams.Add(GridParams);
// Send Request
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
XmlRpcResponse GridResp = GridReq.Send(gridInfo.GridServerURI, 3000);
Hashtable GridRespData = (Hashtable)GridResp.Value;
Hashtable griddatahash = GridRespData;
// Process Response
if (GridRespData.ContainsKey("error"))
{
string errorstring = (string)GridRespData["error"];
OpenSim.Framework.Console.MainLog.Instance.Error("Unable to connect to grid: " + errorstring);
return null;
}
if (!this.listeners.ContainsKey(regionInfo.RegionHandle))
{
// initialised = true;
httpListener = new BaseHttpServer(regionInfo.CommsIPListenPort);
httpListener.AddXmlRPCHandler("expect_user", this.ExpectUser);
httpListener.Start();
}
// Initialise the background listeners
listeners[regionInfo.RegionHandle] = new RegionCommsListener();
return listeners[regionInfo.RegionHandle];
}
public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo)
{
Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1);
List<RegionInfo> neighbours = new List<RegionInfo>();
foreach (Hashtable n in (Hashtable)respData.Values)
{
RegionInfo neighbour = new RegionInfo();
//OGS1
neighbour.RegionHandle = (ulong)n["regionhandle"];
neighbour.RegionLocX = (uint)n["x"];
neighbour.RegionLocY = (uint)n["y"];
neighbour.RegionName = (string)n["name"];
//OGS1+
neighbour.CommsIPListenAddr = (string)n["sim_ip"];
neighbour.CommsIPListenPort = (int)n["sim_port"];
neighbour.CommsExternalAddress = (string)n["sim_uri"];
neighbour.SimUUID = (string)n["uuid"];
neighbours.Add(neighbour);
}
return neighbours;
}
public RegionInfo RequestNeighbourInfo(ulong regionHandle)
{
OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()");
return null;
}
public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
{
Hashtable respData = MapBlockQuery(minX, minY, maxX, maxY);
List<MapBlockData> neighbours = new List<MapBlockData>();
foreach (Hashtable n in (Hashtable)respData.Values)
{
MapBlockData neighbour = new MapBlockData();
neighbour.X = (ushort)n["x"];
neighbour.Y = (ushort)n["y"];
neighbour.Name = (string)n["name"];
neighbour.Access = (byte)n["access"];
neighbour.RegionFlags = (uint)n["region-flags"];
neighbour.WaterHeight = (byte)n["water-height"];
neighbour.MapImageId = (string)n["map-image-id"];
neighbours.Add(neighbour);
}
return neighbours;
}
/// <summary>
/// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates
/// </summary>
/// <remarks>REDUNDANT - OGS1 is to be phased out in favour of OGS2</remarks>
/// <param name="minX">Minimum X value</param>
/// <param name="minY">Minimum Y value</param>
/// <param name="maxX">Maximum X value</param>
/// <param name="maxY">Maximum Y value</param>
/// <returns>Hashtable of hashtables containing map data elements</returns>
private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY)
{
Hashtable param = new Hashtable();
param["xmin"] = minX;
param["ymin"] = minY;
param["xmax"] = maxX;
param["ymax"] = maxY;
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
XmlRpcResponse resp = req.Send(grid.GridServerURI, 3000);
Hashtable respData = (Hashtable)resp.Value;
return respData;
}
// Grid Request Processing
public XmlRpcResponse ExpectUser(XmlRpcRequest request)
{
Hashtable requestData = (Hashtable)request.Params[0];
AgentCircuitData agentData = new AgentCircuitData();
agentData.SessionID = new LLUUID((string)requestData["session_id"]);
agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]);
agentData.firstname = (string)requestData["firstname"];
agentData.lastname = (string)requestData["lastname"];
agentData.AgentID = new LLUUID((string)requestData["agent_id"]);
agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
{
agentData.child = true;
}
else
{
agentData.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"]));
agentData.child = false;
}
if (listeners.ContainsKey((ulong)requestData["regionhandle"]))
{
this.listeners[(ulong)requestData["regionhandle"]].TriggerExpectUser((ulong)requestData["regionhandle"], agentData);
}
else
{
OpenSim.Framework.Console.MainLog.Instance.Error("ExpectUser() - Unknown region " + ((ulong)requestData["regionhandle"]).ToString());
}
return new XmlRpcResponse();
}
#region InterRegion Comms
private void StartRemoting()
{
TcpChannel ch = new TcpChannel(8895);
ChannelServices.RegisterChannel(ch);
WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry( Type.GetType("OGS1InterRegionRemoting"), "InterRegions", WellKnownObjectMode.Singleton);
RemotingConfiguration.RegisterWellKnownServiceType(wellType);
InterRegionSingleton.Instance.OnArrival += this.IncomingArrival;
InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent;
}
#region Methods called by regions in this instance
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
if (this.listeners.ContainsKey(regionHandle))
{
this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
return true;
}
//TODO need to see if we know about where this region is and use .net remoting
// to inform it.
return false;
}
public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
{
if (this.listeners.ContainsKey(regionHandle))
{
this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position);
return true;
}
//TODO need to see if we know about where this region is and use .net remoting
// to inform it.
return false;
}
#endregion
#region Methods triggered by calls from external instances
public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
if (this.listeners.ContainsKey(regionHandle))
{
this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
return true;
}
return false;
}
public bool IncomingArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
{
if (this.listeners.ContainsKey(regionHandle))
{
this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position);
return true;
}
return false;
}
#endregion
#endregion
}
}

View File

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Types;
using OpenSim.Framework.Communications;
namespace OpenSim.Region.Communications.OGS1
{
public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData);
public delegate bool ExpectArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position);
public sealed class InterRegionSingleton
{
static readonly InterRegionSingleton instance = new InterRegionSingleton();
public event InformRegionChild OnChildAgent;
public event ExpectArrival OnArrival;
static InterRegionSingleton()
{
}
InterRegionSingleton()
{
}
public static InterRegionSingleton Instance
{
get
{
return instance;
}
}
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
if (OnChildAgent != null)
{
return OnChildAgent(regionHandle, agentData);
}
return false;
}
public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
{
if (OnArrival != null)
{
return OnArrival(regionHandle, agentID, position);
}
return false;
}
}
public class OGS1InterRegionRemoting : MarshalByRefObject
{
public OGS1InterRegionRemoting()
{
}
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData);
}
public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
{
return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position);
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Data;
using libsecondlife;
namespace OpenSim.Region.Communications.OGS1
{
public class OGSUserServices :IUserServices
{
public UserProfileData GetUserProfile(string firstName, string lastName)
{
return null;
}
public UserProfileData GetUserProfile(string name)
{
return null;
}
public UserProfileData GetUserProfile(LLUUID avatarID)
{
return null;
}
}
}

View File

@ -0,0 +1,149 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6109024D-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>OpenSim.Region.Communications.OGS1</AssemblyName>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim.Region.Communications.OGS1</RootNamespace>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize>
<OutputPath>..\..\..\bin\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
<OutputPath>..\..\..\..\bin\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\bin\libsecondlife.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Data">
<HintPath>System.Data.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Runtime.Remoting">
<HintPath>System.Runtime.Remoting.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml">
<HintPath>System.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="XMLRPC, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\bin\XMLRPC.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Framework\General\OpenSim.Framework.csproj">
<Name>OpenSim.Framework</Name>
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Framework\Communications\OpenSim.Framework.Communications.csproj">
<Name>OpenSim.Framework.Communications</Name>
<Project>{CB52B7E7-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\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>
</ProjectReference>
<ProjectReference Include="..\..\..\Framework\Data\OpenSim.Framework.Data.csproj">
<Name>OpenSim.Framework.Data</Name>
<Project>{36B72A9B-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Framework\Servers\OpenSim.Framework.Servers.csproj">
<Name>OpenSim.Framework.Servers</Name>
<Project>{2CC71860-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="GridCommsManager.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="OGS1GridServices.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="OGSInterSimComms.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="OGSUserServices.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenGrid.Framework.Communications.OGS1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenGrid.Framework.Communications.OGS1")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]