aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs17
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs11
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs26
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs59
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs2
6 files changed, 132 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 329a259..5be6486 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -257,6 +257,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
257 return false; 257 return false;
258 } 258 }
259 259
260 public bool QueryAccess(GridRegion destination, UUID id)
261 {
262 if (destination == null)
263 return false;
264
265 foreach (Scene s in m_sceneList)
266 {
267 if (s.RegionInfo.RegionHandle == destination.RegionHandle)
268 {
269 //m_log.Debug("[LOCAL COMMS]: Found region to send QueryAccess");
270 return s.QueryAccess(id);
271 }
272 }
273 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
274 return false;
275 }
276
260 public bool ReleaseAgent(UUID origin, UUID id, string uri) 277 public bool ReleaseAgent(UUID origin, UUID id, string uri)
261 { 278 {
262 foreach (Scene s in m_sceneList) 279 foreach (Scene s in m_sceneList)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index e16e273..27792c8 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -239,6 +239,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
239 239
240 } 240 }
241 241
242 public bool QueryAccess(GridRegion destination, UUID id)
243 {
244 if (destination == null)
245 return false;
246
247 // Try local first
248 if (m_localBackend.QueryAccess(destination, id))
249 return true;
250
251 // else do the remote thing
252 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
253 return m_remoteConnector.QueryAccess(destination, id);
254
255 return false;
256
257 }
258
242 public bool ReleaseAgent(UUID origin, UUID id, string uri) 259 public bool ReleaseAgent(UUID origin, UUID id, string uri)
243 { 260 {
244 // Try local first 261 // Try local first
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e48b92b..383d95f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5160,5 +5160,16 @@ namespace OpenSim.Region.Framework.Scenes
5160 break; 5160 break;
5161 } 5161 }
5162 } 5162 }
5163
5164 // This method is called across the simulation connector to
5165 // determine if a given agent is allowed in this region
5166 // AS A ROOT AGENT. Returning false here will prevent them
5167 // from logging into the region, teleporting into the region
5168 // or corssing the broder walking, but will NOT prevent
5169 // child agent creation, thereby emulating the SL behavior.
5170 public bool QueryAccess(UUID agentID)
5171 {
5172 return true;
5173 }
5163 } 5174 }
5164} 5175}
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 26516ab..8aa410b 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -115,6 +115,11 @@ namespace OpenSim.Server.Handlers.Simulation
115 DoChildAgentDelete(request, responsedata, agentID, action, regionID); 115 DoChildAgentDelete(request, responsedata, agentID, action, regionID);
116 return responsedata; 116 return responsedata;
117 } 117 }
118 else if (method.Equals("QUERYACCESSS"))
119 {
120 DoQueryAccess(request, responsedata, agentID, regionID);
121 return responsedata;
122 }
118 else 123 else
119 { 124 {
120 m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method); 125 m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method);
@@ -305,6 +310,27 @@ namespace OpenSim.Server.Handlers.Simulation
305 return m_SimulationService.UpdateAgent(destination, agent); 310 return m_SimulationService.UpdateAgent(destination, agent);
306 } 311 }
307 312
313 protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
314 {
315 if (m_SimulationService == null)
316 {
317 m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless.");
318 responsedata["content_type"] = "application/json";
319 responsedata["int_response_code"] = HttpStatusCode.NotImplemented;
320 responsedata["str_response_string"] = string.Empty;
321
322 return;
323 }
324
325 GridRegion destination = new GridRegion();
326 destination.RegionID = regionID;
327
328 bool result = m_SimulationService.QueryAccess(destination, id);
329
330 responsedata["int_response_code"] = HttpStatusCode.OK;
331 responsedata["str_response_string"] = result.ToString();
332 }
333
308 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) 334 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
309 { 335 {
310 if (m_SimulationService == null) 336 if (m_SimulationService == null)
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 415c6ea..d25a766 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -411,6 +411,65 @@ namespace OpenSim.Services.Connectors.Simulation
411 return false; 411 return false;
412 } 412 }
413 413
414 public bool QueryAccess(GridRegion destination, UUID id)
415 {
416 IPEndPoint ext = destination.ExternalEndPoint;
417 if (ext == null) return false;
418 // Eventually, we want to use a caps url instead of the agentID
419 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
420
421 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
422 request.Method = "QUERYACCESS";
423 request.Timeout = 10000;
424 //request.Headers.Add("authorization", ""); // coming soon
425
426 HttpWebResponse webResponse = null;
427 string reply = string.Empty;
428 StreamReader sr = null;
429 try
430 {
431 webResponse = (HttpWebResponse)request.GetResponse();
432 if (webResponse == null)
433 {
434 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on agent query ");
435 }
436
437 sr = new StreamReader(webResponse.GetResponseStream());
438 reply = sr.ReadToEnd().Trim();
439
440
441 }
442 catch (WebException ex)
443 {
444 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent query {0}", ex.Message);
445 // ignore, really
446 return false;
447 }
448 finally
449 {
450 if (sr != null)
451 sr.Close();
452 }
453
454 if (webResponse.StatusCode == HttpStatusCode.OK)
455 {
456 try
457 {
458 bool result;
459
460 result = bool.Parse(reply);
461
462 return result;
463 }
464 catch
465 {
466 return false;
467 }
468 }
469
470 return false;
471 }
472
414 public bool ReleaseAgent(UUID origin, UUID id, string uri) 473 public bool ReleaseAgent(UUID origin, UUID id, string uri)
415 { 474 {
416 WebRequest request = WebRequest.Create(uri); 475 WebRequest request = WebRequest.Create(uri);
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 33d6fde..1f8474c 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -60,6 +60,8 @@ namespace OpenSim.Services.Interfaces
60 60
61 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); 61 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
62 62
63 bool QueryAccess(GridRegion destination, UUID id);
64
63 /// <summary> 65 /// <summary>
64 /// Message from receiving region to departing region, telling it got contacted by the client. 66 /// Message from receiving region to departing region, telling it got contacted by the client.
65 /// When sent over REST, it invokes the opaque uri. 67 /// When sent over REST, it invokes the opaque uri.