aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities
diff options
context:
space:
mode:
authorMelanie2013-07-24 03:50:09 +0100
committerMelanie2013-07-24 03:50:09 +0100
commita7eb1b5b855b3caa6c4622789ef1377830e2f435 (patch)
tree2bd58bcd2bd9b37adeb746f4b399b1d98539d1cf /OpenSim/Capabilities
parentMerge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into ... (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-a7eb1b5b855b3caa6c4622789ef1377830e2f435.zip
opensim-SC_OLD-a7eb1b5b855b3caa6c4622789ef1377830e2f435.tar.gz
opensim-SC_OLD-a7eb1b5b855b3caa6c4622789ef1377830e2f435.tar.bz2
opensim-SC_OLD-a7eb1b5b855b3caa6c4622789ef1377830e2f435.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
Diffstat (limited to 'OpenSim/Capabilities')
-rw-r--r--OpenSim/Capabilities/Caps.cs93
1 files changed, 87 insertions, 6 deletions
diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs
index 95fc61b..30a323e 100644
--- a/OpenSim/Capabilities/Caps.cs
+++ b/OpenSim/Capabilities/Caps.cs
@@ -64,7 +64,11 @@ namespace OpenSim.Framework.Capabilities
64 public string CapsObjectPath { get { return m_capsObjectPath; } } 64 public string CapsObjectPath { get { return m_capsObjectPath; } }
65 65
66 private CapsHandlers m_capsHandlers; 66 private CapsHandlers m_capsHandlers;
67 private Dictionary<string, string> m_externalCapsHandlers; 67
68 private Dictionary<string, PollServiceEventArgs> m_pollServiceHandlers
69 = new Dictionary<string, PollServiceEventArgs>();
70
71 private Dictionary<string, string> m_externalCapsHandlers = new Dictionary<string, string>();
68 72
69 private IHttpServer m_httpListener; 73 private IHttpServer m_httpListener;
70 private UUID m_agentID; 74 private UUID m_agentID;
@@ -134,7 +138,6 @@ namespace OpenSim.Framework.Capabilities
134 138
135 m_agentID = agent; 139 m_agentID = agent;
136 m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL); 140 m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
137 m_externalCapsHandlers = new Dictionary<string, string>();
138 m_regionName = regionName; 141 m_regionName = regionName;
139 } 142 }
140 143
@@ -149,6 +152,27 @@ namespace OpenSim.Framework.Capabilities
149 m_capsHandlers[capName] = handler; 152 m_capsHandlers[capName] = handler;
150 } 153 }
151 154
155 public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler)
156 {
157 m_pollServiceHandlers.Add(capName, pollServiceHandler);
158
159 m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler.Url, pollServiceHandler);
160
161// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
162// string protocol = "http";
163// string hostName = m_httpListenerHostName;
164//
165// if (MainServer.Instance.UseSSL)
166// {
167// hostName = MainServer.Instance.SSLCommonName;
168// port = MainServer.Instance.SSLPort;
169// protocol = "https";
170// }
171
172// RegisterHandler(
173// capName, String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, pollServiceHandler.Url));
174 }
175
152 /// <summary> 176 /// <summary>
153 /// Register an external handler. The service for this capability is somewhere else 177 /// Register an external handler. The service for this capability is somewhere else
154 /// given by the URL. 178 /// given by the URL.
@@ -165,13 +189,70 @@ namespace OpenSim.Framework.Capabilities
165 /// </summary> 189 /// </summary>
166 public void DeregisterHandlers() 190 public void DeregisterHandlers()
167 { 191 {
168 if (m_capsHandlers != null) 192 foreach (string capsName in m_capsHandlers.Caps)
193 {
194 m_capsHandlers.Remove(capsName);
195 }
196
197 foreach (PollServiceEventArgs handler in m_pollServiceHandlers.Values)
198 {
199 m_httpListener.RemovePollServiceHTTPHandler("", handler.Url);
200 }
201 }
202
203 public bool TryGetPollHandler(string name, out PollServiceEventArgs pollHandler)
204 {
205 return m_pollServiceHandlers.TryGetValue(name, out pollHandler);
206 }
207
208 public Dictionary<string, PollServiceEventArgs> GetPollHandlers()
209 {
210 return new Dictionary<string, PollServiceEventArgs>(m_pollServiceHandlers);
211 }
212
213 /// <summary>
214 /// Return an LLSD-serializable Hashtable describing the
215 /// capabilities and their handler details.
216 /// </summary>
217 /// <param name="excludeSeed">If true, then exclude the seed cap.</param>
218 public Hashtable GetCapsDetails(bool excludeSeed, List<string> requestedCaps)
219 {
220 Hashtable caps = CapsHandlers.GetCapsDetails(excludeSeed, requestedCaps);
221
222 lock (m_pollServiceHandlers)
169 { 223 {
170 foreach (string capsName in m_capsHandlers.Caps) 224 foreach (KeyValuePair <string, PollServiceEventArgs> kvp in m_pollServiceHandlers)
171 { 225 {
172 m_capsHandlers.Remove(capsName); 226 if (!requestedCaps.Contains(kvp.Key))
227 continue;
228
229 string hostName = m_httpListenerHostName;
230 uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
231 string protocol = "http";
232
233 if (MainServer.Instance.UseSSL)
234 {
235 hostName = MainServer.Instance.SSLCommonName;
236 port = MainServer.Instance.SSLPort;
237 protocol = "https";
238 }
239 //
240 // caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
241
242 caps[kvp.Key] = string.Format("{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url);
173 } 243 }
174 } 244 }
245
246 // Add the external too
247 foreach (KeyValuePair<string, string> kvp in ExternalCapsHandlers)
248 {
249 if (!requestedCaps.Contains(kvp.Key))
250 continue;
251
252 caps[kvp.Key] = kvp.Value;
253 }
254
255 return caps;
175 } 256 }
176 257
177 public void Activate() 258 public void Activate()
@@ -185,4 +266,4 @@ namespace OpenSim.Framework.Capabilities
185 return m_capsActive.WaitOne(30000); 266 return m_capsActive.WaitOne(30000);
186 } 267 }
187 } 268 }
188} 269} \ No newline at end of file