aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Server/Handlers')
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs16
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeUsersSecurityServerConnector.cs122
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs67
3 files changed, 202 insertions, 3 deletions
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 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Net;
5using System.Reflection;
6
7using Nini.Config;
8using OpenSim.Framework;
9using OpenSim.Server.Base;
10using OpenSim.Services.Interfaces;
11using OpenSim.Framework.Servers.HttpServer;
12using OpenSim.Server.Handlers.Base;
13
14using log4net;
15using Nwc.XmlRpc;
16using OpenMetaverse;
17
18namespace 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}