diff options
Diffstat (limited to 'OpenSim/Framework/Communications/Capabilities/Caps.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Capabilities/Caps.cs | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index e00f49d..4b42046 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -38,33 +38,33 @@ using OpenSim.Framework.Servers; | |||
38 | namespace OpenSim.Region.Capabilities | 38 | namespace OpenSim.Region.Capabilities |
39 | { | 39 | { |
40 | public delegate void UpLoadedAsset( | 40 | public delegate void UpLoadedAsset( |
41 | string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, | 41 | string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, |
42 | byte[] data, string inventoryType, string assetType); | 42 | byte[] data, string inventoryType, string assetType); |
43 | 43 | ||
44 | public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); | 44 | public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); |
45 | 45 | ||
46 | public delegate void UpdateTaskScript(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data); | 46 | public delegate void UpdateTaskScript(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data); |
47 | 47 | ||
48 | public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); | 48 | public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); |
49 | 49 | ||
50 | public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); | 50 | public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); |
51 | 51 | ||
52 | public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID, | 52 | public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID, |
53 | bool isScriptRunning, byte[] data); | 53 | bool isScriptRunning, byte[] data); |
54 | 54 | ||
55 | public class Caps | 55 | public class Caps |
56 | { | 56 | { |
57 | private string m_httpListenerHostName; | 57 | private string m_httpListenerHostName; |
58 | private uint m_httpListenPort; | 58 | private uint m_httpListenPort; |
59 | 59 | ||
60 | private string m_capsObjectPath = "00001-"; | 60 | private string m_capsObjectPath = "00001-"; |
61 | private string m_requestPath = "0000/"; | 61 | private string m_requestPath = "0000/"; |
62 | private string m_mapLayerPath = "0001/"; | 62 | private string m_mapLayerPath = "0001/"; |
63 | private string m_newInventory = "0002/"; | 63 | private string m_newInventory = "0002/"; |
64 | //private string m_requestTexture = "0003/"; | 64 | //private string m_requestTexture = "0003/"; |
65 | private string m_notecardUpdatePath = "0004/"; | 65 | private string m_notecardUpdatePath = "0004/"; |
66 | private string m_notecardTaskUpdatePath = "0005/"; | 66 | private string m_notecardTaskUpdatePath = "0005/"; |
67 | 67 | ||
68 | //private string eventQueue = "0100/"; | 68 | //private string eventQueue = "0100/"; |
69 | private BaseHttpServer m_httpListener; | 69 | private BaseHttpServer m_httpListener; |
70 | private LLUUID m_agentID; | 70 | private LLUUID m_agentID; |
@@ -78,7 +78,7 @@ namespace OpenSim.Region.Capabilities | |||
78 | public NewInventoryItem AddNewInventoryItem = null; | 78 | public NewInventoryItem AddNewInventoryItem = null; |
79 | public ItemUpdatedCallback ItemUpdatedCall = null; | 79 | public ItemUpdatedCallback ItemUpdatedCall = null; |
80 | public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; | 80 | public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; |
81 | 81 | ||
82 | public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, | 82 | public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, |
83 | LLUUID agent, bool dumpAssetsToFile) | 83 | LLUUID agent, bool dumpAssetsToFile) |
84 | { | 84 | { |
@@ -138,7 +138,7 @@ namespace OpenSim.Region.Capabilities | |||
138 | /// <returns></returns> | 138 | /// <returns></returns> |
139 | public string CapsRequest(string request, string path, string param) | 139 | public string CapsRequest(string request, string path, string param) |
140 | { | 140 | { |
141 | //Console.WriteLine("caps request " + request); | 141 | //Console.WriteLine("caps request " + request); |
142 | string result = LLSDHelpers.SerialiseLLSDReply(GetCapabilities()); | 142 | string result = LLSDHelpers.SerialiseLLSDReply(GetCapabilities()); |
143 | return result; | 143 | return result; |
144 | } | 144 | } |
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Capabilities | |||
153 | string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + | 153 | string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + |
154 | m_capsObjectPath; | 154 | m_capsObjectPath; |
155 | caps.MapLayer = capsBaseUrl + m_mapLayerPath; | 155 | caps.MapLayer = capsBaseUrl + m_mapLayerPath; |
156 | // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; | 156 | // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; |
157 | caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; | 157 | caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; |
158 | caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; | 158 | caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; |
159 | caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; | 159 | caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; |
@@ -262,7 +262,7 @@ namespace OpenSim.Region.Capabilities | |||
262 | } | 262 | } |
263 | 263 | ||
264 | #endregion | 264 | #endregion |
265 | 265 | ||
266 | /// <summary> | 266 | /// <summary> |
267 | /// Callback for a client request for an upload url for a script task | 267 | /// Callback for a client request for an upload url for a script task |
268 | /// inventory update | 268 | /// inventory update |
@@ -272,28 +272,28 @@ namespace OpenSim.Region.Capabilities | |||
272 | /// <param name="param"></param> | 272 | /// <param name="param"></param> |
273 | /// <returns></returns> | 273 | /// <returns></returns> |
274 | public string ScriptTaskInventory(string request, string path, string param) | 274 | public string ScriptTaskInventory(string request, string path, string param) |
275 | { | 275 | { |
276 | try | 276 | try |
277 | { | 277 | { |
278 | // MainLog.Instance.Debug("CAPS", "request: {0}, path: {1}, param: {2}", request, path, param); | 278 | // MainLog.Instance.Debug("CAPS", "request: {0}, path: {1}, param: {2}", request, path, param); |
279 | 279 | ||
280 | Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); | 280 | Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request)); |
281 | LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); | 281 | LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); |
282 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdUpdateRequest); | 282 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdUpdateRequest); |
283 | 283 | ||
284 | string capsBase = "/CAPS/" + m_capsObjectPath; | 284 | string capsBase = "/CAPS/" + m_capsObjectPath; |
285 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 285 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
286 | 286 | ||
287 | TaskInventoryScriptUpdater uploader = | 287 | TaskInventoryScriptUpdater uploader = |
288 | new TaskInventoryScriptUpdater( | 288 | new TaskInventoryScriptUpdater( |
289 | llsdUpdateRequest.item_id, | 289 | llsdUpdateRequest.item_id, |
290 | llsdUpdateRequest.task_id, | 290 | llsdUpdateRequest.task_id, |
291 | llsdUpdateRequest.is_script_running, | 291 | llsdUpdateRequest.is_script_running, |
292 | capsBase + uploaderPath, | 292 | capsBase + uploaderPath, |
293 | m_httpListener, | 293 | m_httpListener, |
294 | m_dumpAssetsToFile); | 294 | m_dumpAssetsToFile); |
295 | uploader.OnUpLoad += TaskScriptUpdated; | 295 | uploader.OnUpLoad += TaskScriptUpdated; |
296 | 296 | ||
297 | m_httpListener.AddStreamHandler( | 297 | m_httpListener.AddStreamHandler( |
298 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 298 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); |
299 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + | 299 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + |
@@ -302,13 +302,13 @@ namespace OpenSim.Region.Capabilities | |||
302 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | 302 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); |
303 | uploadResponse.uploader = uploaderURL; | 303 | uploadResponse.uploader = uploaderURL; |
304 | uploadResponse.state = "upload"; | 304 | uploadResponse.state = "upload"; |
305 | 305 | ||
306 | // MainLog.Instance.Verbose( | 306 | // MainLog.Instance.Verbose( |
307 | // "CAPS", | 307 | // "CAPS", |
308 | // "ScriptTaskInventory response: {0}", | 308 | // "ScriptTaskInventory response: {0}", |
309 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse)); | 309 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse)); |
310 | 310 | ||
311 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | 311 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); |
312 | } | 312 | } |
313 | catch (Exception e) | 313 | catch (Exception e) |
314 | { | 314 | { |
@@ -329,7 +329,7 @@ namespace OpenSim.Region.Capabilities | |||
329 | public string NoteCardAgentInventory(string request, string path, string param) | 329 | public string NoteCardAgentInventory(string request, string path, string param) |
330 | { | 330 | { |
331 | //libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)libsecondlife.StructuredData.LLSDParser.DeserializeBinary(Helpers.StringToField(request)); | 331 | //libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)libsecondlife.StructuredData.LLSDParser.DeserializeBinary(Helpers.StringToField(request)); |
332 | Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); | 332 | Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request)); |
333 | LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); | 333 | LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); |
334 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); | 334 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); |
335 | 335 | ||
@@ -353,7 +353,7 @@ namespace OpenSim.Region.Capabilities | |||
353 | // "CAPS", | 353 | // "CAPS", |
354 | // "NoteCardAgentInventory response: {0}", | 354 | // "NoteCardAgentInventory response: {0}", |
355 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse)); | 355 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse)); |
356 | 356 | ||
357 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | 357 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); |
358 | } | 358 | } |
359 | 359 | ||
@@ -453,7 +453,7 @@ namespace OpenSim.Region.Capabilities | |||
453 | { | 453 | { |
454 | return ItemUpdatedCall(m_agentID, itemID, data); | 454 | return ItemUpdatedCall(m_agentID, itemID, data); |
455 | } | 455 | } |
456 | 456 | ||
457 | return LLUUID.Zero; | 457 | return LLUUID.Zero; |
458 | } | 458 | } |
459 | 459 | ||
@@ -613,7 +613,7 @@ namespace OpenSim.Region.Capabilities | |||
613 | fs.Close(); | 613 | fs.Close(); |
614 | } | 614 | } |
615 | } | 615 | } |
616 | 616 | ||
617 | /// <summary> | 617 | /// <summary> |
618 | /// This class is a callback invoked when a client sends asset data to | 618 | /// This class is a callback invoked when a client sends asset data to |
619 | /// a task inventory script update url | 619 | /// a task inventory script update url |
@@ -629,17 +629,17 @@ namespace OpenSim.Region.Capabilities | |||
629 | private BaseHttpServer httpListener; | 629 | private BaseHttpServer httpListener; |
630 | private bool m_dumpAssetToFile; | 630 | private bool m_dumpAssetToFile; |
631 | 631 | ||
632 | public TaskInventoryScriptUpdater(LLUUID inventoryItemID, LLUUID primID, int isScriptRunning, | 632 | public TaskInventoryScriptUpdater(LLUUID inventoryItemID, LLUUID primID, int isScriptRunning, |
633 | string path, BaseHttpServer httpServer, bool dumpAssetToFile) | 633 | string path, BaseHttpServer httpServer, bool dumpAssetToFile) |
634 | { | 634 | { |
635 | m_dumpAssetToFile = dumpAssetToFile; | 635 | m_dumpAssetToFile = dumpAssetToFile; |
636 | 636 | ||
637 | this.inventoryItemID = inventoryItemID; | 637 | this.inventoryItemID = inventoryItemID; |
638 | this.primID = primID; | 638 | this.primID = primID; |
639 | 639 | ||
640 | // This comes in over the packet as an integer, but actually appears to be treated as a bool | 640 | // This comes in over the packet as an integer, but actually appears to be treated as a bool |
641 | this.isScriptRunning = (0 == isScriptRunning ? false : true); | 641 | this.isScriptRunning = (0 == isScriptRunning ? false : true); |
642 | 642 | ||
643 | uploaderPath = path; | 643 | uploaderPath = path; |
644 | httpListener = httpServer; | 644 | httpListener = httpServer; |
645 | } | 645 | } |
@@ -659,7 +659,7 @@ namespace OpenSim.Region.Capabilities | |||
659 | // "CAPS", | 659 | // "CAPS", |
660 | // "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", | 660 | // "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", |
661 | // data, path, param); | 661 | // data, path, param); |
662 | 662 | ||
663 | string res = ""; | 663 | string res = ""; |
664 | LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete(); | 664 | LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete(); |
665 | 665 | ||
@@ -668,7 +668,7 @@ namespace OpenSim.Region.Capabilities | |||
668 | OnUpLoad(inventoryItemID, primID, isScriptRunning, data); | 668 | OnUpLoad(inventoryItemID, primID, isScriptRunning, data); |
669 | } | 669 | } |
670 | 670 | ||
671 | uploadComplete.item_id = inventoryItemID; | 671 | uploadComplete.item_id = inventoryItemID; |
672 | uploadComplete.task_id = primID; | 672 | uploadComplete.task_id = primID; |
673 | uploadComplete.state = "complete"; | 673 | uploadComplete.state = "complete"; |
674 | 674 | ||
@@ -680,7 +680,7 @@ namespace OpenSim.Region.Capabilities | |||
680 | { | 680 | { |
681 | SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data); | 681 | SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data); |
682 | } | 682 | } |
683 | 683 | ||
684 | // MainLog.Instance.Verbose("CAPS", "TaskInventoryScriptUpdater.uploaderCaps res: {0}", res); | 684 | // MainLog.Instance.Verbose("CAPS", "TaskInventoryScriptUpdater.uploaderCaps res: {0}", res); |
685 | 685 | ||
686 | return res; | 686 | return res; |
@@ -689,9 +689,9 @@ namespace OpenSim.Region.Capabilities | |||
689 | { | 689 | { |
690 | MainLog.Instance.Error("CAPS", e.ToString()); | 690 | MainLog.Instance.Error("CAPS", e.ToString()); |
691 | } | 691 | } |
692 | 692 | ||
693 | // XXX Maybe this should be some meaningful error packet | 693 | // XXX Maybe this should be some meaningful error packet |
694 | return null; | 694 | return null; |
695 | } | 695 | } |
696 | 696 | ||
697 | private void SaveAssetToFile(string filename, byte[] data) | 697 | private void SaveAssetToFile(string filename, byte[] data) |
@@ -702,6 +702,6 @@ namespace OpenSim.Region.Capabilities | |||
702 | bw.Close(); | 702 | bw.Close(); |
703 | fs.Close(); | 703 | fs.Close(); |
704 | } | 704 | } |
705 | } | 705 | } |
706 | } | 706 | } |
707 | } | 707 | } \ No newline at end of file |