diff options
author | Diva Canto | 2010-01-28 19:19:42 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-28 19:19:42 -0800 |
commit | 00f7d622cbc2c2e61d2efaacd8275da3f9821d8b (patch) | |
tree | 1bfc6dd3ac2a93443bc75baa03ceefba4cfacc1e /OpenSim/Region/CoreModules | |
parent | Added ExternalName config on Gatekeeper. (diff) | |
download | opensim-SC_OLD-00f7d622cbc2c2e61d2efaacd8275da3f9821d8b.zip opensim-SC_OLD-00f7d622cbc2c2e61d2efaacd8275da3f9821d8b.tar.gz opensim-SC_OLD-00f7d622cbc2c2e61d2efaacd8275da3f9821d8b.tar.bz2 opensim-SC_OLD-00f7d622cbc2c2e61d2efaacd8275da3f9821d8b.tar.xz |
HG 1.5 is in place. Tested in standalone only.
Diffstat (limited to 'OpenSim/Region/CoreModules')
3 files changed, 71 insertions, 55 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ed8c0fd..44f1191 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -237,9 +237,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
237 | 237 | ||
238 | protected void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, Vector3 position, Vector3 lookAt, uint teleportFlags, IEventQueue eq) | 238 | protected void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, Vector3 position, Vector3 lookAt, uint teleportFlags, IEventQueue eq) |
239 | { | 239 | { |
240 | if (reg == null || finalDestination == null) | ||
241 | { | ||
242 | sp.ControllingClient.SendTeleportFailed("Unable to locate destination"); | ||
243 | return; | ||
244 | } | ||
245 | |||
240 | m_log.DebugFormat( | 246 | m_log.DebugFormat( |
241 | "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3} final destination {4}", | 247 | "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3}", |
242 | reg.ExternalHostName, reg.HttpPort, reg.RegionName, position, finalDestination.RegionName); | 248 | reg.ExternalHostName, reg.HttpPort, finalDestination.RegionName, position); |
243 | 249 | ||
244 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | 250 | uint newRegionX = (uint)(reg.RegionHandle >> 40); |
245 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | 251 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 4d5844c..85c2742 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -44,14 +44,13 @@ using Nini.Config; | |||
44 | 44 | ||
45 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | 45 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer |
46 | { | 46 | { |
47 | public class HGEntityTransferModule : EntityTransferModule, ISharedRegionModule, IEntityTransferModule | 47 | public class HGEntityTransferModule : EntityTransferModule, ISharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | private bool m_Initialized = false; | 51 | private bool m_Initialized = false; |
52 | 52 | ||
53 | private GatekeeperServiceConnector m_GatekeeperConnector; | 53 | private GatekeeperServiceConnector m_GatekeeperConnector; |
54 | private IHomeUsersSecurityService m_Security; | ||
55 | 54 | ||
56 | #region ISharedRegionModule | 55 | #region ISharedRegionModule |
57 | 56 | ||
@@ -69,21 +68,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
69 | if (name == Name) | 68 | if (name == Name) |
70 | { | 69 | { |
71 | m_agentsInTransit = new List<UUID>(); | 70 | m_agentsInTransit = new List<UUID>(); |
72 | |||
73 | IConfig config = source.Configs["HGEntityTransferModule"]; | ||
74 | if (config != null) | ||
75 | { | ||
76 | string dll = config.GetString("HomeUsersSecurityService", string.Empty); | ||
77 | if (dll != string.Empty) | ||
78 | { | ||
79 | Object[] args = new Object[] { source }; | ||
80 | m_Security = ServerUtils.LoadPlugin<IHomeUsersSecurityService>(dll, args); | ||
81 | if (m_Security == null) | ||
82 | m_log.Debug("[HG ENTITY TRANSFER MODULE]: Unable to load Home Users Security service"); | ||
83 | else | ||
84 | m_log.Debug("[HG ENTITY TRANSFER MODULE]: Home Users Security service loaded"); | ||
85 | } | ||
86 | } | ||
87 | 71 | ||
88 | m_Enabled = true; | 72 | m_Enabled = true; |
89 | m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | 73 | m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
@@ -95,7 +79,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
95 | { | 79 | { |
96 | base.AddRegion(scene); | 80 | base.AddRegion(scene); |
97 | if (m_Enabled) | 81 | if (m_Enabled) |
98 | scene.RegisterModuleInterface<IHomeUsersSecurityService>(m_Security); | 82 | { |
83 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); | ||
84 | scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(OnNewClient); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | void OnNewClient(IClientAPI client) | ||
89 | { | ||
90 | client.OnLogout += new Action<IClientAPI>(OnLogout); | ||
99 | } | 91 | } |
100 | 92 | ||
101 | public override void RegionLoaded(Scene scene) | 93 | public override void RegionLoaded(Scene scene) |
@@ -113,13 +105,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
113 | { | 105 | { |
114 | base.AddRegion(scene); | 106 | base.AddRegion(scene); |
115 | if (m_Enabled) | 107 | if (m_Enabled) |
116 | scene.UnregisterModuleInterface<IHomeUsersSecurityService>(m_Security); | 108 | { |
109 | scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); | ||
110 | } | ||
117 | } | 111 | } |
118 | 112 | ||
119 | 113 | ||
120 | #endregion | 114 | #endregion |
121 | 115 | ||
122 | #region HG overrides | 116 | #region HG overrides of IEntiryTransferModule |
123 | 117 | ||
124 | protected override GridRegion GetFinalDestination(GridRegion region) | 118 | protected override GridRegion GetFinalDestination(GridRegion region) |
125 | { | 119 | { |
@@ -142,26 +136,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
142 | { | 136 | { |
143 | reason = string.Empty; | 137 | reason = string.Empty; |
144 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); | 138 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); |
145 | if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | 139 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) |
146 | { | 140 | { |
147 | // this user is going to another grid | 141 | // this user is going to another grid |
148 | // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination | 142 | string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); |
149 | GridRegion region = new GridRegion(reg); | 143 | IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver); |
150 | region.RegionName = finalDestination.RegionName; | 144 | bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); |
151 | region.RegionID = finalDestination.RegionID; | 145 | if (success) |
152 | region.RegionLocX = finalDestination.RegionLocX; | 146 | // Log them out of this grid |
153 | region.RegionLocY = finalDestination.RegionLocY; | 147 | m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat); |
154 | 148 | ||
155 | // Log their session and remote endpoint in the home users security service | 149 | return success; |
156 | IHomeUsersSecurityService security = sp.Scene.RequestModuleInterface<IHomeUsersSecurityService>(); | ||
157 | if (security != null) | ||
158 | security.SetEndPoint(sp.ControllingClient.SessionId, sp.ControllingClient.RemoteEndPoint); | ||
159 | |||
160 | //string token = sp.Scene.AuthenticationService.MakeToken(sp.UUID, reg.ExternalHostName + ":" + reg.HttpPort, 30); | ||
161 | // Log them out of this grid | ||
162 | sp.Scene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat); | ||
163 | |||
164 | return m_GatekeeperConnector.CreateAgent(region, agentCircuit, teleportFlags, out reason); | ||
165 | } | 150 | } |
166 | 151 | ||
167 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 152 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); |
@@ -184,23 +169,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
184 | // Foreign user wants to go home | 169 | // Foreign user wants to go home |
185 | // | 170 | // |
186 | AgentCircuitData aCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); | 171 | AgentCircuitData aCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); |
187 | if (aCircuit == null || (aCircuit != null && !aCircuit.ServiceURLs.ContainsKey("GatewayURI"))) | 172 | if (aCircuit == null || (aCircuit != null && !aCircuit.ServiceURLs.ContainsKey("HomeURI"))) |
188 | { | 173 | { |
189 | client.SendTeleportFailed("Your information has been lost"); | 174 | client.SendTeleportFailed("Your information has been lost"); |
190 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); | 175 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); |
191 | return; | 176 | return; |
192 | } | 177 | } |
193 | 178 | ||
194 | GridRegion homeGatekeeper = MakeRegion(aCircuit); | 179 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); |
195 | if (homeGatekeeper == null) | ||
196 | { | ||
197 | client.SendTeleportFailed("Your information has been lost"); | ||
198 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's gateway information is malformed"); | ||
199 | return; | ||
200 | } | ||
201 | |||
202 | Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY; | 180 | Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY; |
203 | GridRegion finalDestination = m_GatekeeperConnector.GetHomeRegion(homeGatekeeper, aCircuit.AgentID, out position, out lookAt); | 181 | GridRegion finalDestination = userAgentService.GetHomeRegion(aCircuit.AgentID, out position, out lookAt); |
204 | if (finalDestination == null) | 182 | if (finalDestination == null) |
205 | { | 183 | { |
206 | client.SendTeleportFailed("Your home region could not be found"); | 184 | client.SendTeleportFailed("Your home region could not be found"); |
@@ -216,20 +194,52 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
216 | return; | 194 | return; |
217 | } | 195 | } |
218 | 196 | ||
219 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}:{5}", | 197 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); |
198 | GridRegion homeGatekeeper = MakeRegion(aCircuit); | ||
199 | |||
200 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}:{5}", | ||
220 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); | 201 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); |
221 | 202 | ||
222 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | ||
223 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); | 203 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); |
224 | } | 204 | } |
225 | #endregion | 205 | #endregion |
226 | 206 | ||
207 | #region IUserAgentVerificationModule | ||
208 | |||
209 | public bool VerifyClient(AgentCircuitData aCircuit, string token) | ||
210 | { | ||
211 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | ||
212 | { | ||
213 | string url = aCircuit.ServiceURLs["HomeURI"].ToString(); | ||
214 | IUserAgentService security = new UserAgentServiceConnector(url); | ||
215 | return security.VerifyClient(aCircuit.SessionID, token); | ||
216 | } | ||
217 | |||
218 | return false; | ||
219 | } | ||
220 | |||
221 | void OnLogout(IClientAPI obj) | ||
222 | { | ||
223 | AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); | ||
224 | |||
225 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | ||
226 | { | ||
227 | string url = aCircuit.ServiceURLs["HomeURI"].ToString(); | ||
228 | IUserAgentService security = new UserAgentServiceConnector(url); | ||
229 | security.LogoutAgent(obj.AgentId, obj.SessionId); | ||
230 | } | ||
231 | |||
232 | } | ||
233 | |||
234 | #endregion | ||
235 | |||
227 | private GridRegion MakeRegion(AgentCircuitData aCircuit) | 236 | private GridRegion MakeRegion(AgentCircuitData aCircuit) |
228 | { | 237 | { |
229 | GridRegion region = new GridRegion(); | 238 | GridRegion region = new GridRegion(); |
230 | 239 | ||
231 | Uri uri = null; | 240 | Uri uri = null; |
232 | if (!Uri.TryCreate(aCircuit.ServiceURLs["GatewayURI"].ToString(), UriKind.Absolute, out uri)) | 241 | if (!aCircuit.ServiceURLs.ContainsKey("HomeURI") || |
242 | (aCircuit.ServiceURLs.ContainsKey("HomeURI") && !Uri.TryCreate(aCircuit.ServiceURLs["HomeURI"].ToString(), UriKind.Absolute, out uri))) | ||
233 | return null; | 243 | return null; |
234 | 244 | ||
235 | region.ExternalHostName = uri.Host; | 245 | region.ExternalHostName = uri.Host; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index 6e6946c..c737f8b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs | |||
@@ -115,11 +115,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid | |||
115 | 115 | ||
116 | m_log.Info("[HypergridService]: Starting..."); | 116 | m_log.Info("[HypergridService]: Starting..."); |
117 | 117 | ||
118 | // Object[] args = new Object[] { m_Config, MainServer.Instance }; | ||
119 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); | 118 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); |
120 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); | 119 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); |
121 | //ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args); | ||
122 | scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); | 120 | scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); |
121 | |||
122 | new UserAgentServerConnector(m_Config, MainServer.Instance); | ||
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||