aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-06-25 19:23:40 +0000
committerMW2007-06-25 19:23:40 +0000
commit9a5ec2b84c1eef98363eed95394fe43b4b39d467 (patch)
treeff8fbebf26b6b8e27d9229a8b01675d7dea114ce
parentSome work in progress LLSD serialise / de-serialise functions. (diff)
downloadopensim-SC-9a5ec2b84c1eef98363eed95394fe43b4b39d467.zip
opensim-SC-9a5ec2b84c1eef98363eed95394fe43b4b39d467.tar.gz
opensim-SC-9a5ec2b84c1eef98363eed95394fe43b4b39d467.tar.bz2
opensim-SC-9a5ec2b84c1eef98363eed95394fe43b4b39d467.tar.xz
Some Caps/LLSD cleaning up.
-rw-r--r--Common/OpenSim.Framework/LLSDHelpers.cs36
-rw-r--r--Common/OpenSim.Servers/BaseHttpServer.cs2
-rw-r--r--OpenSim/OpenSim.Region/Caps.cs54
3 files changed, 56 insertions, 36 deletions
diff --git a/Common/OpenSim.Framework/LLSDHelpers.cs b/Common/OpenSim.Framework/LLSDHelpers.cs
index 5b73483..3b044a3 100644
--- a/Common/OpenSim.Framework/LLSDHelpers.cs
+++ b/Common/OpenSim.Framework/LLSDHelpers.cs
@@ -100,6 +100,31 @@ namespace OpenSim.Framework
100 } 100 }
101 101
102 [LLSDType("MAP")] 102 [LLSDType("MAP")]
103 public class LLSDMapLayerResponse
104 {
105 public LLSDMapRequest AgentData = new LLSDMapRequest();
106 public LLSDArray LayerData = new LLSDArray();
107
108 public LLSDMapLayerResponse()
109 {
110
111 }
112 }
113
114 [LLSDType("MAP")]
115 public class LLSDCapsDetails
116 {
117 public string MapLayer = "";
118 public string NewFileAgentInventory = "";
119 //public string EventQueueGet = "";
120
121 public LLSDCapsDetails()
122 {
123
124 }
125 }
126
127 [LLSDType("MAP")]
103 public class LLSDMapLayer 128 public class LLSDMapLayer
104 { 129 {
105 public int Left = 0; 130 public int Left = 0;
@@ -108,10 +133,9 @@ namespace OpenSim.Framework
108 public int Bottom = 0; 133 public int Bottom = 0;
109 public LLUUID ImageID = LLUUID.Zero; 134 public LLUUID ImageID = LLUUID.Zero;
110 135
111 public LLSDArray TestArray = new LLSDArray();
112 public LLSDMapLayer() 136 public LLSDMapLayer()
113 { 137 {
114 138
115 } 139 }
116 } 140 }
117 141
@@ -137,6 +161,7 @@ namespace OpenSim.Framework
137 } 161 }
138 } 162 }
139 163
164
140 [LLSDType("MAP")] 165 [LLSDType("MAP")]
141 public class LLSDTest 166 public class LLSDTest
142 { 167 {
@@ -153,12 +178,11 @@ namespace OpenSim.Framework
153 [AttributeUsage(AttributeTargets.Class)] 178 [AttributeUsage(AttributeTargets.Class)]
154 public class LLSDType : Attribute 179 public class LLSDType : Attribute
155 { 180 {
156 private string myHandler; 181 private string myType;
157
158 182
159 public LLSDType(string type) 183 public LLSDType(string type)
160 { 184 {
161 myHandler = type; 185 myType = type;
162 186
163 } 187 }
164 188
@@ -166,7 +190,7 @@ namespace OpenSim.Framework
166 { 190 {
167 get 191 get
168 { 192 {
169 return myHandler; 193 return myType;
170 } 194 }
171 } 195 }
172 } 196 }
diff --git a/Common/OpenSim.Servers/BaseHttpServer.cs b/Common/OpenSim.Servers/BaseHttpServer.cs
index 86339c1..e55e33c 100644
--- a/Common/OpenSim.Servers/BaseHttpServer.cs
+++ b/Common/OpenSim.Servers/BaseHttpServer.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Servers
75 75
76 public bool AddRestHandler(string method, string path, RestMethod handler) 76 public bool AddRestHandler(string method, string path, RestMethod handler)
77 { 77 {
78 Console.WriteLine("adding new REST handler for path " + path); 78 //Console.WriteLine("adding new REST handler for path " + path);
79 string methodKey = String.Format("{0}: {1}", method, path); 79 string methodKey = String.Format("{0}: {1}", method, path);
80 80
81 if (!this.m_restHandlers.ContainsKey(methodKey)) 81 if (!this.m_restHandlers.ContainsKey(methodKey))
diff --git a/OpenSim/OpenSim.Region/Caps.cs b/OpenSim/OpenSim.Region/Caps.cs
index 319e027..27d4828 100644
--- a/OpenSim/OpenSim.Region/Caps.cs
+++ b/OpenSim/OpenSim.Region/Caps.cs
@@ -63,10 +63,9 @@ namespace OpenSim.Region
63 /// <returns></returns> 63 /// <returns></returns>
64 public string CapsRequest(string request, string path, string param) 64 public string CapsRequest(string request, string path, string param)
65 { 65 {
66 Console.WriteLine("Caps Request " + request); 66 // Console.WriteLine("Caps Request " + request);
67 string result = "<llsd><map>"; 67 string result = "";
68 result += this.GetCapabilities(); 68 result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities());
69 result += "</map></llsd>";
70 return result; 69 return result;
71 } 70 }
72 71
@@ -74,15 +73,19 @@ namespace OpenSim.Region
74 /// 73 ///
75 /// </summary> 74 /// </summary>
76 /// <returns></returns> 75 /// <returns></returns>
77 protected string GetCapabilities() 76 protected LLSDCapsDetails GetCapabilities()
78 { 77 {
79 string capURLS = ""; 78 /* string capURLS = "";
80
81 capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + "</string>"; 79 capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + "</string>";
82 capURLS += "<key>NewFileAgentInventory</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + "</string>"; 80 capURLS += "<key>NewFileAgentInventory</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + "</string>";
83 //capURLS += "<key>RequestTextureDownload</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + "</string>"; 81 //capURLS += "<key>RequestTextureDownload</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + "</string>";
84 //capURLS += "<key>EventQueueGet</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + "</string>"; 82 //capURLS += "<key>EventQueueGet</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + "</string>";
85 return capURLS; 83 return capURLS;*/
84
85 LLSDCapsDetails caps = new LLSDCapsDetails();
86 caps.MapLayer = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath;
87 caps.NewFileAgentInventory = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory;
88 return caps;
86 } 89 }
87 90
88 /// <summary> 91 /// <summary>
@@ -99,9 +102,12 @@ namespace OpenSim.Region
99 LLSDMapRequest mapReq = new LLSDMapRequest(); 102 LLSDMapRequest mapReq = new LLSDMapRequest();
100 LLSDHelpers.DeserialiseLLSDMap(hash, mapReq ); 103 LLSDHelpers.DeserialiseLLSDMap(hash, mapReq );
101 104
102 string res = "<llsd><map><key>AgentData</key><map><key>Flags</key><integer>0</integer></map><key>LayerData</key><array>"; 105 LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse();
103 res += this.BuildLLSDMapLayerResponse(); 106 mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse());
104 res += "</array></map></llsd>"; 107 string res = LLSDHelpers.SerialiseLLSDReply(mapResponse);
108
109 //Console.WriteLine(" Maplayer response is " + res);
110
105 return res; 111 return res;
106 } 112 }
107 113
@@ -109,24 +115,14 @@ namespace OpenSim.Region
109 /// 115 ///
110 /// </summary> 116 /// </summary>
111 /// <returns></returns> 117 /// <returns></returns>
112 protected string BuildLLSDMapLayerResponse() 118 protected LLSDMapLayer BuildLLSDMapLayerResponse()
113 { 119 {
114 string res = ""; 120 LLSDMapLayer mapLayer = new LLSDMapLayer();
115 int left; 121 mapLayer.Right = 5000;
116 int right; 122 mapLayer.Top = 5000;
117 int top; 123 mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006");
118 int bottom;
119 LLUUID image = null;
120 124
121 left = 0; 125 return mapLayer;
122 bottom = 0;
123 top = 5000;
124 right = 5000;
125 image = new LLUUID("00000000-0000-0000-9999-000000000006");
126
127 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>";
128
129 return res;
130 } 126 }
131 127
132 public string ProcessEventQueue(string request, string path, string param) 128 public string ProcessEventQueue(string request, string path, string param)
@@ -191,7 +187,7 @@ namespace OpenSim.Region
191 AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); 187 AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener);
192 httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); 188 httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps);
193 string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; 189 string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath;
194 Console.WriteLine("uploader url is " + uploaderURL); 190 //Console.WriteLine("uploader url is " + uploaderURL);
195 res += "<llsd><map>"; 191 res += "<llsd><map>";
196 res += "<key>uploader</key><string>" + uploaderURL + "</string>"; 192 res += "<key>uploader</key><string>" + uploaderURL + "</string>";
197 //res += "<key>success</key><boolean>true</boolean>"; 193 //res += "<key>success</key><boolean>true</boolean>";
@@ -244,7 +240,7 @@ namespace OpenSim.Region
244 res += "<key>state</key><string>complete</string>"; 240 res += "<key>state</key><string>complete</string>";
245 res += "</map></llsd>"; 241 res += "</map></llsd>";
246 242
247 Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); 243 // Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated());
248 httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath); 244 httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath);
249 if (OnUpLoad != null) 245 if (OnUpLoad != null)
250 { 246 {