diff options
Diffstat (limited to '')
31 files changed, 596 insertions, 81 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index c07744c..b6ee04d 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -32,11 +32,10 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using log4net; | 34 | using log4net; |
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
37 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
38 | 37 | ||
39 | namespace OpenSim.Region.Capabilities | 38 | namespace OpenSim.Framework.Communications.Capabilities |
40 | { | 39 | { |
41 | public delegate void UpLoadedAsset( | 40 | public delegate void UpLoadedAsset( |
42 | string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, | 41 | string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, |
@@ -54,8 +53,8 @@ namespace OpenSim.Region.Capabilities | |||
54 | bool isScriptRunning, byte[] data); | 53 | bool isScriptRunning, byte[] data); |
55 | 54 | ||
56 | public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID, | 55 | public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID, |
57 | bool fetchFolders, bool fetchItems, int sortOrder); | 56 | bool fetchFolders, bool fetchItems, int sortOrder); |
58 | 57 | ||
59 | /// <summary> | 58 | /// <summary> |
60 | /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that | 59 | /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that |
61 | /// we can popup a message on the user's client if the inventory service has permanently failed). But I didn't want | 60 | /// we can popup a message on the user's client if the inventory service has permanently failed). But I didn't want |
@@ -397,7 +396,7 @@ namespace OpenSim.Region.Capabilities | |||
397 | /// <returns></returns> | 396 | /// <returns></returns> |
398 | public string RequestTexture(string request, string path, string param) | 397 | public string RequestTexture(string request, string path, string param) |
399 | { | 398 | { |
400 | Console.WriteLine("texture request " + request); | 399 | System.Console.WriteLine("texture request " + request); |
401 | // Needs implementing (added to remove compiler warning) | 400 | // Needs implementing (added to remove compiler warning) |
402 | return String.Empty; | 401 | return String.Empty; |
403 | } | 402 | } |
@@ -961,4 +960,4 @@ namespace OpenSim.Region.Capabilities | |||
961 | } | 960 | } |
962 | } | 961 | } |
963 | } | 962 | } |
964 | } | 963 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs index f101131..e76a5c5 100644 --- a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs +++ b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs | |||
@@ -29,7 +29,7 @@ using System.Collections; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenSim.Framework.Servers; | 30 | using OpenSim.Framework.Servers; |
31 | 31 | ||
32 | namespace OpenSim.Region.Capabilities | 32 | namespace OpenSim.Framework.Communications.Capabilities |
33 | { | 33 | { |
34 | /// <summary> | 34 | /// <summary> |
35 | /// CapsHandlers is a cap handler container but also takes | 35 | /// CapsHandlers is a cap handler container but also takes |
@@ -141,4 +141,4 @@ namespace OpenSim.Region.Capabilities | |||
141 | } | 141 | } |
142 | } | 142 | } |
143 | } | 143 | } |
144 | } | 144 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSD.cs b/OpenSim/Framework/Communications/Capabilities/LLSD.cs index b3e841c..13361c7 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSD.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSD.cs | |||
@@ -34,7 +34,7 @@ using System.Text; | |||
34 | using System.Xml; | 34 | using System.Xml; |
35 | using libsecondlife; | 35 | using libsecondlife; |
36 | 36 | ||
37 | namespace OpenSim.Region.Capabilities | 37 | namespace OpenSim.Framework.Communications.Capabilities |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// Borrowed from (a older version of ) libsl for now, as their new llsd code doesn't work we our decoding code. | 40 | /// Borrowed from (a older version of ) libsl for now, as their new llsd code doesn't work we our decoding code. |
@@ -676,4 +676,4 @@ namespace OpenSim.Region.Capabilities | |||
676 | } | 676 | } |
677 | } | 677 | } |
678 | } | 678 | } |
679 | } | 679 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs index a5cdd73..3579cc2 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | using System.Collections; | 28 | using System.Collections; |
29 | 29 | ||
30 | namespace OpenSim.Region.Capabilities | 30 | namespace OpenSim.Framework.Communications.Capabilities |
31 | { | 31 | { |
32 | [LLSDType("ARRAY")] | 32 | [LLSDType("ARRAY")] |
33 | public class LLSDArray | 33 | public class LLSDArray |
@@ -38,4 +38,4 @@ namespace OpenSim.Region.Capabilities | |||
38 | { | 38 | { |
39 | } | 39 | } |
40 | } | 40 | } |
41 | } | 41 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs index 1393523..6c4db4b 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs | |||
@@ -28,7 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | 30 | ||
31 | namespace OpenSim.Region.Capabilities | 31 | namespace OpenSim.Framework.Communications.Capabilities |
32 | { | 32 | { |
33 | [LLSDType("MAP")] | 33 | [LLSDType("MAP")] |
34 | public class LLSDAssetUploadComplete | 34 | public class LLSDAssetUploadComplete |
@@ -42,4 +42,4 @@ namespace OpenSim.Region.Capabilities | |||
42 | { | 42 | { |
43 | } | 43 | } |
44 | } | 44 | } |
45 | } | 45 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs index e71a73e..289cc93 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs | |||
@@ -28,7 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | 30 | ||
31 | namespace OpenSim.Region.Capabilities | 31 | namespace OpenSim.Framework.Communications.Capabilities |
32 | { | 32 | { |
33 | [LLSDMap] | 33 | [LLSDMap] |
34 | public class LLSDAssetUploadRequest | 34 | public class LLSDAssetUploadRequest |
@@ -43,4 +43,4 @@ namespace OpenSim.Region.Capabilities | |||
43 | { | 43 | { |
44 | } | 44 | } |
45 | } | 45 | } |
46 | } | 46 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs index bb293ba..63b3351 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | 29 | ||
30 | namespace OpenSim.Region.Capabilities | 30 | namespace OpenSim.Framework.Communications.Capabilities |
31 | { | 31 | { |
32 | [LLSDMap] | 32 | [LLSDMap] |
33 | public class LLSDAssetUploadResponse | 33 | public class LLSDAssetUploadResponse |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs index c1b15b4..5ff21b8 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs | |||
@@ -25,7 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | namespace OpenSim.Region.Capabilities | 28 | namespace OpenSim.Framework.Communications.Capabilities |
29 | { | 29 | { |
30 | [LLSDType("MAP")] | 30 | [LLSDType("MAP")] |
31 | public class LLSDCapEvent | 31 | public class LLSDCapEvent |
@@ -37,4 +37,4 @@ namespace OpenSim.Region.Capabilities | |||
37 | { | 37 | { |
38 | } | 38 | } |
39 | } | 39 | } |
40 | } | 40 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs index 5a44e26..4abdb59 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs | |||
@@ -25,7 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | namespace OpenSim.Region.Capabilities | 28 | namespace OpenSim.Framework.Communications.Capabilities |
29 | { | 29 | { |
30 | [LLSDType("MAP")] | 30 | [LLSDType("MAP")] |
31 | public class LLSDEmpty | 31 | public class LLSDEmpty |
@@ -34,4 +34,4 @@ namespace OpenSim.Region.Capabilities | |||
34 | { | 34 | { |
35 | } | 35 | } |
36 | } | 36 | } |
37 | } | 37 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs index a39f5aa..409d2e0 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs | |||
@@ -31,7 +31,7 @@ using System.IO; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Xml; | 32 | using System.Xml; |
33 | 33 | ||
34 | namespace OpenSim.Region.Capabilities | 34 | namespace OpenSim.Framework.Communications.Capabilities |
35 | { | 35 | { |
36 | public class LLSDHelpers | 36 | public class LLSDHelpers |
37 | { | 37 | { |
@@ -160,4 +160,4 @@ namespace OpenSim.Region.Capabilities | |||
160 | return obj; | 160 | return obj; |
161 | } | 161 | } |
162 | } | 162 | } |
163 | } | 163 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs b/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs index d402579..31896c2 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | 29 | ||
30 | namespace OpenSim.Region.Capabilities | 30 | namespace OpenSim.Framework.Communications.Capabilities |
31 | { | 31 | { |
32 | [LLSDMap] | 32 | [LLSDMap] |
33 | public class LLSDInventoryItem | 33 | public class LLSDInventoryItem |
@@ -68,15 +68,6 @@ namespace OpenSim.Region.Capabilities | |||
68 | public string sale_type; | 68 | public string sale_type; |
69 | } | 69 | } |
70 | 70 | ||
71 | /* [LLSDMap] | ||
72 | public class LLSDFolderItem | ||
73 | { | ||
74 | public LLUUID folder_id; | ||
75 | public LLUUID parent_id; | ||
76 | public int type; | ||
77 | public string name; | ||
78 | }*/ | ||
79 | |||
80 | [LLSDMap] | 71 | [LLSDMap] |
81 | public class LLSDInventoryDescendents | 72 | public class LLSDInventoryDescendents |
82 | { | 73 | { |
@@ -103,4 +94,4 @@ namespace OpenSim.Region.Capabilities | |||
103 | public LLUUID owner___id; // and of course we can't have field names with "-" in | 94 | public LLUUID owner___id; // and of course we can't have field names with "-" in |
104 | public int version; | 95 | public int version; |
105 | } | 96 | } |
106 | } | 97 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs index 6211c4f..2c4b68f 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | 29 | ||
30 | namespace OpenSim.Region.Capabilities | 30 | namespace OpenSim.Framework.Communications.Capabilities |
31 | { | 31 | { |
32 | [LLSDMap] | 32 | [LLSDMap] |
33 | public class LLSDItemUpdate | 33 | public class LLSDItemUpdate |
@@ -38,4 +38,4 @@ namespace OpenSim.Region.Capabilities | |||
38 | { | 38 | { |
39 | } | 39 | } |
40 | } | 40 | } |
41 | } | 41 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs index 0cf82a8..50f5241 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | 29 | ||
30 | namespace OpenSim.Region.Capabilities | 30 | namespace OpenSim.Framework.Communications.Capabilities |
31 | { | 31 | { |
32 | [LLSDType("MAP")] | 32 | [LLSDType("MAP")] |
33 | public class LLSDMapLayer | 33 | public class LLSDMapLayer |
@@ -42,4 +42,4 @@ namespace OpenSim.Region.Capabilities | |||
42 | { | 42 | { |
43 | } | 43 | } |
44 | } | 44 | } |
45 | } | 45 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs index 205a645..7dabbec 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs | |||
@@ -25,7 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | namespace OpenSim.Region.Capabilities | 28 | namespace OpenSim.Framework.Communications.Capabilities |
29 | { | 29 | { |
30 | [LLSDType("MAP")] | 30 | [LLSDType("MAP")] |
31 | public class LLSDMapLayerResponse | 31 | public class LLSDMapLayerResponse |
@@ -37,4 +37,4 @@ namespace OpenSim.Region.Capabilities | |||
37 | { | 37 | { |
38 | } | 38 | } |
39 | } | 39 | } |
40 | } | 40 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs index 748c5ea..317e35d 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs | |||
@@ -25,7 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | namespace OpenSim.Region.Capabilities | 28 | namespace OpenSim.Framework.Communications.Capabilities |
29 | { | 29 | { |
30 | [LLSDType("MAP")] | 30 | [LLSDType("MAP")] |
31 | public class LLSDMapRequest | 31 | public class LLSDMapRequest |
@@ -36,4 +36,4 @@ namespace OpenSim.Region.Capabilities | |||
36 | { | 36 | { |
37 | } | 37 | } |
38 | } | 38 | } |
39 | } | 39 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs index deb9223..55d62ac 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs | |||
@@ -25,7 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | namespace OpenSim.Region.Capabilities | 28 | namespace OpenSim.Framework.Communications.Capabilities |
29 | { | 29 | { |
30 | public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); | 30 | public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); |
31 | } | 31 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDParcelVoiceInfoResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDParcelVoiceInfoResponse.cs index 4439346..fb5eaa8 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDParcelVoiceInfoResponse.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDParcelVoiceInfoResponse.cs | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | using System.Collections; | 29 | using System.Collections; |
30 | 30 | ||
31 | namespace OpenSim.Region.Capabilities | 31 | namespace OpenSim.Framework.Communications.Capabilities |
32 | { | 32 | { |
33 | [LLSDMap] | 33 | [LLSDMap] |
34 | public class LLSDParcelVoiceInfoResponse | 34 | public class LLSDParcelVoiceInfoResponse |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs index 545643a..5e8a08f 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs | |||
@@ -30,7 +30,7 @@ using System.IO; | |||
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Framework.Servers; | 31 | using OpenSim.Framework.Servers; |
32 | 32 | ||
33 | namespace OpenSim.Region.Capabilities | 33 | namespace OpenSim.Framework.Communications.Capabilities |
34 | { | 34 | { |
35 | public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler | 35 | public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler |
36 | where TRequest : new() | 36 | where TRequest : new() |
@@ -65,4 +65,4 @@ namespace OpenSim.Region.Capabilities | |||
65 | return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); | 65 | return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | } | 68 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs index 22e45f4..ee9ff1b 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | 29 | ||
30 | namespace OpenSim.Region.Capabilities | 30 | namespace OpenSim.Framework.Communications.Capabilities |
31 | { | 31 | { |
32 | [LLSDMap] | 32 | [LLSDMap] |
33 | public class LLSDTaskInventoryUploadComplete | 33 | public class LLSDTaskInventoryUploadComplete |
@@ -47,4 +47,4 @@ namespace OpenSim.Region.Capabilities | |||
47 | /// </summary> | 47 | /// </summary> |
48 | public string state; | 48 | public string state; |
49 | } | 49 | } |
50 | } | 50 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs index ed7e824..df32d1a 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | 29 | ||
30 | namespace OpenSim.Region.Capabilities | 30 | namespace OpenSim.Framework.Communications.Capabilities |
31 | { | 31 | { |
32 | [LLSDMap] | 32 | [LLSDMap] |
33 | public class LLSDTaskScriptUpdate | 33 | public class LLSDTaskScriptUpdate |
@@ -47,4 +47,4 @@ namespace OpenSim.Region.Capabilities | |||
47 | /// </summary> | 47 | /// </summary> |
48 | public int is_script_running; | 48 | public int is_script_running; |
49 | } | 49 | } |
50 | } | 50 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs index d050176..91db060 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs | |||
@@ -25,7 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | namespace OpenSim.Region.Capabilities | 28 | namespace OpenSim.Framework.Communications.Capabilities |
29 | { | 29 | { |
30 | [LLSDType("MAP")] | 30 | [LLSDType("MAP")] |
31 | public class LLSDTest | 31 | public class LLSDTest |
@@ -37,4 +37,4 @@ namespace OpenSim.Region.Capabilities | |||
37 | { | 37 | { |
38 | } | 38 | } |
39 | } | 39 | } |
40 | } | 40 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs index bdc8e79..181a465 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | 29 | ||
30 | namespace OpenSim.Region.Capabilities | 30 | namespace OpenSim.Framework.Communications.Capabilities |
31 | { | 31 | { |
32 | [AttributeUsage(AttributeTargets.Class)] | 32 | [AttributeUsage(AttributeTargets.Class)] |
33 | public class LLSDType : Attribute | 33 | public class LLSDType : Attribute |
@@ -52,4 +52,4 @@ namespace OpenSim.Region.Capabilities | |||
52 | { | 52 | { |
53 | } | 53 | } |
54 | } | 54 | } |
55 | } | 55 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDVoiceAccountResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDVoiceAccountResponse.cs index 941e70e..67064b0 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDVoiceAccountResponse.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDVoiceAccountResponse.cs | |||
@@ -26,7 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | namespace OpenSim.Region.Capabilities | 29 | namespace OpenSim.Framework.Communications.Capabilities |
30 | { | 30 | { |
31 | [LLSDMap] | 31 | [LLSDMap] |
32 | public class LLSDVoiceAccountResponse | 32 | public class LLSDVoiceAccountResponse |
diff --git a/OpenSim/Framework/Communications/GenericAsyncResult.cs b/OpenSim/Framework/Communications/GenericAsyncResult.cs new file mode 100644 index 0000000..ed41614 --- /dev/null +++ b/OpenSim/Framework/Communications/GenericAsyncResult.cs | |||
@@ -0,0 +1,156 @@ | |||
1 | using System; | ||
2 | using System.Threading; | ||
3 | |||
4 | namespace OpenSim.Framework.Communications | ||
5 | { | ||
6 | internal class SimpleAsyncResult : IAsyncResult | ||
7 | { | ||
8 | private readonly AsyncCallback m_callback; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Is process completed? | ||
12 | /// </summary> | ||
13 | /// <remarks>Should really be boolean, but VolatileRead has no boolean method</remarks> | ||
14 | private byte m_completed; | ||
15 | |||
16 | /// <summary> | ||
17 | /// Did process complete synchroneously? | ||
18 | /// </summary> | ||
19 | /// <remarks>I have a hard time imagining a scenario where this is the case, again, same issue about | ||
20 | /// booleans and VolatileRead as m_completed | ||
21 | /// </remarks> | ||
22 | private byte m_completedSynchronously; | ||
23 | |||
24 | private readonly object m_asyncState; | ||
25 | private ManualResetEvent m_waitHandle; | ||
26 | private Exception m_exception; | ||
27 | |||
28 | internal SimpleAsyncResult(AsyncCallback cb, object state) | ||
29 | { | ||
30 | m_callback = cb; | ||
31 | m_asyncState = state; | ||
32 | m_completed = 0; | ||
33 | m_completedSynchronously = 1; | ||
34 | } | ||
35 | |||
36 | #region IAsyncResult Members | ||
37 | |||
38 | public object AsyncState | ||
39 | { | ||
40 | get { return m_asyncState; } | ||
41 | } | ||
42 | |||
43 | public WaitHandle AsyncWaitHandle | ||
44 | { | ||
45 | get | ||
46 | { | ||
47 | if (m_waitHandle == null) | ||
48 | { | ||
49 | bool done = IsCompleted; | ||
50 | ManualResetEvent mre = new ManualResetEvent(done); | ||
51 | if (Interlocked.CompareExchange(ref m_waitHandle, mre, null) != null) | ||
52 | { | ||
53 | mre.Close(); | ||
54 | } | ||
55 | else | ||
56 | { | ||
57 | if (!done && IsCompleted) | ||
58 | { | ||
59 | m_waitHandle.Set(); | ||
60 | } | ||
61 | } | ||
62 | } | ||
63 | return m_waitHandle; | ||
64 | } | ||
65 | } | ||
66 | |||
67 | |||
68 | public bool CompletedSynchronously | ||
69 | { | ||
70 | get { return Thread.VolatileRead(ref m_completedSynchronously) == 1; } | ||
71 | } | ||
72 | |||
73 | |||
74 | public bool IsCompleted | ||
75 | { | ||
76 | get { return Thread.VolatileRead(ref m_completed) == 1; } | ||
77 | } | ||
78 | |||
79 | #endregion | ||
80 | |||
81 | #region class Methods | ||
82 | |||
83 | internal void SetAsCompleted(bool completedSynchronously) | ||
84 | { | ||
85 | m_completed = 1; | ||
86 | if (completedSynchronously) | ||
87 | m_completedSynchronously = 1; | ||
88 | else | ||
89 | m_completedSynchronously = 0; | ||
90 | |||
91 | SignalCompletion(); | ||
92 | } | ||
93 | |||
94 | internal void HandleException(Exception e, bool completedSynchronously) | ||
95 | { | ||
96 | m_completed = 1; | ||
97 | if (completedSynchronously) | ||
98 | m_completedSynchronously = 1; | ||
99 | else | ||
100 | m_completedSynchronously = 0; | ||
101 | m_exception = e; | ||
102 | |||
103 | SignalCompletion(); | ||
104 | } | ||
105 | |||
106 | private void SignalCompletion() | ||
107 | { | ||
108 | if (m_waitHandle != null) m_waitHandle.Set(); | ||
109 | |||
110 | if (m_callback != null) m_callback(this); | ||
111 | } | ||
112 | |||
113 | public void EndInvoke() | ||
114 | { | ||
115 | // This method assumes that only 1 thread calls EndInvoke | ||
116 | if (!IsCompleted) | ||
117 | { | ||
118 | // If the operation isn't done, wait for it | ||
119 | AsyncWaitHandle.WaitOne(); | ||
120 | AsyncWaitHandle.Close(); | ||
121 | m_waitHandle = null; // Allow early GC | ||
122 | } | ||
123 | |||
124 | // Operation is done: if an exception occured, throw it | ||
125 | if (m_exception != null) throw m_exception; | ||
126 | } | ||
127 | |||
128 | #endregion | ||
129 | } | ||
130 | |||
131 | internal class AsyncResult<T> : SimpleAsyncResult | ||
132 | { | ||
133 | private T m_result = default(T); | ||
134 | |||
135 | public AsyncResult(AsyncCallback asyncCallback, Object state) : | ||
136 | base(asyncCallback, state) | ||
137 | { | ||
138 | } | ||
139 | |||
140 | public void SetAsCompleted(T result, bool completedSynchronously) | ||
141 | { | ||
142 | // Save the asynchronous operation's result | ||
143 | m_result = result; | ||
144 | |||
145 | // Tell the base class that the operation completed | ||
146 | // sucessfully (no exception) | ||
147 | base.SetAsCompleted(completedSynchronously); | ||
148 | } | ||
149 | |||
150 | public new T EndInvoke() | ||
151 | { | ||
152 | base.EndInvoke(); | ||
153 | return m_result; | ||
154 | } | ||
155 | } | ||
156 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs index 2b6e0d5..7c243c6 100644 --- a/OpenSim/Framework/Communications/IUserService.cs +++ b/OpenSim/Framework/Communications/IUserService.cs | |||
@@ -28,7 +28,7 @@ | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | 30 | ||
31 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework.Communications |
32 | { | 32 | { |
33 | public interface IUserService | 33 | public interface IUserService |
34 | { | 34 | { |
diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index a379253..f7989ab 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs | |||
@@ -34,7 +34,7 @@ using libsecondlife.StructuredData; | |||
34 | using log4net; | 34 | using log4net; |
35 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
36 | 36 | ||
37 | namespace OpenSim.Framework.UserManagement | 37 | namespace OpenSim.Framework.Communications |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// A temp class to handle login response. | 40 | /// A temp class to handle login response. |
@@ -777,4 +777,4 @@ namespace OpenSim.Framework.UserManagement | |||
777 | } | 777 | } |
778 | } | 778 | } |
779 | } | 779 | } |
780 | } | 780 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 37c0bd8..db4e2ec 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -40,7 +40,7 @@ using Nwc.XmlRpc; | |||
40 | using OpenSim.Framework.Communications.Cache; | 40 | using OpenSim.Framework.Communications.Cache; |
41 | using OpenSim.Framework.Statistics; | 41 | using OpenSim.Framework.Statistics; |
42 | 42 | ||
43 | namespace OpenSim.Framework.UserManagement | 43 | namespace OpenSim.Framework.Communications |
44 | { | 44 | { |
45 | public abstract class LoginService | 45 | public abstract class LoginService |
46 | { | 46 | { |
@@ -122,8 +122,8 @@ namespace OpenSim.Framework.UserManagement | |||
122 | lastname = (string) requestData["last"]; | 122 | lastname = (string) requestData["last"]; |
123 | 123 | ||
124 | m_log.InfoFormat( | 124 | m_log.InfoFormat( |
125 | "[LOGIN BEGIN]: Received login request message from user {0} {1}", | 125 | "[LOGIN BEGIN]: Received login request message from user {0} {1}", |
126 | firstname, lastname); | 126 | firstname, lastname); |
127 | 127 | ||
128 | string clientVersion = "Unknown"; | 128 | string clientVersion = "Unknown"; |
129 | 129 | ||
@@ -138,7 +138,7 @@ namespace OpenSim.Framework.UserManagement | |||
138 | } | 138 | } |
139 | 139 | ||
140 | m_log.DebugFormat( | 140 | m_log.DebugFormat( |
141 | "[LOGIN]: Client is {0}, start location is {1}", clientVersion, startLocationRequest); | 141 | "[LOGIN]: Client is {0}, start location is {1}", clientVersion, startLocationRequest); |
142 | 142 | ||
143 | userProfile = GetTheUser(firstname, lastname); | 143 | userProfile = GetTheUser(firstname, lastname); |
144 | if (userProfile == null) | 144 | if (userProfile == null) |
@@ -163,8 +163,8 @@ namespace OpenSim.Framework.UserManagement | |||
163 | catch (Exception e) | 163 | catch (Exception e) |
164 | { | 164 | { |
165 | m_log.InfoFormat( | 165 | m_log.InfoFormat( |
166 | "[LOGIN END]: Bad web_login_key: {0} for user {1} {2}, exception {3}", | 166 | "[LOGIN END]: Bad web_login_key: {0} for user {1} {2}, exception {3}", |
167 | requestData["web_login_key"], firstname, lastname, e); | 167 | requestData["web_login_key"], firstname, lastname, e); |
168 | 168 | ||
169 | return logResponse.CreateFailedResponse(); | 169 | return logResponse.CreateFailedResponse(); |
170 | } | 170 | } |
@@ -201,8 +201,8 @@ namespace OpenSim.Framework.UserManagement | |||
201 | // Reject the login | 201 | // Reject the login |
202 | 202 | ||
203 | m_log.InfoFormat( | 203 | m_log.InfoFormat( |
204 | "[LOGIN END]: Notifying user {0} {1} that they are already logged in", | 204 | "[LOGIN END]: Notifying user {0} {1} that they are already logged in", |
205 | firstname, lastname); | 205 | firstname, lastname); |
206 | 206 | ||
207 | return logResponse.CreateAlreadyLoggedInResponse(); | 207 | return logResponse.CreateAlreadyLoggedInResponse(); |
208 | } | 208 | } |
@@ -286,8 +286,8 @@ namespace OpenSim.Framework.UserManagement | |||
286 | StatsManager.UserStats.AddSuccessfulLogin(); | 286 | StatsManager.UserStats.AddSuccessfulLogin(); |
287 | 287 | ||
288 | m_log.DebugFormat( | 288 | m_log.DebugFormat( |
289 | "[LOGIN END]: Authentication of user {0} {1} successful. Sending response to client.", | 289 | "[LOGIN END]: Authentication of user {0} {1} successful. Sending response to client.", |
290 | firstname, lastname); | 290 | firstname, lastname); |
291 | 291 | ||
292 | return logResponse.ToXmlRpcResponse(); | 292 | return logResponse.ToXmlRpcResponse(); |
293 | } | 293 | } |
@@ -516,9 +516,9 @@ namespace OpenSim.Framework.UserManagement | |||
516 | statuscode = 301; | 516 | statuscode = 301; |
517 | 517 | ||
518 | string redirectURL = "about:blank?redirect-http-hack=" + | 518 | string redirectURL = "about:blank?redirect-http-hack=" + |
519 | HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" + | 519 | HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" + |
520 | lastname + | 520 | lastname + |
521 | "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString()); | 521 | "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString()); |
522 | //m_log.Info("[WEB]: R:" + redirectURL); | 522 | //m_log.Info("[WEB]: R:" + redirectURL); |
523 | returnactions["int_response_code"] = statuscode; | 523 | returnactions["int_response_code"] = statuscode; |
524 | returnactions["str_redirect_location"] = redirectURL; | 524 | returnactions["str_redirect_location"] = redirectURL; |
@@ -677,7 +677,7 @@ namespace OpenSim.Framework.UserManagement | |||
677 | //m_log.Info("[LOGIN]: userprofile:" + profile.passwordHash + " SubCT:" + password); | 677 | //m_log.Info("[LOGIN]: userprofile:" + profile.passwordHash + " SubCT:" + password); |
678 | 678 | ||
679 | passwordSuccess = (profile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) | 679 | passwordSuccess = (profile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) |
680 | || profile.PasswordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase)); | 680 | || profile.PasswordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase)); |
681 | 681 | ||
682 | return passwordSuccess; | 682 | return passwordSuccess; |
683 | } | 683 | } |
@@ -792,4 +792,4 @@ namespace OpenSim.Framework.UserManagement | |||
792 | } | 792 | } |
793 | } | 793 | } |
794 | } | 794 | } |
795 | } | 795 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs new file mode 100644 index 0000000..91284e8 --- /dev/null +++ b/OpenSim/Framework/Communications/RestClient.cs | |||
@@ -0,0 +1,368 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.IO; | ||
4 | using System.Net; | ||
5 | using System.Reflection; | ||
6 | using System.Text; | ||
7 | using System.Threading; | ||
8 | using System.Web; | ||
9 | using log4net; | ||
10 | |||
11 | namespace OpenSim.Framework.Communications | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Implementation of a generic REST client | ||
15 | /// </summary> | ||
16 | /// <remarks> | ||
17 | /// This class is a generic implementation of a REST (Representational State Transfer) web service. This | ||
18 | /// class is designed to execute both synchroneously and asynchroneously. | ||
19 | /// | ||
20 | /// Internally the implementation works as a two stage asynchroneous web-client. | ||
21 | /// When the request is initiated, RestClient will query asynchroneously for for a web-response, | ||
22 | /// sleeping until the initial response is returned by the server. Once the initial response is retrieved | ||
23 | /// the second stage of asynchroneous requests will be triggered, in an attempt to read of the response | ||
24 | /// object into a memorystream as a sequence of asynchroneous reads. | ||
25 | /// | ||
26 | /// The asynchronisity of RestClient is designed to move as much processing into the back-ground, allowing | ||
27 | /// other threads to execute, while it waits for a response from the web-service. RestClient it self, can be | ||
28 | /// invoked by the caller in either synchroneous mode or asynchroneous mode. | ||
29 | /// </remarks> | ||
30 | public class RestClient | ||
31 | { | ||
32 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
33 | |||
34 | private string realuri; | ||
35 | |||
36 | #region member variables | ||
37 | |||
38 | /// <summary> | ||
39 | /// The base Uri of the web-service e.g. http://www.google.com | ||
40 | /// </summary> | ||
41 | private string _url; | ||
42 | |||
43 | /// <summary> | ||
44 | /// Path elements of the query | ||
45 | /// </summary> | ||
46 | private List<string> _pathElements = new List<string>(); | ||
47 | |||
48 | /// <summary> | ||
49 | /// Parameter elements of the query, e.g. min=34 | ||
50 | /// </summary> | ||
51 | private Dictionary<string, string> _parameterElements = new Dictionary<string, string>(); | ||
52 | |||
53 | /// <summary> | ||
54 | /// Request method. E.g. GET, POST, PUT or DELETE | ||
55 | /// </summary> | ||
56 | private string _method; | ||
57 | |||
58 | /// <summary> | ||
59 | /// Temporary buffer used to store bytes temporarily as they come in from the server | ||
60 | /// </summary> | ||
61 | private byte[] _readbuf; | ||
62 | |||
63 | /// <summary> | ||
64 | /// MemoryStream representing the resultiong resource | ||
65 | /// </summary> | ||
66 | private Stream _resource; | ||
67 | |||
68 | /// <summary> | ||
69 | /// WebRequest object, held as a member variable | ||
70 | /// </summary> | ||
71 | private HttpWebRequest _request; | ||
72 | |||
73 | /// <summary> | ||
74 | /// WebResponse object, held as a member variable, so we can close it | ||
75 | /// </summary> | ||
76 | private HttpWebResponse _response; | ||
77 | |||
78 | /// <summary> | ||
79 | /// This flag will help block the main synchroneous method, in case we run in synchroneous mode | ||
80 | /// </summary> | ||
81 | public static ManualResetEvent _allDone = new ManualResetEvent(false); | ||
82 | |||
83 | /// <summary> | ||
84 | /// Default time out period | ||
85 | /// </summary> | ||
86 | private const int DefaultTimeout = 10*1000; // 10 seconds timeout | ||
87 | |||
88 | /// <summary> | ||
89 | /// Default Buffer size of a block requested from the web-server | ||
90 | /// </summary> | ||
91 | private const int BufferSize = 4096; // Read blocks of 4 KB. | ||
92 | |||
93 | |||
94 | /// <summary> | ||
95 | /// if an exception occours during async processing, we need to save it, so it can be | ||
96 | /// rethrown on the primary thread; | ||
97 | /// </summary> | ||
98 | private Exception _asyncException; | ||
99 | |||
100 | #endregion member variables | ||
101 | |||
102 | #region constructors | ||
103 | |||
104 | /// <summary> | ||
105 | /// Instantiate a new RestClient | ||
106 | /// </summary> | ||
107 | /// <param name="url">Web-service to query, e.g. http://osgrid.org:8003</param> | ||
108 | public RestClient(string url) | ||
109 | { | ||
110 | _url = url; | ||
111 | _readbuf = new byte[BufferSize]; | ||
112 | _resource = new MemoryStream(); | ||
113 | _request = null; | ||
114 | _response = null; | ||
115 | _lock = new object(); | ||
116 | } | ||
117 | |||
118 | private object _lock; | ||
119 | |||
120 | #endregion constructors | ||
121 | |||
122 | /// <summary> | ||
123 | /// Add a path element to the query, e.g. assets | ||
124 | /// </summary> | ||
125 | /// <param name="element">path entry</param> | ||
126 | public void AddResourcePath(string element) | ||
127 | { | ||
128 | if (isSlashed(element)) | ||
129 | _pathElements.Add(element.Substring(0, element.Length - 1)); | ||
130 | else | ||
131 | _pathElements.Add(element); | ||
132 | } | ||
133 | |||
134 | /// <summary> | ||
135 | /// Add a query parameter to the Url | ||
136 | /// </summary> | ||
137 | /// <param name="name">Name of the parameter, e.g. min</param> | ||
138 | /// <param name="value">Value of the parameter, e.g. 42</param> | ||
139 | public void AddQueryParameter(string name, string value) | ||
140 | { | ||
141 | _parameterElements.Add(HttpUtility.UrlEncode(name), HttpUtility.UrlEncode(value)); | ||
142 | } | ||
143 | |||
144 | /// <summary> | ||
145 | /// Add a query parameter to the Url | ||
146 | /// </summary> | ||
147 | /// <param name="name">Name of the parameter, e.g. min</param> | ||
148 | public void AddQueryParameter(string name) | ||
149 | { | ||
150 | _parameterElements.Add(HttpUtility.UrlEncode(name), null); | ||
151 | } | ||
152 | |||
153 | /// <summary> | ||
154 | /// Web-Request method, e.g. GET, PUT, POST, DELETE | ||
155 | /// </summary> | ||
156 | public string RequestMethod | ||
157 | { | ||
158 | get { return _method; } | ||
159 | set { _method = value; } | ||
160 | } | ||
161 | |||
162 | /// <summary> | ||
163 | /// True if string contains a trailing slash '/' | ||
164 | /// </summary> | ||
165 | /// <param name="s">string to be examined</param> | ||
166 | /// <returns>true if slash is present</returns> | ||
167 | private bool isSlashed(string s) | ||
168 | { | ||
169 | return s.Substring(s.Length - 1, 1) == "/"; | ||
170 | } | ||
171 | |||
172 | /// <summary> | ||
173 | /// Build a Uri based on the initial Url, path elements and parameters | ||
174 | /// </summary> | ||
175 | /// <returns>fully constructed Uri</returns> | ||
176 | private Uri buildUri() | ||
177 | { | ||
178 | StringBuilder sb = new StringBuilder(); | ||
179 | sb.Append(_url); | ||
180 | |||
181 | foreach (string e in _pathElements) | ||
182 | { | ||
183 | sb.Append("/"); | ||
184 | sb.Append(e); | ||
185 | } | ||
186 | |||
187 | bool firstElement = true; | ||
188 | foreach (KeyValuePair<string, string> kv in _parameterElements) | ||
189 | { | ||
190 | if (firstElement) | ||
191 | { | ||
192 | sb.Append("?"); | ||
193 | firstElement = false; | ||
194 | } | ||
195 | else | ||
196 | sb.Append("&"); | ||
197 | |||
198 | sb.Append(kv.Key); | ||
199 | if (kv.Value != null && kv.Value.Length != 0) | ||
200 | { | ||
201 | sb.Append("="); | ||
202 | sb.Append(kv.Value); | ||
203 | } | ||
204 | } | ||
205 | realuri = sb.ToString(); | ||
206 | //m_log.InfoFormat("[REST CLIENT]: RestURL: {0}", realuri); | ||
207 | return new Uri(sb.ToString()); | ||
208 | } | ||
209 | |||
210 | #region Async communications with server | ||
211 | |||
212 | /// <summary> | ||
213 | /// Async method, invoked when a block of data has been received from the service | ||
214 | /// </summary> | ||
215 | /// <param name="ar"></param> | ||
216 | private void StreamIsReadyDelegate(IAsyncResult ar) | ||
217 | { | ||
218 | try | ||
219 | { | ||
220 | Stream s = (Stream) ar.AsyncState; | ||
221 | int read = s.EndRead(ar); | ||
222 | |||
223 | if (read > 0) | ||
224 | { | ||
225 | _resource.Write(_readbuf, 0, read); | ||
226 | IAsyncResult asynchronousResult = | ||
227 | s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); | ||
228 | |||
229 | // TODO! Implement timeout, without killing the server | ||
230 | //ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); | ||
231 | } | ||
232 | else | ||
233 | { | ||
234 | s.Close(); | ||
235 | _allDone.Set(); | ||
236 | } | ||
237 | } | ||
238 | catch (Exception e) | ||
239 | { | ||
240 | _allDone.Set(); | ||
241 | _asyncException = e; | ||
242 | } | ||
243 | } | ||
244 | |||
245 | #endregion Async communications with server | ||
246 | |||
247 | /// <summary> | ||
248 | /// Perform synchroneous request | ||
249 | /// </summary> | ||
250 | public Stream Request() | ||
251 | { | ||
252 | lock (_lock) | ||
253 | { | ||
254 | _request = (HttpWebRequest) WebRequest.Create(buildUri()); | ||
255 | _request.KeepAlive = false; | ||
256 | _request.ContentType = "application/xml"; | ||
257 | _request.Timeout = 200000; | ||
258 | _asyncException = null; | ||
259 | |||
260 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); | ||
261 | _response = (HttpWebResponse) _request.GetResponse(); | ||
262 | Stream src = _response.GetResponseStream(); | ||
263 | int length = src.Read(_readbuf, 0, BufferSize); | ||
264 | while (length > 0) | ||
265 | { | ||
266 | _resource.Write(_readbuf, 0, length); | ||
267 | length = src.Read(_readbuf, 0, BufferSize); | ||
268 | } | ||
269 | |||
270 | |||
271 | // TODO! Implement timeout, without killing the server | ||
272 | // this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted | ||
273 | //ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); | ||
274 | |||
275 | // _allDone.WaitOne(); | ||
276 | if (_response != null) | ||
277 | _response.Close(); | ||
278 | if (_asyncException != null) | ||
279 | throw _asyncException; | ||
280 | |||
281 | if (_resource != null) | ||
282 | { | ||
283 | _resource.Flush(); | ||
284 | _resource.Seek(0, SeekOrigin.Begin); | ||
285 | } | ||
286 | |||
287 | return _resource; | ||
288 | } | ||
289 | } | ||
290 | |||
291 | public Stream Request(Stream src) | ||
292 | { | ||
293 | _request = (HttpWebRequest) WebRequest.Create(buildUri()); | ||
294 | _request.KeepAlive = false; | ||
295 | _request.ContentType = "application/xml"; | ||
296 | _request.Timeout = 900000; | ||
297 | _request.Method = RequestMethod; | ||
298 | _asyncException = null; | ||
299 | _request.ContentLength = src.Length; | ||
300 | |||
301 | m_log.InfoFormat("[REST]: Request Length {0}", _request.ContentLength); | ||
302 | m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri()); | ||
303 | src.Seek(0, SeekOrigin.Begin); | ||
304 | m_log.Info("[REST]: Seek is ok"); | ||
305 | Stream dst = _request.GetRequestStream(); | ||
306 | m_log.Info("[REST]: GetRequestStream is ok"); | ||
307 | |||
308 | byte[] buf = new byte[1024]; | ||
309 | int length = src.Read(buf, 0, 1024); | ||
310 | m_log.Info("[REST]: First Read is ok"); | ||
311 | while (length > 0) | ||
312 | { | ||
313 | dst.Write(buf, 0, length); | ||
314 | length = src.Read(buf, 0, 1024); | ||
315 | } | ||
316 | |||
317 | _response = (HttpWebResponse) _request.GetResponse(); | ||
318 | |||
319 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); | ||
320 | |||
321 | // TODO! Implement timeout, without killing the server | ||
322 | // this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted | ||
323 | //ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); | ||
324 | |||
325 | return null; | ||
326 | } | ||
327 | |||
328 | #region Async Invocation | ||
329 | |||
330 | public IAsyncResult BeginRequest(AsyncCallback callback, object state) | ||
331 | { | ||
332 | /// <summary> | ||
333 | /// In case, we are invoked asynchroneously this object will keep track of the state | ||
334 | /// </summary> | ||
335 | AsyncResult<Stream> ar = new AsyncResult<Stream>(callback, state); | ||
336 | ThreadPool.QueueUserWorkItem(RequestHelper, ar); | ||
337 | return ar; | ||
338 | } | ||
339 | |||
340 | public Stream EndRequest(IAsyncResult asyncResult) | ||
341 | { | ||
342 | AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult; | ||
343 | |||
344 | // Wait for operation to complete, then return result or | ||
345 | // throw exception | ||
346 | return ar.EndInvoke(); | ||
347 | } | ||
348 | |||
349 | private void RequestHelper(Object asyncResult) | ||
350 | { | ||
351 | // We know that it's really an AsyncResult<DateTime> object | ||
352 | AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult; | ||
353 | try | ||
354 | { | ||
355 | // Perform the operation; if sucessful set the result | ||
356 | Stream s = Request(); | ||
357 | ar.SetAsCompleted(s, false); | ||
358 | } | ||
359 | catch (Exception e) | ||
360 | { | ||
361 | // If operation fails, set the exception | ||
362 | ar.HandleException(e, false); | ||
363 | } | ||
364 | } | ||
365 | |||
366 | #endregion Async Invocation | ||
367 | } | ||
368 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 0f7dc44..e4d8ca2 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -36,7 +36,7 @@ using log4net; | |||
36 | using Nwc.XmlRpc; | 36 | using Nwc.XmlRpc; |
37 | using OpenSim.Framework.Statistics; | 37 | using OpenSim.Framework.Statistics; |
38 | 38 | ||
39 | namespace OpenSim.Framework.UserManagement | 39 | namespace OpenSim.Framework.Communications |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// Base class for user management (create, read, etc) | 42 | /// Base class for user management (create, read, etc) |
@@ -245,7 +245,7 @@ namespace OpenSim.Framework.UserManagement | |||
245 | { | 245 | { |
246 | try | 246 | try |
247 | { | 247 | { |
248 | plugin.Value.RemoveUserFriend(friendlistowner, friend); | 248 | plugin.Value.RemoveUserFriend(friendlistowner, friend); |
249 | } | 249 | } |
250 | catch (Exception e) | 250 | catch (Exception e) |
251 | { | 251 | { |
@@ -370,7 +370,7 @@ namespace OpenSim.Framework.UserManagement | |||
370 | if ((profile.CurrentAgent.Position.X > 0) | 370 | if ((profile.CurrentAgent.Position.X > 0) |
371 | && (profile.CurrentAgent.Position.Y > 0) | 371 | && (profile.CurrentAgent.Position.Y > 0) |
372 | && (profile.CurrentAgent.Position.Z > 0) | 372 | && (profile.CurrentAgent.Position.Z > 0) |
373 | ) | 373 | ) |
374 | { | 374 | { |
375 | // TODO: Right now, currentRegion has not been used in GridServer for requesting region. | 375 | // TODO: Right now, currentRegion has not been used in GridServer for requesting region. |
376 | // TODO: It is only using currentHandle. | 376 | // TODO: It is only using currentHandle. |
@@ -564,7 +564,7 @@ namespace OpenSim.Framework.UserManagement | |||
564 | catch (Exception e) | 564 | catch (Exception e) |
565 | { | 565 | { |
566 | m_log.Info("[USERSTORAGE]: Unable to update user " + UserProfile.ID.ToString() | 566 | m_log.Info("[USERSTORAGE]: Unable to update user " + UserProfile.ID.ToString() |
567 | + " via " + plugin.Key + "(" + e.ToString() + ")"); | 567 | + " via " + plugin.Key + "(" + e.ToString() + ")"); |
568 | return false; | 568 | return false; |
569 | } | 569 | } |
570 | } | 570 | } |
@@ -596,4 +596,4 @@ namespace OpenSim.Framework.UserManagement | |||
596 | return false; | 596 | return false; |
597 | } | 597 | } |
598 | } | 598 | } |
599 | } | 599 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index e985c06..4770017 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | |||
@@ -31,6 +31,7 @@ using System.Net; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Text; | 32 | using System.Text; |
33 | using log4net; | 33 | using log4net; |
34 | using OpenSim.Framework.Configuration.XML; | ||
34 | 35 | ||
35 | namespace OpenSim.Framework.Configuration.HTTP | 36 | namespace OpenSim.Framework.Configuration.HTTP |
36 | { | 37 | { |
diff --git a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs index c0b4ca0..0a9f751 100644 --- a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs +++ b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs | |||
@@ -29,7 +29,7 @@ using System; | |||
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Xml; | 30 | using System.Xml; |
31 | 31 | ||
32 | namespace OpenSim.Framework.Configuration | 32 | namespace OpenSim.Framework.Configuration.XML |
33 | { | 33 | { |
34 | public class XmlConfiguration : IGenericConfig | 34 | public class XmlConfiguration : IGenericConfig |
35 | { | 35 | { |
@@ -135,4 +135,4 @@ namespace OpenSim.Framework.Configuration | |||
135 | doc = null; | 135 | doc = null; |
136 | } | 136 | } |
137 | } | 137 | } |
138 | } | 138 | } \ No newline at end of file |