aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Capabilities
diff options
context:
space:
mode:
authorMW2007-07-22 11:44:36 +0000
committerMW2007-07-22 11:44:36 +0000
commit70fa30204272e874b8e3acccdc2e22cd4e42b2b2 (patch)
tree2f6c3c0f3b3bd60d5972f8dea6b3abeae4dc9065 /OpenSim/Region/Capabilities
parent* Aerobic erosion now uses Navier Stokes algorithms for wind calculations. (diff)
downloadopensim-SC_OLD-70fa30204272e874b8e3acccdc2e22cd4e42b2b2.zip
opensim-SC_OLD-70fa30204272e874b8e3acccdc2e22cd4e42b2b2.tar.gz
opensim-SC_OLD-70fa30204272e874b8e3acccdc2e22cd4e42b2b2.tar.bz2
opensim-SC_OLD-70fa30204272e874b8e3acccdc2e22cd4e42b2b2.tar.xz
* Some work in progress code: Inventory cache, start of inventory server/service, userprofile cache, inventory handling. (non of it is enabled yet (or at least it shouldn't be).
* Fixed some of the problems with crossing regions when flying: you should no longer sink to ground level when crossing (should keep roughly your right height). Should no longer sometimes get sent back to the centre of the current region when attempting to border cross. But instead sometimes you will find you avatar stop at the edge of region and you will need to start moving again to retry the crossing (which should then work). This code is partly based on Babblefrog's issue #212 patch. [I think I have some ideas of how to solve the stopping at edges problem, just want to get the inventory code done first] * Capabilities code has now been moved to the OpenSim.Framework.Communications project as some of the caps code will be tightly tied to inventory/asset handling and it was causing a two way reference problem when it was in its own project/dll. This is a Big commit as I was going to keep my inventory work local until I had it in a working state, in case it brakes anything, but its getting harder to keep in sync with svn.
Diffstat (limited to 'OpenSim/Region/Capabilities')
-rw-r--r--OpenSim/Region/Capabilities/Caps.cs330
-rw-r--r--OpenSim/Region/Capabilities/LLSDArray.cs42
-rw-r--r--OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs44
-rw-r--r--OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs21
-rw-r--r--OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs18
-rw-r--r--OpenSim/Region/Capabilities/LLSDCapEvent.cs41
-rw-r--r--OpenSim/Region/Capabilities/LLSDCapsDetails.cs17
-rw-r--r--OpenSim/Region/Capabilities/LLSDEmpty.cs38
-rw-r--r--OpenSim/Region/Capabilities/LLSDHelpers.cs164
-rw-r--r--OpenSim/Region/Capabilities/LLSDMapLayer.cs46
-rw-r--r--OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs41
-rw-r--r--OpenSim/Region/Capabilities/LLSDMapRequest.cs13
-rw-r--r--OpenSim/Region/Capabilities/LLSDMethod.cs8
-rw-r--r--OpenSim/Region/Capabilities/LLSDStreamHandler.cs42
-rw-r--r--OpenSim/Region/Capabilities/LLSDTest.cs41
-rw-r--r--OpenSim/Region/Capabilities/LLSDType.cs59
16 files changed, 0 insertions, 965 deletions
diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs
deleted file mode 100644
index 06a4bd5..0000000
--- a/OpenSim/Region/Capabilities/Caps.cs
+++ /dev/null
@@ -1,330 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using libsecondlife;
34using OpenSim.Framework.Servers;
35using OpenSim.Framework.Types;
36using OpenSim.Framework.Utilities;
37using OpenSim.Region.Caches;
38
39namespace OpenSim.Region.Capabilities
40{
41 public delegate void UpLoadedTexture(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data);
42
43 public class Caps
44 {
45 private string m_httpListenerHostName;
46 private int m_httpListenPort;
47 private string m_capsObjectPath = "00001-";
48 private string m_requestPath = "0000/";
49 private string m_mapLayerPath = "0001/";
50 private string m_newInventory = "0002/";
51 // private string m_requestTexture = "0003/";
52 //private string eventQueue = "0100/";
53 private BaseHttpServer httpListener;
54 private LLUUID agentID;
55 private AssetCache assetCache;
56 private int eventQueueCount = 1;
57 private Queue<string> CapsEventQueue = new Queue<string>();
58
59 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent)
60 {
61 assetCache = assetCach;
62 m_capsObjectPath = capsPath;
63 httpListener = httpServer;
64 m_httpListenerHostName = httpListen;
65 m_httpListenPort = httpPort;
66 agentID = agent;
67 }
68
69 /// <summary>
70 ///
71 /// </summary>
72 public void RegisterHandlers()
73 {
74 Console.WriteLine("registering CAPS handlers");
75 string capsBase = "/CAPS/" + m_capsObjectPath;
76
77 httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer ));
78 httpListener.AddStreamHandler( new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest));
79
80 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest);
81 }
82
83 [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")]
84 private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod)
85 {
86 string capsBase = "/CAPS/" + m_capsObjectPath;
87 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod));
88 }
89
90 /// <summary>
91 ///
92 /// </summary>
93 /// <param name="request"></param>
94 /// <param name="path"></param>
95 /// <param name="param"></param>
96 /// <returns></returns>
97 public string CapsRequest(string request, string path, string param)
98 {
99 // Console.WriteLine("caps request " + request);
100 string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities());
101 return result;
102 }
103
104 /// <summary>
105 ///
106 /// </summary>
107 /// <returns></returns>
108 protected LLSDCapsDetails GetCapabilities()
109 {
110 LLSDCapsDetails caps = new LLSDCapsDetails();
111 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath;
112 caps.MapLayer = capsBaseUrl + m_mapLayerPath;
113 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory;
114 //caps.RequestTextureDownload = capsBaseUrl + m_requestTexture;
115 // caps.ChatSessionRequest = capsBaseUrl + m_requestTexture;
116 return caps;
117 }
118
119 /// <summary>
120 ///
121 /// </summary>
122 /// <param name="mapReq"></param>
123 /// <returns></returns>
124 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
125 {
126 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
127 mapResponse.LayerData.Array.Add(this.GetLLSDMapLayerResponse());
128 return mapResponse;
129 }
130
131 /// <summary>
132 ///
133 /// </summary>
134 /// <returns></returns>
135 protected LLSDMapLayer GetLLSDMapLayerResponse()
136 {
137 LLSDMapLayer mapLayer = new LLSDMapLayer();
138 mapLayer.Right = 5000;
139 mapLayer.Top = 5000;
140 mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006");
141 return mapLayer;
142 }
143
144 /// <summary>
145 ///
146 /// </summary>
147 /// <param name="request"></param>
148 /// <param name="path"></param>
149 /// <param name="param"></param>
150 /// <returns></returns>
151 public string RequestTexture(string request, string path, string param)
152 {
153 Console.WriteLine("texture request " + request);
154 // Needs implementing (added to remove compiler warning)
155 return "";
156 }
157
158 #region EventQueue (Currently not enabled)
159 /// <summary>
160 ///
161 /// </summary>
162 /// <param name="request"></param>
163 /// <param name="path"></param>
164 /// <param name="param"></param>
165 /// <returns></returns>
166 public string ProcessEventQueue(string request, string path, string param)
167 {
168 string res = "";
169
170 if (this.CapsEventQueue.Count > 0)
171 {
172 lock (this.CapsEventQueue)
173 {
174 string item = CapsEventQueue.Dequeue();
175 res = item;
176 }
177 }
178 else
179 {
180 res = this.CreateEmptyEventResponse();
181 }
182 return res;
183 }
184
185 /// <summary>
186 ///
187 /// </summary>
188 /// <param name="caps"></param>
189 /// <param name="ipAddressPort"></param>
190 /// <returns></returns>
191 public string CreateEstablishAgentComms(string caps, string ipAddressPort)
192 {
193 LLSDCapEvent eventItem = new LLSDCapEvent();
194 eventItem.id = eventQueueCount;
195 //should be creating a EstablishAgentComms item, but there isn't a class for it yet
196 eventItem.events.Array.Add(new LLSDEmpty());
197 string res = LLSDHelpers.SerialiseLLSDReply(eventItem);
198 eventQueueCount++;
199
200 this.CapsEventQueue.Enqueue(res);
201 return res;
202 }
203
204 /// <summary>
205 ///
206 /// </summary>
207 /// <returns></returns>
208 public string CreateEmptyEventResponse()
209 {
210 LLSDCapEvent eventItem = new LLSDCapEvent();
211 eventItem.id = eventQueueCount;
212 eventItem.events.Array.Add(new LLSDEmpty());
213 string res = LLSDHelpers.SerialiseLLSDReply(eventItem);
214 eventQueueCount++;
215 return res;
216 }
217 #endregion
218
219 /// <summary>
220 ///
221 /// </summary>
222 /// <param name="llsdRequest"></param>
223 /// <returns></returns>
224 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
225 {
226 // Console.WriteLine("asset upload request via CAPS");
227 string assetName = llsdRequest.name;
228 string capsBase = "/CAPS/" + m_capsObjectPath;
229 LLUUID newAsset = LLUUID.Random();
230 LLUUID newInvItem = LLUUID.Random();
231 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
232
233 AssetUploader uploader = new AssetUploader(assetName, newAsset, newInvItem, capsBase + uploaderPath, this.httpListener);
234 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
235 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath;
236
237 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
238 uploadResponse.uploader = uploaderURL;
239 uploadResponse.state = "upload";
240 uploader.OnUpLoad += this.UploadCompleteHandler;
241 return uploadResponse;
242 }
243
244 /// <summary>
245 ///
246 /// </summary>
247 /// <param name="assetID"></param>
248 /// <param name="inventoryItem"></param>
249 /// <param name="data"></param>
250 public void UploadCompleteHandler(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data)
251 {
252 AssetBase asset;
253 asset = new AssetBase();
254 asset.FullID = assetID;
255 asset.Type = 0;
256 asset.InvType = 0;
257 asset.Name = assetName;
258 asset.Data = data;
259 this.assetCache.AddAsset(asset);
260 }
261
262 public class AssetUploader
263 {
264 public event UpLoadedTexture OnUpLoad;
265
266 private string uploaderPath = "";
267 private LLUUID newAssetID;
268 private LLUUID inventoryItemID;
269 private BaseHttpServer httpListener;
270 private bool SaveImages = false;
271 private string m_assetName = "";
272
273 /// <summary>
274 ///
275 /// </summary>
276 /// <param name="assetID"></param>
277 /// <param name="inventoryItem"></param>
278 /// <param name="path"></param>
279 /// <param name="httpServer"></param>
280 public AssetUploader(string assetName, LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer)
281 {
282 m_assetName = assetName;
283 newAssetID = assetID;
284 inventoryItemID = inventoryItem;
285 uploaderPath = path;
286 httpListener = httpServer;
287 }
288
289 /// <summary>
290 ///
291 /// </summary>
292 /// <param name="data"></param>
293 /// <param name="path"></param>
294 /// <param name="param"></param>
295 /// <returns></returns>
296 public string uploaderCaps(byte[] data, string path, string param)
297 {
298 LLUUID inv = this.inventoryItemID;
299 string res = "";
300 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
301 uploadComplete.new_asset = newAssetID.ToStringHyphenated();
302 uploadComplete.new_inventory_item = inv;
303 uploadComplete.state = "complete";
304 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
305
306 httpListener.RemoveStreamHandler("POST", uploaderPath);
307
308 if(this.SaveImages)
309 this.SaveImageToFile(m_assetName + ".jp2", data);
310
311 if (OnUpLoad != null)
312 {
313 OnUpLoad(m_assetName, newAssetID, inv, data);
314 }
315
316 return res;
317 }
318
319 private void SaveImageToFile(string filename, byte[] data)
320 {
321
322 FileStream fs = File.Create(filename);
323 BinaryWriter bw = new BinaryWriter(fs);
324 bw.Write(data);
325 bw.Close();
326 fs.Close();
327 }
328 }
329 }
330}
diff --git a/OpenSim/Region/Capabilities/LLSDArray.cs b/OpenSim/Region/Capabilities/LLSDArray.cs
deleted file mode 100644
index d3e1979..0000000
--- a/OpenSim/Region/Capabilities/LLSDArray.cs
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System.Collections;
29
30namespace OpenSim.Region.Capabilities
31{
32 [LLSDType("ARRAY")]
33 public class LLSDArray
34 {
35 public ArrayList Array = new ArrayList();
36
37 public LLSDArray()
38 {
39
40 }
41 }
42}
diff --git a/OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs
deleted file mode 100644
index 5718b8f..0000000
--- a/OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using libsecondlife;
29
30namespace OpenSim.Region.Capabilities
31{
32 [LLSDType("MAP")]
33 public class LLSDAssetUploadComplete
34 {
35 public string new_asset = "";
36 public LLUUID new_inventory_item = LLUUID.Zero;
37 public string state = "";
38
39 public LLSDAssetUploadComplete()
40 {
41
42 }
43 }
44}
diff --git a/OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs
deleted file mode 100644
index 0096fb1..0000000
--- a/OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Region.Capabilities
7{
8 [LLSDMap]
9 public class LLSDAssetUploadRequest
10 {
11 public string asset_type = "";
12 public string description = "";
13 public LLUUID folder_id = LLUUID.Zero;
14 public string inventory_type = "";
15 public string name = "";
16
17 public LLSDAssetUploadRequest()
18 {
19 }
20 }
21}
diff --git a/OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs
deleted file mode 100644
index 2a2a5d1..0000000
--- a/OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs
+++ /dev/null
@@ -1,18 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Capabilities
6{
7 [LLSDMap]
8 public class LLSDAssetUploadResponse
9 {
10 public string uploader = "";
11 public string state = "";
12
13 public LLSDAssetUploadResponse()
14 {
15
16 }
17 }
18}
diff --git a/OpenSim/Region/Capabilities/LLSDCapEvent.cs b/OpenSim/Region/Capabilities/LLSDCapEvent.cs
deleted file mode 100644
index 2c2689b..0000000
--- a/OpenSim/Region/Capabilities/LLSDCapEvent.cs
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28namespace OpenSim.Region.Capabilities
29{
30 [LLSDType("MAP")]
31 public class LLSDCapEvent
32 {
33 public int id = 0;
34 public LLSDArray events = new LLSDArray();
35
36 public LLSDCapEvent()
37 {
38
39 }
40 }
41}
diff --git a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs
deleted file mode 100644
index 132b8f7..0000000
--- a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs
+++ /dev/null
@@ -1,17 +0,0 @@
1namespace OpenSim.Region.Capabilities
2{
3 [LLSDType("MAP")]
4 public class LLSDCapsDetails
5 {
6 public string MapLayer = "";
7 public string NewFileAgentInventory = "";
8 //public string EventQueueGet = "";
9 //public string RequestTextureDownload = "";
10 //public string ChatSessionRequest = "";
11
12 public LLSDCapsDetails()
13 {
14
15 }
16 }
17}
diff --git a/OpenSim/Region/Capabilities/LLSDEmpty.cs b/OpenSim/Region/Capabilities/LLSDEmpty.cs
deleted file mode 100644
index ca27c9d..0000000
--- a/OpenSim/Region/Capabilities/LLSDEmpty.cs
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28namespace OpenSim.Region.Capabilities
29{
30 [LLSDType("MAP")]
31 public class LLSDEmpty
32 {
33 public LLSDEmpty()
34 {
35
36 }
37 }
38}
diff --git a/OpenSim/Region/Capabilities/LLSDHelpers.cs b/OpenSim/Region/Capabilities/LLSDHelpers.cs
deleted file mode 100644
index efeb9b1..0000000
--- a/OpenSim/Region/Capabilities/LLSDHelpers.cs
+++ /dev/null
@@ -1,164 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections;
30using System.IO;
31using System.Reflection;
32using System.Xml;
33using libsecondlife;
34
35namespace OpenSim.Region.Capabilities
36{
37 public class LLSDHelpers
38 {
39 public static string SerialiseLLSDReply(object obj)
40 {
41 StringWriter sw = new StringWriter();
42 XmlTextWriter writer = new XmlTextWriter(sw);
43 writer.Formatting = Formatting.None;
44 writer.WriteStartElement(String.Empty, "llsd", String.Empty);
45 SerializeLLSDType(writer, obj);
46 writer.WriteEndElement();
47 writer.Close();
48 return sw.ToString();
49 }
50
51 public static void SerializeLLSDType(XmlTextWriter writer, object obj)
52 {
53 Type myType = obj.GetType();
54 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false);
55 if (llsdattributes.Length > 0)
56 {
57 switch (llsdattributes[0].ObjectType)
58 {
59 case "MAP":
60 writer.WriteStartElement(String.Empty, "map", String.Empty);
61 FieldInfo[] fields = myType.GetFields();
62 for (int i = 0; i < fields.Length; i++)
63 {
64 object fieldValue = fields[i].GetValue(obj);
65 LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false);
66 if (fieldAttributes.Length > 0)
67 {
68 writer.WriteStartElement(String.Empty, "key", String.Empty);
69 writer.WriteString(fields[i].Name);
70 writer.WriteEndElement();
71 SerializeLLSDType(writer, fieldValue);
72 }
73 else
74 {
75 writer.WriteStartElement(String.Empty, "key", String.Empty);
76 writer.WriteString(fields[i].Name);
77 writer.WriteEndElement();
78 LLSD.LLSDWriteOne(writer, fieldValue);
79 }
80 }
81 writer.WriteEndElement();
82 break;
83 case "ARRAY":
84 // LLSDArray arrayObject = obj as LLSDArray;
85 // ArrayList a = arrayObject.Array;
86 ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj);
87 if (a != null)
88 {
89 writer.WriteStartElement(String.Empty, "array", String.Empty);
90 foreach (object item in a)
91 {
92 SerializeLLSDType(writer, item);
93 }
94 writer.WriteEndElement();
95 }
96 break;
97 }
98 }
99 else
100 {
101 LLSD.LLSDWriteOne(writer, obj);
102 }
103 }
104
105 public static object DeserialiseLLSDMap(Hashtable llsd, object obj)
106 {
107 Type myType = obj.GetType();
108 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false);
109 if (llsdattributes.Length > 0)
110 {
111 switch (llsdattributes[0].ObjectType)
112 {
113 case "MAP":
114 IDictionaryEnumerator enumerator = llsd.GetEnumerator();
115 while (enumerator.MoveNext())
116 {
117 FieldInfo field = myType.GetField((string)enumerator.Key);
118 if (field != null)
119 {
120 if (enumerator.Value is Hashtable)
121 {
122 object fieldValue = field.GetValue(obj);
123 DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue);
124 }
125 else if (enumerator.Value is ArrayList)
126 {
127 object fieldValue = field.GetValue(obj);
128 fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value);
129 //TODO
130 // the LLSD map/array types in the array need to be deserialised
131 // but first we need to know the right class to deserialise them into.
132 }
133 else
134 {
135 field.SetValue(obj, enumerator.Value);
136 }
137 }
138 }
139 break;
140 }
141 }
142 return obj;
143 }
144 }
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164}
diff --git a/OpenSim/Region/Capabilities/LLSDMapLayer.cs b/OpenSim/Region/Capabilities/LLSDMapLayer.cs
deleted file mode 100644
index e0c006c..0000000
--- a/OpenSim/Region/Capabilities/LLSDMapLayer.cs
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using libsecondlife;
29
30namespace OpenSim.Region.Capabilities
31{
32 [LLSDType("MAP")]
33 public class LLSDMapLayer
34 {
35 public int Left = 0;
36 public int Right = 0;
37 public int Top = 0;
38 public int Bottom = 0;
39 public LLUUID ImageID = LLUUID.Zero;
40
41 public LLSDMapLayer()
42 {
43
44 }
45 }
46}
diff --git a/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs
deleted file mode 100644
index 8b9837b..0000000
--- a/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28namespace OpenSim.Region.Capabilities
29{
30 [LLSDType("MAP")]
31 public class LLSDMapLayerResponse
32 {
33 public LLSDMapRequest AgentData = new LLSDMapRequest();
34 public LLSDArray LayerData = new LLSDArray();
35
36 public LLSDMapLayerResponse()
37 {
38
39 }
40 }
41}
diff --git a/OpenSim/Region/Capabilities/LLSDMapRequest.cs b/OpenSim/Region/Capabilities/LLSDMapRequest.cs
deleted file mode 100644
index 8ac7943..0000000
--- a/OpenSim/Region/Capabilities/LLSDMapRequest.cs
+++ /dev/null
@@ -1,13 +0,0 @@
1namespace OpenSim.Region.Capabilities
2{
3 [LLSDType("MAP")]
4 public class LLSDMapRequest
5 {
6 public int Flags = 0;
7
8 public LLSDMapRequest()
9 {
10
11 }
12 }
13}
diff --git a/OpenSim/Region/Capabilities/LLSDMethod.cs b/OpenSim/Region/Capabilities/LLSDMethod.cs
deleted file mode 100644
index 068d539..0000000
--- a/OpenSim/Region/Capabilities/LLSDMethod.cs
+++ /dev/null
@@ -1,8 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Capabilities
6{
7 public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request);
8}
diff --git a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs b/OpenSim/Region/Capabilities/LLSDStreamHandler.cs
deleted file mode 100644
index d98e23f..0000000
--- a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs
+++ /dev/null
@@ -1,42 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Servers;
5using System.IO;
6using System.Collections;
7using libsecondlife;
8
9namespace OpenSim.Region.Capabilities
10{
11 public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler
12 where TRequest : new()
13 {
14 private LLSDMethod<TRequest, TResponse> m_method;
15
16 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
17 : base(httpMethod, path )
18 {
19 m_method = method;
20 }
21
22 public override byte[] Handle(string path, Stream request)
23 {
24 //Encoding encoding = Encoding.UTF8;
25 //StreamReader streamReader = new StreamReader(request, false);
26
27 //string requestBody = streamReader.ReadToEnd();
28 //streamReader.Close();
29
30 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request );
31 TRequest llsdRequest = new TRequest();
32 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
33
34 TResponse response = m_method(llsdRequest);
35
36 Encoding encoding = new UTF8Encoding(false);
37
38 return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) );
39
40 }
41 }
42}
diff --git a/OpenSim/Region/Capabilities/LLSDTest.cs b/OpenSim/Region/Capabilities/LLSDTest.cs
deleted file mode 100644
index 78ccf67..0000000
--- a/OpenSim/Region/Capabilities/LLSDTest.cs
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28namespace OpenSim.Region.Capabilities
29{
30 [LLSDType("MAP")]
31 public class LLSDTest
32 {
33 public int Test1 = 20;
34 public int Test2 = 10;
35
36 public LLSDTest()
37 {
38
39 }
40 }
41}
diff --git a/OpenSim/Region/Capabilities/LLSDType.cs b/OpenSim/Region/Capabilities/LLSDType.cs
deleted file mode 100644
index 04f4d9a..0000000
--- a/OpenSim/Region/Capabilities/LLSDType.cs
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29
30namespace OpenSim.Region.Capabilities
31{
32 [AttributeUsage(AttributeTargets.Class)]
33 public class LLSDType : Attribute
34 {
35 protected string myType;
36
37 public LLSDType(string type)
38 {
39 myType = type;
40
41 }
42
43 public string ObjectType
44 {
45 get
46 {
47 return myType;
48 }
49 }
50 }
51
52 [AttributeUsage(AttributeTargets.Class)]
53 public class LLSDMap : LLSDType
54 {
55 public LLSDMap() : base( "MAP" )
56 {
57 }
58 }
59}