From 303ea70efad0ba703743f4a5b9812250c314c2d4 Mon Sep 17 00:00:00 2001 From: MW Date: Sat, 23 Jun 2007 11:14:58 +0000 Subject: More work on CAPS handler. --- .../LocalBackEndServices.cs | 1 + .../LocalUserServices.cs | 5 +- OpenSim/OpenSim.Region/Caps.cs | 18 ++++--- OpenSim/OpenSim.Region/OpenSim.Region.csproj | 58 ++++++++++------------ OpenSim/OpenSim.Region/OpenSim.Region.dll.build | 1 + OpenSim/OpenSim.Region/Scenes/Scene.cs | 12 +++-- 6 files changed, 51 insertions(+), 44 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs b/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs index 10e6dd9..ebf0fd1 100644 --- a/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs +++ b/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs @@ -193,6 +193,7 @@ namespace OpenSim.LocalCommunications agent.BaseFolder = loginData.BaseFolder; agent.InventoryFolder = loginData.InventoryFolder; agent.startpos = new LLVector3(128, 128, 70); + agent.CapsPath = loginData.CapsPath; if (this.regionHosts.ContainsKey(regionHandle)) { diff --git a/OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs b/OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs index 00f514a..b8c6c3b 100644 --- a/OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs +++ b/OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs @@ -86,12 +86,12 @@ namespace OpenSim.LocalCommunications 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.IPListenAddr; response.SimPort = (Int32)reg.IPListenPort; response.RegionX = reg.RegionLocX ; response.RegionY = reg.RegionLocY ; - response.SeedCapability = "http://" + reg.IPListenAddr + ":" + "9000" + "/CAPS/00334-0000/"; + response.SeedCapability = "http://" + reg.IPListenAddr + ":" + "9000" + "/CAPS/"+capsPath +"0000/"; theUser.currentAgent.currentRegion = reg.SimUUID; theUser.currentAgent.currentHandle = reg.RegionHandle; @@ -103,6 +103,7 @@ namespace OpenSim.LocalCommunications _login.Session = response.SessionID; _login.SecureSession = response.SecureSessionID; _login.CircuitCode = (uint)response.CircuitCode; + _login.CapsPath = capsPath; m_Parent.InformRegionOfLogin(currentRegion, _login); } diff --git a/OpenSim/OpenSim.Region/Caps.cs b/OpenSim/OpenSim.Region/Caps.cs index f3ee628..c86061f 100644 --- a/OpenSim/OpenSim.Region/Caps.cs +++ b/OpenSim/OpenSim.Region/Caps.cs @@ -10,16 +10,19 @@ namespace OpenSim.Region { private string httpListenerAddress; private uint httpListenPort; - private string MainPath = "00334-0000/"; - private string MapLayerPath = "00334-0001/"; + private string capsObjectPath = "00001-"; + private string requestPath = "0000/"; + private string mapLayerPath = "0001/"; private BaseHttpServer httpListener; - // private LLUUID agentID; + private LLUUID agentID; - public Caps(BaseHttpServer httpServer, string httpListen, uint httpPort) + public Caps(BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) { + capsObjectPath = capsPath; httpListener = httpServer; httpListenerAddress = httpListen; httpListenPort = httpPort; + agentID = agent; } /// @@ -28,8 +31,8 @@ namespace OpenSim.Region public void RegisterHandlers() { Console.WriteLine("registering CAPS handlers"); - httpListener.AddRestHandler("POST", "/CAPS/" + MainPath, CapsRequest); - httpListener.AddRestHandler("POST", "/CAPS/" + MapLayerPath, MapLayer); + httpListener.AddRestHandler("POST", "/CAPS/" +capsObjectPath+ requestPath, CapsRequest); + httpListener.AddRestHandler("POST", "/CAPS/" +capsObjectPath+ mapLayerPath, MapLayer); } /// @@ -41,6 +44,7 @@ namespace OpenSim.Region /// public string CapsRequest(string request, string path, string param) { + //Console.WriteLine("Caps Request " + request); string result = ""; result += this.GetCapabilities(); result += ""; @@ -55,7 +59,7 @@ namespace OpenSim.Region { string capURLS=""; - capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + MapLayerPath + ""; + capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" +capsObjectPath+ mapLayerPath + ""; return capURLS; } diff --git a/OpenSim/OpenSim.Region/OpenSim.Region.csproj b/OpenSim/OpenSim.Region/OpenSim.Region.csproj index 2ae7909..d18bf3f 100644 --- a/OpenSim/OpenSim.Region/OpenSim.Region.csproj +++ b/OpenSim/OpenSim.Region/OpenSim.Region.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,8 +6,7 @@ {196916AF-0000-0000-0000-000000000000} Debug AnyCPU - - + OpenSim.Region @@ -16,11 +15,9 @@ IE50 false Library - - + OpenSim.Region - - + @@ -31,8 +28,7 @@ TRACE;DEBUG - - + True 4096 False @@ -41,8 +37,7 @@ False False 4 - - + False @@ -51,8 +46,7 @@ TRACE - - + False 4096 True @@ -61,28 +55,26 @@ False False 4 - - + - + ..\..\bin\Axiom.MathLib.dll False - + ..\..\bin\Db4objects.Db4o.dll False - + ..\..\bin\libsecondlife.dll False - + System.dll False - - + System.Xml.dll False @@ -92,59 +84,61 @@ 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 + Code @@ -210,4 +204,4 @@ - \ No newline at end of file + diff --git a/OpenSim/OpenSim.Region/OpenSim.Region.dll.build b/OpenSim/OpenSim.Region/OpenSim.Region.dll.build index 4a8ca9e..2e1014f 100644 --- a/OpenSim/OpenSim.Region/OpenSim.Region.dll.build +++ b/OpenSim/OpenSim.Region/OpenSim.Region.dll.build @@ -11,6 +11,7 @@ + diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs index 14c77c2..07f1d70 100644 --- a/OpenSim/OpenSim.Region/Scenes/Scene.cs +++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs @@ -69,7 +69,7 @@ namespace OpenSim.Region.Scenes protected RegionCommsListener regionCommsHost; protected CommunicationsManager commsManager; - protected Caps TestCapsHandler; + protected List capsHandlers = new List(); protected BaseHttpServer httpListener; public ParcelManager parcelManager; @@ -132,8 +132,7 @@ namespace OpenSim.Region.Scenes ScenePresence.LoadAnims(); this.httpListener = httpServer; - this.TestCapsHandler = new Caps(httpListener, "127.0.0.1" , 9000); - this.TestCapsHandler.RegisterHandlers(); + } catch (Exception e) { @@ -728,6 +727,13 @@ namespace OpenSim.Region.Scenes //should just check that its meant for this region if (regionHandle == this.m_regInfo.RegionHandle) { + if (agent.CapsPath != "") + { + //Console.WriteLine("new user, so creating caps handler for it"); + Caps cap = new Caps(httpListener, this.m_regInfo.IPListenAddr, 9000, agent.CapsPath, agent.AgentID); + cap.RegisterHandlers(); + this.capsHandlers.Add(cap); + } this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent); } } -- cgit v1.1