aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region/Caps.cs
diff options
context:
space:
mode:
authorMW2007-06-22 22:21:08 +0000
committerMW2007-06-22 22:21:08 +0000
commitd7121a422a334f20e96d09251cf7382164b590db (patch)
tree64ebfea926bc57569963bd1a8adc16e71c942ab1 /OpenSim/OpenSim.Region/Caps.cs
parentImported Share folder from trunk (diff)
downloadopensim-SC-d7121a422a334f20e96d09251cf7382164b590db.zip
opensim-SC-d7121a422a334f20e96d09251cf7382164b590db.tar.gz
opensim-SC-d7121a422a334f20e96d09251cf7382164b590db.tar.bz2
opensim-SC-d7121a422a334f20e96d09251cf7382164b590db.tar.xz
Started work on CAPS support, now we have our first test capability, MapLayer requests are handled by CAPS.
Diffstat (limited to '')
-rw-r--r--OpenSim/OpenSim.Region/Caps.cs98
1 files changed, 98 insertions, 0 deletions
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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Servers;
5using libsecondlife;
6
7namespace OpenSim.Region
8{
9 public class Caps
10 {
11 private string httpListenerAddress;
12 private uint httpListenPort;
13 private string MainPath = "00334-0000/";
14 private string MapLayerPath = "00334-0001/";
15 private BaseHttpServer httpListener;
16
17 public Caps(BaseHttpServer httpServer, string httpListen, uint httpPort)
18 {
19 httpListener = httpServer;
20 httpListenerAddress = httpListen;
21 httpListenPort = httpPort;
22 }
23
24 /// <summary>
25 ///
26 /// </summary>
27 public void RegisterHandlers()
28 {
29 Console.WriteLine("registering caps handlers");
30 httpListener.AddRestHandler("POST", "/CAPS/" + MainPath, CapsRequest);
31 httpListener.AddRestHandler("POST", "/CAPS/" + MapLayerPath, MapLayer);
32 }
33
34 /// <summary>
35 ///
36 /// </summary>
37 /// <param name="request"></param>
38 /// <param name="path"></param>
39 /// <param name="param"></param>
40 /// <returns></returns>
41 public string CapsRequest(string request, string path, string param)
42 {
43 Console.WriteLine("Caps request " + request);
44 string result = "<llsd><map>";
45 result += this.GetCapabilities();
46 result += "</map></llsd>";
47 return result;
48 }
49
50 /// <summary>
51 ///
52 /// </summary>
53 /// <returns></returns>
54 protected string GetCapabilities()
55 {
56 string capURLS = "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + MapLayerPath + "</string>";
57 return capURLS;
58 }
59
60 /// <summary>
61 ///
62 /// </summary>
63 /// <param name="request"></param>
64 /// <param name="path"></param>
65 /// <param name="param"></param>
66 /// <returns></returns>
67 public string MapLayer(string request, string path, string param)
68 {
69 Console.WriteLine("Caps MapLayer request " + request);
70 string res = "<llsd><map><key>AgentData</key><map><key>Flags</key><integer>0</integer></map><key>LayerData</key><array>";
71 res += this.BuildLLSDMapLayerResponse();
72 res += "</array></map></llsd>";
73 return res;
74 }
75
76 /// <summary>
77 ///
78 /// </summary>
79 /// <returns></returns>
80 protected string BuildLLSDMapLayerResponse()
81 {
82 int left;
83 int right;
84 int top;
85 int bottom;
86 LLUUID image = null;
87
88 left = 500;
89 bottom = 500;
90 top = 1500;
91 right = 1500;
92 image = new LLUUID("00000000-0000-0000-9999-000000000006");
93
94 string res= "<map><key>Left</key><integer>"+left+"</integer><key>Bottom</key><integer>"+bottom +"</integer><key>Top</key><integer>"+top+"</integer><key>Right</key><integer>"+right+"</integer><key>ImageID</key><uuid>"+image.ToStringHyphenated()+"</uuid></map>";
95 return res;
96 }
97 }
98}