aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs')
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs74
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
28using System; 28using System;
29using System.Collections;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Reflection; 30using System.Reflection;
32using System.Net;
33using Nini.Config; 31using Nini.Config;
34using OpenSim.Framework; 32using OpenSim.Framework;
35using OpenSim.Server.Base; 33using OpenSim.Server.Base;
36using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
37using OpenSim.Framework.Servers.HttpServer; 35using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Server.Handlers.Base; 36using OpenSim.Server.Handlers.Base;
39using GridRegion = OpenSim.Services.Interfaces.GridRegion;
40 37
41using OpenMetaverse;
42using log4net; 38using log4net;
43using Nwc.XmlRpc;
44 39
45namespace OpenSim.Server.Handlers.Hypergrid 40namespace 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}