Started work on CAPS support, now we have our first test capability, MapLayer requests are handled by CAPS.

Sugilite
MW 2007-06-22 22:21:08 +00:00
parent 0a02dd287d
commit d7121a422a
12 changed files with 167 additions and 52 deletions

View File

@ -35,7 +35,7 @@ namespace OpenGrid.Framework.Communications
{ {
public interface IInterRegionCommunications public interface IInterRegionCommunications
{ {
bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData); bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position); bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position);
} }
} }

View File

@ -40,8 +40,6 @@ namespace OpenGrid.Framework.UserManagement
private LLUUID agentID; private LLUUID agentID;
private LLUUID sessionID; private LLUUID sessionID;
private LLUUID secureSessionID; private LLUUID secureSessionID;
private LLUUID baseFolderID;
private LLUUID inventoryFolderID;
// Login Flags // Login Flags
private string dst; private string dst;
@ -106,8 +104,6 @@ namespace OpenGrid.Framework.UserManagement
} // LoginServer } // LoginServer
public void SetDefaultValues() public void SetDefaultValues()
{
try
{ {
this.DST = "N"; this.DST = "N";
this.StipendSinceLogin = "N"; this.StipendSinceLogin = "N";
@ -153,14 +149,7 @@ namespace OpenGrid.Framework.UserManagement
InitialOutfitHash["folder_name"] = "Nightclub Female"; InitialOutfitHash["folder_name"] = "Nightclub Female";
InitialOutfitHash["gender"] = "female"; InitialOutfitHash["gender"] = "female";
this.initialOutfit.Add(InitialOutfitHash); this.initialOutfit.Add(InitialOutfitHash);
}
catch (Exception e)
{
OpenSim.Framework.Console.MainLog.Instance.WriteLine(
OpenSim.Framework.Console.LogPriority.LOW,
"LoginResponse: Unable to set default values: " + e.Message
);
}
} // SetDefaultValues } // SetDefaultValues

View File

@ -66,6 +66,7 @@ namespace OpenSim.Servers
protected Dictionary<string, RestMethodEntry> m_restHandlers = new Dictionary<string, RestMethodEntry>(); protected Dictionary<string, RestMethodEntry> m_restHandlers = new Dictionary<string, RestMethodEntry>();
protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
protected int m_port; protected int m_port;
protected bool firstcaps = true;
public BaseHttpServer(int port) public BaseHttpServer(int port)
{ {
@ -74,6 +75,7 @@ namespace OpenSim.Servers
public bool AddRestHandler(string method, string path, RestMethod handler) public bool AddRestHandler(string method, string path, RestMethod handler)
{ {
Console.WriteLine("adding new REST handler for path " + path);
string methodKey = String.Format("{0}: {1}", method, path); string methodKey = String.Format("{0}: {1}", method, path);
if (!this.m_restHandlers.ContainsKey(methodKey)) if (!this.m_restHandlers.ContainsKey(methodKey))
@ -158,7 +160,14 @@ namespace OpenSim.Servers
protected virtual string ParseLLSDXML(string requestBody) protected virtual string ParseLLSDXML(string requestBody)
{ {
// dummy function for now - IMPLEMENT ME! // dummy function for now - IMPLEMENT ME!
return ""; Console.WriteLine("LLSD request "+requestBody);
string resp = "";
if (firstcaps)
{
resp = "<llsd><map><key>MapLayer</key><string>http://127.0.0.1:9000/CAPS/</string></map></llsd>";
firstcaps = false;
}
return resp;
} }
protected virtual string ParseXMLRPC(string requestBody) protected virtual string ParseXMLRPC(string requestBody)
@ -204,6 +213,7 @@ namespace OpenSim.Servers
//Console.WriteLine(requestBody); //Console.WriteLine(requestBody);
string responseString = ""; string responseString = "";
Console.WriteLine("new request " + request.ContentType);
switch (request.ContentType) switch (request.ContentType)
{ {
case "text/xml": case "text/xml":
@ -217,7 +227,9 @@ namespace OpenSim.Servers
case "application/xml": case "application/xml":
// probably LLSD we hope, otherwise it should be ignored by the parser // probably LLSD we hope, otherwise it should be ignored by the parser
responseString = ParseLLSDXML(requestBody); // responseString = ParseLLSDXML(requestBody);
Console.WriteLine(" request " + request.HttpMethod + " to " + request.RawUrl);
responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
response.AddHeader("Content-type", "application/xml"); response.AddHeader("Content-type", "application/xml");
break; break;

View File

@ -11,6 +11,7 @@ using OpenSim.Region.Scenes;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Caches; using OpenSim.Caches;
using OpenGrid.Framework.Communications; using OpenGrid.Framework.Communications;
using OpenSim.Servers;
namespace SimpleApp namespace SimpleApp
{ {
@ -19,8 +20,8 @@ namespace SimpleApp
private RegionInfo m_regionInfo; private RegionInfo m_regionInfo;
private List<OpenSim.Region.Scenes.ScenePresence> m_avatars; private List<OpenSim.Region.Scenes.ScenePresence> m_avatars;
public MyWorld(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach) public MyWorld(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer)
: base(clientThreads, regionInfo, authen, commsMan, assetCach) : base(clientThreads, regionInfo, authen, commsMan, assetCach, httpServer)
{ {
m_regionInfo = regionInfo; m_regionInfo = regionInfo;
m_avatars = new List<Avatar>(); m_avatars = new List<Avatar>();

View File

@ -56,15 +56,14 @@ namespace SimpleApp
CommunicationsManager communicationsManager = new CommunicationsLocal(1000, 1000); CommunicationsManager communicationsManager = new CommunicationsLocal(1000, 1000);
RegionInfo regionInfo = new RegionInfo( ); RegionInfo regionInfo = new RegionInfo( );
BaseHttpServer httpServer = new BaseHttpServer(simPort);
udpServer.LocalWorld = new MyWorld( packetServer.ClientAPIs, regionInfo, m_circuitManager, communicationsManager, assetCache ); udpServer.LocalWorld = new MyWorld( packetServer.ClientAPIs, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer );
// World world = new World(udpServer.PacketServer.ClientAPIs, regionInfo); // World world = new World(udpServer.PacketServer.ClientAPIs, regionInfo);
// PhysicsScene physicsScene = new NullPhysicsScene(); // PhysicsScene physicsScene = new NullPhysicsScene();
// world.PhysicsScene = physicsScene; // world.PhysicsScene = physicsScene;
// udpServer.LocalWorld = world; // udpServer.LocalWorld = world;
BaseHttpServer httpServer = new BaseHttpServer( simPort );
httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod ); httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod );
httpServer.Start(); httpServer.Start();

View File

@ -144,7 +144,7 @@ namespace OpenSim.LocalCommunications
/// <param name="regionHandle"></param> /// <param name="regionHandle"></param>
/// <param name="agentData"></param> /// <param name="agentData"></param>
/// <returns></returns> /// <returns></returns>
public bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData
{ {
//Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
if (this.regionHosts.ContainsKey(regionHandle)) if (this.regionHosts.ContainsKey(regionHandle))

View File

@ -91,7 +91,7 @@ namespace OpenSim.LocalCommunications
response.SimPort = (Int32)reg.IPListenPort; response.SimPort = (Int32)reg.IPListenPort;
response.RegionX = reg.RegionLocX ; response.RegionX = reg.RegionLocX ;
response.RegionY = reg.RegionLocY ; response.RegionY = reg.RegionLocY ;
response.SeedCapability = "http://" + reg.IPListenAddr + ":" + "9000" + "/CAPS/00334-0000/";
theUser.currentAgent.currentRegion = reg.SimUUID; theUser.currentAgent.currentRegion = reg.SimUUID;
theUser.currentAgent.currentHandle = reg.RegionHandle; theUser.currentAgent.currentHandle = reg.RegionHandle;

View File

@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Servers;
using libsecondlife;
namespace OpenSim.Region
{
public class Caps
{
private string httpListenerAddress;
private uint httpListenPort;
private string MainPath = "00334-0000/";
private string MapLayerPath = "00334-0001/";
private BaseHttpServer httpListener;
public Caps(BaseHttpServer httpServer, string httpListen, uint httpPort)
{
httpListener = httpServer;
httpListenerAddress = httpListen;
httpListenPort = httpPort;
}
/// <summary>
///
/// </summary>
public void RegisterHandlers()
{
Console.WriteLine("registering caps handlers");
httpListener.AddRestHandler("POST", "/CAPS/" + MainPath, CapsRequest);
httpListener.AddRestHandler("POST", "/CAPS/" + MapLayerPath, MapLayer);
}
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="path"></param>
/// <param name="param"></param>
/// <returns></returns>
public string CapsRequest(string request, string path, string param)
{
Console.WriteLine("Caps request " + request);
string result = "<llsd><map>";
result += this.GetCapabilities();
result += "</map></llsd>";
return result;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
protected string GetCapabilities()
{
string capURLS = "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + MapLayerPath + "</string>";
return capURLS;
}
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="path"></param>
/// <param name="param"></param>
/// <returns></returns>
public string MapLayer(string request, string path, string param)
{
Console.WriteLine("Caps MapLayer request " + request);
string res = "<llsd><map><key>AgentData</key><map><key>Flags</key><integer>0</integer></map><key>LayerData</key><array>";
res += this.BuildLLSDMapLayerResponse();
res += "</array></map></llsd>";
return res;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
protected string BuildLLSDMapLayerResponse()
{
int left;
int right;
int top;
int bottom;
LLUUID image = null;
left = 500;
bottom = 500;
top = 1500;
right = 1500;
image = new LLUUID("00000000-0000-0000-9999-000000000006");
string res= "<map><key>Left</key><integer>"+left+"</integer><key>Bottom</key><integer>"+bottom +"</integer><key>Top</key><integer>"+top+"</integer><key>Right</key><integer>"+right+"</integer><key>ImageID</key><uuid>"+image.ToStringHyphenated()+"</uuid></map>";
return res;
}
}
}

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> <PropertyGroup>
<ProjectType>Local</ProjectType> <ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>8.0.50727</ProductVersion>
@ -6,7 +6,8 @@
<ProjectGuid>{196916AF-0000-0000-0000-000000000000}</ProjectGuid> <ProjectGuid>{196916AF-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon></ApplicationIcon> <ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName> <AssemblyKeyContainerName>
</AssemblyKeyContainerName> </AssemblyKeyContainerName>
<AssemblyName>OpenSim.Region</AssemblyName> <AssemblyName>OpenSim.Region</AssemblyName>
@ -15,9 +16,11 @@
<DefaultTargetSchema>IE50</DefaultTargetSchema> <DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign> <DelaySign>false</DelaySign>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder></AppDesignerFolder> <AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim.Region</RootNamespace> <RootNamespace>OpenSim.Region</RootNamespace>
<StartupObject></StartupObject> <StartupObject>
</StartupObject>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
</PropertyGroup> </PropertyGroup>
@ -28,7 +31,8 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants> <DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile></DocumentationFile> <DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize> <Optimize>False</Optimize>
@ -37,7 +41,8 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<NoWarn></NoWarn> <NoWarn>
</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@ -46,7 +51,8 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<DocumentationFile></DocumentationFile> <DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols> <DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize> <Optimize>True</Optimize>
@ -55,7 +61,8 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<NoWarn></NoWarn> <NoWarn>
</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Axiom.MathLib.dll"> <Reference Include="Axiom.MathLib.dll">
@ -74,6 +81,7 @@
<HintPath>System.dll</HintPath> <HintPath>System.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml"> <Reference Include="System.Xml">
<HintPath>System.Xml.dll</HintPath> <HintPath>System.Xml.dll</HintPath>
<Private>False</Private> <Private>False</Private>
@ -136,6 +144,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Caps.cs" />
<Compile Include="EstateManager.cs"> <Compile Include="EstateManager.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>

View File

@ -411,7 +411,7 @@ namespace OpenSim.Region.Scenes
lPos = this.Pos; lPos = this.Pos;
} }
remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-5005-000000000005")); remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-1000-5005-000000000018"));
} }
/// <summary> /// <summary>

View File

@ -43,6 +43,8 @@ using OpenSim.Region.Scripting;
using OpenSim.Terrain; using OpenSim.Terrain;
using OpenGrid.Framework.Communications; using OpenGrid.Framework.Communications;
using OpenSim.Caches; using OpenSim.Caches;
using OpenSim.Region;
using OpenSim.Servers;
namespace OpenSim.Region.Scenes namespace OpenSim.Region.Scenes
{ {
@ -67,6 +69,8 @@ namespace OpenSim.Region.Scenes
protected RegionCommsListener regionCommsHost; protected RegionCommsListener regionCommsHost;
protected CommunicationsManager commsManager; protected CommunicationsManager commsManager;
protected Caps TestCapsHandler;
protected BaseHttpServer httpListener;
public ParcelManager parcelManager; public ParcelManager parcelManager;
public EstateManager estateManager; public EstateManager estateManager;
@ -96,7 +100,7 @@ namespace OpenSim.Region.Scenes
/// <param name="clientThreads">Dictionary to contain client threads</param> /// <param name="clientThreads">Dictionary to contain client threads</param>
/// <param name="regionHandle">Region Handle for this region</param> /// <param name="regionHandle">Region Handle for this region</param>
/// <param name="regionName">Region Name for this region</param> /// <param name="regionName">Region Name for this region</param>
public Scene(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach) public Scene(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer)
{ {
try try
{ {
@ -127,6 +131,9 @@ namespace OpenSim.Region.Scenes
Terrain = new TerrainEngine(); Terrain = new TerrainEngine();
ScenePresence.LoadAnims(); ScenePresence.LoadAnims();
this.httpListener = httpServer;
this.TestCapsHandler = new Caps(httpListener, "127.0.0.1" , 9000);
this.TestCapsHandler.RegisterHandlers();
} }
catch (Exception e) catch (Exception e)
{ {
@ -755,7 +762,7 @@ namespace OpenSim.Region.Scenes
agent.InventoryFolder = LLUUID.Zero; agent.InventoryFolder = LLUUID.Zero;
agent.startpos = new LLVector3(128, 128, 70); agent.startpos = new LLVector3(128, 128, 70);
agent.child = true; agent.child = true;
this.commsManager.InterRegion.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent); this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent);
remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort); remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort);
} }
} }
@ -816,7 +823,7 @@ namespace OpenSim.Region.Scenes
agent.InventoryFolder = LLUUID.Zero; agent.InventoryFolder = LLUUID.Zero;
agent.startpos = new LLVector3(128, 128, 70); agent.startpos = new LLVector3(128, 128, 70);
agent.child = true; agent.child = true;
this.commsManager.InterRegion.InformNeighbourOfChildAgent(regionHandle, agent); this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position);
remoteClient.SendRegionTeleport(regionHandle, 13, reg.IPListenAddr, (ushort)reg.IPListenPort, 4, (1 << 4)); remoteClient.SendRegionTeleport(regionHandle, 13, reg.IPListenAddr, (ushort)reg.IPListenPort, 4, (1 << 4));
} }

View File

@ -120,12 +120,12 @@ namespace OpenSim
this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
this.physManager.LoadPlugins(); this.physManager.LoadPlugins();
this.SetupHttpListener();
this.SetupWorld(); this.SetupWorld();
m_log.Verbose( "Main.cs:Startup() - Initialising HTTP server"); m_log.Verbose( "Main.cs:Startup() - Initialising HTTP server");
this.SetupHttpListener();
//Login server setup //Login server setup
LoginServer loginServer = null; LoginServer loginServer = null;
LoginServer adminLoginServer = null; LoginServer adminLoginServer = null;
@ -242,7 +242,7 @@ namespace OpenSim
m_log.componentname = "Region " + regionData.RegionName; m_log.componentname = "Region " + regionData.RegionName;
*/ */
LocalWorld = new Scene(udpServer.PacketServer.ClientAPIs, regionDat, authenBase, commsManager, this.AssetCache); LocalWorld = new Scene(udpServer.PacketServer.ClientAPIs, regionDat, authenBase, commsManager, this.AssetCache, httpServer);
this.m_localWorld.Add(LocalWorld); this.m_localWorld.Add(LocalWorld);
//LocalWorld.InventoryCache = InventoryCache; //LocalWorld.InventoryCache = InventoryCache;
//LocalWorld.AssetCache = AssetCache; //LocalWorld.AssetCache = AssetCache;