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
{
bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
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 sessionID;
private LLUUID secureSessionID;
private LLUUID baseFolderID;
private LLUUID inventoryFolderID;
// Login Flags
private string dst;
@ -107,8 +105,6 @@ namespace OpenGrid.Framework.UserManagement
public void SetDefaultValues()
{
try
{
this.DST = "N";
this.StipendSinceLogin = "N";
this.Gendered = "Y";
@ -153,14 +149,7 @@ namespace OpenGrid.Framework.UserManagement
InitialOutfitHash["folder_name"] = "Nightclub Female";
InitialOutfitHash["gender"] = "female";
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

View File

@ -66,6 +66,7 @@ namespace OpenSim.Servers
protected Dictionary<string, RestMethodEntry> m_restHandlers = new Dictionary<string, RestMethodEntry>();
protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
protected int m_port;
protected bool firstcaps = true;
public BaseHttpServer(int port)
{
@ -74,6 +75,7 @@ namespace OpenSim.Servers
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);
if (!this.m_restHandlers.ContainsKey(methodKey))
@ -158,7 +160,14 @@ namespace OpenSim.Servers
protected virtual string ParseLLSDXML(string requestBody)
{
// 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)
@ -204,6 +213,7 @@ namespace OpenSim.Servers
//Console.WriteLine(requestBody);
string responseString = "";
Console.WriteLine("new request " + request.ContentType);
switch (request.ContentType)
{
case "text/xml":
@ -217,7 +227,9 @@ namespace OpenSim.Servers
case "application/xml":
// 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");
break;

View File

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

View File

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

View File

@ -144,7 +144,7 @@ namespace OpenSim.LocalCommunications
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <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");
if (this.regionHosts.ContainsKey(regionHandle))

View File

@ -91,7 +91,7 @@ namespace OpenSim.LocalCommunications
response.SimPort = (Int32)reg.IPListenPort;
response.RegionX = reg.RegionLocX ;
response.RegionY = reg.RegionLocY ;
response.SeedCapability = "http://" + reg.IPListenAddr + ":" + "9000" + "/CAPS/00334-0000/";
theUser.currentAgent.currentRegion = reg.SimUUID;
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>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
@ -6,7 +6,8 @@
<ProjectGuid>{196916AF-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon></ApplicationIcon>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>OpenSim.Region</AssemblyName>
@ -15,9 +16,11 @@
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<AppDesignerFolder></AppDesignerFolder>
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim.Region</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="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>
<Reference Include="libsecondlife.dll" >
<Reference Include="libsecondlife.dll">
<HintPath>..\..\bin\libsecondlife.dll</HintPath>
<Private>False</Private>
</Reference>
<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>
@ -84,58 +92,59 @@
<Name>OpenGrid.Framework.Communications</Name>
<Project>{683344D5-0000-0000-0000-000000000000}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\OpenSim.Caches\OpenSim.Caches.csproj">
<Name>OpenSim.Caches</Name>
<Project>{1938EB12-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="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj">
<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\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>
<Compile Include="Caps.cs" />
<Compile Include="EstateManager.cs">
<SubType>Code</SubType>
</Compile>
@ -201,4 +210,4 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>

View File

@ -411,7 +411,7 @@ namespace OpenSim.Region.Scenes
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>

View File

@ -43,6 +43,8 @@ using OpenSim.Region.Scripting;
using OpenSim.Terrain;
using OpenGrid.Framework.Communications;
using OpenSim.Caches;
using OpenSim.Region;
using OpenSim.Servers;
namespace OpenSim.Region.Scenes
{
@ -67,6 +69,8 @@ namespace OpenSim.Region.Scenes
protected RegionCommsListener regionCommsHost;
protected CommunicationsManager commsManager;
protected Caps TestCapsHandler;
protected BaseHttpServer httpListener;
public ParcelManager parcelManager;
public EstateManager estateManager;
@ -96,7 +100,7 @@ namespace OpenSim.Region.Scenes
/// <param name="clientThreads">Dictionary to contain client threads</param>
/// <param name="regionHandle">Region Handle 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
{
@ -127,6 +131,9 @@ namespace OpenSim.Region.Scenes
Terrain = new TerrainEngine();
ScenePresence.LoadAnims();
this.httpListener = httpServer;
this.TestCapsHandler = new Caps(httpListener, "127.0.0.1" , 9000);
this.TestCapsHandler.RegisterHandlers();
}
catch (Exception e)
{
@ -755,7 +762,7 @@ namespace OpenSim.Region.Scenes
agent.InventoryFolder = LLUUID.Zero;
agent.startpos = new LLVector3(128, 128, 70);
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);
}
}
@ -816,7 +823,7 @@ namespace OpenSim.Region.Scenes
agent.InventoryFolder = LLUUID.Zero;
agent.startpos = new LLVector3(128, 128, 70);
agent.child = true;
this.commsManager.InterRegion.InformNeighbourOfChildAgent(regionHandle, agent);
this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position);
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.LoadPlugins();
this.SetupHttpListener();
this.SetupWorld();
m_log.Verbose( "Main.cs:Startup() - Initialising HTTP server");
this.SetupHttpListener();
//Login server setup
LoginServer loginServer = null;
LoginServer adminLoginServer = null;
@ -242,7 +242,7 @@ namespace OpenSim
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);
//LocalWorld.InventoryCache = InventoryCache;
//LocalWorld.AssetCache = AssetCache;