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/Server/Handlers/Hypergrid | |
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 'OpenSim/Server/Handlers/Hypergrid')
4 files changed, 269 insertions, 67 deletions
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 | ||