diff options
author | diva | 2009-06-18 00:48:39 +0000 |
---|---|---|
committer | diva | 2009-06-18 00:48:39 +0000 |
commit | 913bc3bdb380cebebd11b657966486448962ab47 (patch) | |
tree | f41837093cd692b9fe42a21c9cb1473ef81dd0f1 /OpenSim/Framework/Communications | |
parent | Fix an uninitialized data block. Thanks, jhurliman (diff) | |
download | opensim-SC-913bc3bdb380cebebd11b657966486448962ab47.zip opensim-SC-913bc3bdb380cebebd11b657966486448962ab47.tar.gz opensim-SC-913bc3bdb380cebebd11b657966486448962ab47.tar.bz2 opensim-SC-913bc3bdb380cebebd11b657966486448962ab47.tar.xz |
Moved OpenSim/Framework/Communications/Capabilities up to OpenSim/Framework/Capabilities. Didn't change the namespace because VC# is not helping, and this would imply manually changing more than 50 files. So the namespace is still OpenSim.Framework.Communications.Capabilities, to be cleaned up later by someone with more energy.
Diffstat (limited to 'OpenSim/Framework/Communications')
26 files changed, 0 insertions, 3286 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs deleted file mode 100644 index 8c14e1d..0000000 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ /dev/null | |||
@@ -1,1212 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework.Servers; | ||
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | |||
39 | // using OpenSim.Region.Framework.Interfaces; | ||
40 | |||
41 | namespace OpenSim.Framework.Communications.Capabilities | ||
42 | { | ||
43 | public delegate void UpLoadedAsset( | ||
44 | string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, | ||
45 | byte[] data, string inventoryType, string assetType); | ||
46 | |||
47 | public delegate UUID UpdateItem(UUID itemID, byte[] data); | ||
48 | |||
49 | public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data); | ||
50 | |||
51 | public delegate void NewInventoryItem(UUID userID, InventoryItemBase item); | ||
52 | |||
53 | public delegate void NewAsset(AssetBase asset); | ||
54 | |||
55 | public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data); | ||
56 | |||
57 | public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID, | ||
58 | bool isScriptRunning, byte[] data); | ||
59 | |||
60 | public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, | ||
61 | bool fetchFolders, bool fetchItems, int sortOrder); | ||
62 | |||
63 | /// <summary> | ||
64 | /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that | ||
65 | /// we can popup a message on the user's client if the inventory service has permanently failed). But I didn't want | ||
66 | /// to just pass the whole Scene into CAPS. | ||
67 | /// </summary> | ||
68 | public delegate IClientAPI GetClientDelegate(UUID agentID); | ||
69 | |||
70 | public class Caps | ||
71 | { | ||
72 | private static readonly ILog m_log = | ||
73 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
74 | |||
75 | private string m_httpListenerHostName; | ||
76 | private uint m_httpListenPort; | ||
77 | |||
78 | /// <summary> | ||
79 | /// This is the uuid portion of every CAPS path. It is used to make capability urls private to the requester. | ||
80 | /// </summary> | ||
81 | private string m_capsObjectPath; | ||
82 | public string CapsObjectPath { get { return m_capsObjectPath; } } | ||
83 | |||
84 | private CapsHandlers m_capsHandlers; | ||
85 | |||
86 | private static readonly string m_requestPath = "0000/"; | ||
87 | // private static readonly string m_mapLayerPath = "0001/"; | ||
88 | private static readonly string m_newInventory = "0002/"; | ||
89 | //private static readonly string m_requestTexture = "0003/"; | ||
90 | private static readonly string m_notecardUpdatePath = "0004/"; | ||
91 | private static readonly string m_notecardTaskUpdatePath = "0005/"; | ||
92 | // private static readonly string m_fetchInventoryPath = "0006/"; | ||
93 | |||
94 | // The following entries are in a module, however, they are also here so that we don't re-assign | ||
95 | // the path to another cap by mistake. | ||
96 | // private static readonly string m_parcelVoiceInfoRequestPath = "0007/"; // This is in a module. | ||
97 | // private static readonly string m_provisionVoiceAccountRequestPath = "0008/";// This is in a module. | ||
98 | |||
99 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. | ||
100 | |||
101 | //private string eventQueue = "0100/"; | ||
102 | private IHttpServer m_httpListener; | ||
103 | private UUID m_agentID; | ||
104 | private IAssetService m_assetCache; | ||
105 | private int m_eventQueueCount = 1; | ||
106 | private Queue<string> m_capsEventQueue = new Queue<string>(); | ||
107 | private bool m_dumpAssetsToFile; | ||
108 | private string m_regionName; | ||
109 | |||
110 | public bool SSLCaps | ||
111 | { | ||
112 | get { return m_httpListener.UseSSL; } | ||
113 | } | ||
114 | public string SSLCommonName | ||
115 | { | ||
116 | get { return m_httpListener.SSLCommonName; } | ||
117 | } | ||
118 | public CapsHandlers CapsHandlers | ||
119 | { | ||
120 | get { return m_capsHandlers; } | ||
121 | } | ||
122 | |||
123 | // These are callbacks which will be setup by the scene so that we can update scene data when we | ||
124 | // receive capability calls | ||
125 | public NewInventoryItem AddNewInventoryItem = null; | ||
126 | public NewAsset AddNewAsset = null; | ||
127 | public ItemUpdatedCallback ItemUpdatedCall = null; | ||
128 | public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; | ||
129 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; | ||
130 | public GetClientDelegate GetClient = null; | ||
131 | |||
132 | public Caps(IAssetService assetCache, IHttpServer httpServer, string httpListen, uint httpPort, string capsPath, | ||
133 | UUID agent, bool dumpAssetsToFile, string regionName) | ||
134 | { | ||
135 | m_assetCache = assetCache; | ||
136 | m_capsObjectPath = capsPath; | ||
137 | m_httpListener = httpServer; | ||
138 | m_httpListenerHostName = httpListen; | ||
139 | |||
140 | m_httpListenPort = httpPort; | ||
141 | |||
142 | if (httpServer.UseSSL) | ||
143 | { | ||
144 | m_httpListenPort = httpServer.SSLPort; | ||
145 | httpListen = httpServer.SSLCommonName; | ||
146 | httpPort = httpServer.SSLPort; | ||
147 | } | ||
148 | |||
149 | m_agentID = agent; | ||
150 | m_dumpAssetsToFile = dumpAssetsToFile; | ||
151 | m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, httpServer.UseSSL); | ||
152 | m_regionName = regionName; | ||
153 | } | ||
154 | |||
155 | /// <summary> | ||
156 | /// Register all CAPS http service handlers | ||
157 | /// </summary> | ||
158 | public void RegisterHandlers() | ||
159 | { | ||
160 | DeregisterHandlers(); | ||
161 | |||
162 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
163 | |||
164 | RegisterRegionServiceHandlers(capsBase); | ||
165 | RegisterInventoryServiceHandlers(capsBase); | ||
166 | |||
167 | } | ||
168 | |||
169 | public void RegisterRegionServiceHandlers(string capsBase) | ||
170 | { | ||
171 | try | ||
172 | { | ||
173 | // the root of all evil | ||
174 | m_capsHandlers["SEED"] = new RestStreamHandler("POST", capsBase + m_requestPath, CapsRequest); | ||
175 | m_log.DebugFormat( | ||
176 | "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_agentID); | ||
177 | |||
178 | //m_capsHandlers["MapLayer"] = | ||
179 | // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", | ||
180 | // capsBase + m_mapLayerPath, | ||
181 | // GetMapLayer); | ||
182 | m_capsHandlers["UpdateScriptTaskInventory"] = | ||
183 | new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); | ||
184 | m_capsHandlers["UpdateScriptTask"] = m_capsHandlers["UpdateScriptTaskInventory"]; | ||
185 | |||
186 | } | ||
187 | catch (Exception e) | ||
188 | { | ||
189 | m_log.Error("[CAPS]: " + e.ToString()); | ||
190 | } | ||
191 | } | ||
192 | |||
193 | public void RegisterInventoryServiceHandlers(string capsBase) | ||
194 | { | ||
195 | try | ||
196 | { | ||
197 | // I don't think this one works... | ||
198 | m_capsHandlers["NewFileAgentInventory"] = | ||
199 | new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", | ||
200 | capsBase + m_newInventory, | ||
201 | NewAgentInventoryRequest); | ||
202 | m_capsHandlers["UpdateNotecardAgentInventory"] = | ||
203 | new RestStreamHandler("POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory); | ||
204 | m_capsHandlers["UpdateScriptAgentInventory"] = m_capsHandlers["UpdateNotecardAgentInventory"]; | ||
205 | m_capsHandlers["UpdateScriptAgent"] = m_capsHandlers["UpdateScriptAgentInventory"]; | ||
206 | |||
207 | // As of RC 1.22.9 of the Linden client this is | ||
208 | // supported | ||
209 | |||
210 | // m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest); | ||
211 | |||
212 | // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and | ||
213 | // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires | ||
214 | // enhancements (probably filling out the folder part of the LLSD reply) to our CAPS service, | ||
215 | // but when I went on the Linden grid, the | ||
216 | // simulators I visited (version 1.21) were, surprisingly, no longer supplying this capability. Instead, | ||
217 | // the 1.19.1.4 client appeared to be happily flowing inventory data over UDP | ||
218 | // | ||
219 | // This is very probably just a temporary measure - once the CAPS service appears again on the Linden grid | ||
220 | // we will be | ||
221 | // able to get the data we need to implement the necessary part of the protocol to fix the issue above. | ||
222 | // m_capsHandlers["FetchInventoryDescendents"] = | ||
223 | // new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryRequest); | ||
224 | |||
225 | // m_capsHandlers["FetchInventoryDescendents"] = | ||
226 | // new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST", | ||
227 | // capsBase + m_fetchInventory, | ||
228 | // FetchInventory)); | ||
229 | // m_capsHandlers["RequestTextureDownload"] = new RestStreamHandler("POST", | ||
230 | // capsBase + m_requestTexture, | ||
231 | // RequestTexture); | ||
232 | } | ||
233 | catch (Exception e) | ||
234 | { | ||
235 | m_log.Error("[CAPS]: " + e.ToString()); | ||
236 | } | ||
237 | } | ||
238 | |||
239 | /// <summary> | ||
240 | /// Register a handler. This allows modules to register handlers. | ||
241 | /// </summary> | ||
242 | /// <param name="capName"></param> | ||
243 | /// <param name="handler"></param> | ||
244 | public void RegisterHandler(string capName, IRequestHandler handler) | ||
245 | { | ||
246 | m_capsHandlers[capName] = handler; | ||
247 | //m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path); | ||
248 | } | ||
249 | |||
250 | /// <summary> | ||
251 | /// Remove all CAPS service handlers. | ||
252 | /// | ||
253 | /// </summary> | ||
254 | /// <param name="httpListener"></param> | ||
255 | /// <param name="path"></param> | ||
256 | /// <param name="restMethod"></param> | ||
257 | public void DeregisterHandlers() | ||
258 | { | ||
259 | if (m_capsHandlers != null) | ||
260 | { | ||
261 | foreach (string capsName in m_capsHandlers.Caps) | ||
262 | { | ||
263 | m_capsHandlers.Remove(capsName); | ||
264 | } | ||
265 | } | ||
266 | } | ||
267 | |||
268 | /// <summary> | ||
269 | /// Construct a client response detailing all the capabilities this server can provide. | ||
270 | /// </summary> | ||
271 | /// <param name="request"></param> | ||
272 | /// <param name="path"></param> | ||
273 | /// <param name="param"></param> | ||
274 | /// <param name="httpRequest">HTTP request header object</param> | ||
275 | /// <param name="httpResponse">HTTP response header object</param> | ||
276 | /// <returns></returns> | ||
277 | public string CapsRequest(string request, string path, string param, | ||
278 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
279 | { | ||
280 | //m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); | ||
281 | |||
282 | string result = LLSDHelpers.SerialiseLLSDReply(m_capsHandlers.CapsDetails); | ||
283 | |||
284 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); | ||
285 | |||
286 | return result; | ||
287 | } | ||
288 | |||
289 | // FIXME: these all should probably go into the respective region | ||
290 | // modules | ||
291 | |||
292 | /// <summary> | ||
293 | /// Processes a fetch inventory request and sends the reply | ||
294 | |||
295 | /// </summary> | ||
296 | /// <param name="request"></param> | ||
297 | /// <param name="path"></param> | ||
298 | /// <param name="param"></param> | ||
299 | /// <returns></returns> | ||
300 | // Request is like: | ||
301 | //<llsd> | ||
302 | // <map><key>folders</key> | ||
303 | // <array> | ||
304 | // <map> | ||
305 | // <key>fetch-folders</key><boolean>1</boolean><key>fetch-items</key><boolean>1</boolean><key>folder-id</key><uuid>8e1e3a30-b9bf-11dc-95ff-0800200c9a66</uuid><key>owner-id</key><uuid>11111111-1111-0000-0000-000100bba000</uuid><key>sort-order</key><integer>1</integer> | ||
306 | // </map> | ||
307 | // </array> | ||
308 | // </map> | ||
309 | //</llsd> | ||
310 | // | ||
311 | // multiple fetch-folder maps are allowed within the larger folders map. | ||
312 | public string FetchInventoryRequest(string request, string path, string param) | ||
313 | { | ||
314 | // string unmodifiedRequest = request.ToString(); | ||
315 | |||
316 | //m_log.DebugFormat("[AGENT INVENTORY]: Received CAPS fetch inventory request {0}", unmodifiedRequest); | ||
317 | m_log.Debug("[CAPS]: Inventory Request in region: " + m_regionName); | ||
318 | |||
319 | Hashtable hash = new Hashtable(); | ||
320 | try | ||
321 | { | ||
322 | hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
323 | } | ||
324 | catch (LLSD.LLSDParseException pe) | ||
325 | { | ||
326 | m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message); | ||
327 | m_log.Error("Request: " + request.ToString()); | ||
328 | } | ||
329 | |||
330 | ArrayList foldersrequested = (ArrayList)hash["folders"]; | ||
331 | |||
332 | string response = ""; | ||
333 | |||
334 | for (int i = 0; i < foldersrequested.Count; i++) | ||
335 | { | ||
336 | string inventoryitemstr = ""; | ||
337 | Hashtable inventoryhash = (Hashtable)foldersrequested[i]; | ||
338 | |||
339 | LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); | ||
340 | LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest); | ||
341 | LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); | ||
342 | |||
343 | inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); | ||
344 | inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); | ||
345 | inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); | ||
346 | |||
347 | response += inventoryitemstr; | ||
348 | } | ||
349 | |||
350 | if (response.Length == 0) | ||
351 | { | ||
352 | // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. | ||
353 | // Therefore, I'm concluding that the client only has so many threads available to do requests | ||
354 | // and when a thread stalls.. is stays stalled. | ||
355 | // Therefore we need to return something valid | ||
356 | response = "<llsd><map><key>folders</key><array /></map></llsd>"; | ||
357 | } | ||
358 | else | ||
359 | { | ||
360 | response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; | ||
361 | } | ||
362 | |||
363 | //m_log.DebugFormat("[AGENT INVENTORY]: Replying to CAPS fetch inventory request with following xml"); | ||
364 | //m_log.Debug(Util.GetFormattedXml(response)); | ||
365 | |||
366 | return response; | ||
367 | } | ||
368 | |||
369 | public string FetchInventoryDescendentsRequest(string request, string path, string param,OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
370 | { | ||
371 | // m_log.Debug("[CAPS]: FetchInventoryDescendentsRequest in region: " + m_regionName + "request is "+request); | ||
372 | |||
373 | // nasty temporary hack here, the linden client falsely identifies the uuid 00000000-0000-0000-0000-000000000000 as a string which breaks us | ||
374 | // correctly mark it as a uuid | ||
375 | request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>"); | ||
376 | |||
377 | // another hack <integer>1</integer> results in a System.ArgumentException: Object type System.Int32 cannot be converted to target type: System.Boolean | ||
378 | request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>"); | ||
379 | request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>"); | ||
380 | Hashtable hash = new Hashtable(); | ||
381 | try | ||
382 | { | ||
383 | hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
384 | } | ||
385 | catch (LLSD.LLSDParseException pe) | ||
386 | { | ||
387 | m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message); | ||
388 | m_log.Error("Request: " + request.ToString()); | ||
389 | } | ||
390 | |||
391 | ArrayList foldersrequested = (ArrayList)hash["folders"]; | ||
392 | |||
393 | string response = ""; | ||
394 | for (int i = 0; i < foldersrequested.Count; i++) | ||
395 | { | ||
396 | string inventoryitemstr = ""; | ||
397 | Hashtable inventoryhash = (Hashtable)foldersrequested[i]; | ||
398 | |||
399 | LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); | ||
400 | |||
401 | try{ | ||
402 | LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest); | ||
403 | } | ||
404 | catch(Exception e) | ||
405 | { | ||
406 | m_log.Debug("[CAPS]: caught exception doing OSD deserialize" + e); | ||
407 | } | ||
408 | LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); | ||
409 | |||
410 | inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); | ||
411 | inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); | ||
412 | inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); | ||
413 | |||
414 | response += inventoryitemstr; | ||
415 | } | ||
416 | |||
417 | |||
418 | if (response.Length == 0) | ||
419 | { | ||
420 | // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. | ||
421 | // Therefore, I'm concluding that the client only has so many threads available to do requests | ||
422 | // and when a thread stalls.. is stays stalled. | ||
423 | // Therefore we need to return something valid | ||
424 | response = "<llsd><map><key>folders</key><array /></map></llsd>"; | ||
425 | } | ||
426 | else | ||
427 | { | ||
428 | response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; | ||
429 | } | ||
430 | |||
431 | //m_log.DebugFormat("[CAPS]: Replying to CAPS fetch inventory request with following xml"); | ||
432 | //m_log.Debug("[CAPS] "+response); | ||
433 | |||
434 | return response; | ||
435 | } | ||
436 | |||
437 | |||
438 | |||
439 | /// <summary> | ||
440 | /// Construct an LLSD reply packet to a CAPS inventory request | ||
441 | /// </summary> | ||
442 | /// <param name="invFetch"></param> | ||
443 | /// <returns></returns> | ||
444 | private LLSDInventoryDescendents FetchInventoryReply(LLSDFetchInventoryDescendents invFetch) | ||
445 | { | ||
446 | LLSDInventoryDescendents reply = new LLSDInventoryDescendents(); | ||
447 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); | ||
448 | contents.agent_id = m_agentID; | ||
449 | contents.owner_id = invFetch.owner_id; | ||
450 | contents.folder_id = invFetch.folder_id; | ||
451 | |||
452 | // The version number being sent back was originally 1. | ||
453 | // Unfortunately, on 1.19.1.4, this means that we see a problem where on subsequent logins | ||
454 | // without clearing client cache, objects in the root folder disappear until the cache is cleared, | ||
455 | // at which point they reappear. | ||
456 | // | ||
457 | // Seeing the version to something other than 0 may be the right thing to do, but there is | ||
458 | // a greater subtlety of the second life protocol that needs to be understood first. | ||
459 | contents.version = 0; | ||
460 | |||
461 | contents.descendents = 0; | ||
462 | reply.folders.Array.Add(contents); | ||
463 | List<InventoryItemBase> itemList = null; | ||
464 | if (CAPSFetchInventoryDescendents != null) | ||
465 | { | ||
466 | itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); | ||
467 | } | ||
468 | |||
469 | if (itemList != null) | ||
470 | { | ||
471 | foreach (InventoryItemBase invItem in itemList) | ||
472 | { | ||
473 | contents.items.Array.Add(ConvertInventoryItem(invItem)); | ||
474 | } | ||
475 | } | ||
476 | /* The following block is removed as it ALWAYS sends the error to the client because the RC 1.22.9 client tries to | ||
477 | find items that have become dissasociated with a paret folder and have parent of 00000000-0000-00000.... | ||
478 | else | ||
479 | { | ||
480 | IClientAPI client = GetClient(m_agentID); | ||
481 | |||
482 | // We're going to both notify the client of inventory service failure and send back a 'no folder contents' response. | ||
483 | // If we don't send back the response, | ||
484 | // the client becomes unhappy (see Teravus' comment in FetchInventoryRequest()) | ||
485 | if (client != null) | ||
486 | { | ||
487 | client.SendAgentAlertMessage( | ||
488 | "AGIN0001E: The inventory service has either failed or is not responding. Your inventory will not function properly for the rest of this session. Please clear your cache and relog.", | ||
489 | true); | ||
490 | } | ||
491 | else | ||
492 | { | ||
493 | m_log.ErrorFormat( | ||
494 | "[AGENT INVENTORY]: Could not lookup controlling client for {0} in order to notify them of the inventory service failure", | ||
495 | m_agentID); | ||
496 | } | ||
497 | }*/ | ||
498 | |||
499 | contents.descendents = contents.items.Array.Count; | ||
500 | return reply; | ||
501 | } | ||
502 | |||
503 | /// <summary> | ||
504 | /// Convert an internal inventory item object into an LLSD object. | ||
505 | /// </summary> | ||
506 | /// <param name="invItem"></param> | ||
507 | /// <returns></returns> | ||
508 | private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem) | ||
509 | { | ||
510 | LLSDInventoryItem llsdItem = new LLSDInventoryItem(); | ||
511 | llsdItem.asset_id = invItem.AssetID; | ||
512 | llsdItem.created_at = invItem.CreationDate; | ||
513 | llsdItem.desc = invItem.Description; | ||
514 | llsdItem.flags = 0; | ||
515 | llsdItem.item_id = invItem.ID; | ||
516 | llsdItem.name = invItem.Name; | ||
517 | llsdItem.parent_id = invItem.Folder; | ||
518 | try | ||
519 | { | ||
520 | // TODO reevaluate after upgrade to libomv >= r2566. Probably should use UtilsConversions. | ||
521 | llsdItem.type = TaskInventoryItem.Types[invItem.AssetType]; | ||
522 | llsdItem.inv_type = TaskInventoryItem.InvTypes[invItem.InvType]; | ||
523 | } | ||
524 | catch (Exception e) | ||
525 | { | ||
526 | m_log.Error("[CAPS]: Problem setting asset/inventory type while converting inventory item " + invItem.Name + " to LLSD:", e); | ||
527 | } | ||
528 | llsdItem.permissions = new LLSDPermissions(); | ||
529 | llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; | ||
530 | llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; | ||
531 | llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions; | ||
532 | llsdItem.permissions.group_id = UUID.Zero; | ||
533 | llsdItem.permissions.group_mask = 0; | ||
534 | llsdItem.permissions.is_owner_group = false; | ||
535 | llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; | ||
536 | llsdItem.permissions.owner_id = m_agentID; // FixMe | ||
537 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; | ||
538 | llsdItem.sale_info = new LLSDSaleInfo(); | ||
539 | llsdItem.sale_info.sale_price = 10; | ||
540 | llsdItem.sale_info.sale_type = "not"; | ||
541 | |||
542 | return llsdItem; | ||
543 | } | ||
544 | |||
545 | /// <summary> | ||
546 | /// | ||
547 | /// </summary> | ||
548 | /// <param name="mapReq"></param> | ||
549 | /// <returns></returns> | ||
550 | public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) | ||
551 | { | ||
552 | m_log.Debug("[CAPS]: MapLayer Request in region: " + m_regionName); | ||
553 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); | ||
554 | mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); | ||
555 | return mapResponse; | ||
556 | } | ||
557 | |||
558 | /// <summary> | ||
559 | /// | ||
560 | /// </summary> | ||
561 | /// <returns></returns> | ||
562 | protected static OSDMapLayer GetOSDMapLayerResponse() | ||
563 | { | ||
564 | OSDMapLayer mapLayer = new OSDMapLayer(); | ||
565 | mapLayer.Right = 5000; | ||
566 | mapLayer.Top = 5000; | ||
567 | mapLayer.ImageID = new UUID("00000000-0000-1111-9999-000000000006"); | ||
568 | |||
569 | return mapLayer; | ||
570 | } | ||
571 | |||
572 | /// <summary> | ||
573 | /// | ||
574 | /// </summary> | ||
575 | /// <param name="request"></param> | ||
576 | /// <param name="path"></param> | ||
577 | /// <param name="param"></param> | ||
578 | /// <returns></returns> | ||
579 | public string RequestTexture(string request, string path, string param) | ||
580 | { | ||
581 | m_log.Debug("texture request " + request); | ||
582 | // Needs implementing (added to remove compiler warning) | ||
583 | return String.Empty; | ||
584 | } | ||
585 | |||
586 | #region EventQueue (Currently not enabled) | ||
587 | |||
588 | /// <summary> | ||
589 | /// | ||
590 | /// </summary> | ||
591 | /// <param name="request"></param> | ||
592 | /// <param name="path"></param> | ||
593 | /// <param name="param"></param> | ||
594 | /// <returns></returns> | ||
595 | public string ProcessEventQueue(string request, string path, string param) | ||
596 | { | ||
597 | string res = String.Empty; | ||
598 | |||
599 | if (m_capsEventQueue.Count > 0) | ||
600 | { | ||
601 | lock (m_capsEventQueue) | ||
602 | { | ||
603 | string item = m_capsEventQueue.Dequeue(); | ||
604 | res = item; | ||
605 | } | ||
606 | } | ||
607 | else | ||
608 | { | ||
609 | res = CreateEmptyEventResponse(); | ||
610 | } | ||
611 | return res; | ||
612 | } | ||
613 | |||
614 | /// <summary> | ||
615 | /// | ||
616 | /// </summary> | ||
617 | /// <param name="caps"></param> | ||
618 | /// <param name="ipAddressPort"></param> | ||
619 | /// <returns></returns> | ||
620 | public string CreateEstablishAgentComms(string caps, string ipAddressPort) | ||
621 | { | ||
622 | LLSDCapEvent eventItem = new LLSDCapEvent(); | ||
623 | eventItem.id = m_eventQueueCount; | ||
624 | //should be creating a EstablishAgentComms item, but there isn't a class for it yet | ||
625 | eventItem.events.Array.Add(new LLSDEmpty()); | ||
626 | string res = LLSDHelpers.SerialiseLLSDReply(eventItem); | ||
627 | m_eventQueueCount++; | ||
628 | |||
629 | m_capsEventQueue.Enqueue(res); | ||
630 | return res; | ||
631 | } | ||
632 | |||
633 | /// <summary> | ||
634 | /// | ||
635 | /// </summary> | ||
636 | /// <returns></returns> | ||
637 | public string CreateEmptyEventResponse() | ||
638 | { | ||
639 | LLSDCapEvent eventItem = new LLSDCapEvent(); | ||
640 | eventItem.id = m_eventQueueCount; | ||
641 | eventItem.events.Array.Add(new LLSDEmpty()); | ||
642 | string res = LLSDHelpers.SerialiseLLSDReply(eventItem); | ||
643 | m_eventQueueCount++; | ||
644 | return res; | ||
645 | } | ||
646 | |||
647 | #endregion | ||
648 | |||
649 | /// <summary> | ||
650 | /// Called by the script task update handler. Provides a URL to which the client can upload a new asset. | ||
651 | /// </summary> | ||
652 | /// <param name="request"></param> | ||
653 | /// <param name="path"></param> | ||
654 | /// <param name="param"></param> | ||
655 | /// <param name="httpRequest">HTTP request header object</param> | ||
656 | /// <param name="httpResponse">HTTP response header object</param> | ||
657 | /// <returns></returns> | ||
658 | public string ScriptTaskInventory(string request, string path, string param, | ||
659 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
660 | { | ||
661 | try | ||
662 | { | ||
663 | m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName); | ||
664 | //m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param); | ||
665 | |||
666 | Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
667 | LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); | ||
668 | LLSDHelpers.DeserialiseOSDMap(hash, llsdUpdateRequest); | ||
669 | |||
670 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
671 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
672 | |||
673 | TaskInventoryScriptUpdater uploader = | ||
674 | new TaskInventoryScriptUpdater( | ||
675 | llsdUpdateRequest.item_id, | ||
676 | llsdUpdateRequest.task_id, | ||
677 | llsdUpdateRequest.is_script_running, | ||
678 | capsBase + uploaderPath, | ||
679 | m_httpListener, | ||
680 | m_dumpAssetsToFile); | ||
681 | uploader.OnUpLoad += TaskScriptUpdated; | ||
682 | |||
683 | m_httpListener.AddStreamHandler( | ||
684 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
685 | |||
686 | string protocol = "http://"; | ||
687 | |||
688 | if (m_httpListener.UseSSL) | ||
689 | protocol = "https://"; | ||
690 | |||
691 | string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + | ||
692 | uploaderPath; | ||
693 | |||
694 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
695 | uploadResponse.uploader = uploaderURL; | ||
696 | uploadResponse.state = "upload"; | ||
697 | |||
698 | // m_log.InfoFormat("[CAPS]: " + | ||
699 | // "ScriptTaskInventory response: {0}", | ||
700 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse))); | ||
701 | |||
702 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
703 | } | ||
704 | catch (Exception e) | ||
705 | { | ||
706 | m_log.Error("[CAPS]: " + e.ToString()); | ||
707 | } | ||
708 | |||
709 | return null; | ||
710 | } | ||
711 | |||
712 | /// <summary> | ||
713 | /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset. | ||
714 | /// </summary> | ||
715 | /// <param name="request"></param> | ||
716 | /// <param name="path"></param> | ||
717 | /// <param name="param"></param> | ||
718 | /// <returns></returns> | ||
719 | public string NoteCardAgentInventory(string request, string path, string param, | ||
720 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
721 | { | ||
722 | //m_log.Debug("[CAPS]: NoteCardAgentInventory Request in region: " + m_regionName + "\n" + request); | ||
723 | //m_log.Debug("[CAPS]: NoteCardAgentInventory Request is: " + request); | ||
724 | |||
725 | //OpenMetaverse.StructuredData.OSDMap hash = (OpenMetaverse.StructuredData.OSDMap)OpenMetaverse.StructuredData.LLSDParser.DeserializeBinary(Utils.StringToBytes(request)); | ||
726 | Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
727 | LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); | ||
728 | LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest); | ||
729 | |||
730 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
731 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
732 | |||
733 | ItemUpdater uploader = | ||
734 | new ItemUpdater(llsdRequest.item_id, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile); | ||
735 | uploader.OnUpLoad += ItemUpdated; | ||
736 | |||
737 | m_httpListener.AddStreamHandler( | ||
738 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
739 | |||
740 | string protocol = "http://"; | ||
741 | |||
742 | if (m_httpListener.UseSSL) | ||
743 | protocol = "https://"; | ||
744 | |||
745 | string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + | ||
746 | uploaderPath; | ||
747 | |||
748 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
749 | uploadResponse.uploader = uploaderURL; | ||
750 | uploadResponse.state = "upload"; | ||
751 | |||
752 | // m_log.InfoFormat("[CAPS]: " + | ||
753 | // "NoteCardAgentInventory response: {0}", | ||
754 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse))); | ||
755 | |||
756 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
757 | } | ||
758 | |||
759 | /// <summary> | ||
760 | /// | ||
761 | /// </summary> | ||
762 | /// <param name="llsdRequest"></param> | ||
763 | /// <returns></returns> | ||
764 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) | ||
765 | { | ||
766 | //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString()); | ||
767 | //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); | ||
768 | |||
769 | if (llsdRequest.asset_type == "texture" || | ||
770 | llsdRequest.asset_type == "animation" || | ||
771 | llsdRequest.asset_type == "sound") | ||
772 | { | ||
773 | IClientAPI client = null; | ||
774 | IScene scene = null; | ||
775 | if (GetClient != null) | ||
776 | { | ||
777 | client = GetClient(m_agentID); | ||
778 | scene = client.Scene; | ||
779 | |||
780 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); | ||
781 | |||
782 | if (mm != null) | ||
783 | { | ||
784 | if (!mm.UploadCovered(client)) | ||
785 | { | ||
786 | if (client != null) | ||
787 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | ||
788 | |||
789 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | ||
790 | errorResponse.uploader = ""; | ||
791 | errorResponse.state = "error"; | ||
792 | return errorResponse; | ||
793 | } | ||
794 | } | ||
795 | } | ||
796 | } | ||
797 | |||
798 | |||
799 | string assetName = llsdRequest.name; | ||
800 | string assetDes = llsdRequest.description; | ||
801 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
802 | UUID newAsset = UUID.Random(); | ||
803 | UUID newInvItem = UUID.Random(); | ||
804 | UUID parentFolder = llsdRequest.folder_id; | ||
805 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
806 | |||
807 | AssetUploader uploader = | ||
808 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | ||
809 | llsdRequest.asset_type, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile); | ||
810 | m_httpListener.AddStreamHandler( | ||
811 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
812 | |||
813 | string protocol = "http://"; | ||
814 | |||
815 | if (m_httpListener.UseSSL) | ||
816 | protocol = "https://"; | ||
817 | |||
818 | string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + | ||
819 | uploaderPath; | ||
820 | |||
821 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
822 | uploadResponse.uploader = uploaderURL; | ||
823 | uploadResponse.state = "upload"; | ||
824 | uploader.OnUpLoad += UploadCompleteHandler; | ||
825 | return uploadResponse; | ||
826 | } | ||
827 | |||
828 | /// <summary> | ||
829 | /// | ||
830 | /// </summary> | ||
831 | /// <param name="assetID"></param> | ||
832 | /// <param name="inventoryItem"></param> | ||
833 | /// <param name="data"></param> | ||
834 | public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, | ||
835 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, | ||
836 | string assetType) | ||
837 | { | ||
838 | sbyte assType = 0; | ||
839 | sbyte inType = 0; | ||
840 | |||
841 | if (inventoryType == "sound") | ||
842 | { | ||
843 | inType = 1; | ||
844 | assType = 1; | ||
845 | } | ||
846 | else if (inventoryType == "animation") | ||
847 | { | ||
848 | inType = 19; | ||
849 | assType = 20; | ||
850 | } | ||
851 | else if (inventoryType == "wearable") | ||
852 | { | ||
853 | inType = 18; | ||
854 | switch (assetType) | ||
855 | { | ||
856 | case "bodypart": | ||
857 | assType = 13; | ||
858 | break; | ||
859 | case "clothing": | ||
860 | assType = 5; | ||
861 | break; | ||
862 | } | ||
863 | } | ||
864 | |||
865 | AssetBase asset; | ||
866 | asset = new AssetBase(); | ||
867 | asset.FullID = assetID; | ||
868 | asset.Type = assType; | ||
869 | asset.Name = assetName; | ||
870 | asset.Data = data; | ||
871 | if (AddNewAsset != null) | ||
872 | AddNewAsset(asset); | ||
873 | else if (m_assetCache != null) | ||
874 | m_assetCache.Store(asset); | ||
875 | |||
876 | InventoryItemBase item = new InventoryItemBase(); | ||
877 | item.Owner = m_agentID; | ||
878 | item.CreatorId = m_agentID.ToString(); | ||
879 | item.ID = inventoryItem; | ||
880 | item.AssetID = asset.FullID; | ||
881 | item.Description = assetDescription; | ||
882 | item.Name = assetName; | ||
883 | item.AssetType = assType; | ||
884 | item.InvType = inType; | ||
885 | item.Folder = parentFolder; | ||
886 | item.CurrentPermissions = 2147483647; | ||
887 | item.BasePermissions = 2147483647; | ||
888 | item.EveryOnePermissions = 0; | ||
889 | item.NextPermissions = 2147483647; | ||
890 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
891 | |||
892 | if (AddNewInventoryItem != null) | ||
893 | { | ||
894 | AddNewInventoryItem(m_agentID, item); | ||
895 | } | ||
896 | } | ||
897 | |||
898 | /// <summary> | ||
899 | /// Called when new asset data for an agent inventory item update has been uploaded. | ||
900 | /// </summary> | ||
901 | /// <param name="itemID">Item to update</param> | ||
902 | /// <param name="data">New asset data</param> | ||
903 | /// <returns></returns> | ||
904 | public UUID ItemUpdated(UUID itemID, byte[] data) | ||
905 | { | ||
906 | if (ItemUpdatedCall != null) | ||
907 | { | ||
908 | return ItemUpdatedCall(m_agentID, itemID, data); | ||
909 | } | ||
910 | |||
911 | return UUID.Zero; | ||
912 | } | ||
913 | |||
914 | /// <summary> | ||
915 | /// Called when new asset data for an agent inventory item update has been uploaded. | ||
916 | /// </summary> | ||
917 | /// <param name="itemID">Item to update</param> | ||
918 | /// <param name="primID">Prim containing item to update</param> | ||
919 | /// <param name="isScriptRunning">Signals whether the script to update is currently running</param> | ||
920 | /// <param name="data">New asset data</param> | ||
921 | public void TaskScriptUpdated(UUID itemID, UUID primID, bool isScriptRunning, byte[] data) | ||
922 | { | ||
923 | if (TaskScriptUpdatedCall != null) | ||
924 | { | ||
925 | TaskScriptUpdatedCall(m_agentID, itemID, primID, isScriptRunning, data); | ||
926 | } | ||
927 | } | ||
928 | |||
929 | public class AssetUploader | ||
930 | { | ||
931 | public event UpLoadedAsset OnUpLoad; | ||
932 | private UpLoadedAsset handlerUpLoad = null; | ||
933 | |||
934 | private string uploaderPath = String.Empty; | ||
935 | private UUID newAssetID; | ||
936 | private UUID inventoryItemID; | ||
937 | private UUID parentFolder; | ||
938 | private IHttpServer httpListener; | ||
939 | private bool m_dumpAssetsToFile; | ||
940 | private string m_assetName = String.Empty; | ||
941 | private string m_assetDes = String.Empty; | ||
942 | |||
943 | private string m_invType = String.Empty; | ||
944 | private string m_assetType = String.Empty; | ||
945 | |||
946 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, | ||
947 | UUID parentFolderID, string invType, string assetType, string path, | ||
948 | IHttpServer httpServer, bool dumpAssetsToFile) | ||
949 | { | ||
950 | m_assetName = assetName; | ||
951 | m_assetDes = description; | ||
952 | newAssetID = assetID; | ||
953 | inventoryItemID = inventoryItem; | ||
954 | uploaderPath = path; | ||
955 | httpListener = httpServer; | ||
956 | parentFolder = parentFolderID; | ||
957 | m_assetType = assetType; | ||
958 | m_invType = invType; | ||
959 | m_dumpAssetsToFile = dumpAssetsToFile; | ||
960 | } | ||
961 | |||
962 | /// <summary> | ||
963 | /// | ||
964 | /// </summary> | ||
965 | /// <param name="data"></param> | ||
966 | /// <param name="path"></param> | ||
967 | /// <param name="param"></param> | ||
968 | /// <returns></returns> | ||
969 | public string uploaderCaps(byte[] data, string path, string param) | ||
970 | { | ||
971 | UUID inv = inventoryItemID; | ||
972 | string res = String.Empty; | ||
973 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
974 | uploadComplete.new_asset = newAssetID.ToString(); | ||
975 | uploadComplete.new_inventory_item = inv; | ||
976 | uploadComplete.state = "complete"; | ||
977 | |||
978 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
979 | |||
980 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
981 | |||
982 | // TODO: probably make this a better set of extensions here | ||
983 | string extension = ".jp2"; | ||
984 | if (m_invType != "image") | ||
985 | { | ||
986 | extension = ".dat"; | ||
987 | } | ||
988 | |||
989 | if (m_dumpAssetsToFile) | ||
990 | { | ||
991 | SaveAssetToFile(m_assetName + extension, data); | ||
992 | } | ||
993 | handlerUpLoad = OnUpLoad; | ||
994 | if (handlerUpLoad != null) | ||
995 | { | ||
996 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); | ||
997 | } | ||
998 | |||
999 | return res; | ||
1000 | } | ||
1001 | ///Left this in and commented in case there are unforseen issues | ||
1002 | //private void SaveAssetToFile(string filename, byte[] data) | ||
1003 | //{ | ||
1004 | // FileStream fs = File.Create(filename); | ||
1005 | // BinaryWriter bw = new BinaryWriter(fs); | ||
1006 | // bw.Write(data); | ||
1007 | // bw.Close(); | ||
1008 | // fs.Close(); | ||
1009 | //} | ||
1010 | private static void SaveAssetToFile(string filename, byte[] data) | ||
1011 | { | ||
1012 | string assetPath = "UserAssets"; | ||
1013 | if (!Directory.Exists(assetPath)) | ||
1014 | { | ||
1015 | Directory.CreateDirectory(assetPath); | ||
1016 | } | ||
1017 | FileStream fs = File.Create(Path.Combine(assetPath, Util.safeFileName(filename))); | ||
1018 | BinaryWriter bw = new BinaryWriter(fs); | ||
1019 | bw.Write(data); | ||
1020 | bw.Close(); | ||
1021 | fs.Close(); | ||
1022 | } | ||
1023 | } | ||
1024 | |||
1025 | /// <summary> | ||
1026 | /// This class is a callback invoked when a client sends asset data to | ||
1027 | /// an agent inventory notecard update url | ||
1028 | /// </summary> | ||
1029 | public class ItemUpdater | ||
1030 | { | ||
1031 | public event UpdateItem OnUpLoad; | ||
1032 | |||
1033 | private UpdateItem handlerUpdateItem = null; | ||
1034 | |||
1035 | private string uploaderPath = String.Empty; | ||
1036 | private UUID inventoryItemID; | ||
1037 | private IHttpServer httpListener; | ||
1038 | private bool m_dumpAssetToFile; | ||
1039 | |||
1040 | public ItemUpdater(UUID inventoryItem, string path, IHttpServer httpServer, bool dumpAssetToFile) | ||
1041 | { | ||
1042 | m_dumpAssetToFile = dumpAssetToFile; | ||
1043 | |||
1044 | inventoryItemID = inventoryItem; | ||
1045 | uploaderPath = path; | ||
1046 | httpListener = httpServer; | ||
1047 | } | ||
1048 | |||
1049 | /// <summary> | ||
1050 | /// | ||
1051 | /// </summary> | ||
1052 | /// <param name="data"></param> | ||
1053 | /// <param name="path"></param> | ||
1054 | /// <param name="param"></param> | ||
1055 | /// <returns></returns> | ||
1056 | public string uploaderCaps(byte[] data, string path, string param) | ||
1057 | { | ||
1058 | UUID inv = inventoryItemID; | ||
1059 | string res = String.Empty; | ||
1060 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
1061 | UUID assetID = UUID.Zero; | ||
1062 | handlerUpdateItem = OnUpLoad; | ||
1063 | if (handlerUpdateItem != null) | ||
1064 | { | ||
1065 | assetID = handlerUpdateItem(inv, data); | ||
1066 | } | ||
1067 | |||
1068 | uploadComplete.new_asset = assetID.ToString(); | ||
1069 | uploadComplete.new_inventory_item = inv; | ||
1070 | uploadComplete.state = "complete"; | ||
1071 | |||
1072 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
1073 | |||
1074 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
1075 | |||
1076 | if (m_dumpAssetToFile) | ||
1077 | { | ||
1078 | SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data); | ||
1079 | } | ||
1080 | |||
1081 | return res; | ||
1082 | } | ||
1083 | ///Left this in and commented in case there are unforseen issues | ||
1084 | //private void SaveAssetToFile(string filename, byte[] data) | ||
1085 | //{ | ||
1086 | // FileStream fs = File.Create(filename); | ||
1087 | // BinaryWriter bw = new BinaryWriter(fs); | ||
1088 | // bw.Write(data); | ||
1089 | // bw.Close(); | ||
1090 | // fs.Close(); | ||
1091 | //} | ||
1092 | private static void SaveAssetToFile(string filename, byte[] data) | ||
1093 | { | ||
1094 | string assetPath = "UserAssets"; | ||
1095 | if (!Directory.Exists(assetPath)) | ||
1096 | { | ||
1097 | Directory.CreateDirectory(assetPath); | ||
1098 | } | ||
1099 | FileStream fs = File.Create(Path.Combine(assetPath, filename)); | ||
1100 | BinaryWriter bw = new BinaryWriter(fs); | ||
1101 | bw.Write(data); | ||
1102 | bw.Close(); | ||
1103 | fs.Close(); | ||
1104 | } | ||
1105 | } | ||
1106 | |||
1107 | /// <summary> | ||
1108 | /// This class is a callback invoked when a client sends asset data to | ||
1109 | /// a task inventory script update url | ||
1110 | /// </summary> | ||
1111 | public class TaskInventoryScriptUpdater | ||
1112 | { | ||
1113 | public event UpdateTaskScript OnUpLoad; | ||
1114 | |||
1115 | private UpdateTaskScript handlerUpdateTaskScript = null; | ||
1116 | |||
1117 | private string uploaderPath = String.Empty; | ||
1118 | private UUID inventoryItemID; | ||
1119 | private UUID primID; | ||
1120 | private bool isScriptRunning; | ||
1121 | private IHttpServer httpListener; | ||
1122 | private bool m_dumpAssetToFile; | ||
1123 | |||
1124 | public TaskInventoryScriptUpdater(UUID inventoryItemID, UUID primID, int isScriptRunning, | ||
1125 | string path, IHttpServer httpServer, bool dumpAssetToFile) | ||
1126 | { | ||
1127 | m_dumpAssetToFile = dumpAssetToFile; | ||
1128 | |||
1129 | this.inventoryItemID = inventoryItemID; | ||
1130 | this.primID = primID; | ||
1131 | |||
1132 | // This comes in over the packet as an integer, but actually appears to be treated as a bool | ||
1133 | this.isScriptRunning = (0 == isScriptRunning ? false : true); | ||
1134 | |||
1135 | uploaderPath = path; | ||
1136 | httpListener = httpServer; | ||
1137 | } | ||
1138 | |||
1139 | /// <summary> | ||
1140 | /// | ||
1141 | /// </summary> | ||
1142 | /// <param name="data"></param> | ||
1143 | /// <param name="path"></param> | ||
1144 | /// <param name="param"></param> | ||
1145 | /// <returns></returns> | ||
1146 | public string uploaderCaps(byte[] data, string path, string param) | ||
1147 | { | ||
1148 | try | ||
1149 | { | ||
1150 | // m_log.InfoFormat("[CAPS]: " + | ||
1151 | // "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", | ||
1152 | // data, path, param)); | ||
1153 | |||
1154 | string res = String.Empty; | ||
1155 | LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete(); | ||
1156 | |||
1157 | handlerUpdateTaskScript = OnUpLoad; | ||
1158 | if (handlerUpdateTaskScript != null) | ||
1159 | { | ||
1160 | handlerUpdateTaskScript(inventoryItemID, primID, isScriptRunning, data); | ||
1161 | } | ||
1162 | |||
1163 | uploadComplete.item_id = inventoryItemID; | ||
1164 | uploadComplete.task_id = primID; | ||
1165 | uploadComplete.state = "complete"; | ||
1166 | |||
1167 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
1168 | |||
1169 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
1170 | |||
1171 | if (m_dumpAssetToFile) | ||
1172 | { | ||
1173 | SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data); | ||
1174 | } | ||
1175 | |||
1176 | // m_log.InfoFormat("[CAPS]: TaskInventoryScriptUpdater.uploaderCaps res: {0}", res); | ||
1177 | |||
1178 | return res; | ||
1179 | } | ||
1180 | catch (Exception e) | ||
1181 | { | ||
1182 | m_log.Error("[CAPS]: " + e.ToString()); | ||
1183 | } | ||
1184 | |||
1185 | // XXX Maybe this should be some meaningful error packet | ||
1186 | return null; | ||
1187 | } | ||
1188 | ///Left this in and commented in case there are unforseen issues | ||
1189 | //private void SaveAssetToFile(string filename, byte[] data) | ||
1190 | //{ | ||
1191 | // FileStream fs = File.Create(filename); | ||
1192 | // BinaryWriter bw = new BinaryWriter(fs); | ||
1193 | // bw.Write(data); | ||
1194 | // bw.Close(); | ||
1195 | // fs.Close(); | ||
1196 | //} | ||
1197 | private static void SaveAssetToFile(string filename, byte[] data) | ||
1198 | { | ||
1199 | string assetPath = "UserAssets"; | ||
1200 | if (!Directory.Exists(assetPath)) | ||
1201 | { | ||
1202 | Directory.CreateDirectory(assetPath); | ||
1203 | } | ||
1204 | FileStream fs = File.Create(Path.Combine(assetPath, filename)); | ||
1205 | BinaryWriter bw = new BinaryWriter(fs); | ||
1206 | bw.Write(data); | ||
1207 | bw.Close(); | ||
1208 | fs.Close(); | ||
1209 | } | ||
1210 | } | ||
1211 | } | ||
1212 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs deleted file mode 100644 index cc44023..0000000 --- a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs +++ /dev/null | |||
@@ -1,171 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Framework.Servers; | ||
31 | using OpenSim.Framework.Servers.HttpServer; | ||
32 | |||
33 | namespace OpenSim.Framework.Communications.Capabilities | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// CapsHandlers is a cap handler container but also takes | ||
37 | /// care of adding and removing cap handlers to and from the | ||
38 | /// supplied BaseHttpServer. | ||
39 | /// </summary> | ||
40 | public class CapsHandlers | ||
41 | { | ||
42 | private Dictionary <string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>(); | ||
43 | private IHttpServer m_httpListener; | ||
44 | private string m_httpListenerHostName; | ||
45 | private uint m_httpListenerPort; | ||
46 | private bool m_useSSL = false; | ||
47 | |||
48 | /// <summary></summary> | ||
49 | /// CapsHandlers is a cap handler container but also takes | ||
50 | /// care of adding and removing cap handlers to and from the | ||
51 | /// supplied BaseHttpServer. | ||
52 | /// </summary> | ||
53 | /// <param name="httpListener">base HTTP server</param> | ||
54 | /// <param name="httpListenerHostname">host name of the HTTP | ||
55 | /// server</param> | ||
56 | /// <param name="httpListenerPort">HTTP port</param> | ||
57 | public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort) | ||
58 | : this (httpListener,httpListenerHostname,httpListenerPort, false) | ||
59 | { | ||
60 | } | ||
61 | |||
62 | /// <summary></summary> | ||
63 | /// CapsHandlers is a cap handler container but also takes | ||
64 | /// care of adding and removing cap handlers to and from the | ||
65 | /// supplied BaseHttpServer. | ||
66 | /// </summary> | ||
67 | /// <param name="httpListener">base HTTP server</param> | ||
68 | /// <param name="httpListenerHostname">host name of the HTTP | ||
69 | /// server</param> | ||
70 | /// <param name="httpListenerPort">HTTP port</param> | ||
71 | public CapsHandlers(IHttpServer httpListener, string httpListenerHostname, uint httpListenerPort, bool https) | ||
72 | { | ||
73 | m_httpListener = httpListener; | ||
74 | m_httpListenerHostName = httpListenerHostname; | ||
75 | m_httpListenerPort = httpListenerPort; | ||
76 | m_useSSL = https; | ||
77 | if (m_useSSL) | ||
78 | { | ||
79 | m_httpListenerHostName = httpListener.SSLCommonName; | ||
80 | m_httpListenerPort = httpListener.SSLPort; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | /// <summary> | ||
85 | /// Remove the cap handler for a capability. | ||
86 | /// </summary> | ||
87 | /// <param name="capsName">name of the capability of the cap | ||
88 | /// handler to be removed</param> | ||
89 | public void Remove(string capsName) | ||
90 | { | ||
91 | // This line must be here, or caps will break! | ||
92 | m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path); | ||
93 | m_capsHandlers.Remove(capsName); | ||
94 | } | ||
95 | |||
96 | public bool ContainsCap(string cap) | ||
97 | { | ||
98 | return m_capsHandlers.ContainsKey(cap); | ||
99 | } | ||
100 | |||
101 | /// <summary> | ||
102 | /// The indexer allows us to treat the CapsHandlers object | ||
103 | /// in an intuitive dictionary like way. | ||
104 | /// </summary> | ||
105 | /// <Remarks> | ||
106 | /// The indexer will throw an exception when you try to | ||
107 | /// retrieve a cap handler for a cap that is not contained in | ||
108 | /// CapsHandlers. | ||
109 | /// </Remarks> | ||
110 | public IRequestHandler this[string idx] | ||
111 | { | ||
112 | get | ||
113 | { | ||
114 | return m_capsHandlers[idx]; | ||
115 | } | ||
116 | |||
117 | set | ||
118 | { | ||
119 | if (m_capsHandlers.ContainsKey(idx)) | ||
120 | { | ||
121 | m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path); | ||
122 | m_capsHandlers.Remove(idx); | ||
123 | } | ||
124 | |||
125 | if (null == value) return; | ||
126 | |||
127 | m_capsHandlers[idx] = value; | ||
128 | m_httpListener.AddStreamHandler(value); | ||
129 | } | ||
130 | } | ||
131 | |||
132 | /// <summary> | ||
133 | /// Return the list of cap names for which this CapsHandlers | ||
134 | /// object contains cap handlers. | ||
135 | /// </summary> | ||
136 | public string[] Caps | ||
137 | { | ||
138 | get | ||
139 | { | ||
140 | string[] __keys = new string[m_capsHandlers.Keys.Count]; | ||
141 | m_capsHandlers.Keys.CopyTo(__keys, 0); | ||
142 | return __keys; | ||
143 | } | ||
144 | } | ||
145 | |||
146 | /// <summary> | ||
147 | /// Return an LLSD-serializable Hashtable describing the | ||
148 | /// capabilities and their handler details. | ||
149 | /// </summary> | ||
150 | public Hashtable CapsDetails | ||
151 | { | ||
152 | get | ||
153 | { | ||
154 | Hashtable caps = new Hashtable(); | ||
155 | string protocol = "http://"; | ||
156 | |||
157 | if (m_useSSL) | ||
158 | protocol = "https://"; | ||
159 | |||
160 | string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString(); | ||
161 | foreach (string capsName in m_capsHandlers.Keys) | ||
162 | { | ||
163 | // skip SEED cap | ||
164 | if ("SEED" == capsName) continue; | ||
165 | caps[capsName] = baseUrl + m_capsHandlers[capsName].Path; | ||
166 | } | ||
167 | return caps; | ||
168 | } | ||
169 | } | ||
170 | } | ||
171 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/CapsUtil.cs b/OpenSim/Framework/Communications/Capabilities/CapsUtil.cs deleted file mode 100644 index a90eaa9..0000000 --- a/OpenSim/Framework/Communications/Capabilities/CapsUtil.cs +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.Capabilities | ||
31 | { | ||
32 | /// <summary> | ||
33 | /// Capabilities utility methods | ||
34 | /// </summary> | ||
35 | public class CapsUtil | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Generate a CAPS seed path using a previously generated CAPS object path component | ||
39 | /// </summary> | ||
40 | /// <param name="capsKey"></param> | ||
41 | /// <returns></returns> | ||
42 | public static string GetCapsSeedPath(string capsObjectPath) | ||
43 | { | ||
44 | return "/CAPS/" + capsObjectPath + "0000/"; | ||
45 | } | ||
46 | |||
47 | /// <summary> | ||
48 | /// Get a random CAPS object path component that will be used as the identifying part of all future CAPS requests | ||
49 | /// </summary> | ||
50 | /// <returns></returns> | ||
51 | public static string GetRandomCapsObjectPath() | ||
52 | { | ||
53 | UUID caps = UUID.Random(); | ||
54 | string capsPath = caps.ToString(); | ||
55 | // I'm commenting this, rather than delete, to keep as historical record. | ||
56 | // The caps seed is now a full UUID string that gets added four more digits | ||
57 | // for producing certain CAPs URLs in OpenSim | ||
58 | //capsPath = capsPath.Remove(capsPath.Length - 4, 4); | ||
59 | return capsPath; | ||
60 | } | ||
61 | } | ||
62 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSD.cs b/OpenSim/Framework/Communications/Capabilities/LLSD.cs deleted file mode 100644 index c982092..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSD.cs +++ /dev/null | |||
@@ -1,679 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Globalization; | ||
31 | using System.IO; | ||
32 | using System.Security.Cryptography; | ||
33 | using System.Text; | ||
34 | using System.Xml; | ||
35 | using OpenMetaverse; | ||
36 | |||
37 | namespace OpenSim.Framework.Communications.Capabilities | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// Borrowed from (a older version of) libsl for now, as their new llsd code doesn't work we our decoding code. | ||
41 | /// </summary> | ||
42 | public static class LLSD | ||
43 | { | ||
44 | /// <summary> | ||
45 | /// | ||
46 | /// </summary> | ||
47 | public class LLSDParseException : Exception | ||
48 | { | ||
49 | public LLSDParseException(string message) : base(message) | ||
50 | { | ||
51 | } | ||
52 | } | ||
53 | |||
54 | /// <summary> | ||
55 | /// | ||
56 | /// </summary> | ||
57 | public class LLSDSerializeException : Exception | ||
58 | { | ||
59 | public LLSDSerializeException(string message) : base(message) | ||
60 | { | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /// <summary> | ||
65 | /// | ||
66 | /// </summary> | ||
67 | /// <param name="b"></param> | ||
68 | /// <returns></returns> | ||
69 | public static object LLSDDeserialize(byte[] b) | ||
70 | { | ||
71 | return LLSDDeserialize(new MemoryStream(b, false)); | ||
72 | } | ||
73 | |||
74 | /// <summary> | ||
75 | /// | ||
76 | /// </summary> | ||
77 | /// <param name="st"></param> | ||
78 | /// <returns></returns> | ||
79 | public static object LLSDDeserialize(Stream st) | ||
80 | { | ||
81 | XmlTextReader reader = new XmlTextReader(st); | ||
82 | reader.Read(); | ||
83 | SkipWS(reader); | ||
84 | |||
85 | if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "llsd") | ||
86 | throw new LLSDParseException("Expected <llsd>"); | ||
87 | |||
88 | reader.Read(); | ||
89 | object ret = LLSDParseOne(reader); | ||
90 | SkipWS(reader); | ||
91 | |||
92 | if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "llsd") | ||
93 | throw new LLSDParseException("Expected </llsd>"); | ||
94 | |||
95 | return ret; | ||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// | ||
100 | /// </summary> | ||
101 | /// <param name="obj"></param> | ||
102 | /// <returns></returns> | ||
103 | public static byte[] LLSDSerialize(object obj) | ||
104 | { | ||
105 | StringWriter sw = new StringWriter(); | ||
106 | XmlTextWriter writer = new XmlTextWriter(sw); | ||
107 | writer.Formatting = Formatting.None; | ||
108 | |||
109 | writer.WriteStartElement(String.Empty, "llsd", String.Empty); | ||
110 | LLSDWriteOne(writer, obj); | ||
111 | writer.WriteEndElement(); | ||
112 | |||
113 | writer.Close(); | ||
114 | |||
115 | return Encoding.UTF8.GetBytes(sw.ToString()); | ||
116 | } | ||
117 | |||
118 | /// <summary> | ||
119 | /// | ||
120 | /// </summary> | ||
121 | /// <param name="writer"></param> | ||
122 | /// <param name="obj"></param> | ||
123 | public static void LLSDWriteOne(XmlTextWriter writer, object obj) | ||
124 | { | ||
125 | if (obj == null) | ||
126 | { | ||
127 | writer.WriteStartElement(String.Empty, "undef", String.Empty); | ||
128 | writer.WriteEndElement(); | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | if (obj is string) | ||
133 | { | ||
134 | writer.WriteStartElement(String.Empty, "string", String.Empty); | ||
135 | writer.WriteString((string) obj); | ||
136 | writer.WriteEndElement(); | ||
137 | } | ||
138 | else if (obj is int) | ||
139 | { | ||
140 | writer.WriteStartElement(String.Empty, "integer", String.Empty); | ||
141 | writer.WriteString(obj.ToString()); | ||
142 | writer.WriteEndElement(); | ||
143 | } | ||
144 | else if (obj is double) | ||
145 | { | ||
146 | writer.WriteStartElement(String.Empty, "real", String.Empty); | ||
147 | writer.WriteString(obj.ToString()); | ||
148 | writer.WriteEndElement(); | ||
149 | } | ||
150 | else if (obj is bool) | ||
151 | { | ||
152 | bool b = (bool) obj; | ||
153 | writer.WriteStartElement(String.Empty, "boolean", String.Empty); | ||
154 | writer.WriteString(b ? "1" : "0"); | ||
155 | writer.WriteEndElement(); | ||
156 | } | ||
157 | else if (obj is ulong) | ||
158 | { | ||
159 | throw new Exception("ulong in LLSD is currently not implemented, fix me!"); | ||
160 | } | ||
161 | else if (obj is UUID) | ||
162 | { | ||
163 | UUID u = (UUID) obj; | ||
164 | writer.WriteStartElement(String.Empty, "uuid", String.Empty); | ||
165 | writer.WriteString(u.ToString()); | ||
166 | writer.WriteEndElement(); | ||
167 | } | ||
168 | else if (obj is Hashtable) | ||
169 | { | ||
170 | Hashtable h = obj as Hashtable; | ||
171 | writer.WriteStartElement(String.Empty, "map", String.Empty); | ||
172 | foreach (string key in h.Keys) | ||
173 | { | ||
174 | writer.WriteStartElement(String.Empty, "key", String.Empty); | ||
175 | writer.WriteString(key); | ||
176 | writer.WriteEndElement(); | ||
177 | LLSDWriteOne(writer, h[key]); | ||
178 | } | ||
179 | writer.WriteEndElement(); | ||
180 | } | ||
181 | else if (obj is ArrayList) | ||
182 | { | ||
183 | ArrayList a = obj as ArrayList; | ||
184 | writer.WriteStartElement(String.Empty, "array", String.Empty); | ||
185 | foreach (object item in a) | ||
186 | { | ||
187 | LLSDWriteOne(writer, item); | ||
188 | } | ||
189 | writer.WriteEndElement(); | ||
190 | } | ||
191 | else if (obj is byte[]) | ||
192 | { | ||
193 | byte[] b = obj as byte[]; | ||
194 | writer.WriteStartElement(String.Empty, "binary", String.Empty); | ||
195 | |||
196 | writer.WriteStartAttribute(String.Empty, "encoding", String.Empty); | ||
197 | writer.WriteString("base64"); | ||
198 | writer.WriteEndAttribute(); | ||
199 | |||
200 | //// Calculate the length of the base64 output | ||
201 | //long length = (long)(4.0d * b.Length / 3.0d); | ||
202 | //if (length % 4 != 0) length += 4 - (length % 4); | ||
203 | |||
204 | //// Create the char[] for base64 output and fill it | ||
205 | //char[] tmp = new char[length]; | ||
206 | //int i = Convert.ToBase64CharArray(b, 0, b.Length, tmp, 0); | ||
207 | |||
208 | //writer.WriteString(new String(tmp)); | ||
209 | |||
210 | writer.WriteString(Convert.ToBase64String(b)); | ||
211 | writer.WriteEndElement(); | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | throw new LLSDSerializeException("Unknown type " + obj.GetType().Name); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | /// <summary> | ||
220 | /// | ||
221 | /// </summary> | ||
222 | /// <param name="reader"></param> | ||
223 | /// <returns></returns> | ||
224 | public static object LLSDParseOne(XmlTextReader reader) | ||
225 | { | ||
226 | SkipWS(reader); | ||
227 | if (reader.NodeType != XmlNodeType.Element) | ||
228 | throw new LLSDParseException("Expected an element"); | ||
229 | |||
230 | string dtype = reader.LocalName; | ||
231 | object ret = null; | ||
232 | |||
233 | switch (dtype) | ||
234 | { | ||
235 | case "undef": | ||
236 | { | ||
237 | if (reader.IsEmptyElement) | ||
238 | { | ||
239 | reader.Read(); | ||
240 | return null; | ||
241 | } | ||
242 | |||
243 | reader.Read(); | ||
244 | SkipWS(reader); | ||
245 | ret = null; | ||
246 | break; | ||
247 | } | ||
248 | case "boolean": | ||
249 | { | ||
250 | if (reader.IsEmptyElement) | ||
251 | { | ||
252 | reader.Read(); | ||
253 | return false; | ||
254 | } | ||
255 | |||
256 | reader.Read(); | ||
257 | string s = reader.ReadString().Trim(); | ||
258 | |||
259 | if (s == String.Empty || s == "false" || s == "0") | ||
260 | ret = false; | ||
261 | else if (s == "true" || s == "1") | ||
262 | ret = true; | ||
263 | else | ||
264 | throw new LLSDParseException("Bad boolean value " + s); | ||
265 | |||
266 | break; | ||
267 | } | ||
268 | case "integer": | ||
269 | { | ||
270 | if (reader.IsEmptyElement) | ||
271 | { | ||
272 | reader.Read(); | ||
273 | return 0; | ||
274 | } | ||
275 | |||
276 | reader.Read(); | ||
277 | ret = Convert.ToInt32(reader.ReadString().Trim()); | ||
278 | break; | ||
279 | } | ||
280 | case "real": | ||
281 | { | ||
282 | if (reader.IsEmptyElement) | ||
283 | { | ||
284 | reader.Read(); | ||
285 | return 0.0f; | ||
286 | } | ||
287 | |||
288 | reader.Read(); | ||
289 | ret = Convert.ToDouble(reader.ReadString().Trim()); | ||
290 | break; | ||
291 | } | ||
292 | case "uuid": | ||
293 | { | ||
294 | if (reader.IsEmptyElement) | ||
295 | { | ||
296 | reader.Read(); | ||
297 | return UUID.Zero; | ||
298 | } | ||
299 | |||
300 | reader.Read(); | ||
301 | ret = new UUID(reader.ReadString().Trim()); | ||
302 | break; | ||
303 | } | ||
304 | case "string": | ||
305 | { | ||
306 | if (reader.IsEmptyElement) | ||
307 | { | ||
308 | reader.Read(); | ||
309 | return String.Empty; | ||
310 | } | ||
311 | |||
312 | reader.Read(); | ||
313 | ret = reader.ReadString(); | ||
314 | break; | ||
315 | } | ||
316 | case "binary": | ||
317 | { | ||
318 | if (reader.IsEmptyElement) | ||
319 | { | ||
320 | reader.Read(); | ||
321 | return new byte[0]; | ||
322 | } | ||
323 | |||
324 | if (reader.GetAttribute("encoding") != null && | ||
325 | reader.GetAttribute("encoding") != "base64") | ||
326 | { | ||
327 | throw new LLSDParseException("Unknown encoding: " + reader.GetAttribute("encoding")); | ||
328 | } | ||
329 | |||
330 | reader.Read(); | ||
331 | FromBase64Transform b64 = new FromBase64Transform(FromBase64TransformMode.IgnoreWhiteSpaces); | ||
332 | byte[] inp = Encoding.UTF8.GetBytes(reader.ReadString()); | ||
333 | ret = b64.TransformFinalBlock(inp, 0, inp.Length); | ||
334 | break; | ||
335 | } | ||
336 | case "date": | ||
337 | { | ||
338 | reader.Read(); | ||
339 | throw new Exception("LLSD TODO: date"); | ||
340 | } | ||
341 | case "map": | ||
342 | { | ||
343 | return LLSDParseMap(reader); | ||
344 | } | ||
345 | case "array": | ||
346 | { | ||
347 | return LLSDParseArray(reader); | ||
348 | } | ||
349 | default: | ||
350 | throw new LLSDParseException("Unknown element <" + dtype + ">"); | ||
351 | } | ||
352 | |||
353 | if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != dtype) | ||
354 | { | ||
355 | throw new LLSDParseException("Expected </" + dtype + ">"); | ||
356 | } | ||
357 | |||
358 | reader.Read(); | ||
359 | return ret; | ||
360 | } | ||
361 | |||
362 | /// <summary> | ||
363 | /// | ||
364 | /// </summary> | ||
365 | /// <param name="reader"></param> | ||
366 | /// <returns></returns> | ||
367 | public static Hashtable LLSDParseMap(XmlTextReader reader) | ||
368 | { | ||
369 | Hashtable ret = new Hashtable(); | ||
370 | |||
371 | if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "map") | ||
372 | throw new LLSDParseException("Expected <map>"); | ||
373 | |||
374 | if (reader.IsEmptyElement) | ||
375 | { | ||
376 | reader.Read(); | ||
377 | return ret; | ||
378 | } | ||
379 | |||
380 | reader.Read(); | ||
381 | |||
382 | while (true) | ||
383 | { | ||
384 | SkipWS(reader); | ||
385 | if (reader.NodeType == XmlNodeType.EndElement && reader.LocalName == "map") | ||
386 | { | ||
387 | reader.Read(); | ||
388 | break; | ||
389 | } | ||
390 | |||
391 | if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "key") | ||
392 | throw new LLSDParseException("Expected <key>"); | ||
393 | |||
394 | string key = reader.ReadString(); | ||
395 | |||
396 | if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "key") | ||
397 | throw new LLSDParseException("Expected </key>"); | ||
398 | |||
399 | reader.Read(); | ||
400 | object val = LLSDParseOne(reader); | ||
401 | ret[key] = val; | ||
402 | } | ||
403 | |||
404 | return ret; // TODO | ||
405 | } | ||
406 | |||
407 | /// <summary> | ||
408 | /// | ||
409 | /// </summary> | ||
410 | /// <param name="reader"></param> | ||
411 | /// <returns></returns> | ||
412 | public static ArrayList LLSDParseArray(XmlTextReader reader) | ||
413 | { | ||
414 | ArrayList ret = new ArrayList(); | ||
415 | |||
416 | if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "array") | ||
417 | throw new LLSDParseException("Expected <array>"); | ||
418 | |||
419 | if (reader.IsEmptyElement) | ||
420 | { | ||
421 | reader.Read(); | ||
422 | return ret; | ||
423 | } | ||
424 | |||
425 | reader.Read(); | ||
426 | |||
427 | while (true) | ||
428 | { | ||
429 | SkipWS(reader); | ||
430 | |||
431 | if (reader.NodeType == XmlNodeType.EndElement && reader.LocalName == "array") | ||
432 | { | ||
433 | reader.Read(); | ||
434 | break; | ||
435 | } | ||
436 | |||
437 | ret.Insert(ret.Count, LLSDParseOne(reader)); | ||
438 | } | ||
439 | |||
440 | return ret; // TODO | ||
441 | } | ||
442 | |||
443 | /// <summary> | ||
444 | /// | ||
445 | /// </summary> | ||
446 | /// <param name="count"></param> | ||
447 | /// <returns></returns> | ||
448 | private static string GetSpaces(int count) | ||
449 | { | ||
450 | StringBuilder b = new StringBuilder(); | ||
451 | for (int i = 0; i < count; i++) b.Append(" "); | ||
452 | return b.ToString(); | ||
453 | } | ||
454 | |||
455 | /// <summary> | ||
456 | /// | ||
457 | /// </summary> | ||
458 | /// <param name="obj"></param> | ||
459 | /// <param name="indent"></param> | ||
460 | /// <returns></returns> | ||
461 | public static String LLSDDump(object obj, int indent) | ||
462 | { | ||
463 | if (obj == null) | ||
464 | { | ||
465 | return GetSpaces(indent) + "- undef\n"; | ||
466 | } | ||
467 | else if (obj is string) | ||
468 | { | ||
469 | return GetSpaces(indent) + "- string \"" + (string) obj + "\"\n"; | ||
470 | } | ||
471 | else if (obj is int) | ||
472 | { | ||
473 | return GetSpaces(indent) + "- integer " + obj.ToString() + "\n"; | ||
474 | } | ||
475 | else if (obj is double) | ||
476 | { | ||
477 | return GetSpaces(indent) + "- float " + obj.ToString() + "\n"; | ||
478 | } | ||
479 | else if (obj is UUID) | ||
480 | { | ||
481 | return GetSpaces(indent) + "- uuid " + ((UUID) obj).ToString() + Environment.NewLine; | ||
482 | } | ||
483 | else if (obj is Hashtable) | ||
484 | { | ||
485 | StringBuilder ret = new StringBuilder(); | ||
486 | ret.Append(GetSpaces(indent) + "- map" + Environment.NewLine); | ||
487 | Hashtable map = (Hashtable) obj; | ||
488 | |||
489 | foreach (string key in map.Keys) | ||
490 | { | ||
491 | ret.Append(GetSpaces(indent + 2) + "- key \"" + key + "\"" + Environment.NewLine); | ||
492 | ret.Append(LLSDDump(map[key], indent + 3)); | ||
493 | } | ||
494 | |||
495 | return ret.ToString(); | ||
496 | } | ||
497 | else if (obj is ArrayList) | ||
498 | { | ||
499 | StringBuilder ret = new StringBuilder(); | ||
500 | ret.Append(GetSpaces(indent) + "- array\n"); | ||
501 | ArrayList list = (ArrayList) obj; | ||
502 | |||
503 | foreach (object item in list) | ||
504 | { | ||
505 | ret.Append(LLSDDump(item, indent + 2)); | ||
506 | } | ||
507 | |||
508 | return ret.ToString(); | ||
509 | } | ||
510 | else if (obj is byte[]) | ||
511 | { | ||
512 | return GetSpaces(indent) + "- binary\n" + Utils.BytesToHexString((byte[]) obj, GetSpaces(indent)) + | ||
513 | Environment.NewLine; | ||
514 | } | ||
515 | else | ||
516 | { | ||
517 | return GetSpaces(indent) + "- unknown type " + obj.GetType().Name + Environment.NewLine; | ||
518 | } | ||
519 | } | ||
520 | |||
521 | public static object ParseTerseLLSD(string llsd) | ||
522 | { | ||
523 | int notused; | ||
524 | return ParseTerseLLSD(llsd, out notused); | ||
525 | } | ||
526 | |||
527 | public static object ParseTerseLLSD(string llsd, out int endPos) | ||
528 | { | ||
529 | if (llsd.Length == 0) | ||
530 | { | ||
531 | endPos = 0; | ||
532 | return null; | ||
533 | } | ||
534 | |||
535 | // Identify what type of object this is | ||
536 | switch (llsd[0]) | ||
537 | { | ||
538 | case '!': | ||
539 | throw new LLSDParseException("Undefined value type encountered"); | ||
540 | case '1': | ||
541 | endPos = 1; | ||
542 | return true; | ||
543 | case '0': | ||
544 | endPos = 1; | ||
545 | return false; | ||
546 | case 'i': | ||
547 | { | ||
548 | if (llsd.Length < 2) throw new LLSDParseException("Integer value type with no value"); | ||
549 | int value; | ||
550 | endPos = FindEnd(llsd, 1); | ||
551 | |||
552 | if (Int32.TryParse(llsd.Substring(1, endPos - 1), out value)) | ||
553 | return value; | ||
554 | else | ||
555 | throw new LLSDParseException("Failed to parse integer value type"); | ||
556 | } | ||
557 | case 'r': | ||
558 | { | ||
559 | if (llsd.Length < 2) throw new LLSDParseException("Real value type with no value"); | ||
560 | double value; | ||
561 | endPos = FindEnd(llsd, 1); | ||
562 | |||
563 | if (Double.TryParse(llsd.Substring(1, endPos - 1), NumberStyles.Float, | ||
564 | Utils.EnUsCulture.NumberFormat, out value)) | ||
565 | return value; | ||
566 | else | ||
567 | throw new LLSDParseException("Failed to parse double value type"); | ||
568 | } | ||
569 | case 'u': | ||
570 | { | ||
571 | if (llsd.Length < 17) throw new LLSDParseException("UUID value type with no value"); | ||
572 | UUID value; | ||
573 | endPos = FindEnd(llsd, 1); | ||
574 | |||
575 | if (UUID.TryParse(llsd.Substring(1, endPos - 1), out value)) | ||
576 | return value; | ||
577 | else | ||
578 | throw new LLSDParseException("Failed to parse UUID value type"); | ||
579 | } | ||
580 | case 'b': | ||
581 | //byte[] value = new byte[llsd.Length - 1]; | ||
582 | // This isn't the actual binary LLSD format, just the terse format sent | ||
583 | // at login so I don't even know if there is a binary type | ||
584 | throw new LLSDParseException("Binary value type is unimplemented"); | ||
585 | case 's': | ||
586 | case 'l': | ||
587 | if (llsd.Length < 2) throw new LLSDParseException("String value type with no value"); | ||
588 | endPos = FindEnd(llsd, 1); | ||
589 | return llsd.Substring(1, endPos - 1); | ||
590 | case 'd': | ||
591 | // Never seen one before, don't know what the format is | ||
592 | throw new LLSDParseException("Date value type is unimplemented"); | ||
593 | case '[': | ||
594 | { | ||
595 | if (llsd.IndexOf(']') == -1) throw new LLSDParseException("Invalid array"); | ||
596 | |||
597 | int pos = 0; | ||
598 | ArrayList array = new ArrayList(); | ||
599 | |||
600 | while (llsd[pos] != ']') | ||
601 | { | ||
602 | ++pos; | ||
603 | |||
604 | // Advance past comma if need be | ||
605 | if (llsd[pos] == ',') ++pos; | ||
606 | |||
607 | // Allow a single whitespace character | ||
608 | if (pos < llsd.Length && llsd[pos] == ' ') ++pos; | ||
609 | |||
610 | int end; | ||
611 | array.Add(ParseTerseLLSD(llsd.Substring(pos), out end)); | ||
612 | pos += end; | ||
613 | } | ||
614 | |||
615 | endPos = pos + 1; | ||
616 | return array; | ||
617 | } | ||
618 | case '{': | ||
619 | { | ||
620 | if (llsd.IndexOf('}') == -1) throw new LLSDParseException("Invalid map"); | ||
621 | |||
622 | int pos = 0; | ||
623 | Hashtable hashtable = new Hashtable(); | ||
624 | |||
625 | while (llsd[pos] != '}') | ||
626 | { | ||
627 | ++pos; | ||
628 | |||
629 | // Advance past comma if need be | ||
630 | if (llsd[pos] == ',') ++pos; | ||
631 | |||
632 | // Allow a single whitespace character | ||
633 | if (pos < llsd.Length && llsd[pos] == ' ') ++pos; | ||
634 | |||
635 | if (llsd[pos] != '\'') throw new LLSDParseException("Expected a map key"); | ||
636 | int endquote = llsd.IndexOf('\'', pos + 1); | ||
637 | if (endquote == -1 || (endquote + 1) >= llsd.Length || llsd[endquote + 1] != ':') | ||
638 | throw new LLSDParseException("Invalid map format"); | ||
639 | string key = llsd.Substring(pos, endquote - pos); | ||
640 | key = key.Replace("'", String.Empty); | ||
641 | pos += (endquote - pos) + 2; | ||
642 | |||
643 | int end; | ||
644 | hashtable.Add(key, ParseTerseLLSD(llsd.Substring(pos), out end)); | ||
645 | pos += end; | ||
646 | } | ||
647 | |||
648 | endPos = pos + 1; | ||
649 | return hashtable; | ||
650 | } | ||
651 | default: | ||
652 | throw new Exception("Unknown value type"); | ||
653 | } | ||
654 | } | ||
655 | |||
656 | private static int FindEnd(string llsd, int start) | ||
657 | { | ||
658 | int end = llsd.IndexOfAny(new char[] {',', ']', '}'}); | ||
659 | if (end == -1) end = llsd.Length - 1; | ||
660 | return end; | ||
661 | } | ||
662 | |||
663 | /// <summary> | ||
664 | /// | ||
665 | /// </summary> | ||
666 | /// <param name="reader"></param> | ||
667 | private static void SkipWS(XmlTextReader reader) | ||
668 | { | ||
669 | while ( | ||
670 | reader.NodeType == XmlNodeType.Comment || | ||
671 | reader.NodeType == XmlNodeType.Whitespace || | ||
672 | reader.NodeType == XmlNodeType.SignificantWhitespace || | ||
673 | reader.NodeType == XmlNodeType.XmlDeclaration) | ||
674 | { | ||
675 | reader.Read(); | ||
676 | } | ||
677 | } | ||
678 | } | ||
679 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs deleted file mode 100644 index 40e588f..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using System.Collections; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.Capabilities | ||
31 | { | ||
32 | [LLSDType("ARRAY")] | ||
33 | public class OSDArray | ||
34 | { | ||
35 | public ArrayList Array = new ArrayList(); | ||
36 | |||
37 | public OSDArray() | ||
38 | { | ||
39 | } | ||
40 | } | ||
41 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs deleted file mode 100644 index 3a31523..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | |||
31 | namespace OpenSim.Framework.Communications.Capabilities | ||
32 | { | ||
33 | [LLSDType("MAP")] | ||
34 | public class LLSDAssetUploadComplete | ||
35 | { | ||
36 | public string new_asset = String.Empty; | ||
37 | public UUID new_inventory_item = UUID.Zero; | ||
38 | public string state = String.Empty; | ||
39 | //public bool success = false; | ||
40 | |||
41 | public LLSDAssetUploadComplete() | ||
42 | { | ||
43 | } | ||
44 | } | ||
45 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs deleted file mode 100644 index 45c0afb..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | |||
31 | namespace OpenSim.Framework.Communications.Capabilities | ||
32 | { | ||
33 | [OSDMap] | ||
34 | public class LLSDAssetUploadRequest | ||
35 | { | ||
36 | public string asset_type = String.Empty; | ||
37 | public string description = String.Empty; | ||
38 | public UUID folder_id = UUID.Zero; | ||
39 | public string inventory_type = String.Empty; | ||
40 | public string name = String.Empty; | ||
41 | |||
42 | public LLSDAssetUploadRequest() | ||
43 | { | ||
44 | } | ||
45 | } | ||
46 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs deleted file mode 100644 index 36adb93..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using System; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.Capabilities | ||
31 | { | ||
32 | [OSDMap] | ||
33 | public class LLSDAssetUploadResponse | ||
34 | { | ||
35 | public string uploader = String.Empty; | ||
36 | public string state = String.Empty; | ||
37 | |||
38 | public LLSDAssetUploadResponse() | ||
39 | { | ||
40 | } | ||
41 | } | ||
42 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs deleted file mode 100644 index 8e5c197..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | namespace OpenSim.Framework.Communications.Capabilities | ||
29 | { | ||
30 | [LLSDType("MAP")] | ||
31 | public class LLSDCapEvent | ||
32 | { | ||
33 | public int id = 0; | ||
34 | public OSDArray events = new OSDArray(); | ||
35 | |||
36 | public LLSDCapEvent() | ||
37 | { | ||
38 | } | ||
39 | } | ||
40 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs deleted file mode 100644 index d49ee1a..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | namespace OpenSim.Framework.Communications.Capabilities | ||
29 | { | ||
30 | [LLSDType("MAP")] | ||
31 | public class LLSDEmpty | ||
32 | { | ||
33 | public LLSDEmpty() | ||
34 | { | ||
35 | } | ||
36 | } | ||
37 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs deleted file mode 100644 index 3316b3f..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs +++ /dev/null | |||
@@ -1,172 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using System.Xml; | ||
33 | |||
34 | namespace OpenSim.Framework.Communications.Capabilities | ||
35 | { | ||
36 | public class LLSDHelpers | ||
37 | { | ||
38 | // private static readonly log4net.ILog m_log | ||
39 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | |||
41 | public static string SerialiseLLSDReply(object obj) | ||
42 | { | ||
43 | StringWriter sw = new StringWriter(); | ||
44 | XmlTextWriter writer = new XmlTextWriter(sw); | ||
45 | writer.Formatting = Formatting.None; | ||
46 | writer.WriteStartElement(String.Empty, "llsd", String.Empty); | ||
47 | SerializeOSDType(writer, obj); | ||
48 | writer.WriteEndElement(); | ||
49 | writer.Close(); | ||
50 | |||
51 | //m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString()); | ||
52 | |||
53 | return sw.ToString(); | ||
54 | } | ||
55 | |||
56 | private static void SerializeOSDType(XmlTextWriter writer, object obj) | ||
57 | { | ||
58 | Type myType = obj.GetType(); | ||
59 | LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false); | ||
60 | if (llsdattributes.Length > 0) | ||
61 | { | ||
62 | switch (llsdattributes[0].ObjectType) | ||
63 | { | ||
64 | case "MAP": | ||
65 | writer.WriteStartElement(String.Empty, "map", String.Empty); | ||
66 | FieldInfo[] fields = myType.GetFields(); | ||
67 | for (int i = 0; i < fields.Length; i++) | ||
68 | { | ||
69 | if (fields[i] != null && fields[i].GetValue(obj) != null) | ||
70 | { | ||
71 | object fieldValue = fields[i].GetValue(obj); | ||
72 | LLSDType[] fieldAttributes = | ||
73 | (LLSDType[]) fieldValue.GetType().GetCustomAttributes(typeof (LLSDType), false); | ||
74 | if (fieldAttributes.Length > 0) | ||
75 | { | ||
76 | writer.WriteStartElement(String.Empty, "key", String.Empty); | ||
77 | string fieldName = fields[i].Name; | ||
78 | fieldName = fieldName.Replace("___", "-"); | ||
79 | writer.WriteString(fieldName); | ||
80 | writer.WriteEndElement(); | ||
81 | SerializeOSDType(writer, fieldValue); | ||
82 | } | ||
83 | else | ||
84 | { | ||
85 | writer.WriteStartElement(String.Empty, "key", String.Empty); | ||
86 | string fieldName = fields[i].Name; | ||
87 | fieldName = fieldName.Replace("___", "-"); | ||
88 | writer.WriteString(fieldName); | ||
89 | writer.WriteEndElement(); | ||
90 | LLSD.LLSDWriteOne(writer, fieldValue); | ||
91 | // OpenMetaverse.StructuredData.LLSDParser.SerializeXmlElement( | ||
92 | // writer, OpenMetaverse.StructuredData.OSD.FromObject(fieldValue)); | ||
93 | } | ||
94 | } | ||
95 | else | ||
96 | { | ||
97 | // TODO from ADAM: There is a nullref being caused by fields[i] being null | ||
98 | // on some computers. Unsure what is causing this, but would appreciate | ||
99 | // if sdague could take a look at this. | ||
100 | } | ||
101 | } | ||
102 | writer.WriteEndElement(); | ||
103 | break; | ||
104 | case "ARRAY": | ||
105 | // OSDArray arrayObject = obj as OSDArray; | ||
106 | // ArrayList a = arrayObject.Array; | ||
107 | ArrayList a = (ArrayList) obj.GetType().GetField("Array").GetValue(obj); | ||
108 | if (a != null) | ||
109 | { | ||
110 | writer.WriteStartElement(String.Empty, "array", String.Empty); | ||
111 | foreach (object item in a) | ||
112 | { | ||
113 | SerializeOSDType(writer, item); | ||
114 | } | ||
115 | writer.WriteEndElement(); | ||
116 | } | ||
117 | break; | ||
118 | } | ||
119 | } | ||
120 | else | ||
121 | { | ||
122 | LLSD.LLSDWriteOne(writer, obj); | ||
123 | //OpenMetaverse.StructuredData.LLSDParser.SerializeXmlElement( | ||
124 | // writer, OpenMetaverse.StructuredData.OSD.FromObject(obj)); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | public static object DeserialiseOSDMap(Hashtable llsd, object obj) | ||
129 | { | ||
130 | Type myType = obj.GetType(); | ||
131 | LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false); | ||
132 | if (llsdattributes.Length > 0) | ||
133 | { | ||
134 | switch (llsdattributes[0].ObjectType) | ||
135 | { | ||
136 | case "MAP": | ||
137 | IDictionaryEnumerator enumerator = llsd.GetEnumerator(); | ||
138 | while (enumerator.MoveNext()) | ||
139 | { | ||
140 | string keyName = (string)enumerator.Key; | ||
141 | keyName = keyName.Replace("-","_"); | ||
142 | FieldInfo field = myType.GetField(keyName); | ||
143 | if (field != null) | ||
144 | { | ||
145 | // if (enumerator.Value is OpenMetaverse.StructuredData.OSDMap) | ||
146 | if (enumerator.Value is Hashtable) | ||
147 | { | ||
148 | object fieldValue = field.GetValue(obj); | ||
149 | DeserialiseOSDMap((Hashtable) enumerator.Value, fieldValue); | ||
150 | // DeserialiseOSDMap((OpenMetaverse.StructuredData.OSDMap) enumerator.Value, fieldValue); | ||
151 | } | ||
152 | else if (enumerator.Value is ArrayList) | ||
153 | { | ||
154 | object fieldValue = field.GetValue(obj); | ||
155 | fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value); | ||
156 | //TODO | ||
157 | // the LLSD map/array types in the array need to be deserialised | ||
158 | // but first we need to know the right class to deserialise them into. | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | field.SetValue(obj, enumerator.Value); | ||
163 | } | ||
164 | } | ||
165 | } | ||
166 | break; | ||
167 | } | ||
168 | } | ||
169 | return obj; | ||
170 | } | ||
171 | } | ||
172 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs b/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs deleted file mode 100644 index b0b463f..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.Capabilities | ||
31 | { | ||
32 | [OSDMap] | ||
33 | public class LLSDInventoryItem | ||
34 | { | ||
35 | public UUID parent_id; | ||
36 | |||
37 | public UUID asset_id; | ||
38 | public UUID item_id; | ||
39 | public LLSDPermissions permissions; | ||
40 | public string type; | ||
41 | public string inv_type; | ||
42 | public int flags; | ||
43 | |||
44 | public LLSDSaleInfo sale_info; | ||
45 | public string name; | ||
46 | public string desc; | ||
47 | public int created_at; | ||
48 | } | ||
49 | |||
50 | [OSDMap] | ||
51 | public class LLSDPermissions | ||
52 | { | ||
53 | public UUID creator_id; | ||
54 | public UUID owner_id; | ||
55 | public UUID group_id; | ||
56 | public int base_mask; | ||
57 | public int owner_mask; | ||
58 | public int group_mask; | ||
59 | public int everyone_mask; | ||
60 | public int next_owner_mask; | ||
61 | public bool is_owner_group; | ||
62 | } | ||
63 | |||
64 | [OSDMap] | ||
65 | public class LLSDSaleInfo | ||
66 | { | ||
67 | public int sale_price; | ||
68 | public string sale_type; | ||
69 | } | ||
70 | |||
71 | [OSDMap] | ||
72 | public class LLSDInventoryDescendents | ||
73 | { | ||
74 | public OSDArray folders = new OSDArray(); | ||
75 | } | ||
76 | |||
77 | [OSDMap] | ||
78 | public class LLSDFetchInventoryDescendents | ||
79 | { | ||
80 | public UUID folder_id; | ||
81 | public UUID owner_id; | ||
82 | public int sort_order; | ||
83 | public bool fetch_folders; | ||
84 | public bool fetch_items; | ||
85 | } | ||
86 | |||
87 | [OSDMap] | ||
88 | public class LLSDInventoryFolderContents | ||
89 | { | ||
90 | public UUID agent_id; | ||
91 | public int descendents; | ||
92 | public UUID folder_id; | ||
93 | public OSDArray items = new OSDArray(); | ||
94 | public UUID owner_id; | ||
95 | public int version; | ||
96 | } | ||
97 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs deleted file mode 100644 index 8ddb492..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.Capabilities | ||
31 | { | ||
32 | [OSDMap] | ||
33 | public class LLSDItemUpdate | ||
34 | { | ||
35 | public UUID item_id; | ||
36 | |||
37 | public LLSDItemUpdate() | ||
38 | { | ||
39 | } | ||
40 | } | ||
41 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs deleted file mode 100644 index d012b8f..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.Capabilities | ||
31 | { | ||
32 | [LLSDType("MAP")] | ||
33 | public class OSDMapLayer | ||
34 | { | ||
35 | public int Left = 0; | ||
36 | public int Right = 0; | ||
37 | public int Top = 0; | ||
38 | public int Bottom = 0; | ||
39 | public UUID ImageID = UUID.Zero; | ||
40 | |||
41 | public OSDMapLayer() | ||
42 | { | ||
43 | } | ||
44 | } | ||
45 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs deleted file mode 100644 index 4acc736..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | namespace OpenSim.Framework.Communications.Capabilities | ||
29 | { | ||
30 | [LLSDType("MAP")] | ||
31 | public class LLSDMapLayerResponse | ||
32 | { | ||
33 | public LLSDMapRequest AgentData = new LLSDMapRequest(); | ||
34 | public OSDArray LayerData = new OSDArray(); | ||
35 | |||
36 | public LLSDMapLayerResponse() | ||
37 | { | ||
38 | } | ||
39 | } | ||
40 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs deleted file mode 100644 index c528208..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | namespace OpenSim.Framework.Communications.Capabilities | ||
29 | { | ||
30 | [LLSDType("MAP")] | ||
31 | public class LLSDMapRequest | ||
32 | { | ||
33 | public int Flags = 0; | ||
34 | |||
35 | public LLSDMapRequest() | ||
36 | { | ||
37 | } | ||
38 | } | ||
39 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs deleted file mode 100644 index 0ef4838..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | namespace OpenSim.Framework.Communications.Capabilities | ||
29 | { | ||
30 | public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); | ||
31 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMethodString.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMethodString.cs deleted file mode 100644 index 68c3d75..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMethodString.cs +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | namespace OpenSim.Framework.Communications.Capabilities | ||
29 | { | ||
30 | public delegate TResponse LLSDMethodString<TRequest, TResponse>(TRequest request, string path); | ||
31 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDParcelVoiceInfoResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDParcelVoiceInfoResponse.cs deleted file mode 100644 index e8d3c21..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDParcelVoiceInfoResponse.cs +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | */ | ||
28 | |||
29 | using System.Collections; | ||
30 | |||
31 | namespace OpenSim.Framework.Communications.Capabilities | ||
32 | { | ||
33 | [OSDMap] | ||
34 | public class LLSDParcelVoiceInfoResponse | ||
35 | { | ||
36 | public int parcel_local_id; | ||
37 | public string region_name; | ||
38 | public Hashtable voice_credentials; | ||
39 | |||
40 | public LLSDParcelVoiceInfoResponse() | ||
41 | { | ||
42 | } | ||
43 | |||
44 | public LLSDParcelVoiceInfoResponse(string region, int localID, Hashtable creds) | ||
45 | { | ||
46 | region_name = region; | ||
47 | parcel_local_id = localID; | ||
48 | voice_credentials = creds; | ||
49 | } | ||
50 | } | ||
51 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDRemoteParcelResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDRemoteParcelResponse.cs deleted file mode 100644 index 6ad2db9..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDRemoteParcelResponse.cs +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | */ | ||
28 | |||
29 | using OpenMetaverse; | ||
30 | |||
31 | namespace OpenSim.Framework.Communications.Capabilities | ||
32 | { | ||
33 | [LLSDType("MAP")] | ||
34 | public class LLSDRemoteParcelResponse | ||
35 | { | ||
36 | public UUID parcel_id; | ||
37 | |||
38 | public LLSDRemoteParcelResponse() | ||
39 | { | ||
40 | } | ||
41 | } | ||
42 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs deleted file mode 100644 index a55b86d..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using System.Collections; | ||
29 | using System.IO; | ||
30 | using System.Text; | ||
31 | using OpenSim.Framework.Servers; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | ||
33 | |||
34 | namespace OpenSim.Framework.Communications.Capabilities | ||
35 | { | ||
36 | public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler | ||
37 | where TRequest : new() | ||
38 | { | ||
39 | private LLSDMethod<TRequest, TResponse> m_method; | ||
40 | |||
41 | public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) | ||
42 | : base(httpMethod, path) | ||
43 | { | ||
44 | m_method = method; | ||
45 | } | ||
46 | |||
47 | public override byte[] Handle(string path, Stream request, | ||
48 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
49 | { | ||
50 | //Encoding encoding = Encoding.UTF8; | ||
51 | //StreamReader streamReader = new StreamReader(request, false); | ||
52 | |||
53 | //string requestBody = streamReader.ReadToEnd(); | ||
54 | //streamReader.Close(); | ||
55 | |||
56 | // OpenMetaverse.StructuredData.OSDMap hash = (OpenMetaverse.StructuredData.OSDMap) | ||
57 | // OpenMetaverse.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request)); | ||
58 | |||
59 | Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request); | ||
60 | TRequest llsdRequest = new TRequest(); | ||
61 | LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest); | ||
62 | |||
63 | TResponse response = m_method(llsdRequest); | ||
64 | |||
65 | Encoding encoding = new UTF8Encoding(false); | ||
66 | |||
67 | return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); | ||
68 | } | ||
69 | } | ||
70 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs deleted file mode 100644 index c359770..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.Capabilities | ||
31 | { | ||
32 | [OSDMap] | ||
33 | public class LLSDTaskInventoryUploadComplete | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// The task inventory item that was updated | ||
37 | /// </summary> | ||
38 | public UUID item_id; | ||
39 | |||
40 | /// <summary> | ||
41 | /// The task that was updated | ||
42 | /// </summary> | ||
43 | public UUID task_id; | ||
44 | |||
45 | /// <summary> | ||
46 | /// State of the upload. So far have only even seen this set to "complete" | ||
47 | /// </summary> | ||
48 | public string state; | ||
49 | } | ||
50 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs deleted file mode 100644 index 4bcf715..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.Capabilities | ||
31 | { | ||
32 | [OSDMap] | ||
33 | public class LLSDTaskScriptUpdate | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// The item containing the script to update | ||
37 | /// </summary> | ||
38 | public UUID item_id; | ||
39 | |||
40 | /// <summary> | ||
41 | /// The task containing the script | ||
42 | /// </summary> | ||
43 | public UUID task_id; | ||
44 | |||
45 | /// <summary> | ||
46 | /// Signals whether the script is currently active | ||
47 | /// </summary> | ||
48 | public int is_script_running; | ||
49 | } | ||
50 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs deleted file mode 100644 index 6bed9cf..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | namespace OpenSim.Framework.Communications.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 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs deleted file mode 100644 index f3f5158..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | |||
28 | using System; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.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 | public string ObjectType | ||
43 | { | ||
44 | get { return myType; } | ||
45 | } | ||
46 | } | ||
47 | |||
48 | [AttributeUsage(AttributeTargets.Class)] | ||
49 | public class OSDMap : LLSDType | ||
50 | { | ||
51 | public OSDMap() : base("MAP") | ||
52 | { | ||
53 | } | ||
54 | } | ||
55 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDVoiceAccountResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDVoiceAccountResponse.cs deleted file mode 100644 index 06812aa..0000000 --- a/OpenSim/Framework/Communications/Capabilities/LLSDVoiceAccountResponse.cs +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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 | */ | ||
28 | |||
29 | namespace OpenSim.Framework.Communications.Capabilities | ||
30 | { | ||
31 | [OSDMap] | ||
32 | public class LLSDVoiceAccountResponse | ||
33 | { | ||
34 | public string username; | ||
35 | public string password; | ||
36 | public string voice_sip_uri_hostname; | ||
37 | public string voice_account_server_name; | ||
38 | |||
39 | public LLSDVoiceAccountResponse() | ||
40 | { | ||
41 | } | ||
42 | |||
43 | public LLSDVoiceAccountResponse(string user, string pass) | ||
44 | { | ||
45 | username = user; | ||
46 | password = pass; | ||
47 | } | ||
48 | |||
49 | public LLSDVoiceAccountResponse(string user, string pass, string sipUriHost, string accountServer) | ||
50 | { | ||
51 | username = user; | ||
52 | password = pass; | ||
53 | voice_sip_uri_hostname = sipUriHost; | ||
54 | voice_account_server_name = accountServer; | ||
55 | } | ||
56 | } | ||
57 | } \ No newline at end of file | ||