diff --git a/Common/OpenGrid.Framework.Communications/IInterRegionCommunications.cs b/Common/OpenGrid.Framework.Communications/IInterRegionCommunications.cs index 27e6fc7bd2..4cb8a38121 100644 --- a/Common/OpenGrid.Framework.Communications/IInterRegionCommunications.cs +++ b/Common/OpenGrid.Framework.Communications/IInterRegionCommunications.cs @@ -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); } } diff --git a/Common/OpenGrid.Framework.UserManager/LoginResponse.cs b/Common/OpenGrid.Framework.UserManager/LoginResponse.cs index 1c51aeb7f2..514ebef970 100644 --- a/Common/OpenGrid.Framework.UserManager/LoginResponse.cs +++ b/Common/OpenGrid.Framework.UserManager/LoginResponse.cs @@ -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 diff --git a/Common/OpenSim.Servers/BaseHttpServer.cs b/Common/OpenSim.Servers/BaseHttpServer.cs index 3daec8d6fd..71c36a7785 100644 --- a/Common/OpenSim.Servers/BaseHttpServer.cs +++ b/Common/OpenSim.Servers/BaseHttpServer.cs @@ -66,6 +66,7 @@ namespace OpenSim.Servers protected Dictionary m_restHandlers = new Dictionary(); protected Dictionary m_rpcHandlers = new Dictionary(); 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 = "MapLayerhttp://127.0.0.1:9000/CAPS/"; + 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; diff --git a/OpenSim/Examples/SimpleApp/MyWorld.cs b/OpenSim/Examples/SimpleApp/MyWorld.cs index 334b6af17d..477d29d8be 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 944bca38f9..ffcaa52836 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 06e09f2fdc..10e6dd9b21 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 7a7f2bf739..00f514adf6 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 0000000000..c672d2927f --- /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 7ab7ed1de2..2ae7909018 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 39b3fbc39a..8192bf018a 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 ca8e5c3046..14c77c2c2d 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 3b83fd8919..66cc2ba162 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;