diff options
Diffstat (limited to '')
6 files changed, 213 insertions, 133 deletions
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs index 94bda82..1a62d2f 100644 --- a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs +++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs | |||
@@ -214,7 +214,7 @@ namespace OpenSim.Services.Connectors | |||
214 | 214 | ||
215 | } | 215 | } |
216 | else | 216 | else |
217 | m_log.DebugFormat("[GRID USER CONNECTOR]: Loggedin received empty reply"); | 217 | m_log.DebugFormat("[GRID USER CONNECTOR]: Get received empty reply"); |
218 | } | 218 | } |
219 | catch (Exception e) | 219 | catch (Exception e) |
220 | { | 220 | { |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index f51c809..aca414b 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -271,41 +271,6 @@ namespace OpenSim.Services.Connectors.Simulation | |||
271 | return false; | 271 | return false; |
272 | } | 272 | } |
273 | 273 | ||
274 | /// <summary> | ||
275 | /// Not sure what sequence causes this function to be invoked. The only calling | ||
276 | /// path is through the GET method | ||
277 | /// </summary> | ||
278 | public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) | ||
279 | { | ||
280 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: RetrieveAgent start"); | ||
281 | |||
282 | agent = null; | ||
283 | |||
284 | // Eventually, we want to use a caps url instead of the agentID | ||
285 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | ||
286 | |||
287 | try | ||
288 | { | ||
289 | OSDMap result = WebUtil.GetFromService(uri, 10000); | ||
290 | if (result["Success"].AsBoolean()) | ||
291 | { | ||
292 | // OSDMap args = Util.GetOSDMap(result["_RawResult"].AsString()); | ||
293 | OSDMap args = (OSDMap)result["_Result"]; | ||
294 | if (args != null) | ||
295 | { | ||
296 | agent = new CompleteAgentData(); | ||
297 | agent.Unpack(args, null); | ||
298 | return true; | ||
299 | } | ||
300 | } | ||
301 | } | ||
302 | catch (Exception e) | ||
303 | { | ||
304 | m_log.Warn("[REMOTE SIMULATION CONNECTOR]: UpdateAgent failed with exception: " + e.ToString()); | ||
305 | } | ||
306 | |||
307 | return false; | ||
308 | } | ||
309 | 274 | ||
310 | /// <summary> | 275 | /// <summary> |
311 | /// </summary> | 276 | /// </summary> |
@@ -402,11 +367,10 @@ namespace OpenSim.Services.Connectors.Simulation | |||
402 | 367 | ||
403 | /// <summary> | 368 | /// <summary> |
404 | /// </summary> | 369 | /// </summary> |
405 | public bool CloseAgent(GridRegion destination, UUID id) | 370 | public bool CloseAgent(GridRegion destination, UUID id, string auth_code) |
406 | { | 371 | { |
407 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); | 372 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/?auth=" + auth_code; |
408 | 373 | m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent {0}", uri); | |
409 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | ||
410 | 374 | ||
411 | try | 375 | try |
412 | { | 376 | { |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 0cf1c14..0a3e70b 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -419,6 +419,12 @@ namespace OpenSim.Services.HypergridService | |||
419 | if (!CheckAddress(aCircuit.ServiceSessionID)) | 419 | if (!CheckAddress(aCircuit.ServiceSessionID)) |
420 | return false; | 420 | return false; |
421 | 421 | ||
422 | if (string.IsNullOrEmpty(aCircuit.IPAddress)) | ||
423 | { | ||
424 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Agent did not provide a client IP address."); | ||
425 | return false; | ||
426 | } | ||
427 | |||
422 | string userURL = string.Empty; | 428 | string userURL = string.Empty; |
423 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 429 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |
424 | userURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | 430 | userURL = aCircuit.ServiceURLs["HomeURI"].ToString(); |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 733993f..b414aca 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | 32 | ||
33 | using OpenSim.Data; | ||
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Services.Connectors.Friends; | 35 | using OpenSim.Services.Connectors.Friends; |
35 | using OpenSim.Services.Connectors.Hypergrid; | 36 | using OpenSim.Services.Connectors.Hypergrid; |
@@ -50,14 +51,14 @@ namespace OpenSim.Services.HypergridService | |||
50 | /// needs to do it for them. | 51 | /// needs to do it for them. |
51 | /// Once we have better clients, this shouldn't be needed. | 52 | /// Once we have better clients, this shouldn't be needed. |
52 | /// </summary> | 53 | /// </summary> |
53 | public class UserAgentService : IUserAgentService | 54 | public class UserAgentService : UserAgentServiceBase, IUserAgentService |
54 | { | 55 | { |
55 | private static readonly ILog m_log = | 56 | private static readonly ILog m_log = |
56 | LogManager.GetLogger( | 57 | LogManager.GetLogger( |
57 | MethodBase.GetCurrentMethod().DeclaringType); | 58 | MethodBase.GetCurrentMethod().DeclaringType); |
58 | 59 | ||
59 | // This will need to go into a DB table | 60 | // This will need to go into a DB table |
60 | static Dictionary<UUID, TravelingAgentInfo> m_TravelingAgents = new Dictionary<UUID, TravelingAgentInfo>(); | 61 | //static Dictionary<UUID, TravelingAgentInfo> m_Database = new Dictionary<UUID, TravelingAgentInfo>(); |
61 | 62 | ||
62 | static bool m_Initialized = false; | 63 | static bool m_Initialized = false; |
63 | 64 | ||
@@ -86,6 +87,7 @@ namespace OpenSim.Services.HypergridService | |||
86 | } | 87 | } |
87 | 88 | ||
88 | public UserAgentService(IConfigSource config, IFriendsSimConnector friendsConnector) | 89 | public UserAgentService(IConfigSource config, IFriendsSimConnector friendsConnector) |
90 | : base(config) | ||
89 | { | 91 | { |
90 | // Let's set this always, because we don't know the sequence | 92 | // Let's set this always, because we don't know the sequence |
91 | // of instantiations | 93 | // of instantiations |
@@ -146,6 +148,9 @@ namespace OpenSim.Services.HypergridService | |||
146 | if (!m_GridName.EndsWith("/")) | 148 | if (!m_GridName.EndsWith("/")) |
147 | m_GridName = m_GridName + "/"; | 149 | m_GridName = m_GridName + "/"; |
148 | 150 | ||
151 | // Finally some cleanup | ||
152 | m_Database.DeleteOld(); | ||
153 | |||
149 | } | 154 | } |
150 | } | 155 | } |
151 | 156 | ||
@@ -260,7 +265,8 @@ namespace OpenSim.Services.HypergridService | |||
260 | 265 | ||
261 | // Generate a new service session | 266 | // Generate a new service session |
262 | agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); | 267 | agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); |
263 | TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); | 268 | TravelingAgentInfo old = null; |
269 | TravelingAgentInfo travel = CreateTravelInfo(agentCircuit, region, fromLogin, out old); | ||
264 | 270 | ||
265 | bool success = false; | 271 | bool success = false; |
266 | string myExternalIP = string.Empty; | 272 | string myExternalIP = string.Empty; |
@@ -282,23 +288,21 @@ namespace OpenSim.Services.HypergridService | |||
282 | m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", | 288 | m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", |
283 | agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); | 289 | agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); |
284 | 290 | ||
285 | // restore the old travel info | 291 | if (old != null) |
286 | lock (m_TravelingAgents) | 292 | StoreTravelInfo(old); |
287 | { | 293 | else |
288 | if (old == null) | 294 | m_Database.Delete(agentCircuit.SessionID); |
289 | m_TravelingAgents.Remove(agentCircuit.SessionID); | ||
290 | else | ||
291 | m_TravelingAgents[agentCircuit.SessionID] = old; | ||
292 | } | ||
293 | 295 | ||
294 | return false; | 296 | return false; |
295 | } | 297 | } |
296 | 298 | ||
299 | // Everything is ok | ||
300 | |||
301 | // Update the perceived IP Address of our grid | ||
297 | m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP); | 302 | m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP); |
298 | // else set the IP addresses associated with this client | 303 | travel.MyIpAddress = myExternalIP; |
299 | if (fromLogin) | 304 | |
300 | m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress = agentCircuit.IPAddress; | 305 | StoreTravelInfo(travel); |
301 | m_TravelingAgents[agentCircuit.SessionID].MyIpAddress = myExternalIP; | ||
302 | 306 | ||
303 | return true; | 307 | return true; |
304 | } | 308 | } |
@@ -309,57 +313,39 @@ namespace OpenSim.Services.HypergridService | |||
309 | return LoginAgentToGrid(agentCircuit, gatekeeper, finalDestination, false, out reason); | 313 | return LoginAgentToGrid(agentCircuit, gatekeeper, finalDestination, false, out reason); |
310 | } | 314 | } |
311 | 315 | ||
312 | private void SetClientIP(UUID sessionID, string ip) | 316 | TravelingAgentInfo CreateTravelInfo(AgentCircuitData agentCircuit, GridRegion region, bool fromLogin, out TravelingAgentInfo existing) |
313 | { | 317 | { |
314 | if (m_TravelingAgents.ContainsKey(sessionID)) | 318 | HGTravelingData hgt = m_Database.Get(agentCircuit.SessionID); |
315 | { | 319 | existing = null; |
316 | m_log.DebugFormat("[USER AGENT SERVICE]: Setting IP {0} for session {1}", ip, sessionID); | ||
317 | m_TravelingAgents[sessionID].ClientIPAddress = ip; | ||
318 | } | ||
319 | } | ||
320 | 320 | ||
321 | TravelingAgentInfo UpdateTravelInfo(AgentCircuitData agentCircuit, GridRegion region) | 321 | if (hgt != null) |
322 | { | ||
323 | TravelingAgentInfo travel = new TravelingAgentInfo(); | ||
324 | TravelingAgentInfo old = null; | ||
325 | lock (m_TravelingAgents) | ||
326 | { | 322 | { |
327 | if (m_TravelingAgents.ContainsKey(agentCircuit.SessionID)) | 323 | // Very important! Override whatever this agent comes with. |
328 | { | 324 | // UserAgentService always sets the IP for every new agent |
329 | // Very important! Override whatever this agent comes with. | 325 | // with the original IP address. |
330 | // UserAgentService always sets the IP for every new agent | 326 | existing = new TravelingAgentInfo(hgt); |
331 | // with the original IP address. | 327 | agentCircuit.IPAddress = existing.ClientIPAddress; |
332 | agentCircuit.IPAddress = m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress; | ||
333 | |||
334 | old = m_TravelingAgents[agentCircuit.SessionID]; | ||
335 | } | ||
336 | |||
337 | m_TravelingAgents[agentCircuit.SessionID] = travel; | ||
338 | } | 328 | } |
329 | |||
330 | TravelingAgentInfo travel = new TravelingAgentInfo(existing); | ||
331 | travel.SessionID = agentCircuit.SessionID; | ||
339 | travel.UserID = agentCircuit.AgentID; | 332 | travel.UserID = agentCircuit.AgentID; |
340 | travel.GridExternalName = region.ServerURI; | 333 | travel.GridExternalName = region.ServerURI; |
341 | travel.ServiceToken = agentCircuit.ServiceSessionID; | 334 | travel.ServiceToken = agentCircuit.ServiceSessionID; |
342 | if (old != null) | ||
343 | travel.ClientIPAddress = old.ClientIPAddress; | ||
344 | 335 | ||
345 | return old; | 336 | if (fromLogin) |
337 | travel.ClientIPAddress = agentCircuit.IPAddress; | ||
338 | |||
339 | StoreTravelInfo(travel); | ||
340 | |||
341 | return travel; | ||
346 | } | 342 | } |
347 | 343 | ||
348 | public void LogoutAgent(UUID userID, UUID sessionID) | 344 | public void LogoutAgent(UUID userID, UUID sessionID) |
349 | { | 345 | { |
350 | m_log.DebugFormat("[USER AGENT SERVICE]: User {0} logged out", userID); | 346 | m_log.DebugFormat("[USER AGENT SERVICE]: User {0} logged out", userID); |
351 | 347 | ||
352 | lock (m_TravelingAgents) | 348 | m_Database.Delete(sessionID); |
353 | { | ||
354 | List<UUID> travels = new List<UUID>(); | ||
355 | foreach (KeyValuePair<UUID, TravelingAgentInfo> kvp in m_TravelingAgents) | ||
356 | if (kvp.Value == null) // do some clean up | ||
357 | travels.Add(kvp.Key); | ||
358 | else if (kvp.Value.UserID == userID) | ||
359 | travels.Add(kvp.Key); | ||
360 | foreach (UUID session in travels) | ||
361 | m_TravelingAgents.Remove(session); | ||
362 | } | ||
363 | 349 | ||
364 | GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(userID.ToString()); | 350 | GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(userID.ToString()); |
365 | if (guinfo != null) | 351 | if (guinfo != null) |
@@ -369,10 +355,11 @@ namespace OpenSim.Services.HypergridService | |||
369 | // We need to prevent foreign users with the same UUID as a local user | 355 | // We need to prevent foreign users with the same UUID as a local user |
370 | public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName) | 356 | public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName) |
371 | { | 357 | { |
372 | if (!m_TravelingAgents.ContainsKey(sessionID)) | 358 | HGTravelingData hgt = m_Database.Get(sessionID); |
359 | if (hgt == null) | ||
373 | return false; | 360 | return false; |
374 | 361 | ||
375 | TravelingAgentInfo travel = m_TravelingAgents[sessionID]; | 362 | TravelingAgentInfo travel = new TravelingAgentInfo(hgt); |
376 | 363 | ||
377 | return travel.GridExternalName.ToLower() == thisGridExternalName.ToLower(); | 364 | return travel.GridExternalName.ToLower() == thisGridExternalName.ToLower(); |
378 | } | 365 | } |
@@ -385,31 +372,32 @@ namespace OpenSim.Services.HypergridService | |||
385 | m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.", | 372 | m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.", |
386 | sessionID, reportedIP); | 373 | sessionID, reportedIP); |
387 | 374 | ||
388 | if (m_TravelingAgents.ContainsKey(sessionID)) | 375 | HGTravelingData hgt = m_Database.Get(sessionID); |
389 | { | 376 | if (hgt == null) |
390 | bool result = m_TravelingAgents[sessionID].ClientIPAddress == reportedIP || | 377 | return false; |
391 | m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed | ||
392 | 378 | ||
393 | m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {1}; result is {3}", | 379 | TravelingAgentInfo travel = new TravelingAgentInfo(hgt); |
394 | reportedIP, m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress, result); | ||
395 | 380 | ||
396 | return result; | 381 | bool result = travel.ClientIPAddress == reportedIP || travel.MyIpAddress == reportedIP; // NATed |
397 | } | 382 | |
383 | m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {1}; result is {3}", | ||
384 | reportedIP, travel.ClientIPAddress, travel.MyIpAddress, result); | ||
398 | 385 | ||
399 | return false; | 386 | return result; |
400 | } | 387 | } |
401 | 388 | ||
402 | public bool VerifyAgent(UUID sessionID, string token) | 389 | public bool VerifyAgent(UUID sessionID, string token) |
403 | { | 390 | { |
404 | if (m_TravelingAgents.ContainsKey(sessionID)) | 391 | HGTravelingData hgt = m_Database.Get(sessionID); |
392 | if (hgt == null) | ||
405 | { | 393 | { |
406 | m_log.DebugFormat("[USER AGENT SERVICE]: Verifying agent token {0} against {1}", token, m_TravelingAgents[sessionID].ServiceToken); | 394 | m_log.DebugFormat("[USER AGENT SERVICE]: Token verification for session {0}: no such session", sessionID); |
407 | return m_TravelingAgents[sessionID].ServiceToken == token; | 395 | return false; |
408 | } | 396 | } |
409 | 397 | ||
410 | m_log.DebugFormat("[USER AGENT SERVICE]: Token verification for session {0}: no such session", sessionID); | 398 | TravelingAgentInfo travel = new TravelingAgentInfo(hgt); |
411 | 399 | m_log.DebugFormat("[USER AGENT SERVICE]: Verifying agent token {0} against {1}", token, travel.ServiceToken); | |
412 | return false; | 400 | return travel.ServiceToken == token; |
413 | } | 401 | } |
414 | 402 | ||
415 | [Obsolete] | 403 | [Obsolete] |
@@ -472,17 +460,17 @@ namespace OpenSim.Services.HypergridService | |||
472 | } | 460 | } |
473 | } | 461 | } |
474 | 462 | ||
475 | // Lastly, let's notify the rest who may be online somewhere else | 463 | //// Lastly, let's notify the rest who may be online somewhere else |
476 | foreach (string user in usersToBeNotified) | 464 | //foreach (string user in usersToBeNotified) |
477 | { | 465 | //{ |
478 | UUID id = new UUID(user); | 466 | // UUID id = new UUID(user); |
479 | if (m_TravelingAgents.ContainsKey(id) && m_TravelingAgents[id].GridExternalName != m_GridName) | 467 | // if (m_Database.ContainsKey(id) && m_Database[id].GridExternalName != m_GridName) |
480 | { | 468 | // { |
481 | string url = m_TravelingAgents[id].GridExternalName; | 469 | // string url = m_Database[id].GridExternalName; |
482 | // forward | 470 | // // forward |
483 | m_log.WarnFormat("[USER AGENT SERVICE]: User {0} is visiting {1}. HG Status notifications still not implemented.", user, url); | 471 | // m_log.WarnFormat("[USER AGENT SERVICE]: User {0} is visiting {1}. HG Status notifications still not implemented.", user, url); |
484 | } | 472 | // } |
485 | } | 473 | //} |
486 | 474 | ||
487 | // and finally, let's send the online friends | 475 | // and finally, let's send the online friends |
488 | if (online) | 476 | if (online) |
@@ -609,16 +597,13 @@ namespace OpenSim.Services.HypergridService | |||
609 | 597 | ||
610 | public string LocateUser(UUID userID) | 598 | public string LocateUser(UUID userID) |
611 | { | 599 | { |
612 | foreach (TravelingAgentInfo t in m_TravelingAgents.Values) | 600 | HGTravelingData[] hgts = m_Database.GetSessions(userID); |
613 | { | 601 | if (hgts == null) |
614 | if (t == null) | 602 | return string.Empty; |
615 | { | 603 | |
616 | m_log.ErrorFormat("[USER AGENT SERVICE]: Oops! Null TravelingAgentInfo. Please report this on mantis"); | 604 | foreach (HGTravelingData t in hgts) |
617 | continue; | 605 | if (t.Data.ContainsKey("GridExternalName") && !m_GridName.Equals(t.Data["GridExternalName"])) |
618 | } | 606 | return t.Data["GridExternalName"]; |
619 | if (t.UserID == userID && !m_GridName.Equals(t.GridExternalName)) | ||
620 | return t.GridExternalName; | ||
621 | } | ||
622 | 607 | ||
623 | return string.Empty; | 608 | return string.Empty; |
624 | } | 609 | } |
@@ -689,17 +674,60 @@ namespace OpenSim.Services.HypergridService | |||
689 | return exception; | 674 | return exception; |
690 | } | 675 | } |
691 | 676 | ||
677 | private void StoreTravelInfo(TravelingAgentInfo travel) | ||
678 | { | ||
679 | if (travel == null) | ||
680 | return; | ||
681 | |||
682 | HGTravelingData hgt = new HGTravelingData(); | ||
683 | hgt.SessionID = travel.SessionID; | ||
684 | hgt.UserID = travel.UserID; | ||
685 | hgt.Data = new Dictionary<string, string>(); | ||
686 | hgt.Data["GridExternalName"] = travel.GridExternalName; | ||
687 | hgt.Data["ServiceToken"] = travel.ServiceToken; | ||
688 | hgt.Data["ClientIPAddress"] = travel.ClientIPAddress; | ||
689 | hgt.Data["MyIPAddress"] = travel.MyIpAddress; | ||
690 | |||
691 | m_Database.Store(hgt); | ||
692 | } | ||
692 | #endregion | 693 | #endregion |
693 | 694 | ||
694 | } | 695 | } |
695 | 696 | ||
696 | class TravelingAgentInfo | 697 | class TravelingAgentInfo |
697 | { | 698 | { |
699 | public UUID SessionID; | ||
698 | public UUID UserID; | 700 | public UUID UserID; |
699 | public string GridExternalName = string.Empty; | 701 | public string GridExternalName = string.Empty; |
700 | public string ServiceToken = string.Empty; | 702 | public string ServiceToken = string.Empty; |
701 | public string ClientIPAddress = string.Empty; // as seen from this user agent service | 703 | public string ClientIPAddress = string.Empty; // as seen from this user agent service |
702 | public string MyIpAddress = string.Empty; // the user agent service's external IP, as seen from the next gatekeeper | 704 | public string MyIpAddress = string.Empty; // the user agent service's external IP, as seen from the next gatekeeper |
705 | |||
706 | public TravelingAgentInfo(HGTravelingData t) | ||
707 | { | ||
708 | if (t.Data != null) | ||
709 | { | ||
710 | SessionID = new UUID(t.SessionID); | ||
711 | UserID = new UUID(t.UserID); | ||
712 | GridExternalName = t.Data["GridExternalName"]; | ||
713 | ServiceToken = t.Data["ServiceToken"]; | ||
714 | ClientIPAddress = t.Data["ClientIPAddress"]; | ||
715 | MyIpAddress = t.Data["MyIPAddress"]; | ||
716 | } | ||
717 | } | ||
718 | |||
719 | public TravelingAgentInfo(TravelingAgentInfo old) | ||
720 | { | ||
721 | if (old != null) | ||
722 | { | ||
723 | SessionID = old.SessionID; | ||
724 | UserID = old.UserID; | ||
725 | GridExternalName = old.GridExternalName; | ||
726 | ServiceToken = old.ServiceToken; | ||
727 | ClientIPAddress = old.ClientIPAddress; | ||
728 | MyIpAddress = old.MyIpAddress; | ||
729 | } | ||
730 | } | ||
703 | } | 731 | } |
704 | 732 | ||
705 | } | 733 | } |
diff --git a/OpenSim/Services/HypergridService/UserAgentServiceBase.cs b/OpenSim/Services/HypergridService/UserAgentServiceBase.cs new file mode 100644 index 0000000..a00e5a6 --- /dev/null +++ b/OpenSim/Services/HypergridService/UserAgentServiceBase.cs | |||
@@ -0,0 +1,84 @@ | |||
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 | using System; | ||
29 | using System.Reflection; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Data; | ||
33 | using OpenSim.Services.Interfaces; | ||
34 | using OpenSim.Services.Base; | ||
35 | |||
36 | namespace OpenSim.Services.HypergridService | ||
37 | { | ||
38 | public class UserAgentServiceBase : ServiceBase | ||
39 | { | ||
40 | protected IHGTravelingData m_Database = null; | ||
41 | |||
42 | public UserAgentServiceBase(IConfigSource config) | ||
43 | : base(config) | ||
44 | { | ||
45 | string dllName = String.Empty; | ||
46 | string connString = String.Empty; | ||
47 | string realm = "hg_traveling_data"; | ||
48 | |||
49 | // | ||
50 | // Try reading the [DatabaseService] section, if it exists | ||
51 | // | ||
52 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
53 | if (dbConfig != null) | ||
54 | { | ||
55 | if (dllName == String.Empty) | ||
56 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
57 | if (connString == String.Empty) | ||
58 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
59 | } | ||
60 | |||
61 | // | ||
62 | // [UserAgentService] section overrides [DatabaseService], if it exists | ||
63 | // | ||
64 | IConfig gridConfig = config.Configs["UserAgentService"]; | ||
65 | if (gridConfig != null) | ||
66 | { | ||
67 | dllName = gridConfig.GetString("StorageProvider", dllName); | ||
68 | connString = gridConfig.GetString("ConnectionString", connString); | ||
69 | realm = gridConfig.GetString("Realm", realm); | ||
70 | } | ||
71 | |||
72 | // | ||
73 | // We tried, but this doesn't exist. We can't proceed. | ||
74 | // | ||
75 | if (dllName.Equals(String.Empty)) | ||
76 | throw new Exception("No StorageProvider configured"); | ||
77 | |||
78 | m_Database = LoadPlugin<IHGTravelingData>(dllName, new Object[] { connString, realm }); | ||
79 | if (m_Database == null) | ||
80 | throw new Exception("Could not find a storage interface in the given module"); | ||
81 | |||
82 | } | ||
83 | } | ||
84 | } | ||
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index b10a85c..1c82b3e 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs | |||
@@ -75,8 +75,6 @@ namespace OpenSim.Services.Interfaces | |||
75 | /// <returns></returns> | 75 | /// <returns></returns> |
76 | bool UpdateAgent(GridRegion destination, AgentPosition data); | 76 | bool UpdateAgent(GridRegion destination, AgentPosition data); |
77 | 77 | ||
78 | bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); | ||
79 | |||
80 | bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason); | 78 | bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason); |
81 | 79 | ||
82 | /// <summary> | 80 | /// <summary> |
@@ -95,7 +93,7 @@ namespace OpenSim.Services.Interfaces | |||
95 | /// <param name="regionHandle"></param> | 93 | /// <param name="regionHandle"></param> |
96 | /// <param name="id"></param> | 94 | /// <param name="id"></param> |
97 | /// <returns></returns> | 95 | /// <returns></returns> |
98 | bool CloseAgent(GridRegion destination, UUID id); | 96 | bool CloseAgent(GridRegion destination, UUID id, string auth_token); |
99 | 97 | ||
100 | #endregion Agents | 98 | #endregion Agents |
101 | 99 | ||