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/Examples/SimpleApp/MyWorld.cs | 5 +- OpenSim/Examples/SimpleApp/Program.cs | 5 +- .../LocalBackEndServices.cs | 2 +- .../LocalUserServices.cs | 2 +- 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 ++- OpenSim/OpenSim/OpenSimMain.cs | 6 +- 9 files changed, 151 insertions(+), 37 deletions(-) create mode 100644 OpenSim/OpenSim.Region/Caps.cs (limited to 'OpenSim') diff --git a/OpenSim/Examples/SimpleApp/MyWorld.cs b/OpenSim/Examples/SimpleApp/MyWorld.cs index 334b6af..477d29d 100644 --- a/OpenSim/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Examples/SimpleApp/MyWorld.cs @@ -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 m_avatars; - public MyWorld(Dictionary clientThreads, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach) - : base(clientThreads, regionInfo, authen, commsMan, assetCach) + public MyWorld(Dictionary 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(); diff --git a/OpenSim/Examples/SimpleApp/Program.cs b/OpenSim/Examples/SimpleApp/Program.cs index 944bca3..ffcaa52 100644 --- a/OpenSim/Examples/SimpleApp/Program.cs +++ b/OpenSim/Examples/SimpleApp/Program.cs @@ -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(); diff --git a/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs b/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs index 06e09f2..10e6dd9 100644 --- a/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs +++ b/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs @@ -144,7 +144,7 @@ namespace OpenSim.LocalCommunications /// /// /// - 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)) diff --git a/OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs b/OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs index 7a7f2bf..00f514a 100644 --- a/OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs +++ b/OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs @@ -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; 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)); } diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index 3b83fd8..66cc2ba 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs @@ -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; -- cgit v1.1