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 capsObjectPath = "00001-"; private string requestPath = "0000/"; private string mapLayerPath = "0001/"; private BaseHttpServer httpListener; private LLUUID agentID; public Caps(BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) { capsObjectPath = capsPath; httpListener = httpServer; httpListenerAddress = httpListen; httpListenPort = httpPort; agentID = agent; } /// /// /// public void RegisterHandlers() { Console.WriteLine("registering CAPS handlers"); httpListener.AddRestHandler("POST", "/CAPS/" +capsObjectPath+ requestPath, CapsRequest); httpListener.AddRestHandler("POST", "/CAPS/" +capsObjectPath+ 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=""; capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" +capsObjectPath+ 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; } } }