aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities
diff options
context:
space:
mode:
authorMelanie2011-05-05 09:49:10 +0100
committerMelanie2011-05-05 09:49:10 +0100
commit4beb0c9b9b402c1e8f70a02c0efa557c1f292f1c (patch)
tree24e24cb7b424df74b13788d28be9d7588fbd99d0 /OpenSim/Capabilities
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentTest m_Enabled on RemoveRegion. (diff)
downloadopensim-SC-4beb0c9b9b402c1e8f70a02c0efa557c1f292f1c.zip
opensim-SC-4beb0c9b9b402c1e8f70a02c0efa557c1f292f1c.tar.gz
opensim-SC-4beb0c9b9b402c1e8f70a02c0efa557c1f292f1c.tar.bz2
opensim-SC-4beb0c9b9b402c1e8f70a02c0efa557c1f292f1c.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Capabilities')
-rw-r--r--OpenSim/Capabilities/Caps.cs176
-rw-r--r--OpenSim/Capabilities/CapsHandlers.cs171
-rw-r--r--OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs143
-rw-r--r--OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs79
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs357
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs69
-rw-r--r--OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs299
-rw-r--r--OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs76
-rw-r--r--OpenSim/Capabilities/LLSD.cs679
-rw-r--r--OpenSim/Capabilities/LLSDArray.cs41
-rw-r--r--OpenSim/Capabilities/LLSDAssetUploadComplete.cs45
-rw-r--r--OpenSim/Capabilities/LLSDAssetUploadRequest.cs46
-rw-r--r--OpenSim/Capabilities/LLSDAssetUploadResponse.cs56
-rw-r--r--OpenSim/Capabilities/LLSDCapEvent.cs40
-rw-r--r--OpenSim/Capabilities/LLSDEmpty.cs37
-rw-r--r--OpenSim/Capabilities/LLSDHelpers.cs172
-rw-r--r--OpenSim/Capabilities/LLSDInventoryFolder.cs41
-rw-r--r--OpenSim/Capabilities/LLSDInventoryItem.cs98
-rw-r--r--OpenSim/Capabilities/LLSDItemUpdate.cs41
-rw-r--r--OpenSim/Capabilities/LLSDMapLayer.cs45
-rw-r--r--OpenSim/Capabilities/LLSDMapLayerResponse.cs40
-rw-r--r--OpenSim/Capabilities/LLSDMapRequest.cs39
-rw-r--r--OpenSim/Capabilities/LLSDMethod.cs31
-rw-r--r--OpenSim/Capabilities/LLSDMethodString.cs31
-rw-r--r--OpenSim/Capabilities/LLSDParcelVoiceInfoResponse.cs51
-rw-r--r--OpenSim/Capabilities/LLSDRemoteParcelResponse.cs42
-rw-r--r--OpenSim/Capabilities/LLSDStreamHandler.cs70
-rw-r--r--OpenSim/Capabilities/LLSDTaskInventoryUploadComplete.cs50
-rw-r--r--OpenSim/Capabilities/LLSDTaskScriptUpdate.cs50
-rw-r--r--OpenSim/Capabilities/LLSDTaskScriptUploadComplete.cs54
-rw-r--r--OpenSim/Capabilities/LLSDTest.cs40
-rw-r--r--OpenSim/Capabilities/LLSDType.cs55
-rw-r--r--OpenSim/Capabilities/LLSDVoiceAccountResponse.cs57
33 files changed, 3321 insertions, 0 deletions
diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs
new file mode 100644
index 0000000..e188896
--- /dev/null
+++ b/OpenSim/Capabilities/Caps.cs
@@ -0,0 +1,176 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.IO;
32using System.Reflection;
33using log4net;
34using Nini.Config;
35using OpenMetaverse;
36using OpenSim.Framework.Servers;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Services.Interfaces;
39
40// using OpenSim.Region.Framework.Interfaces;
41
42namespace OpenSim.Framework.Capabilities
43{
44 /// <summary>
45 /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that
46 /// we can popup a message on the user's client if the inventory service has permanently failed). But I didn't want
47 /// to just pass the whole Scene into CAPS.
48 /// </summary>
49 public delegate IClientAPI GetClientDelegate(UUID agentID);
50
51 public class Caps
52 {
53 private static readonly ILog m_log =
54 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55
56 private string m_httpListenerHostName;
57 private uint m_httpListenPort;
58
59 /// <summary>
60 /// This is the uuid portion of every CAPS path. It is used to make capability urls private to the requester.
61 /// </summary>
62 private string m_capsObjectPath;
63 public string CapsObjectPath { get { return m_capsObjectPath; } }
64
65 private CapsHandlers m_capsHandlers;
66 private Dictionary<string, string> m_externalCapsHandlers;
67
68 private IHttpServer m_httpListener;
69 private UUID m_agentID;
70 private string m_regionName;
71
72 public UUID AgentID
73 {
74 get { return m_agentID; }
75 }
76
77 public string RegionName
78 {
79 get { return m_regionName; }
80 }
81
82 public string HostName
83 {
84 get { return m_httpListenerHostName; }
85 }
86
87 public uint Port
88 {
89 get { return m_httpListenPort; }
90 }
91
92 public IHttpServer HttpListener
93 {
94 get { return m_httpListener; }
95 }
96
97 public bool SSLCaps
98 {
99 get { return m_httpListener.UseSSL; }
100 }
101 public string SSLCommonName
102 {
103 get { return m_httpListener.SSLCommonName; }
104 }
105 public CapsHandlers CapsHandlers
106 {
107 get { return m_capsHandlers; }
108 }
109 public Dictionary<string, string> ExternalCapsHandlers
110 {
111 get { return m_externalCapsHandlers; }
112 }
113
114 public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
115 UUID agent, string regionName)
116 {
117 m_capsObjectPath = capsPath;
118 m_httpListener = httpServer;
119 m_httpListenerHostName = httpListen;
120
121 m_httpListenPort = httpPort;
122
123 if (httpServer != null && httpServer.UseSSL)
124 {
125 m_httpListenPort = httpServer.SSLPort;
126 httpListen = httpServer.SSLCommonName;
127 httpPort = httpServer.SSLPort;
128 }
129
130 m_agentID = agent;
131 m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
132 m_externalCapsHandlers = new Dictionary<string, string>();
133 m_regionName = regionName;
134 }
135
136 /// <summary>
137 /// Register a handler. This allows modules to register handlers.
138 /// </summary>
139 /// <param name="capName"></param>
140 /// <param name="handler"></param>
141 public void RegisterHandler(string capName, IRequestHandler handler)
142 {
143 m_capsHandlers[capName] = handler;
144 //m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path);
145 }
146
147 /// <summary>
148 /// Register an external handler. The service for this capability is somewhere else
149 /// given by the URL.
150 /// </summary>
151 /// <param name="capsName"></param>
152 /// <param name="url"></param>
153 public void RegisterHandler(string capsName, string url)
154 {
155 m_externalCapsHandlers.Add(capsName, url);
156 }
157
158 /// <summary>
159 /// Remove all CAPS service handlers.
160 ///
161 /// </summary>
162 /// <param name="httpListener"></param>
163 /// <param name="path"></param>
164 /// <param name="restMethod"></param>
165 public void DeregisterHandlers()
166 {
167 if (m_capsHandlers != null)
168 {
169 foreach (string capsName in m_capsHandlers.Caps)
170 {
171 m_capsHandlers.Remove(capsName);
172 }
173 }
174 }
175 }
176}
diff --git a/OpenSim/Capabilities/CapsHandlers.cs b/OpenSim/Capabilities/CapsHandlers.cs
new file mode 100644
index 0000000..e1c800e
--- /dev/null
+++ b/OpenSim/Capabilities/CapsHandlers.cs
@@ -0,0 +1,171 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections;
29using System.Collections.Generic;
30using OpenSim.Framework.Servers;
31using OpenSim.Framework.Servers.HttpServer;
32
33namespace OpenSim.Framework.Capabilities
34{
35 /// <summary>
36 /// CapsHandlers is a cap handler container but also takes
37 /// care of adding and removing cap handlers to and from the
38 /// supplied BaseHttpServer.
39 /// </summary>
40 public class CapsHandlers
41 {
42 private Dictionary <string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>();
43 private IHttpServer m_httpListener;
44 private string m_httpListenerHostName;
45 private uint m_httpListenerPort;
46 private bool m_useSSL = false;
47
48 /// <summary></summary>
49 /// CapsHandlers is a cap handler container but also takes
50 /// care of adding and removing cap handlers to and from the
51 /// supplied BaseHttpServer.
52 /// </summary>
53 /// <param name="httpListener">base HTTP server</param>
54 /// <param name="httpListenerHostname">host name of the HTTP
55 /// server</param>
56 /// <param name="httpListenerPort">HTTP port</param>
57 public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort)
58 : this (httpListener,httpListenerHostname,httpListenerPort, false)
59 {
60 }
61
62 /// <summary></summary>
63 /// CapsHandlers is a cap handler container but also takes
64 /// care of adding and removing cap handlers to and from the
65 /// supplied BaseHttpServer.
66 /// </summary>
67 /// <param name="httpListener">base HTTP server</param>
68 /// <param name="httpListenerHostname">host name of the HTTP
69 /// server</param>
70 /// <param name="httpListenerPort">HTTP port</param>
71 public CapsHandlers(IHttpServer httpListener, string httpListenerHostname, uint httpListenerPort, bool https)
72 {
73 m_httpListener = httpListener;
74 m_httpListenerHostName = httpListenerHostname;
75 m_httpListenerPort = httpListenerPort;
76 m_useSSL = https;
77 if (httpListener != null && m_useSSL)
78 {
79 m_httpListenerHostName = httpListener.SSLCommonName;
80 m_httpListenerPort = httpListener.SSLPort;
81 }
82 }
83
84 /// <summary>
85 /// Remove the cap handler for a capability.
86 /// </summary>
87 /// <param name="capsName">name of the capability of the cap
88 /// handler to be removed</param>
89 public void Remove(string capsName)
90 {
91 m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
92 m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path);
93 m_capsHandlers.Remove(capsName);
94 }
95
96 public bool ContainsCap(string cap)
97 {
98 return m_capsHandlers.ContainsKey(cap);
99 }
100
101 /// <summary>
102 /// The indexer allows us to treat the CapsHandlers object
103 /// in an intuitive dictionary like way.
104 /// </summary>
105 /// <Remarks>
106 /// The indexer will throw an exception when you try to
107 /// retrieve a cap handler for a cap that is not contained in
108 /// CapsHandlers.
109 /// </Remarks>
110 public IRequestHandler this[string idx]
111 {
112 get
113 {
114 return m_capsHandlers[idx];
115 }
116
117 set
118 {
119 if (m_capsHandlers.ContainsKey(idx))
120 {
121 m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path);
122 m_capsHandlers.Remove(idx);
123 }
124
125 if (null == value) return;
126
127 m_capsHandlers[idx] = value;
128 m_httpListener.AddStreamHandler(value);
129 }
130 }
131
132 /// <summary>
133 /// Return the list of cap names for which this CapsHandlers
134 /// object contains cap handlers.
135 /// </summary>
136 public string[] Caps
137 {
138 get
139 {
140 string[] __keys = new string[m_capsHandlers.Keys.Count];
141 m_capsHandlers.Keys.CopyTo(__keys, 0);
142 return __keys;
143 }
144 }
145
146 /// <summary>
147 /// Return an LLSD-serializable Hashtable describing the
148 /// capabilities and their handler details.
149 /// </summary>
150 public Hashtable CapsDetails
151 {
152 get
153 {
154 Hashtable caps = new Hashtable();
155 string protocol = "http://";
156
157 if (m_useSSL)
158 protocol = "https://";
159
160 string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
161 foreach (string capsName in m_capsHandlers.Keys)
162 {
163 // skip SEED cap
164 if ("SEED" == capsName) continue;
165 caps[capsName] = baseUrl + m_capsHandlers[capsName].Path;
166 }
167 return caps;
168 }
169 }
170 }
171}
diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs
new file mode 100644
index 0000000..c60abb1
--- /dev/null
+++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs
@@ -0,0 +1,143 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Specialized;
31using System.Reflection;
32using System.IO;
33using System.Web;
34using log4net;
35using Nini.Config;
36using OpenMetaverse;
37using OpenMetaverse.StructuredData;
38using OpenSim.Framework;
39using OpenSim.Framework.Servers;
40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Services.Interfaces;
42using Caps = OpenSim.Framework.Capabilities.Caps;
43
44namespace OpenSim.Capabilities.Handlers
45{
46 public class GetMeshHandler
47 {
48// private static readonly ILog m_log =
49// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 private IAssetService m_assetService;
52
53 public GetMeshHandler(IAssetService assService)
54 {
55 m_assetService = assService;
56 }
57
58 public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
59 {
60
61 Hashtable responsedata = new Hashtable();
62 responsedata["int_response_code"] = 400; //501; //410; //404;
63 responsedata["content_type"] = "text/plain";
64 responsedata["keepalive"] = false;
65 responsedata["str_response_string"] = "Request wasn't what was expected";
66
67 string meshStr = string.Empty;
68
69 if (request.ContainsKey("mesh_id"))
70 meshStr = request["mesh_id"].ToString();
71
72
73 UUID meshID = UUID.Zero;
74 if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID))
75 {
76 if (m_assetService == null)
77 {
78 responsedata["int_response_code"] = 404; //501; //410; //404;
79 responsedata["content_type"] = "text/plain";
80 responsedata["keepalive"] = false;
81 responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh.";
82 return responsedata;
83 }
84
85 AssetBase mesh;
86 // Only try to fetch locally cached textures. Misses are redirected
87 mesh = m_assetService.GetCached(meshID.ToString());
88 if (mesh != null)
89 {
90 if (mesh.Type == (SByte)AssetType.Mesh)
91 {
92 responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
93 responsedata["content_type"] = "application/vnd.ll.mesh";
94 responsedata["int_response_code"] = 200;
95 }
96 // Optionally add additional mesh types here
97 else
98 {
99 responsedata["int_response_code"] = 404; //501; //410; //404;
100 responsedata["content_type"] = "text/plain";
101 responsedata["keepalive"] = false;
102 responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
103 return responsedata;
104 }
105 }
106 else
107 {
108 mesh = m_assetService.Get(meshID.ToString());
109 if (mesh != null)
110 {
111 if (mesh.Type == (SByte)AssetType.Mesh)
112 {
113 responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
114 responsedata["content_type"] = "application/vnd.ll.mesh";
115 responsedata["int_response_code"] = 200;
116 }
117 // Optionally add additional mesh types here
118 else
119 {
120 responsedata["int_response_code"] = 404; //501; //410; //404;
121 responsedata["content_type"] = "text/plain";
122 responsedata["keepalive"] = false;
123 responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
124 return responsedata;
125 }
126 }
127
128 else
129 {
130 responsedata["int_response_code"] = 404; //501; //410; //404;
131 responsedata["content_type"] = "text/plain";
132 responsedata["keepalive"] = false;
133 responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
134 return responsedata;
135 }
136 }
137
138 }
139
140 return responsedata;
141 }
142 }
143}
diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs
new file mode 100644
index 0000000..fa5f755
--- /dev/null
+++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs
@@ -0,0 +1,79 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using Nini.Config;
31using OpenSim.Server.Base;
32using OpenSim.Services.Interfaces;
33using OpenSim.Framework.Servers.HttpServer;
34using OpenSim.Server.Handlers.Base;
35using OpenSim.Framework.Servers;
36using OpenSim.Framework.Servers.HttpServer;
37
38using OpenMetaverse;
39
40namespace OpenSim.Capabilities.Handlers
41{
42 public class GetMeshServerConnector : ServiceConnector
43 {
44 private IAssetService m_AssetService;
45 private string m_ConfigName = "CapsService";
46
47 public GetMeshServerConnector(IConfigSource config, IHttpServer server, string configName) :
48 base(config, server, configName)
49 {
50 if (configName != String.Empty)
51 m_ConfigName = configName;
52
53 IConfig serverConfig = config.Configs[m_ConfigName];
54 if (serverConfig == null)
55 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
56
57 string assetService = serverConfig.GetString("AssetService", String.Empty);
58
59 if (assetService == String.Empty)
60 throw new Exception("No AssetService in config file");
61
62 Object[] args = new Object[] { config };
63 m_AssetService =
64 ServerUtils.LoadPlugin<IAssetService>(assetService, args);
65
66 if (m_AssetService == null)
67 throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
68
69 GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
70 IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(),
71 delegate(Hashtable m_dhttpMethod)
72 {
73 return gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null);
74 });
75 server.AddStreamHandler(reqHandler);
76 }
77
78 }
79}
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
new file mode 100644
index 0000000..00ff3d0
--- /dev/null
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -0,0 +1,357 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Specialized;
31using System.Drawing;
32using System.Drawing.Imaging;
33using System.Reflection;
34using System.IO;
35using System.Web;
36using log4net;
37using Nini.Config;
38using OpenMetaverse;
39using OpenMetaverse.StructuredData;
40using OpenMetaverse.Imaging;
41using OpenSim.Framework;
42using OpenSim.Framework.Servers;
43using OpenSim.Framework.Servers.HttpServer;
44using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Services.Interfaces;
46using Caps = OpenSim.Framework.Capabilities.Caps;
47
48namespace OpenSim.Capabilities.Handlers
49{
50
51 public class GetTextureHandler : BaseStreamHandler
52 {
53 private static readonly ILog m_log =
54 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private IAssetService m_assetService;
56
57 public const string DefaultFormat = "x-j2c";
58
59 // TODO: Change this to a config option
60 const string REDIRECT_URL = null;
61
62 public GetTextureHandler(string path, IAssetService assService) :
63 base("GET", path)
64 {
65 m_assetService = assService;
66 }
67
68 public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
69 {
70
71 // Try to parse the texture ID from the request URL
72 NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
73 string textureStr = query.GetOne("texture_id");
74 string format = query.GetOne("format");
75
76 m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr);
77
78 if (m_assetService == null)
79 {
80 m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
81 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
82 return null;
83 }
84
85 UUID textureID;
86 if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
87 {
88 string[] formats;
89 if (format != null && format != string.Empty)
90 {
91 formats = new string[1] { format.ToLower() };
92 }
93 else
94 {
95 formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept"));
96 if (formats.Length == 0)
97 formats = new string[1] { DefaultFormat }; // default
98
99 }
100 // OK, we have an array with preferred formats, possibly with only one entry
101
102 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
103 foreach (string f in formats)
104 {
105 if (FetchTexture(httpRequest, httpResponse, textureID, f))
106 break;
107 }
108
109 }
110 else
111 {
112 m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url);
113 }
114
115 httpResponse.Send();
116 return null;
117 }
118
119 /// <summary>
120 ///
121 /// </summary>
122 /// <param name="httpRequest"></param>
123 /// <param name="httpResponse"></param>
124 /// <param name="textureID"></param>
125 /// <param name="format"></param>
126 /// <returns>False for "caller try another codec"; true otherwise</returns>
127 private bool FetchTexture(OSHttpRequest httpRequest, OSHttpResponse httpResponse, UUID textureID, string format)
128 {
129// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
130 AssetBase texture;
131
132 string fullID = textureID.ToString();
133 if (format != DefaultFormat)
134 fullID = fullID + "-" + format;
135
136 if (!String.IsNullOrEmpty(REDIRECT_URL))
137 {
138 // Only try to fetch locally cached textures. Misses are redirected
139 texture = m_assetService.GetCached(fullID);
140
141 if (texture != null)
142 {
143 if (texture.Type != (sbyte)AssetType.Texture)
144 {
145 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
146 return true;
147 }
148 WriteTextureData(httpRequest, httpResponse, texture, format);
149 }
150 else
151 {
152 string textureUrl = REDIRECT_URL + textureID.ToString();
153 m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
154 httpResponse.RedirectLocation = textureUrl;
155 return true;
156 }
157 }
158 else // no redirect
159 {
160 // try the cache
161 texture = m_assetService.GetCached(fullID);
162
163 if (texture == null)
164 {
165 //m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
166
167 // Fetch locally or remotely. Misses return a 404
168 texture = m_assetService.Get(textureID.ToString());
169
170 if (texture != null)
171 {
172 if (texture.Type != (sbyte)AssetType.Texture)
173 {
174 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
175 return true;
176 }
177 if (format == DefaultFormat)
178 {
179 WriteTextureData(httpRequest, httpResponse, texture, format);
180 return true;
181 }
182 else
183 {
184 AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
185 newTexture.Data = ConvertTextureData(texture, format);
186 if (newTexture.Data.Length == 0)
187 return false; // !!! Caller try another codec, please!
188
189 newTexture.Flags = AssetFlags.Collectable;
190 newTexture.Temporary = true;
191 m_assetService.Store(newTexture);
192 WriteTextureData(httpRequest, httpResponse, newTexture, format);
193 return true;
194 }
195 }
196 }
197 else // it was on the cache
198 {
199 //m_log.DebugFormat("[GETTEXTURE]: texture was in the cache");
200 WriteTextureData(httpRequest, httpResponse, texture, format);
201 return true;
202 }
203 }
204
205 // not found
206// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
207 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
208 return true;
209 }
210
211 private void WriteTextureData(OSHttpRequest request, OSHttpResponse response, AssetBase texture, string format)
212 {
213 string range = request.Headers.GetOne("Range");
214 //m_log.DebugFormat("[GETTEXTURE]: Range {0}", range);
215 if (!String.IsNullOrEmpty(range)) // JP2's only
216 {
217 // Range request
218 int start, end;
219 if (TryParseRange(range, out start, out end))
220 {
221 // Before clamping start make sure we can satisfy it in order to avoid
222 // sending back the last byte instead of an error status
223 if (start >= texture.Data.Length)
224 {
225 response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
226 return;
227 }
228
229 end = Utils.Clamp(end, 0, texture.Data.Length - 1);
230 start = Utils.Clamp(start, 0, end);
231 int len = end - start + 1;
232
233 //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
234
235 if (len < texture.Data.Length)
236 response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
237
238 response.ContentLength = len;
239 response.ContentType = texture.Metadata.ContentType;
240 response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
241
242 response.Body.Write(texture.Data, start, len);
243 }
244 else
245 {
246 m_log.Warn("[GETTEXTURE]: Malformed Range header: " + range);
247 response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
248 }
249 }
250 else // JP2's or other formats
251 {
252 // Full content request
253 response.StatusCode = (int)System.Net.HttpStatusCode.OK;
254 response.ContentLength = texture.Data.Length;
255 if (format == DefaultFormat)
256 response.ContentType = texture.Metadata.ContentType;
257 else
258 response.ContentType = "image/" + format;
259 response.Body.Write(texture.Data, 0, texture.Data.Length);
260 }
261 }
262
263 private bool TryParseRange(string header, out int start, out int end)
264 {
265 if (header.StartsWith("bytes="))
266 {
267 string[] rangeValues = header.Substring(6).Split('-');
268 if (rangeValues.Length == 2)
269 {
270 if (Int32.TryParse(rangeValues[0], out start) && Int32.TryParse(rangeValues[1], out end))
271 return true;
272 }
273 }
274
275 start = end = 0;
276 return false;
277 }
278
279
280 private byte[] ConvertTextureData(AssetBase texture, string format)
281 {
282 m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
283 byte[] data = new byte[0];
284
285 MemoryStream imgstream = new MemoryStream();
286 Bitmap mTexture = new Bitmap(1, 1);
287 ManagedImage managedImage;
288 Image image = (Image)mTexture;
289
290 try
291 {
292 // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
293
294 imgstream = new MemoryStream();
295
296 // Decode image to System.Drawing.Image
297 if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image))
298 {
299 // Save to bitmap
300 mTexture = new Bitmap(image);
301
302 EncoderParameters myEncoderParameters = new EncoderParameters();
303 myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 95L);
304
305 // Save bitmap to stream
306 ImageCodecInfo codec = GetEncoderInfo("image/" + format);
307 if (codec != null)
308 {
309 mTexture.Save(imgstream, codec, myEncoderParameters);
310 // Write the stream to a byte array for output
311 data = imgstream.ToArray();
312 }
313 else
314 m_log.WarnFormat("[GETTEXTURE]: No such codec {0}", format);
315
316 }
317 }
318 catch (Exception e)
319 {
320 m_log.WarnFormat("[GETTEXTURE]: Unable to convert texture {0} to {1}: {2}", texture.ID, format, e.Message);
321 }
322 finally
323 {
324 // Reclaim memory, these are unmanaged resources
325 // If we encountered an exception, one or more of these will be null
326 if (mTexture != null)
327 mTexture.Dispose();
328
329 if (image != null)
330 image.Dispose();
331
332 if (imgstream != null)
333 {
334 imgstream.Close();
335 imgstream.Dispose();
336 }
337 }
338
339 return data;
340 }
341
342 // From msdn
343 private static ImageCodecInfo GetEncoderInfo(String mimeType)
344 {
345 ImageCodecInfo[] encoders;
346 encoders = ImageCodecInfo.GetImageEncoders();
347 for (int j = 0; j < encoders.Length; ++j)
348 {
349 if (encoders[j].MimeType == mimeType)
350 return encoders[j];
351 }
352 return null;
353 }
354
355
356 }
357}
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs
new file mode 100644
index 0000000..0d072f7
--- /dev/null
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs
@@ -0,0 +1,69 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using Nini.Config;
30using OpenSim.Server.Base;
31using OpenSim.Services.Interfaces;
32using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Server.Handlers.Base;
34using OpenMetaverse;
35
36namespace OpenSim.Capabilities.Handlers
37{
38 public class GetTextureServerConnector : ServiceConnector
39 {
40 private IAssetService m_AssetService;
41 private string m_ConfigName = "CapsService";
42
43 public GetTextureServerConnector(IConfigSource config, IHttpServer server, string configName) :
44 base(config, server, configName)
45 {
46 if (configName != String.Empty)
47 m_ConfigName = configName;
48
49 IConfig serverConfig = config.Configs[m_ConfigName];
50 if (serverConfig == null)
51 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
52
53 string assetService = serverConfig.GetString("AssetService", String.Empty);
54
55 if (assetService == String.Empty)
56 throw new Exception("No AssetService in config file");
57
58 Object[] args = new Object[] { config };
59 m_AssetService =
60 ServerUtils.LoadPlugin<IAssetService>(assetService, args);
61
62 if (m_AssetService == null)
63 throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
64
65 server.AddStreamHandler(new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService));
66 }
67
68 }
69}
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
new file mode 100644
index 0000000..6fd7946
--- /dev/null
+++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
@@ -0,0 +1,299 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32using log4net;
33using Nini.Config;
34using OpenMetaverse;
35using OpenMetaverse.StructuredData;
36using OpenSim.Framework;
37using OpenSim.Framework.Capabilities;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Services.Interfaces;
41using Caps = OpenSim.Framework.Capabilities.Caps;
42
43namespace OpenSim.Capabilities.Handlers
44{
45
46 public class WebFetchInvDescHandler
47 {
48 private static readonly ILog m_log =
49 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 private IInventoryService m_InventoryService;
52 private ILibraryService m_LibraryService;
53 private object m_fetchLock = new Object();
54
55 public WebFetchInvDescHandler(IInventoryService invService, ILibraryService libService)
56 {
57 m_InventoryService = invService;
58 m_LibraryService = libService;
59 }
60
61 public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
62 {
63 // nasty temporary hack here, the linden client falsely
64 // identifies the uuid 00000000-0000-0000-0000-000000000000
65 // as a string which breaks us
66 //
67 // correctly mark it as a uuid
68 //
69 request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
70
71 // another hack <integer>1</integer> results in a
72 // System.ArgumentException: Object type System.Int32 cannot
73 // be converted to target type: System.Boolean
74 //
75 request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
76 request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
77
78 Hashtable hash = new Hashtable();
79 try
80 {
81 hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
82 }
83 catch (LLSD.LLSDParseException pe)
84 {
85 m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message);
86 m_log.Error("Request: " + request.ToString());
87 }
88
89 ArrayList foldersrequested = (ArrayList)hash["folders"];
90
91 string response = "";
92 lock (m_fetchLock)
93 {
94 for (int i = 0; i < foldersrequested.Count; i++)
95 {
96 string inventoryitemstr = "";
97 Hashtable inventoryhash = (Hashtable)foldersrequested[i];
98
99 LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents();
100
101 try
102 {
103 LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest);
104 }
105 catch (Exception e)
106 {
107 m_log.Debug("[CAPS]: caught exception doing OSD deserialize" + e);
108 }
109 LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest);
110
111 inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply);
112 inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", "");
113 inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", "");
114
115 response += inventoryitemstr;
116 }
117
118
119 if (response.Length == 0)
120 {
121 // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants.
122 // Therefore, I'm concluding that the client only has so many threads available to do requests
123 // and when a thread stalls.. is stays stalled.
124 // Therefore we need to return something valid
125 response = "<llsd><map><key>folders</key><array /></map></llsd>";
126 }
127 else
128 {
129 response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
130 }
131
132 //m_log.DebugFormat("[CAPS]: Replying to CAPS fetch inventory request with following xml");
133 //m_log.Debug("[CAPS] "+response);
134
135 }
136 return response;
137 }
138
139 /// <summary>
140 /// Construct an LLSD reply packet to a CAPS inventory request
141 /// </summary>
142 /// <param name="invFetch"></param>
143 /// <returns></returns>
144 private LLSDInventoryDescendents FetchInventoryReply(LLSDFetchInventoryDescendents invFetch)
145 {
146 LLSDInventoryDescendents reply = new LLSDInventoryDescendents();
147 LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents();
148 contents.agent_id = invFetch.owner_id;
149 contents.owner_id = invFetch.owner_id;
150 contents.folder_id = invFetch.folder_id;
151
152 reply.folders.Array.Add(contents);
153 InventoryCollection inv = new InventoryCollection();
154 inv.Folders = new List<InventoryFolderBase>();
155 inv.Items = new List<InventoryItemBase>();
156 int version = 0;
157
158 inv = Fetch(invFetch.owner_id, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version);
159
160 if (inv.Folders != null)
161 {
162 foreach (InventoryFolderBase invFolder in inv.Folders)
163 {
164 contents.categories.Array.Add(ConvertInventoryFolder(invFolder));
165 }
166 }
167
168 if (inv.Items != null)
169 {
170 foreach (InventoryItemBase invItem in inv.Items)
171 {
172 contents.items.Array.Add(ConvertInventoryItem(invItem));
173 }
174 }
175
176 contents.descendents = contents.items.Array.Count + contents.categories.Array.Count;
177 contents.version = version;
178
179 return reply;
180 }
181
182 public InventoryCollection Fetch(UUID agentID, UUID folderID, UUID ownerID,
183 bool fetchFolders, bool fetchItems, int sortOrder, out int version)
184 {
185 m_log.DebugFormat(
186 "[WEBFETCHINVENTORYDESCENDANTS]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
187 fetchFolders, fetchItems, folderID, agentID);
188
189 version = 0;
190 InventoryFolderImpl fold;
191 if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner)
192 if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
193 {
194 InventoryCollection ret = new InventoryCollection();
195 ret.Folders = new List<InventoryFolderBase>();
196 ret.Items = fold.RequestListOfItems();
197
198 return ret;
199 }
200
201 InventoryCollection contents = new InventoryCollection();
202
203 if (folderID != UUID.Zero)
204 {
205 contents = m_InventoryService.GetFolderContent(agentID, folderID);
206 InventoryFolderBase containingFolder = new InventoryFolderBase();
207 containingFolder.ID = folderID;
208 containingFolder.Owner = agentID;
209 containingFolder = m_InventoryService.GetFolder(containingFolder);
210 if (containingFolder != null)
211 version = containingFolder.Version;
212 }
213 else
214 {
215 // Lost itemsm don't really need a version
216 version = 1;
217 }
218
219 return contents;
220
221 }
222 /// <summary>
223 /// Convert an internal inventory folder object into an LLSD object.
224 /// </summary>
225 /// <param name="invFolder"></param>
226 /// <returns></returns>
227 private LLSDInventoryFolder ConvertInventoryFolder(InventoryFolderBase invFolder)
228 {
229 LLSDInventoryFolder llsdFolder = new LLSDInventoryFolder();
230 llsdFolder.folder_id = invFolder.ID;
231 llsdFolder.parent_id = invFolder.ParentID;
232 llsdFolder.name = invFolder.Name;
233 if (invFolder.Type < 0 || invFolder.Type >= TaskInventoryItem.Types.Length)
234 llsdFolder.type = "-1";
235 else
236 llsdFolder.type = TaskInventoryItem.Types[invFolder.Type];
237 llsdFolder.preferred_type = "-1";
238
239 return llsdFolder;
240 }
241
242 /// <summary>
243 /// Convert an internal inventory item object into an LLSD object.
244 /// </summary>
245 /// <param name="invItem"></param>
246 /// <returns></returns>
247 private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem)
248 {
249 LLSDInventoryItem llsdItem = new LLSDInventoryItem();
250 llsdItem.asset_id = invItem.AssetID;
251 llsdItem.created_at = invItem.CreationDate;
252 llsdItem.desc = invItem.Description;
253 llsdItem.flags = (int)invItem.Flags;
254 llsdItem.item_id = invItem.ID;
255 llsdItem.name = invItem.Name;
256 llsdItem.parent_id = invItem.Folder;
257 try
258 {
259 // TODO reevaluate after upgrade to libomv >= r2566. Probably should use UtilsConversions.
260 llsdItem.type = TaskInventoryItem.Types[invItem.AssetType];
261 llsdItem.inv_type = TaskInventoryItem.InvTypes[invItem.InvType];
262 }
263 catch (Exception e)
264 {
265 m_log.ErrorFormat("[CAPS]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}", invItem.AssetType, invItem.InvType, invItem.Name, e.Message);
266 }
267 llsdItem.permissions = new LLSDPermissions();
268 llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
269 llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
270 llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions;
271 llsdItem.permissions.group_id = invItem.GroupID;
272 llsdItem.permissions.group_mask = (int)invItem.GroupPermissions;
273 llsdItem.permissions.is_owner_group = invItem.GroupOwned;
274 llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions;
275 llsdItem.permissions.owner_id = invItem.Owner;
276 llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
277 llsdItem.sale_info = new LLSDSaleInfo();
278 llsdItem.sale_info.sale_price = invItem.SalePrice;
279 switch (invItem.SaleType)
280 {
281 default:
282 llsdItem.sale_info.sale_type = "not";
283 break;
284 case 1:
285 llsdItem.sale_info.sale_type = "original";
286 break;
287 case 2:
288 llsdItem.sale_info.sale_type = "copy";
289 break;
290 case 3:
291 llsdItem.sale_info.sale_type = "contents";
292 break;
293 }
294
295 return llsdItem;
296 }
297
298 }
299}
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs
new file mode 100644
index 0000000..92eeb14
--- /dev/null
+++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs
@@ -0,0 +1,76 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using Nini.Config;
30using OpenSim.Server.Base;
31using OpenSim.Services.Interfaces;
32using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Server.Handlers.Base;
34using OpenMetaverse;
35
36namespace OpenSim.Capabilities.Handlers
37{
38 public class WebFetchInvDescServerConnector : ServiceConnector
39 {
40 private IInventoryService m_InventoryService;
41 private ILibraryService m_LibraryService;
42 private string m_ConfigName = "CapsService";
43
44 public WebFetchInvDescServerConnector(IConfigSource config, IHttpServer server, string configName) :
45 base(config, server, configName)
46 {
47 if (configName != String.Empty)
48 m_ConfigName = configName;
49
50 IConfig serverConfig = config.Configs[m_ConfigName];
51 if (serverConfig == null)
52 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
53
54 string invService = serverConfig.GetString("InventoryService", String.Empty);
55
56 if (invService == String.Empty)
57 throw new Exception("No InventoryService in config file");
58
59 Object[] args = new Object[] { config };
60 m_InventoryService =
61 ServerUtils.LoadPlugin<IInventoryService>(invService, args);
62
63 if (m_InventoryService == null)
64 throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));
65
66 string libService = serverConfig.GetString("LibraryService", String.Empty);
67 m_LibraryService =
68 ServerUtils.LoadPlugin<ILibraryService>(libService, args);
69
70 WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
71 IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/, webFetchHandler.FetchInventoryDescendentsRequest);
72 server.AddStreamHandler(reqHandler);
73 }
74
75 }
76}
diff --git a/OpenSim/Capabilities/LLSD.cs b/OpenSim/Capabilities/LLSD.cs
new file mode 100644
index 0000000..eec9e61
--- /dev/null
+++ b/OpenSim/Capabilities/LLSD.cs
@@ -0,0 +1,679 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Globalization;
31using System.IO;
32using System.Security.Cryptography;
33using System.Text;
34using System.Xml;
35using OpenMetaverse;
36
37namespace OpenSim.Framework.Capabilities
38{
39 /// <summary>
40 /// Borrowed from (a older version of) libsl for now, as their new llsd code doesn't work we our decoding code.
41 /// </summary>
42 public static class LLSD
43 {
44 /// <summary>
45 ///
46 /// </summary>
47 public class LLSDParseException : Exception
48 {
49 public LLSDParseException(string message) : base(message)
50 {
51 }
52 }
53
54 /// <summary>
55 ///
56 /// </summary>
57 public class LLSDSerializeException : Exception
58 {
59 public LLSDSerializeException(string message) : base(message)
60 {
61 }
62 }
63
64 /// <summary>
65 ///
66 /// </summary>
67 /// <param name="b"></param>
68 /// <returns></returns>
69 public static object LLSDDeserialize(byte[] b)
70 {
71 return LLSDDeserialize(new MemoryStream(b, false));
72 }
73
74 /// <summary>
75 ///
76 /// </summary>
77 /// <param name="st"></param>
78 /// <returns></returns>
79 public static object LLSDDeserialize(Stream st)
80 {
81 XmlTextReader reader = new XmlTextReader(st);
82 reader.Read();
83 SkipWS(reader);
84
85 if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "llsd")
86 throw new LLSDParseException("Expected <llsd>");
87
88 reader.Read();
89 object ret = LLSDParseOne(reader);
90 SkipWS(reader);
91
92 if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "llsd")
93 throw new LLSDParseException("Expected </llsd>");
94
95 return ret;
96 }
97
98 /// <summary>
99 ///
100 /// </summary>
101 /// <param name="obj"></param>
102 /// <returns></returns>
103 public static byte[] LLSDSerialize(object obj)
104 {
105 StringWriter sw = new StringWriter();
106 XmlTextWriter writer = new XmlTextWriter(sw);
107 writer.Formatting = Formatting.None;
108
109 writer.WriteStartElement(String.Empty, "llsd", String.Empty);
110 LLSDWriteOne(writer, obj);
111 writer.WriteEndElement();
112
113 writer.Close();
114
115 return Util.UTF8.GetBytes(sw.ToString());
116 }
117
118 /// <summary>
119 ///
120 /// </summary>
121 /// <param name="writer"></param>
122 /// <param name="obj"></param>
123 public static void LLSDWriteOne(XmlTextWriter writer, object obj)
124 {
125 if (obj == null)
126 {
127 writer.WriteStartElement(String.Empty, "undef", String.Empty);
128 writer.WriteEndElement();
129 return;
130 }
131
132 if (obj is string)
133 {
134 writer.WriteStartElement(String.Empty, "string", String.Empty);
135 writer.WriteString((string) obj);
136 writer.WriteEndElement();
137 }
138 else if (obj is int)
139 {
140 writer.WriteStartElement(String.Empty, "integer", String.Empty);
141 writer.WriteString(obj.ToString());
142 writer.WriteEndElement();
143 }
144 else if (obj is double)
145 {
146 writer.WriteStartElement(String.Empty, "real", String.Empty);
147 writer.WriteString(obj.ToString());
148 writer.WriteEndElement();
149 }
150 else if (obj is bool)
151 {
152 bool b = (bool) obj;
153 writer.WriteStartElement(String.Empty, "boolean", String.Empty);
154 writer.WriteString(b ? "1" : "0");
155 writer.WriteEndElement();
156 }
157 else if (obj is ulong)
158 {
159 throw new Exception("ulong in LLSD is currently not implemented, fix me!");
160 }
161 else if (obj is UUID)
162 {
163 UUID u = (UUID) obj;
164 writer.WriteStartElement(String.Empty, "uuid", String.Empty);
165 writer.WriteString(u.ToString());
166 writer.WriteEndElement();
167 }
168 else if (obj is Hashtable)
169 {
170 Hashtable h = obj as Hashtable;
171 writer.WriteStartElement(String.Empty, "map", String.Empty);
172 foreach (string key in h.Keys)
173 {
174 writer.WriteStartElement(String.Empty, "key", String.Empty);
175 writer.WriteString(key);
176 writer.WriteEndElement();
177 LLSDWriteOne(writer, h[key]);
178 }
179 writer.WriteEndElement();
180 }
181 else if (obj is ArrayList)
182 {
183 ArrayList a = obj as ArrayList;
184 writer.WriteStartElement(String.Empty, "array", String.Empty);
185 foreach (object item in a)
186 {
187 LLSDWriteOne(writer, item);
188 }
189 writer.WriteEndElement();
190 }
191 else if (obj is byte[])
192 {
193 byte[] b = obj as byte[];
194 writer.WriteStartElement(String.Empty, "binary", String.Empty);
195
196 writer.WriteStartAttribute(String.Empty, "encoding", String.Empty);
197 writer.WriteString("base64");
198 writer.WriteEndAttribute();
199
200 //// Calculate the length of the base64 output
201 //long length = (long)(4.0d * b.Length / 3.0d);
202 //if (length % 4 != 0) length += 4 - (length % 4);
203
204 //// Create the char[] for base64 output and fill it
205 //char[] tmp = new char[length];
206 //int i = Convert.ToBase64CharArray(b, 0, b.Length, tmp, 0);
207
208 //writer.WriteString(new String(tmp));
209
210 writer.WriteString(Convert.ToBase64String(b));
211 writer.WriteEndElement();
212 }
213 else
214 {
215 throw new LLSDSerializeException("Unknown type " + obj.GetType().Name);
216 }
217 }
218
219 /// <summary>
220 ///
221 /// </summary>
222 /// <param name="reader"></param>
223 /// <returns></returns>
224 public static object LLSDParseOne(XmlTextReader reader)
225 {
226 SkipWS(reader);
227 if (reader.NodeType != XmlNodeType.Element)
228 throw new LLSDParseException("Expected an element");
229
230 string dtype = reader.LocalName;
231 object ret = null;
232
233 switch (dtype)
234 {
235 case "undef":
236 {
237 if (reader.IsEmptyElement)
238 {
239 reader.Read();
240 return null;
241 }
242
243 reader.Read();
244 SkipWS(reader);
245 ret = null;
246 break;
247 }
248 case "boolean":
249 {
250 if (reader.IsEmptyElement)
251 {
252 reader.Read();
253 return false;
254 }
255
256 reader.Read();
257 string s = reader.ReadString().Trim();
258
259 if (s == String.Empty || s == "false" || s == "0")
260 ret = false;
261 else if (s == "true" || s == "1")
262 ret = true;
263 else
264 throw new LLSDParseException("Bad boolean value " + s);
265
266 break;
267 }
268 case "integer":
269 {
270 if (reader.IsEmptyElement)
271 {
272 reader.Read();
273 return 0;
274 }
275
276 reader.Read();
277 ret = Convert.ToInt32(reader.ReadString().Trim());
278 break;
279 }
280 case "real":
281 {
282 if (reader.IsEmptyElement)
283 {
284 reader.Read();
285 return 0.0f;
286 }
287
288 reader.Read();
289 ret = Convert.ToDouble(reader.ReadString().Trim());
290 break;
291 }
292 case "uuid":
293 {
294 if (reader.IsEmptyElement)
295 {
296 reader.Read();
297 return UUID.Zero;
298 }
299
300 reader.Read();
301 ret = new UUID(reader.ReadString().Trim());
302 break;
303 }
304 case "string":
305 {
306 if (reader.IsEmptyElement)
307 {
308 reader.Read();
309 return String.Empty;
310 }
311
312 reader.Read();
313 ret = reader.ReadString();
314 break;
315 }
316 case "binary":
317 {
318 if (reader.IsEmptyElement)
319 {
320 reader.Read();
321 return new byte[0];
322 }
323
324 if (reader.GetAttribute("encoding") != null &&
325 reader.GetAttribute("encoding") != "base64")
326 {
327 throw new LLSDParseException("Unknown encoding: " + reader.GetAttribute("encoding"));
328 }
329
330 reader.Read();
331 FromBase64Transform b64 = new FromBase64Transform(FromBase64TransformMode.IgnoreWhiteSpaces);
332 byte[] inp = Util.UTF8.GetBytes(reader.ReadString());
333 ret = b64.TransformFinalBlock(inp, 0, inp.Length);
334 break;
335 }
336 case "date":
337 {
338 reader.Read();
339 throw new Exception("LLSD TODO: date");
340 }
341 case "map":
342 {
343 return LLSDParseMap(reader);
344 }
345 case "array":
346 {
347 return LLSDParseArray(reader);
348 }
349 default:
350 throw new LLSDParseException("Unknown element <" + dtype + ">");
351 }
352
353 if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != dtype)
354 {
355 throw new LLSDParseException("Expected </" + dtype + ">");
356 }
357
358 reader.Read();
359 return ret;
360 }
361
362 /// <summary>
363 ///
364 /// </summary>
365 /// <param name="reader"></param>
366 /// <returns></returns>
367 public static Hashtable LLSDParseMap(XmlTextReader reader)
368 {
369 Hashtable ret = new Hashtable();
370
371 if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "map")
372 throw new LLSDParseException("Expected <map>");
373
374 if (reader.IsEmptyElement)
375 {
376 reader.Read();
377 return ret;
378 }
379
380 reader.Read();
381
382 while (true)
383 {
384 SkipWS(reader);
385 if (reader.NodeType == XmlNodeType.EndElement && reader.LocalName == "map")
386 {
387 reader.Read();
388 break;
389 }
390
391 if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "key")
392 throw new LLSDParseException("Expected <key>");
393
394 string key = reader.ReadString();
395
396 if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "key")
397 throw new LLSDParseException("Expected </key>");
398
399 reader.Read();
400 object val = LLSDParseOne(reader);
401 ret[key] = val;
402 }
403
404 return ret; // TODO
405 }
406
407 /// <summary>
408 ///
409 /// </summary>
410 /// <param name="reader"></param>
411 /// <returns></returns>
412 public static ArrayList LLSDParseArray(XmlTextReader reader)
413 {
414 ArrayList ret = new ArrayList();
415
416 if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "array")
417 throw new LLSDParseException("Expected <array>");
418
419 if (reader.IsEmptyElement)
420 {
421 reader.Read();
422 return ret;
423 }
424
425 reader.Read();
426
427 while (true)
428 {
429 SkipWS(reader);
430
431 if (reader.NodeType == XmlNodeType.EndElement && reader.LocalName == "array")
432 {
433 reader.Read();
434 break;
435 }
436
437 ret.Insert(ret.Count, LLSDParseOne(reader));
438 }
439
440 return ret; // TODO
441 }
442
443 /// <summary>
444 ///
445 /// </summary>
446 /// <param name="count"></param>
447 /// <returns></returns>
448 private static string GetSpaces(int count)
449 {
450 StringBuilder b = new StringBuilder();
451 for (int i = 0; i < count; i++) b.Append(" ");
452 return b.ToString();
453 }
454
455 /// <summary>
456 ///
457 /// </summary>
458 /// <param name="obj"></param>
459 /// <param name="indent"></param>
460 /// <returns></returns>
461 public static String LLSDDump(object obj, int indent)
462 {
463 if (obj == null)
464 {
465 return GetSpaces(indent) + "- undef\n";
466 }
467 else if (obj is string)
468 {
469 return GetSpaces(indent) + "- string \"" + (string) obj + "\"\n";
470 }
471 else if (obj is int)
472 {
473 return GetSpaces(indent) + "- integer " + obj.ToString() + "\n";
474 }
475 else if (obj is double)
476 {
477 return GetSpaces(indent) + "- float " + obj.ToString() + "\n";
478 }
479 else if (obj is UUID)
480 {
481 return GetSpaces(indent) + "- uuid " + ((UUID) obj).ToString() + Environment.NewLine;
482 }
483 else if (obj is Hashtable)
484 {
485 StringBuilder ret = new StringBuilder();
486 ret.Append(GetSpaces(indent) + "- map" + Environment.NewLine);
487 Hashtable map = (Hashtable) obj;
488
489 foreach (string key in map.Keys)
490 {
491 ret.Append(GetSpaces(indent + 2) + "- key \"" + key + "\"" + Environment.NewLine);
492 ret.Append(LLSDDump(map[key], indent + 3));
493 }
494
495 return ret.ToString();
496 }
497 else if (obj is ArrayList)
498 {
499 StringBuilder ret = new StringBuilder();
500 ret.Append(GetSpaces(indent) + "- array\n");
501 ArrayList list = (ArrayList) obj;
502
503 foreach (object item in list)
504 {
505 ret.Append(LLSDDump(item, indent + 2));
506 }
507
508 return ret.ToString();
509 }
510 else if (obj is byte[])
511 {
512 return GetSpaces(indent) + "- binary\n" + Utils.BytesToHexString((byte[]) obj, GetSpaces(indent)) +
513 Environment.NewLine;
514 }
515 else
516 {
517 return GetSpaces(indent) + "- unknown type " + obj.GetType().Name + Environment.NewLine;
518 }
519 }
520
521 public static object ParseTerseLLSD(string llsd)
522 {
523 int notused;
524 return ParseTerseLLSD(llsd, out notused);
525 }
526
527 public static object ParseTerseLLSD(string llsd, out int endPos)
528 {
529 if (llsd.Length == 0)
530 {
531 endPos = 0;
532 return null;
533 }
534
535 // Identify what type of object this is
536 switch (llsd[0])
537 {
538 case '!':
539 throw new LLSDParseException("Undefined value type encountered");
540 case '1':
541 endPos = 1;
542 return true;
543 case '0':
544 endPos = 1;
545 return false;
546 case 'i':
547 {
548 if (llsd.Length < 2) throw new LLSDParseException("Integer value type with no value");
549 int value;
550 endPos = FindEnd(llsd, 1);
551
552 if (Int32.TryParse(llsd.Substring(1, endPos - 1), out value))
553 return value;
554 else
555 throw new LLSDParseException("Failed to parse integer value type");
556 }
557 case 'r':
558 {
559 if (llsd.Length < 2) throw new LLSDParseException("Real value type with no value");
560 double value;
561 endPos = FindEnd(llsd, 1);
562
563 if (Double.TryParse(llsd.Substring(1, endPos - 1), NumberStyles.Float,
564 Utils.EnUsCulture.NumberFormat, out value))
565 return value;
566 else
567 throw new LLSDParseException("Failed to parse double value type");
568 }
569 case 'u':
570 {
571 if (llsd.Length < 17) throw new LLSDParseException("UUID value type with no value");
572 UUID value;
573 endPos = FindEnd(llsd, 1);
574
575 if (UUID.TryParse(llsd.Substring(1, endPos - 1), out value))
576 return value;
577 else
578 throw new LLSDParseException("Failed to parse UUID value type");
579 }
580 case 'b':
581 //byte[] value = new byte[llsd.Length - 1];
582 // This isn't the actual binary LLSD format, just the terse format sent
583 // at login so I don't even know if there is a binary type
584 throw new LLSDParseException("Binary value type is unimplemented");
585 case 's':
586 case 'l':
587 if (llsd.Length < 2) throw new LLSDParseException("String value type with no value");
588 endPos = FindEnd(llsd, 1);
589 return llsd.Substring(1, endPos - 1);
590 case 'd':
591 // Never seen one before, don't know what the format is
592 throw new LLSDParseException("Date value type is unimplemented");
593 case '[':
594 {
595 if (llsd.IndexOf(']') == -1) throw new LLSDParseException("Invalid array");
596
597 int pos = 0;
598 ArrayList array = new ArrayList();
599
600 while (llsd[pos] != ']')
601 {
602 ++pos;
603
604 // Advance past comma if need be
605 if (llsd[pos] == ',') ++pos;
606
607 // Allow a single whitespace character
608 if (pos < llsd.Length && llsd[pos] == ' ') ++pos;
609
610 int end;
611 array.Add(ParseTerseLLSD(llsd.Substring(pos), out end));
612 pos += end;
613 }
614
615 endPos = pos + 1;
616 return array;
617 }
618 case '{':
619 {
620 if (llsd.IndexOf('}') == -1) throw new LLSDParseException("Invalid map");
621
622 int pos = 0;
623 Hashtable hashtable = new Hashtable();
624
625 while (llsd[pos] != '}')
626 {
627 ++pos;
628
629 // Advance past comma if need be
630 if (llsd[pos] == ',') ++pos;
631
632 // Allow a single whitespace character
633 if (pos < llsd.Length && llsd[pos] == ' ') ++pos;
634
635 if (llsd[pos] != '\'') throw new LLSDParseException("Expected a map key");
636 int endquote = llsd.IndexOf('\'', pos + 1);
637 if (endquote == -1 || (endquote + 1) >= llsd.Length || llsd[endquote + 1] != ':')
638 throw new LLSDParseException("Invalid map format");
639 string key = llsd.Substring(pos, endquote - pos);
640 key = key.Replace("'", String.Empty);
641 pos += (endquote - pos) + 2;
642
643 int end;
644 hashtable.Add(key, ParseTerseLLSD(llsd.Substring(pos), out end));
645 pos += end;
646 }
647
648 endPos = pos + 1;
649 return hashtable;
650 }
651 default:
652 throw new Exception("Unknown value type");
653 }
654 }
655
656 private static int FindEnd(string llsd, int start)
657 {
658 int end = llsd.IndexOfAny(new char[] {',', ']', '}'});
659 if (end == -1) end = llsd.Length - 1;
660 return end;
661 }
662
663 /// <summary>
664 ///
665 /// </summary>
666 /// <param name="reader"></param>
667 private static void SkipWS(XmlTextReader reader)
668 {
669 while (
670 reader.NodeType == XmlNodeType.Comment ||
671 reader.NodeType == XmlNodeType.Whitespace ||
672 reader.NodeType == XmlNodeType.SignificantWhitespace ||
673 reader.NodeType == XmlNodeType.XmlDeclaration)
674 {
675 reader.Read();
676 }
677 }
678 }
679}
diff --git a/OpenSim/Capabilities/LLSDArray.cs b/OpenSim/Capabilities/LLSDArray.cs
new file mode 100644
index 0000000..3459e49
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDArray.cs
@@ -0,0 +1,41 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections;
29
30namespace OpenSim.Framework.Capabilities
31{
32 [LLSDType("ARRAY")]
33 public class OSDArray
34 {
35 public ArrayList Array = new ArrayList();
36
37 public OSDArray()
38 {
39 }
40 }
41} \ No newline at end of file
diff --git a/OpenSim/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Capabilities/LLSDAssetUploadComplete.cs
new file mode 100644
index 0000000..ab6cee5
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDAssetUploadComplete.cs
@@ -0,0 +1,45 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenMetaverse;
30
31namespace OpenSim.Framework.Capabilities
32{
33 [LLSDType("MAP")]
34 public class LLSDAssetUploadComplete
35 {
36 public string new_asset = String.Empty;
37 public UUID new_inventory_item = UUID.Zero;
38 public string state = String.Empty;
39 //public bool success = false;
40
41 public LLSDAssetUploadComplete()
42 {
43 }
44 }
45}
diff --git a/OpenSim/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Capabilities/LLSDAssetUploadRequest.cs
new file mode 100644
index 0000000..6e66f0a
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDAssetUploadRequest.cs
@@ -0,0 +1,46 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenMetaverse;
30
31namespace OpenSim.Framework.Capabilities
32{
33 [OSDMap]
34 public class LLSDAssetUploadRequest
35 {
36 public string asset_type = String.Empty;
37 public string description = String.Empty;
38 public UUID folder_id = UUID.Zero;
39 public string inventory_type = String.Empty;
40 public string name = String.Empty;
41
42 public LLSDAssetUploadRequest()
43 {
44 }
45 }
46}
diff --git a/OpenSim/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Capabilities/LLSDAssetUploadResponse.cs
new file mode 100644
index 0000000..0d6f7f9
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDAssetUploadResponse.cs
@@ -0,0 +1,56 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenSim.Framework.Capabilities
31{
32 [OSDMap]
33 public class LLSDAssetUploadResponse
34 {
35 public string uploader = String.Empty;
36 public string state = String.Empty;
37
38 public LLSDAssetUploadResponse()
39 {
40 }
41 }
42
43 [OSDMap]
44 public class LLSDNewFileAngentInventoryVariablePriceReplyResponse
45 {
46 public int resource_cost;
47 public string state;
48 public int upload_price;
49 public string rsvp;
50
51 public LLSDNewFileAngentInventoryVariablePriceReplyResponse()
52 {
53 state = "confirm_upload";
54 }
55 }
56} \ No newline at end of file
diff --git a/OpenSim/Capabilities/LLSDCapEvent.cs b/OpenSim/Capabilities/LLSDCapEvent.cs
new file mode 100644
index 0000000..63abd62
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDCapEvent.cs
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Framework.Capabilities
29{
30 [LLSDType("MAP")]
31 public class LLSDCapEvent
32 {
33 public int id = 0;
34 public OSDArray events = new OSDArray();
35
36 public LLSDCapEvent()
37 {
38 }
39 }
40} \ No newline at end of file
diff --git a/OpenSim/Capabilities/LLSDEmpty.cs b/OpenSim/Capabilities/LLSDEmpty.cs
new file mode 100644
index 0000000..f94fcba
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDEmpty.cs
@@ -0,0 +1,37 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Framework.Capabilities
29{
30 [LLSDType("MAP")]
31 public class LLSDEmpty
32 {
33 public LLSDEmpty()
34 {
35 }
36 }
37} \ No newline at end of file
diff --git a/OpenSim/Capabilities/LLSDHelpers.cs b/OpenSim/Capabilities/LLSDHelpers.cs
new file mode 100644
index 0000000..8f1a40e
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDHelpers.cs
@@ -0,0 +1,172 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.IO;
31using System.Reflection;
32using System.Xml;
33
34namespace OpenSim.Framework.Capabilities
35{
36 public class LLSDHelpers
37 {
38// private static readonly log4net.ILog m_log
39// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
40
41 public static string SerialiseLLSDReply(object obj)
42 {
43 StringWriter sw = new StringWriter();
44 XmlTextWriter writer = new XmlTextWriter(sw);
45 writer.Formatting = Formatting.None;
46 writer.WriteStartElement(String.Empty, "llsd", String.Empty);
47 SerializeOSDType(writer, obj);
48 writer.WriteEndElement();
49 writer.Close();
50
51 //m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString());
52
53 return sw.ToString();
54 }
55
56 private static void SerializeOSDType(XmlTextWriter writer, object obj)
57 {
58 Type myType = obj.GetType();
59 LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
60 if (llsdattributes.Length > 0)
61 {
62 switch (llsdattributes[0].ObjectType)
63 {
64 case "MAP":
65 writer.WriteStartElement(String.Empty, "map", String.Empty);
66 FieldInfo[] fields = myType.GetFields();
67 for (int i = 0; i < fields.Length; i++)
68 {
69 if (fields[i] != null && fields[i].GetValue(obj) != null)
70 {
71 object fieldValue = fields[i].GetValue(obj);
72 LLSDType[] fieldAttributes =
73 (LLSDType[]) fieldValue.GetType().GetCustomAttributes(typeof (LLSDType), false);
74 if (fieldAttributes.Length > 0)
75 {
76 writer.WriteStartElement(String.Empty, "key", String.Empty);
77 string fieldName = fields[i].Name;
78 fieldName = fieldName.Replace("___", "-");
79 writer.WriteString(fieldName);
80 writer.WriteEndElement();
81 SerializeOSDType(writer, fieldValue);
82 }
83 else
84 {
85 writer.WriteStartElement(String.Empty, "key", String.Empty);
86 string fieldName = fields[i].Name;
87 fieldName = fieldName.Replace("___", "-");
88 writer.WriteString(fieldName);
89 writer.WriteEndElement();
90 LLSD.LLSDWriteOne(writer, fieldValue);
91 // OpenMetaverse.StructuredData.LLSDParser.SerializeXmlElement(
92 // writer, OpenMetaverse.StructuredData.OSD.FromObject(fieldValue));
93 }
94 }
95 else
96 {
97 // TODO from ADAM: There is a nullref being caused by fields[i] being null
98 // on some computers. Unsure what is causing this, but would appreciate
99 // if sdague could take a look at this.
100 }
101 }
102 writer.WriteEndElement();
103 break;
104 case "ARRAY":
105 // OSDArray arrayObject = obj as OSDArray;
106 // ArrayList a = arrayObject.Array;
107 ArrayList a = (ArrayList) obj.GetType().GetField("Array").GetValue(obj);
108 if (a != null)
109 {
110 writer.WriteStartElement(String.Empty, "array", String.Empty);
111 foreach (object item in a)
112 {
113 SerializeOSDType(writer, item);
114 }
115 writer.WriteEndElement();
116 }
117 break;
118 }
119 }
120 else
121 {
122 LLSD.LLSDWriteOne(writer, obj);
123 //OpenMetaverse.StructuredData.LLSDParser.SerializeXmlElement(
124 // writer, OpenMetaverse.StructuredData.OSD.FromObject(obj));
125 }
126 }
127
128 public static object DeserialiseOSDMap(Hashtable llsd, object obj)
129 {
130 Type myType = obj.GetType();
131 LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
132 if (llsdattributes.Length > 0)
133 {
134 switch (llsdattributes[0].ObjectType)
135 {
136 case "MAP":
137 IDictionaryEnumerator enumerator = llsd.GetEnumerator();
138 while (enumerator.MoveNext())
139 {
140 string keyName = (string)enumerator.Key;
141 keyName = keyName.Replace("-","_");
142 FieldInfo field = myType.GetField(keyName);
143 if (field != null)
144 {
145 // if (enumerator.Value is OpenMetaverse.StructuredData.OSDMap)
146 if (enumerator.Value is Hashtable)
147 {
148 object fieldValue = field.GetValue(obj);
149 DeserialiseOSDMap((Hashtable) enumerator.Value, fieldValue);
150 // DeserialiseOSDMap((OpenMetaverse.StructuredData.OSDMap) enumerator.Value, fieldValue);
151 }
152 else if (enumerator.Value is ArrayList)
153 {
154 object fieldValue = field.GetValue(obj);
155 fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value);
156 //TODO
157 // the LLSD map/array types in the array need to be deserialised
158 // but first we need to know the right class to deserialise them into.
159 }
160 else
161 {
162 field.SetValue(obj, enumerator.Value);
163 }
164 }
165 }
166 break;
167 }
168 }
169 return obj;
170 }
171 }
172}
diff --git a/OpenSim/Capabilities/LLSDInventoryFolder.cs b/OpenSim/Capabilities/LLSDInventoryFolder.cs
new file mode 100644
index 0000000..3c216e9
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDInventoryFolder.cs
@@ -0,0 +1,41 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework.Capabilities
31{
32 [OSDMap]
33 public class LLSDInventoryFolder
34 {
35 public UUID folder_id;
36 public UUID parent_id;
37 public string name;
38 public string type;
39 public string preferred_type;
40 }
41}
diff --git a/OpenSim/Capabilities/LLSDInventoryItem.cs b/OpenSim/Capabilities/LLSDInventoryItem.cs
new file mode 100644
index 0000000..cce18d7
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDInventoryItem.cs
@@ -0,0 +1,98 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework.Capabilities
31{
32 [OSDMap]
33 public class LLSDInventoryItem
34 {
35 public UUID parent_id;
36
37 public UUID asset_id;
38 public UUID item_id;
39 public LLSDPermissions permissions;
40 public string type;
41 public string inv_type;
42 public int flags;
43
44 public LLSDSaleInfo sale_info;
45 public string name;
46 public string desc;
47 public int created_at;
48 }
49
50 [OSDMap]
51 public class LLSDPermissions
52 {
53 public UUID creator_id;
54 public UUID owner_id;
55 public UUID group_id;
56 public int base_mask;
57 public int owner_mask;
58 public int group_mask;
59 public int everyone_mask;
60 public int next_owner_mask;
61 public bool is_owner_group;
62 }
63
64 [OSDMap]
65 public class LLSDSaleInfo
66 {
67 public int sale_price;
68 public string sale_type;
69 }
70
71 [OSDMap]
72 public class LLSDInventoryDescendents
73 {
74 public OSDArray folders = new OSDArray();
75 }
76
77 [OSDMap]
78 public class LLSDFetchInventoryDescendents
79 {
80 public UUID folder_id;
81 public UUID owner_id;
82 public int sort_order;
83 public bool fetch_folders;
84 public bool fetch_items;
85 }
86
87 [OSDMap]
88 public class LLSDInventoryFolderContents
89 {
90 public UUID agent_id;
91 public int descendents;
92 public UUID folder_id;
93 public OSDArray categories = new OSDArray();
94 public OSDArray items = new OSDArray();
95 public UUID owner_id;
96 public int version;
97 }
98}
diff --git a/OpenSim/Capabilities/LLSDItemUpdate.cs b/OpenSim/Capabilities/LLSDItemUpdate.cs
new file mode 100644
index 0000000..96e2b61
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDItemUpdate.cs
@@ -0,0 +1,41 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework.Capabilities
31{
32 [OSDMap]
33 public class LLSDItemUpdate
34 {
35 public UUID item_id;
36
37 public LLSDItemUpdate()
38 {
39 }
40 }
41}
diff --git a/OpenSim/Capabilities/LLSDMapLayer.cs b/OpenSim/Capabilities/LLSDMapLayer.cs
new file mode 100644
index 0000000..4aeb1ff
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDMapLayer.cs
@@ -0,0 +1,45 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework.Capabilities
31{
32 [LLSDType("MAP")]
33 public class OSDMapLayer
34 {
35 public int Left = 0;
36 public int Right = 0;
37 public int Top = 0;
38 public int Bottom = 0;
39 public UUID ImageID = UUID.Zero;
40
41 public OSDMapLayer()
42 {
43 }
44 }
45}
diff --git a/OpenSim/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Capabilities/LLSDMapLayerResponse.cs
new file mode 100644
index 0000000..839e34c
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDMapLayerResponse.cs
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Framework.Capabilities
29{
30 [LLSDType("MAP")]
31 public class LLSDMapLayerResponse
32 {
33 public LLSDMapRequest AgentData = new LLSDMapRequest();
34 public OSDArray LayerData = new OSDArray();
35
36 public LLSDMapLayerResponse()
37 {
38 }
39 }
40} \ No newline at end of file
diff --git a/OpenSim/Capabilities/LLSDMapRequest.cs b/OpenSim/Capabilities/LLSDMapRequest.cs
new file mode 100644
index 0000000..debf387
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDMapRequest.cs
@@ -0,0 +1,39 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Framework.Capabilities
29{
30 [LLSDType("MAP")]
31 public class LLSDMapRequest
32 {
33 public int Flags = 0;
34
35 public LLSDMapRequest()
36 {
37 }
38 }
39} \ No newline at end of file
diff --git a/OpenSim/Capabilities/LLSDMethod.cs b/OpenSim/Capabilities/LLSDMethod.cs
new file mode 100644
index 0000000..cd2574d
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDMethod.cs
@@ -0,0 +1,31 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Framework.Capabilities
29{
30 public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request);
31} \ No newline at end of file
diff --git a/OpenSim/Capabilities/LLSDMethodString.cs b/OpenSim/Capabilities/LLSDMethodString.cs
new file mode 100644
index 0000000..38700d5
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDMethodString.cs
@@ -0,0 +1,31 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Framework.Capabilities
29{
30 public delegate TResponse LLSDMethodString<TRequest, TResponse>(TRequest request, string path);
31}
diff --git a/OpenSim/Capabilities/LLSDParcelVoiceInfoResponse.cs b/OpenSim/Capabilities/LLSDParcelVoiceInfoResponse.cs
new file mode 100644
index 0000000..b34a668
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDParcelVoiceInfoResponse.cs
@@ -0,0 +1,51 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSimulator Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using System.Collections;
30
31namespace OpenSim.Framework.Capabilities
32{
33 [OSDMap]
34 public class LLSDParcelVoiceInfoResponse
35 {
36 public int parcel_local_id;
37 public string region_name;
38 public Hashtable voice_credentials;
39
40 public LLSDParcelVoiceInfoResponse()
41 {
42 }
43
44 public LLSDParcelVoiceInfoResponse(string region, int localID, Hashtable creds)
45 {
46 region_name = region;
47 parcel_local_id = localID;
48 voice_credentials = creds;
49 }
50 }
51} \ No newline at end of file
diff --git a/OpenSim/Capabilities/LLSDRemoteParcelResponse.cs b/OpenSim/Capabilities/LLSDRemoteParcelResponse.cs
new file mode 100644
index 0000000..13d69d3
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDRemoteParcelResponse.cs
@@ -0,0 +1,42 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSimulator Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using OpenMetaverse;
30
31namespace OpenSim.Framework.Capabilities
32{
33 [LLSDType("MAP")]
34 public class LLSDRemoteParcelResponse
35 {
36 public UUID parcel_id;
37
38 public LLSDRemoteParcelResponse()
39 {
40 }
41 }
42}
diff --git a/OpenSim/Capabilities/LLSDStreamHandler.cs b/OpenSim/Capabilities/LLSDStreamHandler.cs
new file mode 100644
index 0000000..7aaa994
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDStreamHandler.cs
@@ -0,0 +1,70 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections;
29using System.IO;
30using System.Text;
31using OpenSim.Framework.Servers;
32using OpenSim.Framework.Servers.HttpServer;
33
34namespace OpenSim.Framework.Capabilities
35{
36 public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler
37 where TRequest : new()
38 {
39 private LLSDMethod<TRequest, TResponse> m_method;
40
41 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
42 : base(httpMethod, path)
43 {
44 m_method = method;
45 }
46
47 public override byte[] Handle(string path, Stream request,
48 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
49 {
50 //Encoding encoding = Util.UTF8;
51 //StreamReader streamReader = new StreamReader(request, false);
52
53 //string requestBody = streamReader.ReadToEnd();
54 //streamReader.Close();
55
56 // OpenMetaverse.StructuredData.OSDMap hash = (OpenMetaverse.StructuredData.OSDMap)
57 // OpenMetaverse.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request));
58
59 Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
60 TRequest llsdRequest = new TRequest();
61 LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest);
62
63 TResponse response = m_method(llsdRequest);
64
65 Encoding encoding = new UTF8Encoding(false);
66
67 return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
68 }
69 }
70}
diff --git a/OpenSim/Capabilities/LLSDTaskInventoryUploadComplete.cs b/OpenSim/Capabilities/LLSDTaskInventoryUploadComplete.cs
new file mode 100644
index 0000000..47fdaca
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDTaskInventoryUploadComplete.cs
@@ -0,0 +1,50 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework.Capabilities
31{
32 [OSDMap]
33 public class LLSDTaskInventoryUploadComplete
34 {
35 /// <summary>
36 /// The task inventory item that was updated
37 /// </summary>
38 public UUID item_id;
39
40 /// <summary>
41 /// The task that was updated
42 /// </summary>
43 public UUID task_id;
44
45 /// <summary>
46 /// State of the upload. So far have only even seen this set to "complete"
47 /// </summary>
48 public string state;
49 }
50}
diff --git a/OpenSim/Capabilities/LLSDTaskScriptUpdate.cs b/OpenSim/Capabilities/LLSDTaskScriptUpdate.cs
new file mode 100644
index 0000000..9d7c17f
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDTaskScriptUpdate.cs
@@ -0,0 +1,50 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework.Capabilities
31{
32 [OSDMap]
33 public class LLSDTaskScriptUpdate
34 {
35 /// <summary>
36 /// The item containing the script to update
37 /// </summary>
38 public UUID item_id;
39
40 /// <summary>
41 /// The task containing the script
42 /// </summary>
43 public UUID task_id;
44
45 /// <summary>
46 /// Signals whether the script is currently active
47 /// </summary>
48 public int is_script_running;
49 }
50}
diff --git a/OpenSim/Capabilities/LLSDTaskScriptUploadComplete.cs b/OpenSim/Capabilities/LLSDTaskScriptUploadComplete.cs
new file mode 100644
index 0000000..d308831
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDTaskScriptUploadComplete.cs
@@ -0,0 +1,54 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using System;
30using System.Collections;
31
32namespace OpenSim.Framework.Capabilities
33{
34 [OSDMap]
35 public class LLSDTaskScriptUploadComplete
36 {
37 /// <summary>
38 /// The task inventory item that was updated
39 /// </summary>
40 public UUID new_asset;
41
42 /// <summary>
43 /// Was it compiled?
44 /// </summary>
45 public bool compiled;
46
47 /// <summary>
48 /// State of the upload. So far have only even seen this set to "complete"
49 /// </summary>
50 public string state;
51
52 public OSDArray errors;
53 }
54}
diff --git a/OpenSim/Capabilities/LLSDTest.cs b/OpenSim/Capabilities/LLSDTest.cs
new file mode 100644
index 0000000..5f77c3d
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDTest.cs
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Framework.Capabilities
29{
30 [LLSDType("MAP")]
31 public class LLSDTest
32 {
33 public int Test1 = 20;
34 public int Test2 = 10;
35
36 public LLSDTest()
37 {
38 }
39 }
40} \ No newline at end of file
diff --git a/OpenSim/Capabilities/LLSDType.cs b/OpenSim/Capabilities/LLSDType.cs
new file mode 100644
index 0000000..d5ca1ab
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDType.cs
@@ -0,0 +1,55 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenSim.Framework.Capabilities
31{
32 [AttributeUsage(AttributeTargets.Class)]
33 public class LLSDType : Attribute
34 {
35 protected string myType;
36
37 public LLSDType(string type)
38 {
39 myType = type;
40 }
41
42 public string ObjectType
43 {
44 get { return myType; }
45 }
46 }
47
48 [AttributeUsage(AttributeTargets.Class)]
49 public class OSDMap : LLSDType
50 {
51 public OSDMap() : base("MAP")
52 {
53 }
54 }
55} \ No newline at end of file
diff --git a/OpenSim/Capabilities/LLSDVoiceAccountResponse.cs b/OpenSim/Capabilities/LLSDVoiceAccountResponse.cs
new file mode 100644
index 0000000..53c11e7
--- /dev/null
+++ b/OpenSim/Capabilities/LLSDVoiceAccountResponse.cs
@@ -0,0 +1,57 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSimulator Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29namespace OpenSim.Framework.Capabilities
30{
31 [OSDMap]
32 public class LLSDVoiceAccountResponse
33 {
34 public string username;
35 public string password;
36 public string voice_sip_uri_hostname;
37 public string voice_account_server_name;
38
39 public LLSDVoiceAccountResponse()
40 {
41 }
42
43 public LLSDVoiceAccountResponse(string user, string pass)
44 {
45 username = user;
46 password = pass;
47 }
48
49 public LLSDVoiceAccountResponse(string user, string pass, string sipUriHost, string accountServer)
50 {
51 username = user;
52 password = pass;
53 voice_sip_uri_hostname = sipUriHost;
54 voice_account_server_name = accountServer;
55 }
56 }
57} \ No newline at end of file