From d7121a422a334f20e96d09251cf7382164b590db Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 22 Jun 2007 22:21:08 +0000 Subject: Started work on CAPS support, now we have our first test capability, MapLayer requests are handled by CAPS. --- OpenSim/OpenSim.Region/Caps.cs | 98 ++++++++++++++++++++++++++++ OpenSim/OpenSim.Region/OpenSim.Region.csproj | 55 +++++++++------- OpenSim/OpenSim.Region/Scenes/Primitive.cs | 2 +- OpenSim/OpenSim.Region/Scenes/Scene.cs | 13 +++- 4 files changed, 141 insertions(+), 27 deletions(-) create mode 100644 OpenSim/OpenSim.Region/Caps.cs (limited to 'OpenSim/OpenSim.Region') diff --git a/OpenSim/OpenSim.Region/Caps.cs b/OpenSim/OpenSim.Region/Caps.cs new file mode 100644 index 0000000..c672d29 --- /dev/null +++ b/OpenSim/OpenSim.Region/Caps.cs @@ -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; + } + + /// + /// + /// + public void RegisterHandlers() + { + Console.WriteLine("registering caps handlers"); + httpListener.AddRestHandler("POST", "/CAPS/" + MainPath, CapsRequest); + httpListener.AddRestHandler("POST", "/CAPS/" + MapLayerPath, MapLayer); + } + + /// + /// + /// + /// + /// + /// + /// + public string CapsRequest(string request, string path, string param) + { + Console.WriteLine("Caps request " + request); + string result = ""; + result += this.GetCapabilities(); + result += ""; + return result; + } + + /// + /// + /// + /// + protected string GetCapabilities() + { + string capURLS = "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + MapLayerPath + ""; + return capURLS; + } + + /// + /// + /// + /// + /// + /// + /// + public string MapLayer(string request, string path, string param) + { + Console.WriteLine("Caps MapLayer request " + request); + string res = "AgentDataFlags0LayerData"; + res += this.BuildLLSDMapLayerResponse(); + res += ""; + return res; + } + + /// + /// + /// + /// + 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= "Left"+left+"Bottom"+bottom +"Top"+top+"Right"+right+"ImageID"+image.ToStringHyphenated()+""; + return res; + } + } +} diff --git a/OpenSim/OpenSim.Region/OpenSim.Region.csproj b/OpenSim/OpenSim.Region/OpenSim.Region.csproj index 7ab7ed1..2ae7909 100644 --- a/OpenSim/OpenSim.Region/OpenSim.Region.csproj +++ b/OpenSim/OpenSim.Region/OpenSim.Region.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {196916AF-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim.Region @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.Region - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,26 +61,28 @@ False False 4 - + + - + ..\..\bin\Axiom.MathLib.dll False - + ..\..\bin\Db4objects.Db4o.dll False - + ..\..\bin\libsecondlife.dll False - + System.dll False - + + System.Xml.dll False @@ -84,58 +92,59 @@ OpenGrid.Framework.Communications {683344D5-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Caches {1938EB12-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.GenericConfig.Xml {E88EF749-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Physics.Manager {8BE16150-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Servers {8BB20F0A-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Terrain.BasicTerrain {2270B8FE-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False XMLRPC {8E81D43C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False + Code @@ -201,4 +210,4 @@ - + \ No newline at end of file diff --git a/OpenSim/OpenSim.Region/Scenes/Primitive.cs b/OpenSim/OpenSim.Region/Scenes/Primitive.cs index 39b3fbc..8192bf0 100644 --- a/OpenSim/OpenSim.Region/Scenes/Primitive.cs +++ b/OpenSim/OpenSim.Region/Scenes/Primitive.cs @@ -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")); } /// diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs index ca8e5c3..14c77c2 100644 --- a/OpenSim/OpenSim.Region/Scenes/Scene.cs +++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs @@ -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 /// Dictionary to contain client threads /// Region Handle for this region /// Region Name for this region - public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach) + public Scene(Dictionary 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)); } -- cgit v1.1