aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities/Caps.cs
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Capabilities/Caps.cs
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Capabilities/Caps.cs')
-rw-r--r--OpenSim/Capabilities/Caps.cs102
1 files changed, 93 insertions, 9 deletions
diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs
index bc6f6f9..049afab 100644
--- a/OpenSim/Capabilities/Caps.cs
+++ b/OpenSim/Capabilities/Caps.cs
@@ -50,8 +50,7 @@ namespace OpenSim.Framework.Capabilities
50 50
51 public class Caps 51 public class Caps
52 { 52 {
53// private static readonly ILog m_log = 53// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 54
56 private string m_httpListenerHostName; 55 private string m_httpListenerHostName;
57 private uint m_httpListenPort; 56 private uint m_httpListenPort;
@@ -63,7 +62,11 @@ namespace OpenSim.Framework.Capabilities
63 public string CapsObjectPath { get { return m_capsObjectPath; } } 62 public string CapsObjectPath { get { return m_capsObjectPath; } }
64 63
65 private CapsHandlers m_capsHandlers; 64 private CapsHandlers m_capsHandlers;
66 private Dictionary<string, string> m_externalCapsHandlers; 65
66 private Dictionary<string, PollServiceEventArgs> m_pollServiceHandlers
67 = new Dictionary<string, PollServiceEventArgs>();
68
69 private Dictionary<string, string> m_externalCapsHandlers = new Dictionary<string, string>();
67 70
68 private IHttpServer m_httpListener; 71 private IHttpServer m_httpListener;
69 private UUID m_agentID; 72 private UUID m_agentID;
@@ -132,7 +135,6 @@ namespace OpenSim.Framework.Capabilities
132 135
133 m_agentID = agent; 136 m_agentID = agent;
134 m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL); 137 m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
135 m_externalCapsHandlers = new Dictionary<string, string>();
136 m_regionName = regionName; 138 m_regionName = regionName;
137 } 139 }
138 140
@@ -143,8 +145,33 @@ namespace OpenSim.Framework.Capabilities
143 /// <param name="handler"></param> 145 /// <param name="handler"></param>
144 public void RegisterHandler(string capName, IRequestHandler handler) 146 public void RegisterHandler(string capName, IRequestHandler handler)
145 { 147 {
146 m_capsHandlers[capName] = handler;
147 //m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path); 148 //m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path);
149 m_capsHandlers[capName] = handler;
150 }
151
152 public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler)
153 {
154// m_log.DebugFormat(
155// "[CAPS]: Registering handler with name {0}, url {1} for {2}",
156// capName, pollServiceHandler.Url, m_agentID, m_regionName);
157
158 m_pollServiceHandlers.Add(capName, pollServiceHandler);
159
160 m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler.Url, pollServiceHandler);
161
162// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
163// string protocol = "http";
164// string hostName = m_httpListenerHostName;
165//
166// if (MainServer.Instance.UseSSL)
167// {
168// hostName = MainServer.Instance.SSLCommonName;
169// port = MainServer.Instance.SSLPort;
170// protocol = "https";
171// }
172
173// RegisterHandler(
174// capName, String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, pollServiceHandler.Url));
148 } 175 }
149 176
150 /// <summary> 177 /// <summary>
@@ -163,13 +190,70 @@ namespace OpenSim.Framework.Capabilities
163 /// </summary> 190 /// </summary>
164 public void DeregisterHandlers() 191 public void DeregisterHandlers()
165 { 192 {
166 if (m_capsHandlers != null) 193 foreach (string capsName in m_capsHandlers.Caps)
194 {
195 m_capsHandlers.Remove(capsName);
196 }
197
198 foreach (PollServiceEventArgs handler in m_pollServiceHandlers.Values)
167 { 199 {
168 foreach (string capsName in m_capsHandlers.Caps) 200 m_httpListener.RemovePollServiceHTTPHandler("", handler.Url);
201 }
202 }
203
204 public bool TryGetPollHandler(string name, out PollServiceEventArgs pollHandler)
205 {
206 return m_pollServiceHandlers.TryGetValue(name, out pollHandler);
207 }
208
209 public Dictionary<string, PollServiceEventArgs> GetPollHandlers()
210 {
211 return new Dictionary<string, PollServiceEventArgs>(m_pollServiceHandlers);
212 }
213
214 /// <summary>
215 /// Return an LLSD-serializable Hashtable describing the
216 /// capabilities and their handler details.
217 /// </summary>
218 /// <param name="excludeSeed">If true, then exclude the seed cap.</param>
219 public Hashtable GetCapsDetails(bool excludeSeed, List<string> requestedCaps)
220 {
221 Hashtable caps = CapsHandlers.GetCapsDetails(excludeSeed, requestedCaps);
222
223 lock (m_pollServiceHandlers)
224 {
225 foreach (KeyValuePair <string, PollServiceEventArgs> kvp in m_pollServiceHandlers)
169 { 226 {
170 m_capsHandlers.Remove(capsName); 227 if (!requestedCaps.Contains(kvp.Key))
228 continue;
229
230 string hostName = m_httpListenerHostName;
231 uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
232 string protocol = "http";
233
234 if (MainServer.Instance.UseSSL)
235 {
236 hostName = MainServer.Instance.SSLCommonName;
237 port = MainServer.Instance.SSLPort;
238 protocol = "https";
239 }
240 //
241 // caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
242
243 caps[kvp.Key] = string.Format("{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url);
171 } 244 }
172 } 245 }
246
247 // Add the external too
248 foreach (KeyValuePair<string, string> kvp in ExternalCapsHandlers)
249 {
250 if (!requestedCaps.Contains(kvp.Key))
251 continue;
252
253 caps[kvp.Key] = kvp.Value;
254 }
255
256 return caps;
173 } 257 }
174 } 258 }
175} 259} \ No newline at end of file