From 7c00469cd210cfdda3dd835867469159d4c8b9d9 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 27 Jan 2010 08:00:29 -0800 Subject: Added ExternalName config on Gatekeeper. --- OpenSim/Framework/AgentCircuitData.cs | 9 +++++++++ .../Framework/EntityTransfer/HGEntityTransferModule.cs | 1 + OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | 4 +++- .../Connectors/Hypergrid/GatekeeperServiceConnector.cs | 7 ++++--- OpenSim/Services/GridService/HypergridLinker.cs | 18 +++++++++++++++--- OpenSim/Services/HypergridService/GatekeeperService.cs | 5 ++++- OpenSim/Services/Interfaces/IGatekeeperService.cs | 2 +- 7 files changed, 37 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index f2f0a53..142ca2c 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -97,6 +97,12 @@ namespace OpenSim.Framework public UUID SessionID; /// + /// Hypergrid service token; generated by the user domain, consumed by the receiving grid. + /// There is one such unique token for each grid visited. + /// + public string ServiceSessionID = string.Empty; + + /// /// Position the Agent's Avatar starts in the region /// public Vector3 startpos; @@ -156,6 +162,7 @@ namespace OpenSim.Framework args["inventory_folder"] = OSD.FromUUID(InventoryFolder); args["secure_session_id"] = OSD.FromUUID(SecureSessionID); args["session_id"] = OSD.FromUUID(SessionID); + args["service_session_id"] = OSD.FromString(ServiceSessionID); args["start_pos"] = OSD.FromString(startpos.ToString()); args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); @@ -253,6 +260,8 @@ namespace OpenSim.Framework SecureSessionID = args["secure_session_id"].AsUUID(); if (args["session_id"] != null) SessionID = args["session_id"].AsUUID(); + if (args["service_session_id"] != null) + ServiceSessionID = args["service_session_id"].AsString(); if (args["start_pos"] != null) Vector3.TryParse(args["start_pos"].AsString(), out startpos); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index a1de57a..4d5844c 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -157,6 +157,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (security != null) security.SetEndPoint(sp.ControllingClient.SessionId, sp.ControllingClient.RemoteEndPoint); + //string token = sp.Scene.AuthenticationService.MakeToken(sp.UUID, reg.ExternalHostName + ":" + reg.HttpPort, 30); // Log them out of this grid sp.Scene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat); diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index 846d1c2..7d31730 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs @@ -63,17 +63,19 @@ namespace OpenSim.Server.Handlers.Hypergrid string name = (string)requestData["region_name"]; UUID regionID = UUID.Zero; + string externalName = string.Empty; string imageURL = string.Empty; ulong regionHandle = 0; string reason = string.Empty; - bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out imageURL, out reason); + bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out externalName, out imageURL, out reason); Hashtable hash = new Hashtable(); hash["result"] = success.ToString(); hash["uuid"] = regionID.ToString(); hash["handle"] = regionHandle.ToString(); hash["region_image"] = imageURL; + hash["external_name"] = externalName; XmlRpcResponse response = new XmlRpcResponse(); response.Value = hash; diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index ae0a0b6..5ad1af2 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -45,11 +45,12 @@ namespace OpenSim.Services.Connectors.Hypergrid return "/foreignobject/"; } - public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string imageURL, out string reason) + public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) { regionID = UUID.Zero; imageURL = string.Empty; realHandle = 0; + externalName = string.Empty; reason = string.Empty; Hashtable hash = new Hashtable(); @@ -97,9 +98,9 @@ namespace OpenSim.Services.Connectors.Hypergrid //m_log.Debug(">> HERE, realHandle: " + realHandle); } if (hash["region_image"] != null) - { imageURL = (string)hash["region_image"]; - } + if (hash["external_name"] != null) + externalName = (string)hash["external_name"]; } } diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 1289cf6..cda7dae 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -214,8 +214,9 @@ namespace OpenSim.Services.GridService // Finally, link it ulong handle = 0; UUID regionID = UUID.Zero; + string externalName = string.Empty; string imageURL = string.Empty; - if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out imageURL, out reason)) + if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason)) return false; if (regionID != UUID.Zero) @@ -229,11 +230,22 @@ namespace OpenSim.Services.GridService } regInfo.RegionID = regionID; + Uri uri = null; + try + { + uri = new Uri(externalName); + regInfo.ExternalHostName = uri.Host; + regInfo.HttpPort = (uint)uri.Port; + } + catch + { + m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName); + } regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort + ":" + regInfo.RegionName; // Try get the map image - regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); + //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); // I need a texture that works for this... the one I tried doesn't seem to be working - //regInfo.TerrainImage = m_HGMapImage; + regInfo.TerrainImage = m_HGMapImage; AddHyperlinkRegion(regInfo, handle); m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 283ab3e..3cb5d50 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -59,6 +59,7 @@ namespace OpenSim.Services.HypergridService UUID m_ScopeID; bool m_AllowTeleportsToAnyRegion; + string m_ExternalName; GridRegion m_DefaultGatewayRegion; public GatekeeperService(IConfigSource config, ISimulationService simService) @@ -83,6 +84,7 @@ namespace OpenSim.Services.HypergridService UUID.TryParse(scope, out m_ScopeID); //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); + m_ExternalName = serverConfig.GetString("ExternalName", string.Empty); Object[] args = new Object[] { config }; m_GridService = ServerUtils.LoadPlugin(gridService, args); @@ -109,10 +111,11 @@ namespace OpenSim.Services.HypergridService { } - public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason) + public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) { regionID = UUID.Zero; regionHandle = 0; + externalName = m_ExternalName; imageURL = string.Empty; reason = string.Empty; diff --git a/OpenSim/Services/Interfaces/IGatekeeperService.cs b/OpenSim/Services/Interfaces/IGatekeeperService.cs index 5b5c9d1..f8eb817 100644 --- a/OpenSim/Services/Interfaces/IGatekeeperService.cs +++ b/OpenSim/Services/Interfaces/IGatekeeperService.cs @@ -36,7 +36,7 @@ namespace OpenSim.Services.Interfaces { public interface IGatekeeperService { - bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason); + bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason); GridRegion GetHyperlinkRegion(UUID regionID); bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason); -- cgit v1.1