diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | 74 |
1 files changed, 7 insertions, 67 deletions
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 | } |