diff options
author | Diva Canto | 2010-01-17 18:04:55 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-17 18:04:55 -0800 |
commit | b2e6ec9e12ad07eb08496ebe8ca0476b793017d5 (patch) | |
tree | ac72f03b9cfca6f344d697f6d7581e5147ccf450 /OpenSim | |
parent | Oops, forgot this one. (diff) | |
download | opensim-SC_OLD-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.zip opensim-SC_OLD-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.tar.gz opensim-SC_OLD-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.tar.bz2 opensim-SC_OLD-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.tar.xz |
Agent gets there through the Gatekeeper, but still a few quirks to fix.
Diffstat (limited to '')
15 files changed, 560 insertions, 93 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index a3b999e..f2f0a53 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -194,9 +194,11 @@ namespace OpenSim.Framework | |||
194 | OSDArray urls = new OSDArray(ServiceURLs.Count * 2); | 194 | OSDArray urls = new OSDArray(ServiceURLs.Count * 2); |
195 | foreach (KeyValuePair<string, object> kvp in ServiceURLs) | 195 | foreach (KeyValuePair<string, object> kvp in ServiceURLs) |
196 | { | 196 | { |
197 | //System.Console.WriteLine("XXX " + kvp.Key + "=" + kvp.Value); | ||
197 | urls.Add(OSD.FromString(kvp.Key)); | 198 | urls.Add(OSD.FromString(kvp.Key)); |
198 | urls.Add(OSD.FromString((kvp.Value == null) ? string.Empty : kvp.Value.ToString())); | 199 | urls.Add(OSD.FromString((kvp.Value == null) ? string.Empty : kvp.Value.ToString())); |
199 | } | 200 | } |
201 | args["service_urls"] = urls; | ||
200 | } | 202 | } |
201 | 203 | ||
202 | return args; | 204 | return args; |
@@ -289,6 +291,8 @@ namespace OpenSim.Framework | |||
289 | for (int i = 0; i < urls.Count / 2; i++) | 291 | for (int i = 0; i < urls.Count / 2; i++) |
290 | { | 292 | { |
291 | ServiceURLs[urls[i * 2].AsString()] = urls[(i * 2) + 1].AsString(); | 293 | ServiceURLs[urls[i * 2].AsString()] = urls[(i * 2) + 1].AsString(); |
294 | //System.Console.WriteLine("XXX " + urls[i * 2].AsString() + "=" + urls[(i * 2) + 1].AsString()); | ||
295 | |||
292 | } | 296 | } |
293 | } | 297 | } |
294 | } | 298 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index d0171fe..8268bfa 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -239,12 +239,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
239 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | 239 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); |
240 | 240 | ||
241 | string capsPath = String.Empty; | 241 | string capsPath = String.Empty; |
242 | |||
243 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
242 | AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); | 244 | AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); |
243 | agentCircuit.BaseFolder = UUID.Zero; | ||
244 | agentCircuit.InventoryFolder = UUID.Zero; | ||
245 | agentCircuit.startpos = position; | 245 | agentCircuit.startpos = position; |
246 | agentCircuit.child = true; | 246 | agentCircuit.child = true; |
247 | agentCircuit.Appearance = sp.Appearance; | 247 | agentCircuit.Appearance = sp.Appearance; |
248 | if (currentAgentCircuit != null) | ||
249 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
248 | 250 | ||
249 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 251 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) |
250 | { | 252 | { |
@@ -255,9 +257,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
255 | string reason = String.Empty; | 257 | string reason = String.Empty; |
256 | 258 | ||
257 | // Let's create an agent there if one doesn't exist yet. | 259 | // Let's create an agent there if one doesn't exist yet. |
258 | if (!m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason)) | 260 | if (!CreateAgent(reg, finalDestination, agentCircuit, teleportFlags, out reason)) |
259 | { | 261 | { |
260 | sp.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", | 262 | sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", |
261 | reason)); | 263 | reason)); |
262 | return; | 264 | return; |
263 | } | 265 | } |
@@ -345,8 +347,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
345 | agent.CallbackURI = "http://" + sp.Scene.RegionInfo.ExternalHostName + ":" + sp.Scene.RegionInfo.HttpPort + | 347 | agent.CallbackURI = "http://" + sp.Scene.RegionInfo.ExternalHostName + ":" + sp.Scene.RegionInfo.HttpPort + |
346 | "/agent/" + sp.UUID.ToString() + "/" + sp.Scene.RegionInfo.RegionID.ToString() + "/release/"; | 348 | "/agent/" + sp.UUID.ToString() + "/" + sp.Scene.RegionInfo.RegionID.ToString() + "/release/"; |
347 | 349 | ||
348 | // Straight to the region. Safe. | 350 | UpdateAgent(reg, finalDestination, agent); |
349 | m_aScene.SimulationService.UpdateAgent(reg, agent); | ||
350 | 351 | ||
351 | m_log.DebugFormat( | 352 | m_log.DebugFormat( |
352 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); | 353 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); |
@@ -444,6 +445,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
444 | } | 445 | } |
445 | } | 446 | } |
446 | 447 | ||
448 | protected virtual bool CreateAgent(GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) | ||
449 | { | ||
450 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | ||
451 | } | ||
452 | |||
453 | protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent) | ||
454 | { | ||
455 | return m_aScene.SimulationService.UpdateAgent(reg, agent); | ||
456 | } | ||
457 | |||
447 | protected void KillEntity(Scene scene, uint localID) | 458 | protected void KillEntity(Scene scene, uint localID) |
448 | { | 459 | { |
449 | scene.SendKillObject(localID); | 460 | scene.SendKillObject(localID); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 5d88311..e5a862d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | 31 | ||
32 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
33 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenSim.Services.Connectors.Hypergrid; | 35 | using OpenSim.Services.Connectors.Hypergrid; |
@@ -58,6 +59,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
58 | } | 59 | } |
59 | } | 60 | } |
60 | 61 | ||
62 | private GatekeeperServiceConnector m_GatekeeperConnector; | ||
63 | |||
61 | #region ISharedRegionModule | 64 | #region ISharedRegionModule |
62 | 65 | ||
63 | public override string Name | 66 | public override string Name |
@@ -74,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
74 | if (name == Name) | 77 | if (name == Name) |
75 | { | 78 | { |
76 | m_agentsInTransit = new List<UUID>(); | 79 | m_agentsInTransit = new List<UUID>(); |
80 | m_GatekeeperConnector = new GatekeeperServiceConnector(); | ||
77 | m_Enabled = true; | 81 | m_Enabled = true; |
78 | m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | 82 | m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
79 | } | 83 | } |
@@ -131,6 +135,29 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
131 | return true; | 135 | return true; |
132 | } | 136 | } |
133 | 137 | ||
138 | protected override bool CreateAgent(GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) | ||
139 | { | ||
140 | reason = string.Empty; | ||
141 | if (reg.RegionLocX != finalDestination.RegionLocX && reg.RegionLocY != finalDestination.RegionLocY) | ||
142 | { | ||
143 | // this user is going to another grid | ||
144 | reg.RegionName = finalDestination.RegionName; | ||
145 | return m_GatekeeperConnector.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | ||
146 | } | ||
147 | |||
148 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | ||
149 | } | ||
150 | |||
151 | protected override bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent) | ||
152 | { | ||
153 | if (reg.RegionLocX != finalDestination.RegionLocX && reg.RegionLocY != finalDestination.RegionLocY) | ||
154 | { | ||
155 | // this user is going to another grid | ||
156 | return m_GatekeeperConnector.UpdateAgent(reg, agent); | ||
157 | } | ||
158 | |||
159 | return m_aScene.SimulationService.UpdateAgent(reg, agent); | ||
160 | } | ||
134 | 161 | ||
135 | #endregion | 162 | #endregion |
136 | } | 163 | } |
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 08a90a2..c61198d 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -66,6 +66,7 @@ | |||
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" /> \ |
69 | <RegionModule id="AuthenticationServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication.AuthenticationServiceInConnectorModule" /> | ||
69 | <RegionModule id="AccessModule" type="OpenSim.Region.CoreModules.World.AccessModule" /> \ | 70 | <RegionModule id="AccessModule" type="OpenSim.Region.CoreModules.World.AccessModule" /> \ |
70 | 71 | ||
71 | </Extension> | 72 | </Extension> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs new file mode 100644 index 0000000..02acddc --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using System.Collections.Generic; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Servers.HttpServer; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Server.Base; | ||
38 | using OpenSim.Server.Handlers.Base; | ||
39 | using OpenSim.Server.Handlers.Authentication; | ||
40 | using OpenSim.Services.Interfaces; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication | ||
43 | { | ||
44 | public class AuthenticationServiceInConnectorModule : ISharedRegionModule | ||
45 | { | ||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | private static bool m_Enabled = false; | ||
48 | |||
49 | private IConfigSource m_Config; | ||
50 | bool m_Registered = false; | ||
51 | |||
52 | #region IRegionModule interface | ||
53 | |||
54 | public void Initialise(IConfigSource config) | ||
55 | { | ||
56 | m_Config = config; | ||
57 | IConfig moduleConfig = config.Configs["Modules"]; | ||
58 | if (moduleConfig != null) | ||
59 | { | ||
60 | m_Enabled = moduleConfig.GetBoolean("AuthenticationServiceInConnector", false); | ||
61 | if (m_Enabled) | ||
62 | { | ||
63 | m_log.Info("[AUTHENTICATION IN CONNECTOR]: Authentication Service In Connector enabled"); | ||
64 | } | ||
65 | |||
66 | } | ||
67 | |||
68 | } | ||
69 | |||
70 | public void PostInitialise() | ||
71 | { | ||
72 | } | ||
73 | |||
74 | public void Close() | ||
75 | { | ||
76 | } | ||
77 | |||
78 | public Type ReplaceableInterface | ||
79 | { | ||
80 | get { return null; } | ||
81 | } | ||
82 | |||
83 | public string Name | ||
84 | { | ||
85 | get { return "AuthenticationServiceInConnectorModule"; } | ||
86 | } | ||
87 | |||
88 | public void AddRegion(Scene scene) | ||
89 | { | ||
90 | if (!m_Enabled) | ||
91 | return; | ||
92 | } | ||
93 | |||
94 | public void RemoveRegion(Scene scene) | ||
95 | { | ||
96 | if (!m_Enabled) | ||
97 | return; | ||
98 | } | ||
99 | |||
100 | public void RegionLoaded(Scene scene) | ||
101 | { | ||
102 | if (!m_Enabled) | ||
103 | return; | ||
104 | |||
105 | if (!m_Registered) | ||
106 | { | ||
107 | m_Registered = true; | ||
108 | |||
109 | m_log.Info("[AUTHENTICATION IN CONNECTOR]: Starting..."); | ||
110 | |||
111 | new AuthenticationServiceConnector(m_Config, MainServer.Instance, "AuthenticationService"); | ||
112 | } | ||
113 | |||
114 | } | ||
115 | |||
116 | #endregion | ||
117 | |||
118 | } | ||
119 | } | ||
diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs new file mode 100644 index 0000000..a56363c --- /dev/null +++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using System.Net; | ||
33 | using System.Text; | ||
34 | |||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Server.Handlers.Base; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Servers.HttpServer; | ||
41 | using OpenSim.Server.Handlers.Simulation; | ||
42 | using Utils = OpenSim.Server.Handlers.Simulation.Utils; | ||
43 | |||
44 | using OpenMetaverse; | ||
45 | using OpenMetaverse.StructuredData; | ||
46 | using Nini.Config; | ||
47 | using log4net; | ||
48 | |||
49 | |||
50 | namespace OpenSim.Server.Handlers.Hypergrid | ||
51 | { | ||
52 | public class AgentHandler : OpenSim.Server.Handlers.Simulation.AgentHandler | ||
53 | { | ||
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | private IGatekeeperService m_GatekeeperService; | ||
56 | |||
57 | public AgentHandler(IGatekeeperService gatekeeper) | ||
58 | { | ||
59 | m_GatekeeperService = gatekeeper; | ||
60 | } | ||
61 | |||
62 | protected override bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | ||
63 | { | ||
64 | return m_GatekeeperService.LoginAgent(aCircuit, destination, out reason); | ||
65 | } | ||
66 | |||
67 | protected override bool UpdateAgent(GridRegion destination, AgentData agent) | ||
68 | { | ||
69 | return m_GatekeeperService.UpdateAgent(destination, agent); | ||
70 | } | ||
71 | |||
72 | protected override void ReleaseAgent(UUID regionID, UUID id) | ||
73 | { | ||
74 | m_GatekeeperService.ReleaseAgent(regionID, id); | ||
75 | } | ||
76 | |||
77 | } | ||
78 | |||
79 | } | ||
diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs index f72b36c..27b793d 100644 --- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | |||
@@ -26,21 +26,16 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Reflection; | 30 | using System.Reflection; |
32 | using System.Net; | ||
33 | using Nini.Config; | 31 | using Nini.Config; |
34 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
35 | using OpenSim.Server.Base; | 33 | using OpenSim.Server.Base; |
36 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
37 | using OpenSim.Framework.Servers.HttpServer; | 35 | using OpenSim.Framework.Servers.HttpServer; |
38 | using OpenSim.Server.Handlers.Base; | 36 | using OpenSim.Server.Handlers.Base; |
39 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
40 | 37 | ||
41 | using OpenMetaverse; | ||
42 | using log4net; | 38 | using log4net; |
43 | using Nwc.XmlRpc; | ||
44 | 39 | ||
45 | namespace OpenSim.Server.Handlers.Hypergrid | 40 | namespace OpenSim.Server.Handlers.Hypergrid |
46 | { | 41 | { |
@@ -65,8 +60,13 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
65 | if (m_GatekeeperService == null) | 60 | if (m_GatekeeperService == null) |
66 | throw new Exception("Gatekeeper server connector cannot proceed because of missing service"); | 61 | throw new Exception("Gatekeeper server connector cannot proceed because of missing service"); |
67 | 62 | ||
68 | server.AddXmlRPCHandler("link_region", LinkRegionRequest, false); | 63 | HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService); |
69 | server.AddXmlRPCHandler("get_region", GetRegion, false); | 64 | server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); |
65 | server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); | ||
66 | |||
67 | server.AddHTTPHandler("/foreignagent/", new AgentHandler(m_GatekeeperService).Handler); | ||
68 | server.AddHTTPHandler("/foreignobject/", new ObjectHandler(m_GatekeeperService).Handler); | ||
69 | |||
70 | } | 70 | } |
71 | 71 | ||
72 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) | 72 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) |
@@ -74,65 +74,5 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
74 | { | 74 | { |
75 | } | 75 | } |
76 | 76 | ||
77 | /// <summary> | ||
78 | /// Someone wants to link to us | ||
79 | /// </summary> | ||
80 | /// <param name="request"></param> | ||
81 | /// <returns></returns> | ||
82 | public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient) | ||
83 | { | ||
84 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
85 | //string host = (string)requestData["host"]; | ||
86 | //string portstr = (string)requestData["port"]; | ||
87 | string name = (string)requestData["region_name"]; | ||
88 | |||
89 | UUID regionID = UUID.Zero; | ||
90 | string imageURL = string.Empty; | ||
91 | ulong regionHandle = 0; | ||
92 | string reason = string.Empty; | ||
93 | |||
94 | bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out imageURL, out reason); | ||
95 | |||
96 | Hashtable hash = new Hashtable(); | ||
97 | hash["result"] = success.ToString(); | ||
98 | hash["uuid"] = regionID.ToString(); | ||
99 | hash["handle"] = regionHandle.ToString(); | ||
100 | hash["region_image"] = imageURL; | ||
101 | |||
102 | XmlRpcResponse response = new XmlRpcResponse(); | ||
103 | response.Value = hash; | ||
104 | return response; | ||
105 | } | ||
106 | |||
107 | public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient) | ||
108 | { | ||
109 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
110 | //string host = (string)requestData["host"]; | ||
111 | //string portstr = (string)requestData["port"]; | ||
112 | string regionID_str = (string)requestData["region_uuid"]; | ||
113 | UUID regionID = UUID.Zero; | ||
114 | UUID.TryParse(regionID_str, out regionID); | ||
115 | |||
116 | GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID); | ||
117 | |||
118 | Hashtable hash = new Hashtable(); | ||
119 | if (regInfo == null) | ||
120 | hash["result"] = "false"; | ||
121 | else | ||
122 | { | ||
123 | hash["result"] = "true"; | ||
124 | hash["uuid"] = regInfo.RegionID.ToString(); | ||
125 | hash["x"] = regInfo.RegionLocX.ToString(); | ||
126 | hash["y"] = regInfo.RegionLocY.ToString(); | ||
127 | hash["region_name"] = regInfo.RegionName; | ||
128 | hash["hostname"] = regInfo.ExternalHostName; | ||
129 | hash["http_port"] = regInfo.HttpPort.ToString(); | ||
130 | hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); | ||
131 | } | ||
132 | XmlRpcResponse response = new XmlRpcResponse(); | ||
133 | response.Value = hash; | ||
134 | return response; | ||
135 | |||
136 | } | ||
137 | } | 77 | } |
138 | } | 78 | } |
diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs new file mode 100644 index 0000000..baafd7d --- /dev/null +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | |||
@@ -0,0 +1,115 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Net; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using OpenSim.Services.Interfaces; | ||
34 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
35 | |||
36 | using log4net; | ||
37 | using Nwc.XmlRpc; | ||
38 | using OpenMetaverse; | ||
39 | |||
40 | namespace OpenSim.Server.Handlers.Hypergrid | ||
41 | { | ||
42 | public class HypergridHandlers | ||
43 | { | ||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | private IGatekeeperService m_GatekeeperService; | ||
47 | |||
48 | public HypergridHandlers(IGatekeeperService gatekeeper) | ||
49 | { | ||
50 | m_GatekeeperService = gatekeeper; | ||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Someone wants to link to us | ||
55 | /// </summary> | ||
56 | /// <param name="request"></param> | ||
57 | /// <returns></returns> | ||
58 | public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient) | ||
59 | { | ||
60 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
61 | //string host = (string)requestData["host"]; | ||
62 | //string portstr = (string)requestData["port"]; | ||
63 | string name = (string)requestData["region_name"]; | ||
64 | |||
65 | UUID regionID = UUID.Zero; | ||
66 | string imageURL = string.Empty; | ||
67 | ulong regionHandle = 0; | ||
68 | string reason = string.Empty; | ||
69 | |||
70 | bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out imageURL, out reason); | ||
71 | |||
72 | Hashtable hash = new Hashtable(); | ||
73 | hash["result"] = success.ToString(); | ||
74 | hash["uuid"] = regionID.ToString(); | ||
75 | hash["handle"] = regionHandle.ToString(); | ||
76 | hash["region_image"] = imageURL; | ||
77 | |||
78 | XmlRpcResponse response = new XmlRpcResponse(); | ||
79 | response.Value = hash; | ||
80 | return response; | ||
81 | } | ||
82 | |||
83 | public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient) | ||
84 | { | ||
85 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
86 | //string host = (string)requestData["host"]; | ||
87 | //string portstr = (string)requestData["port"]; | ||
88 | string regionID_str = (string)requestData["region_uuid"]; | ||
89 | UUID regionID = UUID.Zero; | ||
90 | UUID.TryParse(regionID_str, out regionID); | ||
91 | |||
92 | GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID); | ||
93 | |||
94 | Hashtable hash = new Hashtable(); | ||
95 | if (regInfo == null) | ||
96 | hash["result"] = "false"; | ||
97 | else | ||
98 | { | ||
99 | hash["result"] = "true"; | ||
100 | hash["uuid"] = regInfo.RegionID.ToString(); | ||
101 | hash["x"] = regInfo.RegionLocX.ToString(); | ||
102 | hash["y"] = regInfo.RegionLocY.ToString(); | ||
103 | hash["region_name"] = regInfo.RegionName; | ||
104 | hash["hostname"] = regInfo.ExternalHostName; | ||
105 | hash["http_port"] = regInfo.HttpPort.ToString(); | ||
106 | hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); | ||
107 | } | ||
108 | XmlRpcResponse response = new XmlRpcResponse(); | ||
109 | response.Value = hash; | ||
110 | return response; | ||
111 | |||
112 | } | ||
113 | |||
114 | } | ||
115 | } | ||
diff --git a/OpenSim/Server/Handlers/Hypergrid/ObjectHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/ObjectHandlers.cs new file mode 100644 index 0000000..20eb375 --- /dev/null +++ b/OpenSim/Server/Handlers/Hypergrid/ObjectHandlers.cs | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using System.Net; | ||
33 | using System.Text; | ||
34 | |||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Server.Handlers.Base; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Servers.HttpServer; | ||
41 | using OpenSim.Server.Handlers.Simulation; | ||
42 | using Utils = OpenSim.Server.Handlers.Simulation.Utils; | ||
43 | |||
44 | using OpenMetaverse; | ||
45 | using OpenMetaverse.StructuredData; | ||
46 | using Nini.Config; | ||
47 | using log4net; | ||
48 | |||
49 | |||
50 | namespace OpenSim.Server.Handlers.Hypergrid | ||
51 | { | ||
52 | public class ObjectHandler : OpenSim.Server.Handlers.Simulation.ObjectHandler | ||
53 | { | ||
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | private IGatekeeperService m_GatekeeperService; | ||
56 | |||
57 | public ObjectHandler(IGatekeeperService gatekeeper) | ||
58 | { | ||
59 | m_GatekeeperService = gatekeeper; | ||
60 | } | ||
61 | |||
62 | protected override bool CreateObject(GridRegion destination, ISceneObject sog) | ||
63 | { | ||
64 | return m_GatekeeperService.LoginAttachment(destination, sog); | ||
65 | } | ||
66 | |||
67 | } | ||
68 | } \ No newline at end of file | ||
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 0c098d9..ab3250d 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -52,6 +52,8 @@ namespace OpenSim.Server.Handlers.Simulation | |||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | private ISimulationService m_SimulationService; | 53 | private ISimulationService m_SimulationService; |
54 | 54 | ||
55 | public AgentHandler() { } | ||
56 | |||
55 | public AgentHandler(ISimulationService sim) | 57 | public AgentHandler(ISimulationService sim) |
56 | { | 58 | { |
57 | m_SimulationService = sim; | 59 | m_SimulationService = sim; |
@@ -117,7 +119,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
117 | 119 | ||
118 | } | 120 | } |
119 | 121 | ||
120 | protected virtual void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) | 122 | protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) |
121 | { | 123 | { |
122 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 124 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |
123 | if (args == null) | 125 | if (args == null) |
@@ -171,7 +173,8 @@ namespace OpenSim.Server.Handlers.Simulation | |||
171 | 173 | ||
172 | // This is the meaning of POST agent | 174 | // This is the meaning of POST agent |
173 | //m_regionClient.AdjustUserInformation(aCircuit); | 175 | //m_regionClient.AdjustUserInformation(aCircuit); |
174 | bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); | 176 | //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); |
177 | bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason); | ||
175 | 178 | ||
176 | resp["reason"] = OSD.FromString(reason); | 179 | resp["reason"] = OSD.FromString(reason); |
177 | resp["success"] = OSD.FromBoolean(result); | 180 | resp["success"] = OSD.FromBoolean(result); |
@@ -181,7 +184,13 @@ namespace OpenSim.Server.Handlers.Simulation | |||
181 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); | 184 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); |
182 | } | 185 | } |
183 | 186 | ||
184 | protected virtual void DoAgentPut(Hashtable request, Hashtable responsedata) | 187 | // subclasses can override this |
188 | protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | ||
189 | { | ||
190 | return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); | ||
191 | } | ||
192 | |||
193 | protected void DoAgentPut(Hashtable request, Hashtable responsedata) | ||
185 | { | 194 | { |
186 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 195 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |
187 | if (args == null) | 196 | if (args == null) |
@@ -237,7 +246,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
237 | 246 | ||
238 | //agent.Dump(); | 247 | //agent.Dump(); |
239 | // This is one of the meanings of PUT agent | 248 | // This is one of the meanings of PUT agent |
240 | result = m_SimulationService.UpdateAgent(destination, agent); | 249 | result = UpdateAgent(destination, agent); |
241 | 250 | ||
242 | } | 251 | } |
243 | else if ("AgentPosition".Equals(messageType)) | 252 | else if ("AgentPosition".Equals(messageType)) |
@@ -263,6 +272,12 @@ namespace OpenSim.Server.Handlers.Simulation | |||
263 | //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead | 272 | //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead |
264 | } | 273 | } |
265 | 274 | ||
275 | // subclasses cab override this | ||
276 | protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) | ||
277 | { | ||
278 | return m_SimulationService.UpdateAgent(destination, agent); | ||
279 | } | ||
280 | |||
266 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) | 281 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) |
267 | { | 282 | { |
268 | GridRegion destination = new GridRegion(); | 283 | GridRegion destination = new GridRegion(); |
@@ -305,7 +320,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
305 | } | 320 | } |
306 | } | 321 | } |
307 | 322 | ||
308 | protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) | 323 | protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) |
309 | { | 324 | { |
310 | m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); | 325 | m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); |
311 | 326 | ||
@@ -313,7 +328,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
313 | destination.RegionID = regionID; | 328 | destination.RegionID = regionID; |
314 | 329 | ||
315 | if (action.Equals("release")) | 330 | if (action.Equals("release")) |
316 | m_SimulationService.ReleaseAgent(regionID, id, ""); | 331 | ReleaseAgent(regionID, id); |
317 | else | 332 | else |
318 | m_SimulationService.CloseAgent(destination, id); | 333 | m_SimulationService.CloseAgent(destination, id); |
319 | 334 | ||
@@ -322,6 +337,11 @@ namespace OpenSim.Server.Handlers.Simulation | |||
322 | 337 | ||
323 | m_log.Debug("[AGENT HANDLER]: Agent Released/Deleted."); | 338 | m_log.Debug("[AGENT HANDLER]: Agent Released/Deleted."); |
324 | } | 339 | } |
340 | |||
341 | protected virtual void ReleaseAgent(UUID regionID, UUID id) | ||
342 | { | ||
343 | m_SimulationService.ReleaseAgent(regionID, id, ""); | ||
344 | } | ||
325 | } | 345 | } |
326 | 346 | ||
327 | } | 347 | } |
diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs index b6eabe3..33e5aa6 100644 --- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs | |||
@@ -52,6 +52,8 @@ namespace OpenSim.Server.Handlers.Simulation | |||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | private ISimulationService m_SimulationService; | 53 | private ISimulationService m_SimulationService; |
54 | 54 | ||
55 | public ObjectHandler() { } | ||
56 | |||
55 | public ObjectHandler(ISimulationService sim) | 57 | public ObjectHandler(ISimulationService sim) |
56 | { | 58 | { |
57 | m_SimulationService = sim; | 59 | m_SimulationService = sim; |
@@ -110,7 +112,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
110 | 112 | ||
111 | } | 113 | } |
112 | 114 | ||
113 | protected virtual void DoObjectPost(Hashtable request, Hashtable responsedata, UUID regionID) | 115 | protected void DoObjectPost(Hashtable request, Hashtable responsedata, UUID regionID) |
114 | { | 116 | { |
115 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 117 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |
116 | if (args == null) | 118 | if (args == null) |
@@ -181,7 +183,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
181 | try | 183 | try |
182 | { | 184 | { |
183 | // This is the meaning of POST object | 185 | // This is the meaning of POST object |
184 | result = m_SimulationService.CreateObject(destination, sog, false); | 186 | result = CreateObject(destination, sog); |
185 | } | 187 | } |
186 | catch (Exception e) | 188 | catch (Exception e) |
187 | { | 189 | { |
@@ -192,6 +194,12 @@ namespace OpenSim.Server.Handlers.Simulation | |||
192 | responsedata["str_response_string"] = result.ToString(); | 194 | responsedata["str_response_string"] = result.ToString(); |
193 | } | 195 | } |
194 | 196 | ||
197 | // subclasses can override this | ||
198 | protected virtual bool CreateObject(GridRegion destination, ISceneObject sog) | ||
199 | { | ||
200 | return m_SimulationService.CreateObject(destination, sog, false); | ||
201 | } | ||
202 | |||
195 | protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID) | 203 | protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID) |
196 | { | 204 | { |
197 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 205 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index b1b2a30..683fe79 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -65,6 +65,11 @@ namespace OpenSim.Services.Connectors.Simulation | |||
65 | 65 | ||
66 | #region Agents | 66 | #region Agents |
67 | 67 | ||
68 | protected virtual string AgentPath() | ||
69 | { | ||
70 | return "/agent/"; | ||
71 | } | ||
72 | |||
68 | public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) | 73 | public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) |
69 | { | 74 | { |
70 | reason = String.Empty; | 75 | reason = String.Empty; |
@@ -80,7 +85,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
80 | string uri = string.Empty; | 85 | string uri = string.Empty; |
81 | try | 86 | try |
82 | { | 87 | { |
83 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + "/agent/" + aCircuit.AgentID + "/"; | 88 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; |
84 | } | 89 | } |
85 | catch (Exception e) | 90 | catch (Exception e) |
86 | { | 91 | { |
@@ -197,7 +202,8 @@ namespace OpenSim.Services.Connectors.Simulation | |||
197 | catch (WebException ex) | 202 | catch (WebException ex) |
198 | { | 203 | { |
199 | m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", ex.Message); | 204 | m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", ex.Message); |
200 | // ignore, really | 205 | reason = "Destination did not reply"; |
206 | return false; | ||
201 | } | 207 | } |
202 | finally | 208 | finally |
203 | { | 209 | { |
@@ -224,7 +230,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
224 | string uri = string.Empty; | 230 | string uri = string.Empty; |
225 | try | 231 | try |
226 | { | 232 | { |
227 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + "/agent/" + cAgentData.AgentID + "/"; | 233 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/"; |
228 | } | 234 | } |
229 | catch (Exception e) | 235 | catch (Exception e) |
230 | { | 236 | { |
@@ -329,7 +335,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
329 | { | 335 | { |
330 | agent = null; | 336 | agent = null; |
331 | // Eventually, we want to use a caps url instead of the agentID | 337 | // Eventually, we want to use a caps url instead of the agentID |
332 | string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + "/agent/" + id + "/" + destination.RegionID.ToString() + "/"; | 338 | string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; |
333 | //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); | 339 | //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); |
334 | 340 | ||
335 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); | 341 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); |
@@ -426,7 +432,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
426 | string uri = string.Empty; | 432 | string uri = string.Empty; |
427 | try | 433 | try |
428 | { | 434 | { |
429 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + "/agent/" + id + "/" + destination.RegionID.ToString() + "/"; | 435 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; |
430 | } | 436 | } |
431 | catch (Exception e) | 437 | catch (Exception e) |
432 | { | 438 | { |
@@ -474,10 +480,15 @@ namespace OpenSim.Services.Connectors.Simulation | |||
474 | 480 | ||
475 | #region Objects | 481 | #region Objects |
476 | 482 | ||
483 | protected virtual string ObjectPath() | ||
484 | { | ||
485 | return "/object/"; | ||
486 | } | ||
487 | |||
477 | public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) | 488 | public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) |
478 | { | 489 | { |
479 | string uri | 490 | string uri |
480 | = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + "/object/" + sog.UUID + "/"; | 491 | = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; |
481 | //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); | 492 | //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); |
482 | 493 | ||
483 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); | 494 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index a5bd881..416e443 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -164,57 +164,103 @@ namespace OpenSim.Services.HypergridService | |||
164 | return region; | 164 | return region; |
165 | } | 165 | } |
166 | 166 | ||
167 | public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination) | 167 | public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) |
168 | { | 168 | { |
169 | reason = string.Empty; | ||
170 | |||
169 | string authURL = string.Empty; | 171 | string authURL = string.Empty; |
170 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 172 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |
171 | authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | 173 | authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); |
172 | |||
173 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to login foreign agent {0} {1} @ {2} ({3}) at destination {4}", | 174 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to login foreign agent {0} {1} @ {2} ({3}) at destination {4}", |
174 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName); | 175 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName); |
175 | 176 | ||
176 | if (!Authenticate(aCircuit)) | 177 | if (!Authenticate(aCircuit)) |
177 | { | 178 | { |
179 | reason = "Unable to verify identity"; | ||
178 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Unable to verify identity of agent {0} {1}. Refusing service.", aCircuit.firstname, aCircuit.lastname); | 180 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Unable to verify identity of agent {0} {1}. Refusing service.", aCircuit.firstname, aCircuit.lastname); |
179 | return false; | 181 | return false; |
180 | } | 182 | } |
183 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Identity verified for {0} {1} @ {2}", aCircuit.firstname, aCircuit.lastname, authURL); | ||
181 | 184 | ||
182 | // Check to see if we have a local user with that UUID | 185 | // Check to see if we have a local user with that UUID |
183 | UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID); | 186 | UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID); |
184 | if (account != null) | 187 | if (account != null) |
185 | { | 188 | { |
186 | // No, sorry; go away | 189 | // No, sorry; go away |
190 | reason = "User identifier not allowed on this grid"; | ||
187 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has UUID of local user {3}. Refusing service.", | 191 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has UUID of local user {3}. Refusing service.", |
188 | aCircuit.firstname, aCircuit.lastname, aCircuit.AgentID); | 192 | aCircuit.firstname, aCircuit.lastname, aCircuit.AgentID); |
189 | return false; | 193 | return false; |
190 | } | 194 | } |
195 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User ID ok"); | ||
191 | 196 | ||
192 | // May want to authorize | 197 | // May want to authorize |
193 | 198 | ||
194 | // Login the presence | 199 | // Login the presence |
195 | if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) | 200 | if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) |
196 | { | 201 | { |
202 | reason = "Unable to login presence"; | ||
197 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.", | 203 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.", |
198 | aCircuit.firstname, aCircuit.lastname); | 204 | aCircuit.firstname, aCircuit.lastname); |
199 | return false; | 205 | return false; |
200 | } | 206 | } |
207 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); | ||
208 | |||
209 | // Get the region | ||
210 | destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); | ||
211 | if (destination == null) | ||
212 | { | ||
213 | reason = "Destination region not found"; | ||
214 | return false; | ||
215 | } | ||
216 | m_log.DebugFormat("[GATEKEEPER SERVICE]: destination ok : {0}", destination.RegionName); | ||
201 | 217 | ||
202 | // Finally launch the agent at the destination | 218 | // Finally launch the agent at the destination |
203 | string reason = string.Empty; | ||
204 | aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname; | 219 | aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname; |
205 | aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString(); | 220 | aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString(); |
206 | return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason); | 221 | return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason); |
207 | } | 222 | } |
208 | 223 | ||
209 | public bool LoginAttachments(ISceneObject sog, GridRegion destination) | 224 | public bool UpdateAgent(GridRegion destination, AgentData agent) |
225 | { | ||
226 | // Get the region | ||
227 | destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); | ||
228 | if (destination == null) | ||
229 | { | ||
230 | return false; | ||
231 | } | ||
232 | |||
233 | return m_SimulationService.UpdateAgent(destination, agent); | ||
234 | } | ||
235 | |||
236 | public bool LoginAttachment(GridRegion destination, ISceneObject sog) | ||
210 | { | 237 | { |
238 | // Get the region | ||
239 | destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); | ||
240 | if (destination == null) | ||
241 | { | ||
242 | return false; | ||
243 | } | ||
244 | |||
211 | // May want to filter attachments | 245 | // May want to filter attachments |
212 | return m_SimulationService.CreateObject(destination, sog, false); | 246 | return m_SimulationService.CreateObject(destination, sog, false); |
213 | } | 247 | } |
214 | 248 | ||
249 | public void ReleaseAgent(UUID regionID, UUID agentID) | ||
250 | { | ||
251 | GridRegion region = m_GridService.GetRegionByUUID(m_ScopeID, regionID); | ||
252 | if (region != null) | ||
253 | { | ||
254 | string uri = "http://" + region.ExternalHostName + ":" + region.HttpPort + | ||
255 | "/agent/" + agentID.ToString() + "/" + regionID.ToString() + "/release/"; | ||
256 | |||
257 | m_SimulationService.ReleaseAgent(regionID, agentID, uri); | ||
258 | } | ||
259 | } | ||
260 | |||
215 | protected bool Authenticate(AgentCircuitData aCircuit) | 261 | protected bool Authenticate(AgentCircuitData aCircuit) |
216 | { | 262 | { |
217 | string authURL = string.Empty; | 263 | string authURL = string.Empty; |
218 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 264 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |
219 | authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | 265 | authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); |
220 | 266 | ||
@@ -227,7 +273,17 @@ namespace OpenSim.Services.HypergridService | |||
227 | Object[] args = new Object[] { authURL }; | 273 | Object[] args = new Object[] { authURL }; |
228 | IAuthenticationService authService = ServerUtils.LoadPlugin<IAuthenticationService>(m_AuthDll, args); | 274 | IAuthenticationService authService = ServerUtils.LoadPlugin<IAuthenticationService>(m_AuthDll, args); |
229 | if (authService != null) | 275 | if (authService != null) |
230 | return authService.Verify(aCircuit.AgentID, aCircuit.SecureSessionID.ToString(), 30); | 276 | { |
277 | try | ||
278 | { | ||
279 | return authService.Verify(aCircuit.AgentID, aCircuit.SecureSessionID.ToString(), 30); | ||
280 | } | ||
281 | catch | ||
282 | { | ||
283 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", authURL); | ||
284 | return false; | ||
285 | } | ||
286 | } | ||
231 | 287 | ||
232 | return false; | 288 | return false; |
233 | } | 289 | } |
diff --git a/OpenSim/Services/Interfaces/IGatekeeperService.cs b/OpenSim/Services/Interfaces/IGatekeeperService.cs index 9904e20..5e21804 100644 --- a/OpenSim/Services/Interfaces/IGatekeeperService.cs +++ b/OpenSim/Services/Interfaces/IGatekeeperService.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | 30 | ||
31 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | 33 | ||
33 | namespace OpenSim.Services.Interfaces | 34 | namespace OpenSim.Services.Interfaces |
@@ -36,5 +37,11 @@ namespace OpenSim.Services.Interfaces | |||
36 | { | 37 | { |
37 | bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason); | 38 | bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason); |
38 | GridRegion GetHyperlinkRegion(UUID regionID); | 39 | GridRegion GetHyperlinkRegion(UUID regionID); |
40 | |||
41 | bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason); | ||
42 | bool UpdateAgent(GridRegion destination, AgentData agent); | ||
43 | void ReleaseAgent(UUID regionID, UUID agentID); | ||
44 | |||
45 | bool LoginAttachment(GridRegion destination, ISceneObject sog); | ||
39 | } | 46 | } |
40 | } | 47 | } |
diff --git a/OpenSim/Services/Interfaces/IHypergridService.cs b/OpenSim/Services/Interfaces/IHypergridService.cs index f2a1983..dd3c053 100644 --- a/OpenSim/Services/Interfaces/IHypergridService.cs +++ b/OpenSim/Services/Interfaces/IHypergridService.cs | |||
@@ -44,4 +44,5 @@ namespace OpenSim.Services.Interfaces | |||
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 | } |