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; // private LLUUID agentID; 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) { string result = ""; result += this.GetCapabilities(); result += ""; return result; } /// /// /// /// protected string GetCapabilities() { string capURLS=""; capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + MapLayerPath + ""; return capURLS; } /// /// /// /// /// /// /// public string MapLayer(string request, string path, string param) { string res = "AgentDataFlags0LayerData"; res += this.BuildLLSDMapLayerResponse(); res += ""; return res; } /// /// /// /// protected string BuildLLSDMapLayerResponse() { string res = ""; 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"); res += "Left" + left + "Bottom" + bottom + "Top" + top + "Right" + right + "ImageID" + image.ToStringHyphenated() + ""; return res; } } }