diff options
author | Melanie | 2010-01-19 04:18:01 +0000 |
---|---|---|
committer | Melanie | 2010-01-19 04:18:01 +0000 |
commit | a3f48a7ca66347b11990e5444a636d40bec5dbf1 (patch) | |
tree | a5708996ccf28ce8696b8257a0b33352f56e2afe | |
parent | Add a Hyperlink flag to the regions table (diff) | |
parent | * Towards enabling hyperlinks at grid-level. (diff) | |
download | opensim-SC_OLD-a3f48a7ca66347b11990e5444a636d40bec5dbf1.zip opensim-SC_OLD-a3f48a7ca66347b11990e5444a636d40bec5dbf1.tar.gz opensim-SC_OLD-a3f48a7ca66347b11990e5444a636d40bec5dbf1.tar.bz2 opensim-SC_OLD-a3f48a7ca66347b11990e5444a636d40bec5dbf1.tar.xz |
Merge branch 'presence-refactor' of melanie@opensimulator.org:/var/git/opensim into presence-refactor
19 files changed, 1129 insertions, 269 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 3c4fa72..ffd2546 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -38,6 +38,7 @@ using OpenMetaverse.Packets; | |||
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Statistics; | 39 | using OpenSim.Framework.Statistics; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Services.Interfaces; | ||
41 | using OpenMetaverse; | 42 | using OpenMetaverse; |
42 | 43 | ||
43 | using TokenBucket = OpenSim.Region.ClientStack.LindenUDP.TokenBucket; | 44 | using TokenBucket = OpenSim.Region.ClientStack.LindenUDP.TokenBucket; |
@@ -900,6 +901,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
900 | 901 | ||
901 | if (!m_scene.TryGetClient(agentID, out existingClient)) | 902 | if (!m_scene.TryGetClient(agentID, out existingClient)) |
902 | { | 903 | { |
904 | IHomeUsersSecurityService security = m_scene.RequestModuleInterface<IHomeUsersSecurityService>(); | ||
905 | if (security != null) | ||
906 | { | ||
907 | IPEndPoint ep = security.GetEndPoint(sessionID); | ||
908 | if (ep != null && ep.ToString() != remoteEndPoint.ToString()) | ||
909 | { | ||
910 | // uh-oh, this is fishy | ||
911 | m_log.WarnFormat("[LLUDPSERVER]: Agent {0} with session {1} connecting with unidentified end point. Refusing service.", agentID, sessionID); | ||
912 | m_log.WarnFormat("[LLUDPSERVER]: EP was {0}, now is {1}", ep.ToString(), remoteEndPoint.ToString()); | ||
913 | return; | ||
914 | } | ||
915 | else if (ep != null) | ||
916 | { | ||
917 | // ok, you're home, welcome back | ||
918 | m_log.InfoFormat("LLUDPSERVER]: Agent {0} is coming back to this grid", agentID); | ||
919 | security.RemoveEndPoint(sessionID); | ||
920 | } | ||
921 | } | ||
922 | |||
903 | // Create the LLClientView | 923 | // Create the LLClientView |
904 | LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); | 924 | LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); |
905 | client.OnLogout += LogoutHandler; | 925 | client.OnLogout += LogoutHandler; |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index fcc7a85..ed8c0fd 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -134,8 +134,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
134 | if (!sp.Scene.Permissions.CanTeleport(sp.UUID)) | 134 | if (!sp.Scene.Permissions.CanTeleport(sp.UUID)) |
135 | return; | 135 | return; |
136 | 136 | ||
137 | bool destRegionUp = true; | ||
138 | |||
139 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 137 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); |
140 | 138 | ||
141 | // Reset animations; the viewer does that in teleports. | 139 | // Reset animations; the viewer does that in teleports. |
@@ -183,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
183 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 181 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
184 | sp.Teleport(position); | 182 | sp.Teleport(position); |
185 | } | 183 | } |
186 | else | 184 | else // Another region possibly in another simulator |
187 | { | 185 | { |
188 | uint x = 0, y = 0; | 186 | uint x = 0, y = 0; |
189 | Utils.LongToUInts(regionHandle, out x, out y); | 187 | Utils.LongToUInts(regionHandle, out x, out y); |
@@ -191,15 +189,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
191 | 189 | ||
192 | if (reg != null) | 190 | if (reg != null) |
193 | { | 191 | { |
194 | m_log.DebugFormat( | ||
195 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation to {0} in {1}", | ||
196 | position, reg.RegionName); | ||
197 | |||
198 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | ||
199 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | ||
200 | uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40); | ||
201 | uint oldRegionY = (((uint)(sp.Scene.RegionInfo.RegionHandle)) >> 8); | ||
202 | |||
203 | GridRegion finalDestination = GetFinalDestination(reg); | 192 | GridRegion finalDestination = GetFinalDestination(reg); |
204 | if (finalDestination == null) | 193 | if (finalDestination == null) |
205 | { | 194 | { |
@@ -207,220 +196,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
207 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); | 196 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); |
208 | return; | 197 | return; |
209 | } | 198 | } |
210 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", finalDestination.RegionLocX, finalDestination.RegionLocY, finalDestination.RegionID); | 199 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", |
211 | ulong destinationHandle = finalDestination.RegionHandle; | 200 | finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID); |
212 | 201 | ||
213 | if (eq == null) | 202 | // |
214 | sp.ControllingClient.SendTeleportLocationStart(); | 203 | // This is it |
215 | 204 | // | |
216 | // Let's do DNS resolution only once in this process, please! | 205 | DoTeleport(sp, reg, finalDestination, position, lookAt, teleportFlags, eq); |
217 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 206 | // |
218 | // it's actually doing a lot of work. | 207 | // |
219 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 208 | // |
220 | if (endPoint.Address == null) | ||
221 | { | ||
222 | // Couldn't resolve the name. Can't TP, because the viewer wants IP addresses. | ||
223 | destRegionUp = false; | ||
224 | } | ||
225 | |||
226 | if (destRegionUp) | ||
227 | { | ||
228 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | ||
229 | // both regions | ||
230 | if (sp.ParentID != (uint)0) | ||
231 | sp.StandUp(); | ||
232 | |||
233 | if (!sp.ValidateAttachments()) | ||
234 | { | ||
235 | sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); | ||
236 | return; | ||
237 | } | ||
238 | |||
239 | // the avatar.Close below will clear the child region list. We need this below for (possibly) | ||
240 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). | ||
241 | //List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); | ||
242 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | ||
243 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail | ||
244 | // once we reach here... | ||
245 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | ||
246 | |||
247 | string capsPath = String.Empty; | ||
248 | |||
249 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
250 | AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); | ||
251 | agentCircuit.startpos = position; | ||
252 | agentCircuit.child = true; | ||
253 | agentCircuit.Appearance = sp.Appearance; | ||
254 | if (currentAgentCircuit != null) | ||
255 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
256 | |||
257 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
258 | { | ||
259 | // brand new agent, let's create a new caps seed | ||
260 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
261 | } | ||
262 | |||
263 | string reason = String.Empty; | ||
264 | |||
265 | // Let's create an agent there if one doesn't exist yet. | ||
266 | if (!CreateAgent(reg, finalDestination, agentCircuit, teleportFlags, out reason)) | ||
267 | { | ||
268 | sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", | ||
269 | reason)); | ||
270 | return; | ||
271 | } | ||
272 | |||
273 | // OK, it got this agent. Let's close some child agents | ||
274 | sp.CloseChildAgents(newRegionX, newRegionY); | ||
275 | |||
276 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
277 | { | ||
278 | #region IP Translation for NAT | ||
279 | IClientIPEndpoint ipepClient; | ||
280 | if (sp.ClientView.TryGet(out ipepClient)) | ||
281 | { | ||
282 | capsPath | ||
283 | = "http://" | ||
284 | + NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName) | ||
285 | + ":" | ||
286 | + finalDestination.HttpPort | ||
287 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
288 | } | ||
289 | else | ||
290 | { | ||
291 | capsPath | ||
292 | = "http://" | ||
293 | + finalDestination.ExternalHostName | ||
294 | + ":" | ||
295 | + finalDestination.HttpPort | ||
296 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
297 | } | ||
298 | #endregion | ||
299 | |||
300 | if (eq != null) | ||
301 | { | ||
302 | #region IP Translation for NAT | ||
303 | // Uses ipepClient above | ||
304 | if (sp.ClientView.TryGet(out ipepClient)) | ||
305 | { | ||
306 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | ||
307 | } | ||
308 | #endregion | ||
309 | |||
310 | eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); | ||
311 | |||
312 | // ES makes the client send a UseCircuitCode message to the destination, | ||
313 | // which triggers a bunch of things there. | ||
314 | // So let's wait | ||
315 | Thread.Sleep(2000); | ||
316 | |||
317 | eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); | ||
318 | |||
319 | } | ||
320 | else | ||
321 | { | ||
322 | sp.ControllingClient.InformClientOfNeighbour(destinationHandle, endPoint); | ||
323 | } | ||
324 | } | ||
325 | else | ||
326 | { | ||
327 | agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); | ||
328 | capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort | ||
329 | + "/CAPS/" + agentCircuit.CapsPath + "0000/"; | ||
330 | } | ||
331 | |||
332 | // Expect avatar crossing is a heavy-duty function at the destination. | ||
333 | // That is where MakeRoot is called, which fetches appearance and inventory. | ||
334 | // Plus triggers OnMakeRoot, which spawns a series of asynchronous updates. | ||
335 | //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, | ||
336 | // position, false); | ||
337 | |||
338 | //{ | ||
339 | // avatar.ControllingClient.SendTeleportFailed("Problem with destination."); | ||
340 | // // We should close that agent we just created over at destination... | ||
341 | // List<ulong> lst = new List<ulong>(); | ||
342 | // lst.Add(reg.RegionHandle); | ||
343 | // SendCloseChildAgentAsync(avatar.UUID, lst); | ||
344 | // return; | ||
345 | //} | ||
346 | |||
347 | SetInTransit(sp.UUID); | ||
348 | |||
349 | // Let's send a full update of the agent. This is a synchronous call. | ||
350 | AgentData agent = new AgentData(); | ||
351 | sp.CopyTo(agent); | ||
352 | agent.Position = position; | ||
353 | SetCallbackURL(agent, sp.Scene.RegionInfo); | ||
354 | |||
355 | UpdateAgent(reg, finalDestination, agent); | ||
356 | |||
357 | m_log.DebugFormat( | ||
358 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); | ||
359 | |||
360 | |||
361 | if (eq != null) | ||
362 | { | ||
363 | eq.TeleportFinishEvent(destinationHandle, 13, endPoint, | ||
364 | 0, teleportFlags, capsPath, sp.UUID); | ||
365 | } | ||
366 | else | ||
367 | { | ||
368 | sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4, | ||
369 | teleportFlags, capsPath); | ||
370 | } | ||
371 | |||
372 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which | ||
373 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation | ||
374 | // that the client contacted the destination before we send the attachments and close things here. | ||
375 | if (!WaitForCallback(sp.UUID)) | ||
376 | { | ||
377 | // Client never contacted destination. Let's restore everything back | ||
378 | sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); | ||
379 | |||
380 | ResetFromTransit(sp.UUID); | ||
381 | |||
382 | // Yikes! We should just have a ref to scene here. | ||
383 | //sp.Scene.InformClientOfNeighbours(sp); | ||
384 | EnableChildAgents(sp); | ||
385 | |||
386 | // Finally, kill the agent we just created at the destination. | ||
387 | m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); | ||
388 | |||
389 | return; | ||
390 | } | ||
391 | |||
392 | KillEntity(sp.Scene, sp.LocalId); | ||
393 | |||
394 | sp.MakeChildAgent(); | ||
395 | |||
396 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | ||
397 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | ||
398 | |||
399 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | ||
400 | |||
401 | if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | ||
402 | { | ||
403 | Thread.Sleep(5000); | ||
404 | sp.Close(); | ||
405 | sp.Scene.IncomingCloseAgent(sp.UUID); | ||
406 | } | ||
407 | else | ||
408 | // now we have a child agent in this region. | ||
409 | sp.Reset(); | ||
410 | |||
411 | |||
412 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
413 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) | ||
414 | { | ||
415 | m_log.DebugFormat( | ||
416 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", | ||
417 | sp.UUID); | ||
418 | } | ||
419 | } | ||
420 | else | ||
421 | { | ||
422 | sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); | ||
423 | } | ||
424 | } | 209 | } |
425 | else | 210 | else |
426 | { | 211 | { |
@@ -450,7 +235,228 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
450 | } | 235 | } |
451 | } | 236 | } |
452 | 237 | ||
453 | protected virtual bool CreateAgent(GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) | 238 | protected void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, Vector3 position, Vector3 lookAt, uint teleportFlags, IEventQueue eq) |
239 | { | ||
240 | m_log.DebugFormat( | ||
241 | "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3} final destination {4}", | ||
242 | reg.ExternalHostName, reg.HttpPort, reg.RegionName, position, finalDestination.RegionName); | ||
243 | |||
244 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | ||
245 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | ||
246 | uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40); | ||
247 | uint oldRegionY = (((uint)(sp.Scene.RegionInfo.RegionHandle)) >> 8); | ||
248 | |||
249 | ulong destinationHandle = finalDestination.RegionHandle; | ||
250 | |||
251 | if (eq == null) | ||
252 | sp.ControllingClient.SendTeleportLocationStart(); | ||
253 | |||
254 | // Let's do DNS resolution only once in this process, please! | ||
255 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | ||
256 | // it's actually doing a lot of work. | ||
257 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | ||
258 | if (endPoint.Address != null) | ||
259 | { | ||
260 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | ||
261 | // both regions | ||
262 | if (sp.ParentID != (uint)0) | ||
263 | sp.StandUp(); | ||
264 | |||
265 | if (!sp.ValidateAttachments()) | ||
266 | { | ||
267 | sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); | ||
268 | return; | ||
269 | } | ||
270 | |||
271 | // the avatar.Close below will clear the child region list. We need this below for (possibly) | ||
272 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). | ||
273 | //List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); | ||
274 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | ||
275 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail | ||
276 | // once we reach here... | ||
277 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | ||
278 | |||
279 | string capsPath = String.Empty; | ||
280 | |||
281 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
282 | AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); | ||
283 | agentCircuit.startpos = position; | ||
284 | agentCircuit.child = true; | ||
285 | agentCircuit.Appearance = sp.Appearance; | ||
286 | if (currentAgentCircuit != null) | ||
287 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
288 | |||
289 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
290 | { | ||
291 | // brand new agent, let's create a new caps seed | ||
292 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
293 | } | ||
294 | |||
295 | string reason = String.Empty; | ||
296 | |||
297 | // Let's create an agent there if one doesn't exist yet. | ||
298 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason)) | ||
299 | { | ||
300 | sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", | ||
301 | reason)); | ||
302 | return; | ||
303 | } | ||
304 | |||
305 | // OK, it got this agent. Let's close some child agents | ||
306 | sp.CloseChildAgents(newRegionX, newRegionY); | ||
307 | |||
308 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
309 | { | ||
310 | #region IP Translation for NAT | ||
311 | IClientIPEndpoint ipepClient; | ||
312 | if (sp.ClientView.TryGet(out ipepClient)) | ||
313 | { | ||
314 | capsPath | ||
315 | = "http://" | ||
316 | + NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName) | ||
317 | + ":" | ||
318 | + finalDestination.HttpPort | ||
319 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
320 | } | ||
321 | else | ||
322 | { | ||
323 | capsPath | ||
324 | = "http://" | ||
325 | + finalDestination.ExternalHostName | ||
326 | + ":" | ||
327 | + finalDestination.HttpPort | ||
328 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
329 | } | ||
330 | #endregion | ||
331 | |||
332 | if (eq != null) | ||
333 | { | ||
334 | #region IP Translation for NAT | ||
335 | // Uses ipepClient above | ||
336 | if (sp.ClientView.TryGet(out ipepClient)) | ||
337 | { | ||
338 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | ||
339 | } | ||
340 | #endregion | ||
341 | |||
342 | eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); | ||
343 | |||
344 | // ES makes the client send a UseCircuitCode message to the destination, | ||
345 | // which triggers a bunch of things there. | ||
346 | // So let's wait | ||
347 | Thread.Sleep(2000); | ||
348 | |||
349 | eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); | ||
350 | |||
351 | } | ||
352 | else | ||
353 | { | ||
354 | sp.ControllingClient.InformClientOfNeighbour(destinationHandle, endPoint); | ||
355 | } | ||
356 | } | ||
357 | else | ||
358 | { | ||
359 | agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); | ||
360 | capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort | ||
361 | + "/CAPS/" + agentCircuit.CapsPath + "0000/"; | ||
362 | } | ||
363 | |||
364 | // Expect avatar crossing is a heavy-duty function at the destination. | ||
365 | // That is where MakeRoot is called, which fetches appearance and inventory. | ||
366 | // Plus triggers OnMakeRoot, which spawns a series of asynchronous updates. | ||
367 | //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, | ||
368 | // position, false); | ||
369 | |||
370 | //{ | ||
371 | // avatar.ControllingClient.SendTeleportFailed("Problem with destination."); | ||
372 | // // We should close that agent we just created over at destination... | ||
373 | // List<ulong> lst = new List<ulong>(); | ||
374 | // lst.Add(reg.RegionHandle); | ||
375 | // SendCloseChildAgentAsync(avatar.UUID, lst); | ||
376 | // return; | ||
377 | //} | ||
378 | |||
379 | SetInTransit(sp.UUID); | ||
380 | |||
381 | // Let's send a full update of the agent. This is a synchronous call. | ||
382 | AgentData agent = new AgentData(); | ||
383 | sp.CopyTo(agent); | ||
384 | agent.Position = position; | ||
385 | SetCallbackURL(agent, sp.Scene.RegionInfo); | ||
386 | |||
387 | UpdateAgent(reg, finalDestination, agent); | ||
388 | |||
389 | m_log.DebugFormat( | ||
390 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); | ||
391 | |||
392 | |||
393 | if (eq != null) | ||
394 | { | ||
395 | eq.TeleportFinishEvent(destinationHandle, 13, endPoint, | ||
396 | 0, teleportFlags, capsPath, sp.UUID); | ||
397 | } | ||
398 | else | ||
399 | { | ||
400 | sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4, | ||
401 | teleportFlags, capsPath); | ||
402 | } | ||
403 | |||
404 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which | ||
405 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation | ||
406 | // that the client contacted the destination before we send the attachments and close things here. | ||
407 | if (!WaitForCallback(sp.UUID)) | ||
408 | { | ||
409 | // Client never contacted destination. Let's restore everything back | ||
410 | sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); | ||
411 | |||
412 | ResetFromTransit(sp.UUID); | ||
413 | |||
414 | // Yikes! We should just have a ref to scene here. | ||
415 | //sp.Scene.InformClientOfNeighbours(sp); | ||
416 | EnableChildAgents(sp); | ||
417 | |||
418 | // Finally, kill the agent we just created at the destination. | ||
419 | m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); | ||
420 | |||
421 | return; | ||
422 | } | ||
423 | |||
424 | KillEntity(sp.Scene, sp.LocalId); | ||
425 | |||
426 | sp.MakeChildAgent(); | ||
427 | |||
428 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | ||
429 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | ||
430 | |||
431 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | ||
432 | |||
433 | if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | ||
434 | { | ||
435 | Thread.Sleep(5000); | ||
436 | sp.Close(); | ||
437 | sp.Scene.IncomingCloseAgent(sp.UUID); | ||
438 | } | ||
439 | else | ||
440 | // now we have a child agent in this region. | ||
441 | sp.Reset(); | ||
442 | |||
443 | |||
444 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
445 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) | ||
446 | { | ||
447 | m_log.DebugFormat( | ||
448 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", | ||
449 | sp.UUID); | ||
450 | } | ||
451 | } | ||
452 | else | ||
453 | { | ||
454 | sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); | ||
455 | } | ||
456 | } | ||
457 | |||
458 | |||
459 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) | ||
454 | { | 460 | { |
455 | return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); | 461 | return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); |
456 | } | 462 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 101aea0..d39537d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -34,6 +34,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Services.Connectors.Hypergrid; | 35 | using OpenSim.Services.Connectors.Hypergrid; |
36 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
37 | using OpenSim.Server.Base; | ||
37 | 38 | ||
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 39 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
39 | 40 | ||
@@ -59,6 +60,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
59 | } | 60 | } |
60 | 61 | ||
61 | private GatekeeperServiceConnector m_GatekeeperConnector; | 62 | private GatekeeperServiceConnector m_GatekeeperConnector; |
63 | private IHomeUsersSecurityService m_Security; | ||
62 | 64 | ||
63 | #region ISharedRegionModule | 65 | #region ISharedRegionModule |
64 | 66 | ||
@@ -77,12 +79,42 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
77 | { | 79 | { |
78 | m_agentsInTransit = new List<UUID>(); | 80 | m_agentsInTransit = new List<UUID>(); |
79 | m_GatekeeperConnector = new GatekeeperServiceConnector(); | 81 | m_GatekeeperConnector = new GatekeeperServiceConnector(); |
82 | |||
83 | IConfig config = source.Configs["HGEntityTransferModule"]; | ||
84 | if (config != null) | ||
85 | { | ||
86 | string dll = config.GetString("HomeUsersSecurityService", string.Empty); | ||
87 | if (dll != string.Empty) | ||
88 | { | ||
89 | Object[] args = new Object[] { source }; | ||
90 | m_Security = ServerUtils.LoadPlugin<IHomeUsersSecurityService>(dll, args); | ||
91 | if (m_Security == null) | ||
92 | m_log.Debug("[HG ENTITY TRANSFER MODULE]: Unable to load Home Users Security service"); | ||
93 | else | ||
94 | m_log.Debug("[HG ENTITY TRANSFER MODULE]: Home Users Security service loaded"); | ||
95 | } | ||
96 | } | ||
97 | |||
80 | m_Enabled = true; | 98 | m_Enabled = true; |
81 | m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | 99 | m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
82 | } | 100 | } |
83 | } | 101 | } |
84 | } | 102 | } |
85 | 103 | ||
104 | public override void AddRegion(Scene scene) | ||
105 | { | ||
106 | base.AddRegion(scene); | ||
107 | if (m_Enabled) | ||
108 | scene.RegisterModuleInterface<IHomeUsersSecurityService>(m_Security); | ||
109 | } | ||
110 | |||
111 | public override void RemoveRegion(Scene scene) | ||
112 | { | ||
113 | base.AddRegion(scene); | ||
114 | if (m_Enabled) | ||
115 | scene.UnregisterModuleInterface<IHomeUsersSecurityService>(m_Security); | ||
116 | } | ||
117 | |||
86 | 118 | ||
87 | #endregion | 119 | #endregion |
88 | 120 | ||
@@ -98,19 +130,101 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
98 | return true; | 130 | return true; |
99 | } | 131 | } |
100 | 132 | ||
101 | protected override bool CreateAgent(GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) | 133 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) |
102 | { | 134 | { |
103 | reason = string.Empty; | 135 | reason = string.Empty; |
104 | if (reg.RegionLocX != finalDestination.RegionLocX && reg.RegionLocY != finalDestination.RegionLocY) | 136 | if (reg.RegionLocX != finalDestination.RegionLocX || reg.RegionLocY != finalDestination.RegionLocY) |
105 | { | 137 | { |
106 | // this user is going to another grid | 138 | // this user is going to another grid |
107 | reg.RegionName = finalDestination.RegionName; | 139 | reg.RegionName = finalDestination.RegionName; |
140 | reg.RegionID = finalDestination.RegionID; | ||
141 | reg.RegionLocX = finalDestination.RegionLocX; | ||
142 | reg.RegionLocY = finalDestination.RegionLocY; | ||
143 | |||
144 | // Log their session and remote endpoint in the home users security service | ||
145 | IHomeUsersSecurityService security = sp.Scene.RequestModuleInterface<IHomeUsersSecurityService>(); | ||
146 | if (security != null) | ||
147 | security.SetEndPoint(sp.ControllingClient.SessionId, sp.ControllingClient.RemoteEndPoint); | ||
148 | |||
149 | // Log them out of this grid | ||
150 | sp.Scene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat); | ||
151 | |||
108 | return m_GatekeeperConnector.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 152 | return m_GatekeeperConnector.CreateAgent(reg, agentCircuit, teleportFlags, out reason); |
109 | } | 153 | } |
110 | 154 | ||
111 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 155 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); |
112 | } | 156 | } |
113 | 157 | ||
158 | public override void TeleportHome(UUID id, IClientAPI client) | ||
159 | { | ||
160 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | ||
161 | |||
162 | // Let's find out if this is a foreign user or a local user | ||
163 | UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, id); | ||
164 | if (account != null) | ||
165 | { | ||
166 | // local grid user | ||
167 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | ||
168 | base.TeleportHome(id, client); | ||
169 | return; | ||
170 | } | ||
171 | |||
172 | // Foreign user wants to go home | ||
173 | // | ||
174 | AgentCircuitData aCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); | ||
175 | if (aCircuit == null || (aCircuit != null && !aCircuit.ServiceURLs.ContainsKey("GatewayURI"))) | ||
176 | { | ||
177 | client.SendTeleportFailed("Your information has been lost"); | ||
178 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); | ||
179 | return; | ||
180 | } | ||
181 | |||
182 | GridRegion homeGatekeeper = MakeRegion(aCircuit); | ||
183 | if (homeGatekeeper == null) | ||
184 | { | ||
185 | client.SendTeleportFailed("Your information has been lost"); | ||
186 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's gateway information is malformed"); | ||
187 | return; | ||
188 | } | ||
189 | |||
190 | Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY; | ||
191 | GridRegion finalDestination = m_GatekeeperConnector.GetHomeRegion(homeGatekeeper, aCircuit.AgentID, out position, out lookAt); | ||
192 | if (finalDestination == null) | ||
193 | { | ||
194 | client.SendTeleportFailed("Your home region could not be found"); | ||
195 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); | ||
196 | return; | ||
197 | } | ||
198 | |||
199 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); | ||
200 | if (sp == null) | ||
201 | { | ||
202 | client.SendTeleportFailed("Internal error"); | ||
203 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); | ||
204 | return; | ||
205 | } | ||
206 | |||
207 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}:{5}", | ||
208 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); | ||
209 | |||
210 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | ||
211 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); | ||
212 | } | ||
114 | #endregion | 213 | #endregion |
214 | |||
215 | private GridRegion MakeRegion(AgentCircuitData aCircuit) | ||
216 | { | ||
217 | GridRegion region = new GridRegion(); | ||
218 | |||
219 | Uri uri = null; | ||
220 | if (!Uri.TryCreate(aCircuit.ServiceURLs["GatewayURI"].ToString(), UriKind.Absolute, out uri)) | ||
221 | return null; | ||
222 | |||
223 | region.ExternalHostName = uri.Host; | ||
224 | region.HttpPort = (uint)uri.Port; | ||
225 | region.RegionName = string.Empty; | ||
226 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); | ||
227 | return region; | ||
228 | } | ||
115 | } | 229 | } |
116 | } | 230 | } |
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index c61198d..0e3739a 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -62,7 +62,7 @@ | |||
62 | <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" /> | 62 | <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" /> |
63 | <RegionModule id="LandServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Land.LandServiceInConnectorModule" /> | 63 | <RegionModule id="LandServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Land.LandServiceInConnectorModule" /> |
64 | <RegionModule id="NeighbourServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour.NeighbourServiceInConnectorModule" /> \ | 64 | <RegionModule id="NeighbourServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour.NeighbourServiceInConnectorModule" /> \ |
65 | <RegionModule id="HypergridServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.HypergridServiceInConnectorModule" /> \ | 65 | <RegionModule id="HypergridServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid.HypergridServiceInConnectorModule" /> \ |
66 | <RegionModule id="LLLoginServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Login.LLLoginServiceInConnectorModule" /> \ | 66 | <RegionModule id="LLLoginServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Login.LLLoginServiceInConnectorModule" /> \ |
67 | <RegionModule id="SimulationServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation.SimulationServiceInConnectorModule" /> \ | 67 | <RegionModule id="SimulationServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation.SimulationServiceInConnectorModule" /> \ |
68 | <RegionModule id="GridInfoServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.GridInfoServiceInConnectorModule" /> \ | 68 | <RegionModule id="GridInfoServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.GridInfoServiceInConnectorModule" /> \ |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index 6ec0fcf..6e6946c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs | |||
@@ -40,7 +40,7 @@ using OpenSim.Server.Handlers.Hypergrid; | |||
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
42 | 42 | ||
43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid | 43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid |
44 | { | 44 | { |
45 | public class HypergridServiceInConnectorModule : ISharedRegionModule | 45 | public class HypergridServiceInConnectorModule : ISharedRegionModule |
46 | { | 46 | { |
@@ -119,6 +119,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid | |||
119 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); | 119 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); |
120 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); | 120 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); |
121 | //ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args); | 121 | //ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args); |
122 | scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); | ||
122 | } | 123 | } |
123 | } | 124 | } |
124 | 125 | ||
diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs index c56ea3f..940ec7a 100644 --- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | |||
@@ -46,6 +46,12 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
46 | MethodBase.GetCurrentMethod().DeclaringType); | 46 | MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private IGatekeeperService m_GatekeeperService; | 48 | private IGatekeeperService m_GatekeeperService; |
49 | public IGatekeeperService GateKeeper | ||
50 | { | ||
51 | get { return m_GatekeeperService; } | ||
52 | } | ||
53 | |||
54 | private IHypergridService m_HypergridService; | ||
49 | 55 | ||
50 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) : | 56 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) : |
51 | base(config, server, String.Empty) | 57 | base(config, server, String.Empty) |
@@ -56,13 +62,19 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
56 | string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty); | 62 | string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty); |
57 | Object[] args = new Object[] { config, simService }; | 63 | Object[] args = new Object[] { config, simService }; |
58 | m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(serviceDll, args); | 64 | m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(serviceDll, args); |
65 | |||
66 | serviceDll = gridConfig.GetString("HypergridService", string.Empty); | ||
67 | m_HypergridService = ServerUtils.LoadPlugin<IHypergridService>(serviceDll, args); | ||
68 | |||
59 | } | 69 | } |
60 | if (m_GatekeeperService == null) | 70 | if (m_GatekeeperService == null || m_HypergridService == null) |
61 | throw new Exception("Gatekeeper server connector cannot proceed because of missing service"); | 71 | throw new Exception("Gatekeeper server connector cannot proceed because of missing service"); |
62 | 72 | ||
63 | HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService); | 73 | HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService, m_HypergridService); |
64 | server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); | 74 | server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); |
75 | server.AddXmlRPCHandler("link_region_by_desc", hghandlers.LinkRegionByDescRequest, false); | ||
65 | server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); | 76 | server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); |
77 | server.AddXmlRPCHandler("get_home_region", hghandlers.GetHomeRegion, false); | ||
66 | 78 | ||
67 | server.AddHTTPHandler("/foreignagent/", new AgentHandler(m_GatekeeperService).Handler); | 79 | server.AddHTTPHandler("/foreignagent/", new AgentHandler(m_GatekeeperService).Handler); |
68 | 80 | ||
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeUsersSecurityServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HomeUsersSecurityServerConnector.cs new file mode 100644 index 0000000..5379784 --- /dev/null +++ b/OpenSim/Server/Handlers/Hypergrid/HomeUsersSecurityServerConnector.cs | |||
@@ -0,0 +1,122 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Net; | ||
5 | using System.Reflection; | ||
6 | |||
7 | using Nini.Config; | ||
8 | using OpenSim.Framework; | ||
9 | using OpenSim.Server.Base; | ||
10 | using OpenSim.Services.Interfaces; | ||
11 | using OpenSim.Framework.Servers.HttpServer; | ||
12 | using OpenSim.Server.Handlers.Base; | ||
13 | |||
14 | using log4net; | ||
15 | using Nwc.XmlRpc; | ||
16 | using OpenMetaverse; | ||
17 | |||
18 | namespace OpenSim.Server.Handlers.Hypergrid | ||
19 | { | ||
20 | public class HomeUsersSecurityServerConnector : ServiceConnector | ||
21 | { | ||
22 | private static readonly ILog m_log = | ||
23 | LogManager.GetLogger( | ||
24 | MethodBase.GetCurrentMethod().DeclaringType); | ||
25 | |||
26 | private IHomeUsersSecurityService m_HomeUsersService; | ||
27 | |||
28 | public HomeUsersSecurityServerConnector(IConfigSource config, IHttpServer server) : | ||
29 | base(config, server, String.Empty) | ||
30 | { | ||
31 | IConfig gridConfig = config.Configs["HomeUsersSecurityService"]; | ||
32 | if (gridConfig != null) | ||
33 | { | ||
34 | string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty); | ||
35 | Object[] args = new Object[] { config }; | ||
36 | m_HomeUsersService = ServerUtils.LoadPlugin<IHomeUsersSecurityService>(serviceDll, args); | ||
37 | } | ||
38 | if (m_HomeUsersService == null) | ||
39 | throw new Exception("HomeUsersSecurity server connector cannot proceed because of missing service"); | ||
40 | |||
41 | server.AddXmlRPCHandler("ep_get", GetEndPoint, false); | ||
42 | server.AddXmlRPCHandler("ep_set", SetEndPoint, false); | ||
43 | server.AddXmlRPCHandler("ep_remove", RemoveEndPoint, false); | ||
44 | |||
45 | } | ||
46 | |||
47 | public XmlRpcResponse GetEndPoint(XmlRpcRequest request, IPEndPoint remoteClient) | ||
48 | { | ||
49 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
50 | //string host = (string)requestData["host"]; | ||
51 | //string portstr = (string)requestData["port"]; | ||
52 | string sessionID_str = (string)requestData["sessionID"]; | ||
53 | UUID sessionID = UUID.Zero; | ||
54 | UUID.TryParse(sessionID_str, out sessionID); | ||
55 | |||
56 | IPEndPoint ep = m_HomeUsersService.GetEndPoint(sessionID); | ||
57 | |||
58 | Hashtable hash = new Hashtable(); | ||
59 | if (ep == null) | ||
60 | hash["result"] = "false"; | ||
61 | else | ||
62 | { | ||
63 | hash["result"] = "true"; | ||
64 | hash["ep_addr"] = ep.Address.ToString(); | ||
65 | hash["ep_port"] = ep.Port.ToString(); | ||
66 | } | ||
67 | XmlRpcResponse response = new XmlRpcResponse(); | ||
68 | response.Value = hash; | ||
69 | return response; | ||
70 | |||
71 | } | ||
72 | |||
73 | public XmlRpcResponse SetEndPoint(XmlRpcRequest request, IPEndPoint remoteClient) | ||
74 | { | ||
75 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
76 | string host = (string)requestData["ep_addr"]; | ||
77 | string portstr = (string)requestData["ep_port"]; | ||
78 | string sessionID_str = (string)requestData["sessionID"]; | ||
79 | UUID sessionID = UUID.Zero; | ||
80 | UUID.TryParse(sessionID_str, out sessionID); | ||
81 | int port = 0; | ||
82 | Int32.TryParse(portstr, out port); | ||
83 | |||
84 | IPEndPoint ep = null; | ||
85 | try | ||
86 | { | ||
87 | ep = new IPEndPoint(IPAddress.Parse(host), port); | ||
88 | } | ||
89 | catch | ||
90 | { | ||
91 | m_log.Debug("[HOME USERS SECURITY]: Exception in creating EndPoint"); | ||
92 | } | ||
93 | |||
94 | m_HomeUsersService.SetEndPoint(sessionID, ep); | ||
95 | |||
96 | Hashtable hash = new Hashtable(); | ||
97 | hash["result"] = "true"; | ||
98 | XmlRpcResponse response = new XmlRpcResponse(); | ||
99 | response.Value = hash; | ||
100 | return response; | ||
101 | |||
102 | } | ||
103 | |||
104 | public XmlRpcResponse RemoveEndPoint(XmlRpcRequest request, IPEndPoint remoteClient) | ||
105 | { | ||
106 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
107 | string sessionID_str = (string)requestData["sessionID"]; | ||
108 | UUID sessionID = UUID.Zero; | ||
109 | UUID.TryParse(sessionID_str, out sessionID); | ||
110 | |||
111 | m_HomeUsersService.RemoveEndPoint(sessionID); | ||
112 | |||
113 | Hashtable hash = new Hashtable(); | ||
114 | hash["result"] = "true"; | ||
115 | XmlRpcResponse response = new XmlRpcResponse(); | ||
116 | response.Value = hash; | ||
117 | return response; | ||
118 | |||
119 | } | ||
120 | |||
121 | } | ||
122 | } | ||
diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index baafd7d..1d711a8 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | |||
@@ -44,10 +44,12 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | private IGatekeeperService m_GatekeeperService; | 46 | private IGatekeeperService m_GatekeeperService; |
47 | private IHypergridService m_HypergridService; | ||
47 | 48 | ||
48 | public HypergridHandlers(IGatekeeperService gatekeeper) | 49 | public HypergridHandlers(IGatekeeperService gatekeeper, IHypergridService hyper) |
49 | { | 50 | { |
50 | m_GatekeeperService = gatekeeper; | 51 | m_GatekeeperService = gatekeeper; |
52 | m_HypergridService = hyper; | ||
51 | } | 53 | } |
52 | 54 | ||
53 | /// <summary> | 55 | /// <summary> |
@@ -80,6 +82,36 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
80 | return response; | 82 | return response; |
81 | } | 83 | } |
82 | 84 | ||
85 | /// <summary> | ||
86 | /// A local region wants to establish a grid-wide hyperlink to another region | ||
87 | /// </summary> | ||
88 | /// <param name="request"></param> | ||
89 | /// <returns></returns> | ||
90 | public XmlRpcResponse LinkRegionByDescRequest(XmlRpcRequest request, IPEndPoint remoteClient) | ||
91 | { | ||
92 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
93 | //string host = (string)requestData["host"]; | ||
94 | //string portstr = (string)requestData["port"]; | ||
95 | string descriptor = (string)requestData["region_desc"]; | ||
96 | |||
97 | UUID regionID = UUID.Zero; | ||
98 | string imageURL = string.Empty; | ||
99 | ulong regionHandle = 0; | ||
100 | string reason = string.Empty; | ||
101 | |||
102 | bool success = m_HypergridService.LinkRegion(descriptor, out regionID, out regionHandle, out imageURL, out reason); | ||
103 | |||
104 | Hashtable hash = new Hashtable(); | ||
105 | hash["result"] = success.ToString(); | ||
106 | hash["uuid"] = regionID.ToString(); | ||
107 | hash["handle"] = regionHandle.ToString(); | ||
108 | hash["region_image"] = imageURL; | ||
109 | |||
110 | XmlRpcResponse response = new XmlRpcResponse(); | ||
111 | response.Value = hash; | ||
112 | return response; | ||
113 | } | ||
114 | |||
83 | public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient) | 115 | public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient) |
84 | { | 116 | { |
85 | Hashtable requestData = (Hashtable)request.Params[0]; | 117 | Hashtable requestData = (Hashtable)request.Params[0]; |
@@ -111,5 +143,38 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
111 | 143 | ||
112 | } | 144 | } |
113 | 145 | ||
146 | public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient) | ||
147 | { | ||
148 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
149 | //string host = (string)requestData["host"]; | ||
150 | //string portstr = (string)requestData["port"]; | ||
151 | string userID_str = (string)requestData["userID"]; | ||
152 | UUID userID = UUID.Zero; | ||
153 | UUID.TryParse(userID_str, out userID); | ||
154 | |||
155 | Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY; | ||
156 | GridRegion regInfo = m_GatekeeperService.GetHomeRegion(userID, out position, out lookAt); | ||
157 | |||
158 | Hashtable hash = new Hashtable(); | ||
159 | if (regInfo == null) | ||
160 | hash["result"] = "false"; | ||
161 | else | ||
162 | { | ||
163 | hash["result"] = "true"; | ||
164 | hash["uuid"] = regInfo.RegionID.ToString(); | ||
165 | hash["x"] = regInfo.RegionLocX.ToString(); | ||
166 | hash["y"] = regInfo.RegionLocY.ToString(); | ||
167 | hash["region_name"] = regInfo.RegionName; | ||
168 | hash["hostname"] = regInfo.ExternalHostName; | ||
169 | hash["http_port"] = regInfo.HttpPort.ToString(); | ||
170 | hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); | ||
171 | hash["position"] = position.ToString(); | ||
172 | hash["lookAt"] = lookAt.ToString(); | ||
173 | } | ||
174 | XmlRpcResponse response = new XmlRpcResponse(); | ||
175 | response.Value = hash; | ||
176 | return response; | ||
177 | |||
178 | } | ||
114 | } | 179 | } |
115 | } | 180 | } |
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs new file mode 100644 index 0000000..a8d9292 --- /dev/null +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | |||
@@ -0,0 +1,119 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Net; | ||
5 | |||
6 | using OpenSim.Services.Interfaces; | ||
7 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
8 | |||
9 | using OpenMetaverse; | ||
10 | using Nwc.XmlRpc; | ||
11 | |||
12 | using OpenSim.Services.Connectors.Simulation; | ||
13 | |||
14 | namespace OpenSim.Services.Connectors.Hypergrid | ||
15 | { | ||
16 | public class GatekeeperServiceConnector : SimulationServiceConnector | ||
17 | { | ||
18 | protected override string AgentPath() | ||
19 | { | ||
20 | return "/foreignagent/"; | ||
21 | } | ||
22 | |||
23 | protected override string ObjectPath() | ||
24 | { | ||
25 | return "/foreignobject/"; | ||
26 | } | ||
27 | |||
28 | public GridRegion GetHomeRegion(GridRegion gatekeeper, UUID userID, out Vector3 position, out Vector3 lookAt) | ||
29 | { | ||
30 | position = Vector3.UnitY; lookAt = Vector3.UnitY; | ||
31 | |||
32 | Hashtable hash = new Hashtable(); | ||
33 | hash["userID"] = userID.ToString(); | ||
34 | |||
35 | IList paramList = new ArrayList(); | ||
36 | paramList.Add(hash); | ||
37 | |||
38 | XmlRpcRequest request = new XmlRpcRequest("get_home_region", paramList); | ||
39 | string uri = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort + "/"; | ||
40 | XmlRpcResponse response = null; | ||
41 | try | ||
42 | { | ||
43 | response = request.Send(uri, 10000); | ||
44 | } | ||
45 | catch (Exception e) | ||
46 | { | ||
47 | return null; | ||
48 | } | ||
49 | |||
50 | if (response.IsFault) | ||
51 | { | ||
52 | return null; | ||
53 | } | ||
54 | |||
55 | hash = (Hashtable)response.Value; | ||
56 | //foreach (Object o in hash) | ||
57 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
58 | try | ||
59 | { | ||
60 | bool success = false; | ||
61 | Boolean.TryParse((string)hash["result"], out success); | ||
62 | if (success) | ||
63 | { | ||
64 | GridRegion region = new GridRegion(); | ||
65 | |||
66 | UUID.TryParse((string)hash["uuid"], out region.RegionID); | ||
67 | //m_log.Debug(">> HERE, uuid: " + region.RegionID); | ||
68 | int n = 0; | ||
69 | if (hash["x"] != null) | ||
70 | { | ||
71 | Int32.TryParse((string)hash["x"], out n); | ||
72 | region.RegionLocX = n; | ||
73 | //m_log.Debug(">> HERE, x: " + region.RegionLocX); | ||
74 | } | ||
75 | if (hash["y"] != null) | ||
76 | { | ||
77 | Int32.TryParse((string)hash["y"], out n); | ||
78 | region.RegionLocY = n; | ||
79 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | ||
80 | } | ||
81 | if (hash["region_name"] != null) | ||
82 | { | ||
83 | region.RegionName = (string)hash["region_name"]; | ||
84 | //m_log.Debug(">> HERE, name: " + region.RegionName); | ||
85 | } | ||
86 | if (hash["hostname"] != null) | ||
87 | region.ExternalHostName = (string)hash["hostname"]; | ||
88 | if (hash["http_port"] != null) | ||
89 | { | ||
90 | uint p = 0; | ||
91 | UInt32.TryParse((string)hash["http_port"], out p); | ||
92 | region.HttpPort = p; | ||
93 | } | ||
94 | if (hash["internal_port"] != null) | ||
95 | { | ||
96 | int p = 0; | ||
97 | Int32.TryParse((string)hash["internal_port"], out p); | ||
98 | region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); | ||
99 | } | ||
100 | if (hash["position"] != null) | ||
101 | Vector3.TryParse((string)hash["position"], out position); | ||
102 | if (hash["lookAt"] != null) | ||
103 | Vector3.TryParse((string)hash["lookAt"], out lookAt); | ||
104 | |||
105 | // Successful return | ||
106 | return region; | ||
107 | } | ||
108 | |||
109 | } | ||
110 | catch (Exception e) | ||
111 | { | ||
112 | return null; | ||
113 | } | ||
114 | |||
115 | return null; | ||
116 | |||
117 | } | ||
118 | } | ||
119 | } | ||
diff --git a/OpenSim/Services/Connectors/Hypergrid/HomeUsersSecurityServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HomeUsersSecurityServiceConnector.cs new file mode 100644 index 0000000..150690b --- /dev/null +++ b/OpenSim/Services/Connectors/Hypergrid/HomeUsersSecurityServiceConnector.cs | |||
@@ -0,0 +1,132 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Net; | ||
5 | using System.Reflection; | ||
6 | |||
7 | using OpenSim.Services.Interfaces; | ||
8 | |||
9 | using OpenMetaverse; | ||
10 | using log4net; | ||
11 | using Nwc.XmlRpc; | ||
12 | using Nini.Config; | ||
13 | |||
14 | namespace OpenSim.Services.Connectors.Hypergrid | ||
15 | { | ||
16 | public class HomeUsersSecurityServiceConnector : IHomeUsersSecurityService | ||
17 | { | ||
18 | private static readonly ILog m_log = | ||
19 | LogManager.GetLogger( | ||
20 | MethodBase.GetCurrentMethod().DeclaringType); | ||
21 | |||
22 | string m_ServerURL; | ||
23 | public HomeUsersSecurityServiceConnector(string url) | ||
24 | { | ||
25 | m_ServerURL = url; | ||
26 | } | ||
27 | |||
28 | public HomeUsersSecurityServiceConnector(IConfigSource config) | ||
29 | { | ||
30 | } | ||
31 | |||
32 | public void SetEndPoint(UUID sessionID, IPEndPoint ep) | ||
33 | { | ||
34 | Hashtable hash = new Hashtable(); | ||
35 | hash["sessionID"] = sessionID.ToString(); | ||
36 | hash["ep_addr"] = ep.Address.ToString(); | ||
37 | hash["ep_port"] = ep.Port.ToString(); | ||
38 | |||
39 | Call("ep_set", hash); | ||
40 | } | ||
41 | |||
42 | public void RemoveEndPoint(UUID sessionID) | ||
43 | { | ||
44 | Hashtable hash = new Hashtable(); | ||
45 | hash["sessionID"] = sessionID.ToString(); | ||
46 | |||
47 | Call("ep_remove", hash); | ||
48 | } | ||
49 | |||
50 | public IPEndPoint GetEndPoint(UUID sessionID) | ||
51 | { | ||
52 | Hashtable hash = new Hashtable(); | ||
53 | hash["sessionID"] = sessionID.ToString(); | ||
54 | |||
55 | IList paramList = new ArrayList(); | ||
56 | paramList.Add(hash); | ||
57 | |||
58 | XmlRpcRequest request = new XmlRpcRequest("ep_get", paramList); | ||
59 | //m_log.Debug("[HGrid]: Linking to " + uri); | ||
60 | XmlRpcResponse response = null; | ||
61 | try | ||
62 | { | ||
63 | response = request.Send(m_ServerURL, 10000); | ||
64 | } | ||
65 | catch (Exception e) | ||
66 | { | ||
67 | m_log.Debug("[HGrid]: Exception " + e.Message); | ||
68 | return null; | ||
69 | } | ||
70 | |||
71 | if (response.IsFault) | ||
72 | { | ||
73 | m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString); | ||
74 | return null; | ||
75 | } | ||
76 | |||
77 | hash = (Hashtable)response.Value; | ||
78 | //foreach (Object o in hash) | ||
79 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
80 | try | ||
81 | { | ||
82 | bool success = false; | ||
83 | Boolean.TryParse((string)hash["result"], out success); | ||
84 | if (success) | ||
85 | { | ||
86 | IPEndPoint ep = null; | ||
87 | int port = 0; | ||
88 | if (hash["ep_port"] != null) | ||
89 | Int32.TryParse((string)hash["ep_port"], out port); | ||
90 | if (hash["ep_addr"] != null) | ||
91 | ep = new IPEndPoint(IPAddress.Parse((string)hash["ep_addr"]), port); | ||
92 | |||
93 | return ep; | ||
94 | } | ||
95 | |||
96 | } | ||
97 | catch (Exception e) | ||
98 | { | ||
99 | m_log.Error("[HGrid]: Got exception while parsing GetEndPoint response " + e.StackTrace); | ||
100 | return null; | ||
101 | } | ||
102 | |||
103 | return null; | ||
104 | } | ||
105 | |||
106 | private void Call(string method, Hashtable hash) | ||
107 | { | ||
108 | IList paramList = new ArrayList(); | ||
109 | paramList.Add(hash); | ||
110 | |||
111 | XmlRpcRequest request = new XmlRpcRequest(method, paramList); | ||
112 | XmlRpcResponse response = null; | ||
113 | try | ||
114 | { | ||
115 | response = request.Send(m_ServerURL, 10000); | ||
116 | } | ||
117 | catch (Exception e) | ||
118 | { | ||
119 | m_log.Debug("[HGrid]: Exception " + e.Message); | ||
120 | return ; | ||
121 | } | ||
122 | |||
123 | if (response.IsFault) | ||
124 | { | ||
125 | m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString); | ||
126 | return ; | ||
127 | } | ||
128 | |||
129 | } | ||
130 | |||
131 | } | ||
132 | } | ||
diff --git a/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs index 953c7bd..1786d38 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs | |||
@@ -41,22 +41,49 @@ using OpenMetaverse; | |||
41 | using OpenMetaverse.Imaging; | 41 | using OpenMetaverse.Imaging; |
42 | using log4net; | 42 | using log4net; |
43 | using Nwc.XmlRpc; | 43 | using Nwc.XmlRpc; |
44 | using Nini.Config; | ||
44 | 45 | ||
45 | namespace OpenSim.Services.Connectors.Hypergrid | 46 | namespace OpenSim.Services.Connectors.Hypergrid |
46 | { | 47 | { |
47 | public class HypergridServiceConnector | 48 | public class HypergridServiceConnector : IHypergridService |
48 | { | 49 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 51 | ||
51 | private IAssetService m_AssetService; | 52 | private IAssetService m_AssetService; |
53 | private string m_ServerURL; | ||
52 | 54 | ||
53 | public HypergridServiceConnector() : this(null) { } | 55 | public HypergridServiceConnector() { } |
54 | 56 | ||
55 | public HypergridServiceConnector(IAssetService assService) | 57 | public HypergridServiceConnector(IAssetService assService) |
56 | { | 58 | { |
57 | m_AssetService = assService; | 59 | m_AssetService = assService; |
58 | } | 60 | } |
59 | 61 | ||
62 | public HypergridServiceConnector(IConfigSource source) | ||
63 | { | ||
64 | Initialise(source); | ||
65 | } | ||
66 | |||
67 | public virtual void Initialise(IConfigSource source) | ||
68 | { | ||
69 | IConfig hgConfig = source.Configs["HypergridService"]; | ||
70 | if (hgConfig == null) | ||
71 | { | ||
72 | m_log.Error("[HYPERGRID CONNECTOR]: HypergridService missing from OpenSim.ini"); | ||
73 | throw new Exception("Hypergrid connector init error"); | ||
74 | } | ||
75 | |||
76 | string serviceURI = hgConfig.GetString("HypergridServerURI", | ||
77 | String.Empty); | ||
78 | |||
79 | if (serviceURI == String.Empty) | ||
80 | { | ||
81 | m_log.Error("[HYPERGRID CONNECTOR]: No Server URI named in section HypergridService"); | ||
82 | throw new Exception("Hypergrid connector init error"); | ||
83 | } | ||
84 | m_ServerURL = serviceURI; | ||
85 | } | ||
86 | |||
60 | public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string imageURL, out string reason) | 87 | public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string imageURL, out string reason) |
61 | { | 88 | { |
62 | regionID = UUID.Zero; | 89 | regionID = UUID.Zero; |
@@ -246,5 +273,82 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
246 | 273 | ||
247 | return null; | 274 | return null; |
248 | } | 275 | } |
276 | |||
277 | #region From local regions to grid-wide hypergrid service | ||
278 | |||
279 | public bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong realHandle, out string imageURL, out string reason) | ||
280 | { | ||
281 | regionID = UUID.Zero; | ||
282 | imageURL = string.Empty; | ||
283 | realHandle = 0; | ||
284 | reason = string.Empty; | ||
285 | |||
286 | Hashtable hash = new Hashtable(); | ||
287 | hash["region_desc"] = regionDescriptor; | ||
288 | |||
289 | IList paramList = new ArrayList(); | ||
290 | paramList.Add(hash); | ||
291 | |||
292 | XmlRpcRequest request = new XmlRpcRequest("link_region_by_desc", paramList); | ||
293 | XmlRpcResponse response = null; | ||
294 | try | ||
295 | { | ||
296 | response = request.Send(m_ServerURL, 10000); | ||
297 | } | ||
298 | catch (Exception e) | ||
299 | { | ||
300 | m_log.Debug("[HGrid]: Exception " + e.Message); | ||
301 | reason = "Error contacting remote server"; | ||
302 | return false; | ||
303 | } | ||
304 | |||
305 | if (response.IsFault) | ||
306 | { | ||
307 | reason = response.FaultString; | ||
308 | m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString); | ||
309 | return false; | ||
310 | } | ||
311 | |||
312 | hash = (Hashtable)response.Value; | ||
313 | //foreach (Object o in hash) | ||
314 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
315 | try | ||
316 | { | ||
317 | bool success = false; | ||
318 | Boolean.TryParse((string)hash["result"], out success); | ||
319 | if (success) | ||
320 | { | ||
321 | UUID.TryParse((string)hash["uuid"], out regionID); | ||
322 | //m_log.Debug(">> HERE, uuid: " + uuid); | ||
323 | if ((string)hash["handle"] != null) | ||
324 | { | ||
325 | realHandle = Convert.ToUInt64((string)hash["handle"]); | ||
326 | //m_log.Debug(">> HERE, realHandle: " + realHandle); | ||
327 | } | ||
328 | if (hash["region_image"] != null) | ||
329 | { | ||
330 | imageURL = (string)hash["region_image"]; | ||
331 | } | ||
332 | } | ||
333 | |||
334 | } | ||
335 | catch (Exception e) | ||
336 | { | ||
337 | reason = "Error parsing return arguments"; | ||
338 | m_log.Error("[HGrid]: Got exception while parsing hyperlink response " + e.StackTrace); | ||
339 | return false; | ||
340 | } | ||
341 | |||
342 | return true; | ||
343 | } | ||
344 | |||
345 | // TODO !!! | ||
346 | public GridRegion GetRegionByUUID(UUID regionID) { return null; } | ||
347 | public GridRegion GetRegionByPosition(int x, int y) { return null; } | ||
348 | public GridRegion GetRegionByName(string name) { return null; } | ||
349 | public List<GridRegion> GetRegionsByName(string name) { return null; } | ||
350 | public List<GridRegion> GetRegionRange(int xmin, int xmax, int ymin, int ymax) { return null; } | ||
351 | |||
352 | #endregion | ||
249 | } | 353 | } |
250 | } | 354 | } |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 72db93f..283ab3e 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Net; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | 32 | ||
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
@@ -51,6 +52,7 @@ namespace OpenSim.Services.HypergridService | |||
51 | IPresenceService m_PresenceService; | 52 | IPresenceService m_PresenceService; |
52 | IAuthenticationService m_AuthenticationService; | 53 | IAuthenticationService m_AuthenticationService; |
53 | IUserAccountService m_UserAccountService; | 54 | IUserAccountService m_UserAccountService; |
55 | IHomeUsersSecurityService m_HomeUsersSecurityService; | ||
54 | ISimulationService m_SimulationService; | 56 | ISimulationService m_SimulationService; |
55 | 57 | ||
56 | string m_AuthDll; | 58 | string m_AuthDll; |
@@ -66,14 +68,15 @@ namespace OpenSim.Services.HypergridService | |||
66 | throw new Exception(String.Format("No section GatekeeperService in config file")); | 68 | throw new Exception(String.Format("No section GatekeeperService in config file")); |
67 | 69 | ||
68 | string accountService = serverConfig.GetString("UserAccountService", String.Empty); | 70 | string accountService = serverConfig.GetString("UserAccountService", String.Empty); |
71 | string homeUsersSecurityService = serverConfig.GetString("HomeUsersSecurityService", string.Empty); | ||
69 | string gridService = serverConfig.GetString("GridService", String.Empty); | 72 | string gridService = serverConfig.GetString("GridService", String.Empty); |
70 | string presenceService = serverConfig.GetString("PresenceService", String.Empty); | 73 | string presenceService = serverConfig.GetString("PresenceService", String.Empty); |
71 | string simulationService = serverConfig.GetString("SimulationService", String.Empty); | 74 | string simulationService = serverConfig.GetString("SimulationService", String.Empty); |
72 | 75 | ||
73 | m_AuthDll = serverConfig.GetString("AuthenticationService", String.Empty); | 76 | m_AuthDll = serverConfig.GetString("AuthenticationService", String.Empty); |
74 | 77 | ||
75 | if (accountService == string.Empty || gridService == string.Empty || | 78 | // These 3 are mandatory, the others aren't |
76 | presenceService == string.Empty || m_AuthDll == string.Empty) | 79 | if (gridService == string.Empty || presenceService == string.Empty || m_AuthDll == string.Empty) |
77 | throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); | 80 | throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); |
78 | 81 | ||
79 | string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString()); | 82 | string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString()); |
@@ -82,16 +85,20 @@ namespace OpenSim.Services.HypergridService | |||
82 | m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); | 85 | m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); |
83 | 86 | ||
84 | Object[] args = new Object[] { config }; | 87 | Object[] args = new Object[] { config }; |
85 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); | ||
86 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); | 88 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); |
87 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); | 89 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); |
90 | |||
91 | if (accountService != string.Empty) | ||
92 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); | ||
93 | if (homeUsersSecurityService != string.Empty) | ||
94 | m_HomeUsersSecurityService = ServerUtils.LoadPlugin<IHomeUsersSecurityService>(homeUsersSecurityService, args); | ||
95 | |||
88 | if (simService != null) | 96 | if (simService != null) |
89 | m_SimulationService = simService; | 97 | m_SimulationService = simService; |
90 | else if (simulationService != string.Empty) | 98 | else if (simulationService != string.Empty) |
91 | m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args); | 99 | m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args); |
92 | 100 | ||
93 | if (m_UserAccountService == null || m_GridService == null || | 101 | if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) |
94 | m_PresenceService == null || m_SimulationService == null) | ||
95 | throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); | 102 | throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); |
96 | 103 | ||
97 | m_log.Debug("[GATEKEEPER SERVICE]: Starting..."); | 104 | m_log.Debug("[GATEKEEPER SERVICE]: Starting..."); |
@@ -164,6 +171,7 @@ namespace OpenSim.Services.HypergridService | |||
164 | return region; | 171 | return region; |
165 | } | 172 | } |
166 | 173 | ||
174 | #region Login Agent | ||
167 | public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) | 175 | public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) |
168 | { | 176 | { |
169 | reason = string.Empty; | 177 | reason = string.Empty; |
@@ -174,6 +182,9 @@ namespace OpenSim.Services.HypergridService | |||
174 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to login foreign agent {0} {1} @ {2} ({3}) at destination {4}", | 182 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to login foreign agent {0} {1} @ {2} ({3}) at destination {4}", |
175 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName); | 183 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName); |
176 | 184 | ||
185 | // | ||
186 | // Authenticate the user | ||
187 | // | ||
177 | if (!Authenticate(aCircuit)) | 188 | if (!Authenticate(aCircuit)) |
178 | { | 189 | { |
179 | reason = "Unable to verify identity"; | 190 | reason = "Unable to verify identity"; |
@@ -181,22 +192,40 @@ namespace OpenSim.Services.HypergridService | |||
181 | return false; | 192 | return false; |
182 | } | 193 | } |
183 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Identity verified for {0} {1} @ {2}", aCircuit.firstname, aCircuit.lastname, authURL); | 194 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Identity verified for {0} {1} @ {2}", aCircuit.firstname, aCircuit.lastname, authURL); |
184 | 195 | ||
185 | // Check to see if we have a local user with that UUID | 196 | // |
186 | UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID); | 197 | // Check for impersonations |
187 | if (account != null) | 198 | // |
199 | UserAccount account = null; | ||
200 | if (m_UserAccountService != null) | ||
188 | { | 201 | { |
189 | // No, sorry; go away | 202 | // Check to see if we have a local user with that UUID |
190 | reason = "User identifier not allowed on this grid"; | 203 | account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID); |
191 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has UUID of local user {3}. Refusing service.", | 204 | if (account != null) |
192 | aCircuit.firstname, aCircuit.lastname, aCircuit.AgentID); | 205 | { |
193 | return false; | 206 | // Make sure this is the user coming home, and not a fake |
207 | if (m_HomeUsersSecurityService != null) | ||
208 | { | ||
209 | Object ep = m_HomeUsersSecurityService.GetEndPoint(aCircuit.SessionID); | ||
210 | if (ep == null) | ||
211 | { | ||
212 | // This is a fake, this session never left this grid | ||
213 | reason = "Unauthorized"; | ||
214 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has same ID as local user. Refusing service.", | ||
215 | aCircuit.firstname, aCircuit.lastname); | ||
216 | return false; | ||
217 | |||
218 | } | ||
219 | } | ||
220 | } | ||
194 | } | 221 | } |
195 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User ID ok"); | 222 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok"); |
196 | 223 | ||
197 | // May want to authorize | 224 | // May want to authorize |
198 | 225 | ||
226 | // | ||
199 | // Login the presence | 227 | // Login the presence |
228 | // | ||
200 | if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) | 229 | if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) |
201 | { | 230 | { |
202 | reason = "Unable to login presence"; | 231 | reason = "Unable to login presence"; |
@@ -206,22 +235,38 @@ namespace OpenSim.Services.HypergridService | |||
206 | } | 235 | } |
207 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); | 236 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); |
208 | 237 | ||
238 | // | ||
209 | // Get the region | 239 | // Get the region |
240 | // | ||
210 | destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); | 241 | destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); |
211 | if (destination == null) | 242 | if (destination == null) |
212 | { | 243 | { |
213 | reason = "Destination region not found"; | 244 | reason = "Destination region not found"; |
214 | return false; | 245 | return false; |
215 | } | 246 | } |
216 | m_log.DebugFormat("[GATEKEEPER SERVICE]: destination ok : {0}", destination.RegionName); | 247 | m_log.DebugFormat("[GATEKEEPER SERVICE]: destination ok: {0}", destination.RegionName); |
217 | 248 | ||
249 | // | ||
250 | // Adjust the visible name | ||
251 | // | ||
252 | if (account != null) | ||
253 | { | ||
254 | aCircuit.firstname = account.FirstName; | ||
255 | aCircuit.lastname = account.LastName; | ||
256 | } | ||
257 | if (account == null && !aCircuit.lastname.StartsWith("@")) | ||
258 | { | ||
259 | aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname; | ||
260 | aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString(); | ||
261 | } | ||
262 | |||
263 | // | ||
218 | // Finally launch the agent at the destination | 264 | // Finally launch the agent at the destination |
219 | aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname; | 265 | // |
220 | aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString(); | ||
221 | return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason); | 266 | return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason); |
222 | } | 267 | } |
223 | 268 | ||
224 | protected bool Authenticate(AgentCircuitData aCircuit) | 269 | protected bool Authenticate(AgentCircuitData aCircuit) |
225 | { | 270 | { |
226 | string authURL = string.Empty; | 271 | string authURL = string.Empty; |
227 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 272 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |
@@ -250,5 +295,40 @@ namespace OpenSim.Services.HypergridService | |||
250 | 295 | ||
251 | return false; | 296 | return false; |
252 | } | 297 | } |
298 | |||
299 | #endregion | ||
300 | |||
301 | public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) | ||
302 | { | ||
303 | position = new Vector3(128, 128, 0); lookAt = Vector3.UnitY; | ||
304 | |||
305 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to get home region of user {0}", userID); | ||
306 | |||
307 | GridRegion home = null; | ||
308 | PresenceInfo[] presences = m_PresenceService.GetAgents(new string[] { userID.ToString() }); | ||
309 | if (presences != null && presences.Length > 0) | ||
310 | { | ||
311 | UUID homeID = presences[0].HomeRegionID; | ||
312 | if (homeID != UUID.Zero) | ||
313 | { | ||
314 | home = m_GridService.GetRegionByUUID(m_ScopeID, homeID); | ||
315 | position = presences[0].HomePosition; | ||
316 | lookAt = presences[0].HomeLookAt; | ||
317 | } | ||
318 | if (home == null) | ||
319 | { | ||
320 | List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID); | ||
321 | if (defs != null && defs.Count > 0) | ||
322 | home = defs[0]; | ||
323 | } | ||
324 | } | ||
325 | |||
326 | return home; | ||
327 | } | ||
328 | |||
329 | #region Misc | ||
330 | |||
331 | |||
332 | #endregion | ||
253 | } | 333 | } |
254 | } | 334 | } |
diff --git a/OpenSim/Services/HypergridService/HomeUsersSecurityService.cs b/OpenSim/Services/HypergridService/HomeUsersSecurityService.cs new file mode 100644 index 0000000..a7adfc1 --- /dev/null +++ b/OpenSim/Services/HypergridService/HomeUsersSecurityService.cs | |||
@@ -0,0 +1,67 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Net; | ||
4 | using System.Reflection; | ||
5 | |||
6 | using OpenSim.Services.Interfaces; | ||
7 | |||
8 | using OpenMetaverse; | ||
9 | using log4net; | ||
10 | using Nini.Config; | ||
11 | |||
12 | namespace OpenSim.Services.HypergridService | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// This service is for HG1.5 only, to make up for the fact that clients don't | ||
16 | /// keep any private information in themselves, and that their 'home service' | ||
17 | /// needs to do it for them. | ||
18 | /// Once we have better clients, this shouldn't be needed. | ||
19 | /// </summary> | ||
20 | public class HomeUsersSecurityService : IHomeUsersSecurityService | ||
21 | { | ||
22 | private static readonly ILog m_log = | ||
23 | LogManager.GetLogger( | ||
24 | MethodBase.GetCurrentMethod().DeclaringType); | ||
25 | |||
26 | // | ||
27 | // This is a persistent storage wannabe for dealing with the | ||
28 | // quirks of HG1.5. We don't really want to store this in a table. | ||
29 | // But this is the necessary information for securing clients | ||
30 | // coming home. | ||
31 | // | ||
32 | protected static Dictionary<UUID, IPEndPoint> m_ClientEndPoints = new Dictionary<UUID, IPEndPoint>(); | ||
33 | |||
34 | public HomeUsersSecurityService(IConfigSource config) | ||
35 | { | ||
36 | m_log.DebugFormat("[HOME USERS SECURITY]: Starting..."); | ||
37 | } | ||
38 | |||
39 | public void SetEndPoint(UUID sessionID, IPEndPoint ep) | ||
40 | { | ||
41 | m_log.DebugFormat("[HOME USERS SECURITY]: Set EndPoint {0} for session {1}", ep.ToString(), sessionID); | ||
42 | |||
43 | lock (m_ClientEndPoints) | ||
44 | m_ClientEndPoints[sessionID] = ep; | ||
45 | } | ||
46 | |||
47 | public IPEndPoint GetEndPoint(UUID sessionID) | ||
48 | { | ||
49 | lock (m_ClientEndPoints) | ||
50 | if (m_ClientEndPoints.ContainsKey(sessionID)) | ||
51 | { | ||
52 | m_log.DebugFormat("[HOME USERS SECURITY]: Get EndPoint {0} for session {1}", m_ClientEndPoints[sessionID].ToString(), sessionID); | ||
53 | return m_ClientEndPoints[sessionID]; | ||
54 | } | ||
55 | |||
56 | return null; | ||
57 | } | ||
58 | |||
59 | public void RemoveEndPoint(UUID sessionID) | ||
60 | { | ||
61 | m_log.DebugFormat("[HOME USERS SECURITY]: Remove EndPoint for session {0}", sessionID); | ||
62 | lock (m_ClientEndPoints) | ||
63 | if (m_ClientEndPoints.ContainsKey(sessionID)) | ||
64 | m_ClientEndPoints.Remove(sessionID); | ||
65 | } | ||
66 | } | ||
67 | } | ||
diff --git a/OpenSim/Services/HypergridService/HypergridService.cs b/OpenSim/Services/HypergridService/HypergridService.cs index 734931d..ac0f5ac 100644 --- a/OpenSim/Services/HypergridService/HypergridService.cs +++ b/OpenSim/Services/HypergridService/HypergridService.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Services.HypergridService | |||
51 | private static HypergridService m_RootInstance = null; | 51 | private static HypergridService m_RootInstance = null; |
52 | protected IConfigSource m_config; | 52 | protected IConfigSource m_config; |
53 | 53 | ||
54 | protected IAuthenticationService m_AuthenticationService = null; | 54 | protected IPresenceService m_PresenceService = null; |
55 | protected IGridService m_GridService; | 55 | protected IGridService m_GridService; |
56 | protected IAssetService m_AssetService; | 56 | protected IAssetService m_AssetService; |
57 | protected HypergridServiceConnector m_HypergridConnector; | 57 | protected HypergridServiceConnector m_HypergridConnector; |
@@ -94,7 +94,7 @@ namespace OpenSim.Services.HypergridService | |||
94 | if (gridConfig != null) | 94 | if (gridConfig != null) |
95 | { | 95 | { |
96 | string gridService = gridConfig.GetString("GridService", string.Empty); | 96 | string gridService = gridConfig.GetString("GridService", string.Empty); |
97 | string authService = gridConfig.GetString("AuthenticationService", String.Empty); | 97 | string presenceService = gridConfig.GetString("PresenceService", String.Empty); |
98 | string assetService = gridConfig.GetString("AssetService", string.Empty); | 98 | string assetService = gridConfig.GetString("AssetService", string.Empty); |
99 | 99 | ||
100 | Object[] args = new Object[] { config }; | 100 | Object[] args = new Object[] { config }; |
@@ -104,8 +104,8 @@ namespace OpenSim.Services.HypergridService | |||
104 | if (m_GridService == null) | 104 | if (m_GridService == null) |
105 | throw new Exception("HypergridService cannot function without a GridService"); | 105 | throw new Exception("HypergridService cannot function without a GridService"); |
106 | 106 | ||
107 | if (authService != String.Empty) | 107 | if (presenceService != String.Empty) |
108 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); | 108 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); |
109 | 109 | ||
110 | if (assetService != string.Empty) | 110 | if (assetService != string.Empty) |
111 | m_AssetService = ServerUtils.LoadPlugin<IAssetService>(assetService, args); | 111 | m_AssetService = ServerUtils.LoadPlugin<IAssetService>(assetService, args); |
diff --git a/OpenSim/Services/Interfaces/IGatekeeperService.cs b/OpenSim/Services/Interfaces/IGatekeeperService.cs index d41df75..5b5c9d1 100644 --- a/OpenSim/Services/Interfaces/IGatekeeperService.cs +++ b/OpenSim/Services/Interfaces/IGatekeeperService.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Net; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | 31 | ||
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
@@ -39,5 +40,18 @@ namespace OpenSim.Services.Interfaces | |||
39 | GridRegion GetHyperlinkRegion(UUID regionID); | 40 | GridRegion GetHyperlinkRegion(UUID regionID); |
40 | 41 | ||
41 | bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason); | 42 | bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason); |
43 | |||
44 | GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); | ||
45 | |||
46 | } | ||
47 | |||
48 | /// <summary> | ||
49 | /// HG1.5 only | ||
50 | /// </summary> | ||
51 | public interface IHomeUsersSecurityService | ||
52 | { | ||
53 | void SetEndPoint(UUID sessionID, IPEndPoint ep); | ||
54 | IPEndPoint GetEndPoint(UUID sessionID); | ||
55 | void RemoveEndPoint(UUID sessionID); | ||
42 | } | 56 | } |
43 | } | 57 | } |
diff --git a/OpenSim/Services/Interfaces/IHypergridService.cs b/OpenSim/Services/Interfaces/IHypergridService.cs index dd3c053..86ef1b4 100644 --- a/OpenSim/Services/Interfaces/IHypergridService.cs +++ b/OpenSim/Services/Interfaces/IHypergridService.cs | |||
@@ -43,6 +43,7 @@ namespace OpenSim.Services.Interfaces | |||
43 | GridRegion GetRegionByName(string name); | 43 | GridRegion GetRegionByName(string name); |
44 | List<GridRegion> GetRegionsByName(string name); | 44 | List<GridRegion> GetRegionsByName(string name); |
45 | List<GridRegion> GetRegionRange(int xmin, int xmax, int ymin, int ymax); | 45 | List<GridRegion> GetRegionRange(int xmin, int xmax, int ymin, int ymax); |
46 | |||
46 | } | 47 | } |
47 | 48 | ||
48 | } | 49 | } |
diff --git a/bin/OpenSim.Server.ini.example b/bin/OpenSim.Server.ini.example index 3d2a5ba..0c6046f 100644 --- a/bin/OpenSim.Server.ini.example +++ b/bin/OpenSim.Server.ini.example | |||
@@ -42,7 +42,6 @@ ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector,OpenSim.S | |||
42 | ; * | 42 | ; * |
43 | [InventoryService] | 43 | [InventoryService] |
44 | LocalServiceModule = "OpenSim.Services.InventoryService.dll:InventoryService" | 44 | LocalServiceModule = "OpenSim.Services.InventoryService.dll:InventoryService" |
45 | UserServerURI = "http://127.0.0.1:8002" | ||
46 | SessionAuthentication = "false" | 45 | SessionAuthentication = "false" |
47 | StorageProvider = "OpenSim.Data.MySQL.dll" | 46 | StorageProvider = "OpenSim.Data.MySQL.dll" |
48 | ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;" | 47 | ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;" |
@@ -58,10 +57,12 @@ ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector,OpenSim.S | |||
58 | Realm = "regions" | 57 | Realm = "regions" |
59 | ; AllowDuplicateNames = "True" | 58 | ; AllowDuplicateNames = "True" |
60 | ;; Next, we can specify properties of regions, including default and fallback regions | 59 | ;; Next, we can specify properties of regions, including default and fallback regions |
61 | ;; The syntax is: Region_<RegioName> = "<flags>" | 60 | ;; The syntax is: Region_<RegionName> = "<flags>" |
61 | ;; or: Region_<RegionID> = "<flags>" | ||
62 | ;; where <flags> can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut,Reservation,NoMove,Authenticate | 62 | ;; where <flags> can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut,Reservation,NoMove,Authenticate |
63 | ;; For example: | 63 | ;; For example: |
64 | ; Region_Welcome_Area = "DefaultRegion, FallbackRegion" | 64 | ; Region_Welcome_Area = "DefaultRegion, FallbackRegion" |
65 | ; (replace spaces with underscore) | ||
65 | 66 | ||
66 | ; * This is the configuration for the freeswitch server in grid mode | 67 | ; * This is the configuration for the freeswitch server in grid mode |
67 | [FreeswitchService] | 68 | [FreeswitchService] |
diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini index 4b6bc17..4885a41 100644 --- a/bin/config-include/GridHypergrid.ini +++ b/bin/config-include/GridHypergrid.ini | |||
@@ -17,18 +17,17 @@ | |||
17 | AvatarServices = "RemoteAvatarServicesConnector" | 17 | AvatarServices = "RemoteAvatarServicesConnector" |
18 | NeighbourServices = "RemoteNeighbourServicesConnector" | 18 | NeighbourServices = "RemoteNeighbourServicesConnector" |
19 | AuthenticationServices = "RemoteAuthenticationServicesConnector" | 19 | AuthenticationServices = "RemoteAuthenticationServicesConnector" |
20 | AuthorizationServices = "LocalAuthorizationServicesConnector" | ||
20 | PresenceServices = "RemotePresenceServicesConnector" | 21 | PresenceServices = "RemotePresenceServicesConnector" |
21 | UserAccountServices = "RemoteUserAccountServicesConnector" | 22 | UserAccountServices = "RemoteUserAccountServicesConnector" |
22 | SimulationServices = "RemoteSimulationConnectorModule" | 23 | SimulationServices = "RemoteSimulationConnectorModule" |
23 | EntityTransferModule = "BasicEntityTransferModule" | 24 | EntityTransferModule = "HGEntityTransferModule" |
24 | LandServiceInConnector = true | 25 | LandServiceInConnector = true |
25 | NeighbourServiceInConnector = true | 26 | NeighbourServiceInConnector = true |
26 | HypergridServiceInConnector = true | ||
27 | SimulationServiceInConnector = true | 27 | SimulationServiceInConnector = true |
28 | LibraryModule = true | 28 | LibraryModule = true |
29 | InventoryServiceInConnector = false | 29 | InventoryServiceInConnector = false |
30 | AssetServiceInConnector = false | 30 | AssetServiceInConnector = false |
31 | LLLoginServiceInConnector = false | ||
32 | 31 | ||
33 | [AssetService] | 32 | [AssetService] |
34 | LocalGridAssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector" | 33 | LocalGridAssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector" |
@@ -41,12 +40,12 @@ | |||
41 | [GridService] | 40 | [GridService] |
42 | ; for the HGGridServicesConnector to instantiate | 41 | ; for the HGGridServicesConnector to instantiate |
43 | GridServiceConnectorModule = "OpenSim.Region.CoreModules.dll:RemoteGridServicesConnector" | 42 | GridServiceConnectorModule = "OpenSim.Region.CoreModules.dll:RemoteGridServicesConnector" |
43 | HypergridService = "OpenSim.Services.HypergridService.dll:HypergridService" | ||
44 | ; RemoteGridServicesConnector instantiates a LocalGridServicesConnector, | 44 | ; RemoteGridServicesConnector instantiates a LocalGridServicesConnector, |
45 | ; which in turn uses this | 45 | ; which in turn uses this |
46 | LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" | 46 | LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" |
47 | StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" | 47 | StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" |
48 | 48 | ||
49 | [LibraryService] | 49 | [HypergridService] |
50 | LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService" | 50 | GridService = "OpenSim.Services.GridService.dll:GridService" |
51 | LibraryName = "OpenSim Library" | 51 | AssetService = "OpenSim.Services.AssetService.dll:AssetService" |
52 | DefaultLibrary = "./inventory/Libraries.xml" | ||
diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini index eb887a6..28b9d47 100644 --- a/bin/config-include/StandaloneHypergrid.ini +++ b/bin/config-include/StandaloneHypergrid.ini | |||
@@ -82,6 +82,9 @@ | |||
82 | GridService = "OpenSim.Services.GridService.dll:GridService" | 82 | GridService = "OpenSim.Services.GridService.dll:GridService" |
83 | AuthenticationService = "OpenSim.Services.Connectors.dll:AuthenticationServicesConnector" | 83 | AuthenticationService = "OpenSim.Services.Connectors.dll:AuthenticationServicesConnector" |
84 | 84 | ||
85 | [HGEntityTransferModule] | ||
86 | HomeUsersSecurityService = "OpenSim.Services.HypergridService.dll:HomeUsersSecurityService" | ||
87 | |||
85 | [PresenceService] | 88 | [PresenceService] |
86 | LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService" | 89 | LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService" |
87 | 90 | ||