29 using System.Collections;
30 using System.Collections.Generic;
32 using System.Reflection;
33 using System.Threading;
37 using OpenSim.Framework.Servers;
38 using OpenSim.Framework.Servers.HttpServer;
39 using OpenSim.Services.Interfaces;
56 private string m_httpListenerHostName;
57 private uint m_httpListenPort;
62 private string m_capsObjectPath;
63 public string CapsObjectPath {
get {
return m_capsObjectPath; } }
67 private Dictionary<string, PollServiceEventArgs> m_pollServiceHandlers
68 =
new Dictionary<string, PollServiceEventArgs>();
70 private Dictionary<string, string> m_externalCapsHandlers =
new Dictionary<string, string>();
73 private UUID m_agentID;
74 private string m_regionName;
75 private ManualResetEvent m_capsActive =
new ManualResetEvent(
false);
79 get {
return m_agentID; }
82 public string RegionName
84 get {
return m_regionName; }
87 public string HostName
89 get {
return m_httpListenerHostName; }
94 get {
return m_httpListenPort; }
99 get {
return m_httpListener; }
104 get {
return m_httpListener.UseSSL; }
107 public string SSLCommonName
109 get {
return m_httpListener.SSLCommonName; }
114 get {
return m_capsHandlers; }
117 public Dictionary<string, string> ExternalCapsHandlers
119 get {
return m_externalCapsHandlers; }
123 UUID agent,
string regionName)
125 m_capsObjectPath = capsPath;
127 m_httpListenerHostName = httpListen;
129 m_httpListenPort = httpPort;
131 if (httpServer != null && httpServer.
UseSSL)
133 m_httpListenPort = httpServer.SSLPort;
134 httpListen = httpServer.SSLCommonName;
135 httpPort = httpServer.SSLPort;
139 m_capsHandlers =
new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ?
false : httpServer.
UseSSL);
140 m_regionName = regionName;
141 m_capsActive.Reset();
152 m_capsHandlers[capName] = handler;
161 m_pollServiceHandlers.Add(capName, pollServiceHandler);
163 m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler.Url, pollServiceHandler);
188 m_externalCapsHandlers.Add(capsName, url);
196 foreach (
string capsName
in m_capsHandlers.Caps)
198 m_capsHandlers.Remove(capsName);
203 m_httpListener.RemovePollServiceHTTPHandler(
"", handler.Url);
209 return m_pollServiceHandlers.TryGetValue(name, out pollHandler);
214 return new Dictionary<string, PollServiceEventArgs>(m_pollServiceHandlers);
224 Hashtable caps = CapsHandlers.GetCapsDetails(excludeSeed, requestedCaps);
226 lock (m_pollServiceHandlers)
228 foreach (KeyValuePair <string, PollServiceEventArgs> kvp
in m_pollServiceHandlers)
230 if (!requestedCaps.Contains(kvp.Key))
233 string hostName = m_httpListenerHostName;
235 string protocol =
"http";
239 hostName = MainServer.Instance.SSLCommonName;
240 port = MainServer.Instance.SSLPort;
246 caps[kvp.Key] = string.Format(
"{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url);
251 foreach (KeyValuePair<string, string> kvp
in ExternalCapsHandlers)
253 if (!requestedCaps.Contains(kvp.Key))
256 caps[kvp.Key] = kvp.Value;
270 return m_capsActive.WaitOne(120000);
bool TryGetPollHandler(string name, out PollServiceEventArgs pollHandler)
void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler)
Interface to OpenSimulator's built in HTTP server. Use this to register handlers (http, llsd, xmlrpc, etc.) for given URLs.
CapsHandlers is a cap handler container but also takes care of adding and removing cap handlers to an...
void DeregisterHandlers()
Remove all CAPS service handlers.
Dictionary< string, PollServiceEventArgs > GetPollHandlers()
void RegisterHandler(string capsName, string url)
Register an external handler. The service for this capability is somewhere else given by the URL...
void RegisterHandler(string capName, IRequestHandler handler)
Register a handler. This allows modules to register handlers.
Interactive OpenSim region server
static BaseHttpServer Instance
Set the main HTTP server instance.
delegate IClientAPI GetClientDelegate(UUID agentID)
XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefl...
Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath, UUID agent, string regionName)
System.Net.HttpListener HttpListener
Hashtable GetCapsDetails(bool excludeSeed, List< string > requestedCaps)
Return an LLSD-serializable Hashtable describing the capabilities and their handler details...