aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
authorAdam Frisby2008-05-01 15:36:39 +0000
committerAdam Frisby2008-05-01 15:36:39 +0000
commita1c8aa4050b7f7a94e02dd40d8cd456f258b4e2b (patch)
treea71b99297fa2b57f7c53492fe18f48b3d3ad8827 /OpenSim/Framework/Communications
parentMoving LaunchSLClient source files so build works (2/2) (diff)
downloadopensim-SC-a1c8aa4050b7f7a94e02dd40d8cd456f258b4e2b.zip
opensim-SC-a1c8aa4050b7f7a94e02dd40d8cd456f258b4e2b.tar.gz
opensim-SC-a1c8aa4050b7f7a94e02dd40d8cd456f258b4e2b.tar.bz2
opensim-SC-a1c8aa4050b7f7a94e02dd40d8cd456f258b4e2b.tar.xz
* Cleaned namespaces of entire solution. OpenSim directories now correspond with namespaces.
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs11
-rw-r--r--OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSD.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDArray.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs2
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs13
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDParcelVoiceInfoResponse.cs2
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDTest.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDType.cs4
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDVoiceAccountResponse.cs2
-rw-r--r--OpenSim/Framework/Communications/GenericAsyncResult.cs156
-rw-r--r--OpenSim/Framework/Communications/IUserService.cs2
-rw-r--r--OpenSim/Framework/Communications/LoginResponse.cs4
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs30
-rw-r--r--OpenSim/Framework/Communications/RestClient.cs368
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs10
29 files changed, 593 insertions, 79 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;
32using System.Reflection; 32using System.Reflection;
33using libsecondlife; 33using libsecondlife;
34using log4net; 34using log4net;
35using OpenSim.Framework;
36using OpenSim.Framework.Communications.Cache; 35using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
38 37
39namespace OpenSim.Region.Capabilities 38namespace 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;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Framework.Servers; 30using OpenSim.Framework.Servers;
31 31
32namespace OpenSim.Region.Capabilities 32namespace 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;
34using System.Xml; 34using System.Xml;
35using libsecondlife; 35using libsecondlife;
36 36
37namespace OpenSim.Region.Capabilities 37namespace 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
28using System.Collections; 28using System.Collections;
29 29
30namespace OpenSim.Region.Capabilities 30namespace 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 @@
28using System; 28using System;
29using libsecondlife; 29using libsecondlife;
30 30
31namespace OpenSim.Region.Capabilities 31namespace 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 @@
28using System; 28using System;
29using libsecondlife; 29using libsecondlife;
30 30
31namespace OpenSim.Region.Capabilities 31namespace 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
28using System; 28using System;
29 29
30namespace OpenSim.Region.Capabilities 30namespace 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
28namespace OpenSim.Region.Capabilities 28namespace 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
28namespace OpenSim.Region.Capabilities 28namespace 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;
31using System.Reflection; 31using System.Reflection;
32using System.Xml; 32using System.Xml;
33 33
34namespace OpenSim.Region.Capabilities 34namespace 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
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Region.Capabilities 30namespace 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
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Region.Capabilities 30namespace 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
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Region.Capabilities 30namespace 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
28namespace OpenSim.Region.Capabilities 28namespace 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
28namespace OpenSim.Region.Capabilities 28namespace 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
28namespace OpenSim.Region.Capabilities 28namespace 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
29using System.Collections; 29using System.Collections;
30 30
31namespace OpenSim.Region.Capabilities 31namespace 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;
30using System.Text; 30using System.Text;
31using OpenSim.Framework.Servers; 31using OpenSim.Framework.Servers;
32 32
33namespace OpenSim.Region.Capabilities 33namespace 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
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Region.Capabilities 30namespace 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
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Region.Capabilities 30namespace 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
28namespace OpenSim.Region.Capabilities 28namespace 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
28using System; 28using System;
29 29
30namespace OpenSim.Region.Capabilities 30namespace 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
29namespace OpenSim.Region.Capabilities 29namespace 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 @@
1using System;
2using System.Threading;
3
4namespace 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 @@
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30 30
31namespace OpenSim.Framework 31namespace 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;
34using log4net; 34using log4net;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
36 36
37namespace OpenSim.Framework.UserManagement 37namespace 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;
40using OpenSim.Framework.Communications.Cache; 40using OpenSim.Framework.Communications.Cache;
41using OpenSim.Framework.Statistics; 41using OpenSim.Framework.Statistics;
42 42
43namespace OpenSim.Framework.UserManagement 43namespace 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 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Net;
5using System.Reflection;
6using System.Text;
7using System.Threading;
8using System.Web;
9using log4net;
10
11namespace 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;
36using Nwc.XmlRpc; 36using Nwc.XmlRpc;
37using OpenSim.Framework.Statistics; 37using OpenSim.Framework.Statistics;
38 38
39namespace OpenSim.Framework.UserManagement 39namespace 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