aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
authorDiva Canto2010-01-28 19:19:42 -0800
committerDiva Canto2010-01-28 19:19:42 -0800
commit00f7d622cbc2c2e61d2efaacd8275da3f9821d8b (patch)
tree1bfc6dd3ac2a93443bc75baa03ceefba4cfacc1e /OpenSim/Server
parentAdded ExternalName config on Gatekeeper. (diff)
downloadopensim-SC_OLD-00f7d622cbc2c2e61d2efaacd8275da3f9821d8b.zip
opensim-SC_OLD-00f7d622cbc2c2e61d2efaacd8275da3f9821d8b.tar.gz
opensim-SC_OLD-00f7d622cbc2c2e61d2efaacd8275da3f9821d8b.tar.bz2
opensim-SC_OLD-00f7d622cbc2c2e61d2efaacd8275da3f9821d8b.tar.xz
HG 1.5 is in place. Tested in standalone only.
Diffstat (limited to 'OpenSim/Server')
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs4
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs3
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeUsersSecurityServerConnector.cs122
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs33
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs168
5 files changed, 171 insertions, 159 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
index 01e368c..c951653 100644
--- a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs
@@ -49,12 +49,12 @@ using log4net;
49 49
50namespace OpenSim.Server.Handlers.Hypergrid 50namespace OpenSim.Server.Handlers.Hypergrid
51{ 51{
52 public class AgentHandler : OpenSim.Server.Handlers.Simulation.AgentHandler 52 public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentHandler
53 { 53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private IGatekeeperService m_GatekeeperService; 55 private IGatekeeperService m_GatekeeperService;
56 56
57 public AgentHandler(IGatekeeperService gatekeeper) 57 public GatekeeperAgentHandler(IGatekeeperService gatekeeper)
58 { 58 {
59 m_GatekeeperService = gatekeeper; 59 m_GatekeeperService = gatekeeper;
60 } 60 }
diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs
index c73b110..f2d9321 100644
--- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs
@@ -68,9 +68,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
68 HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService); 68 HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService);
69 server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); 69 server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false);
70 server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); 70 server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false);
71 server.AddXmlRPCHandler("get_home_region", hghandlers.GetHomeRegion, false);
72 71
73 server.AddHTTPHandler("/foreignagent/", new AgentHandler(m_GatekeeperService).Handler); 72 server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService).Handler);
74 73
75 } 74 }
76 75
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeUsersSecurityServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HomeUsersSecurityServerConnector.cs
deleted file mode 100644
index 5379784..0000000
--- a/OpenSim/Server/Handlers/Hypergrid/HomeUsersSecurityServerConnector.cs
+++ /dev/null
@@ -1,122 +0,0 @@
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 7d31730..0b65245 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs
@@ -113,38 +113,5 @@ namespace OpenSim.Server.Handlers.Hypergrid
113 113
114 } 114 }
115 115
116 public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient)
117 {
118 Hashtable requestData = (Hashtable)request.Params[0];
119 //string host = (string)requestData["host"];
120 //string portstr = (string)requestData["port"];
121 string userID_str = (string)requestData["userID"];
122 UUID userID = UUID.Zero;
123 UUID.TryParse(userID_str, out userID);
124
125 Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY;
126 GridRegion regInfo = m_GatekeeperService.GetHomeRegion(userID, out position, out lookAt);
127
128 Hashtable hash = new Hashtable();
129 if (regInfo == null)
130 hash["result"] = "false";
131 else
132 {
133 hash["result"] = "true";
134 hash["uuid"] = regInfo.RegionID.ToString();
135 hash["x"] = regInfo.RegionLocX.ToString();
136 hash["y"] = regInfo.RegionLocY.ToString();
137 hash["region_name"] = regInfo.RegionName;
138 hash["hostname"] = regInfo.ExternalHostName;
139 hash["http_port"] = regInfo.HttpPort.ToString();
140 hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
141 hash["position"] = position.ToString();
142 hash["lookAt"] = lookAt.ToString();
143 }
144 XmlRpcResponse response = new XmlRpcResponse();
145 response.Value = hash;
146 return response;
147
148 }
149 } 116 }
150} 117}
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
new file mode 100644
index 0000000..79c6b2a
--- /dev/null
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -0,0 +1,168 @@
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;
13using GridRegion = OpenSim.Services.Interfaces.GridRegion;
14
15using log4net;
16using Nwc.XmlRpc;
17using OpenMetaverse;
18
19namespace OpenSim.Server.Handlers.Hypergrid
20{
21 public class UserAgentServerConnector : ServiceConnector
22 {
23 private static readonly ILog m_log =
24 LogManager.GetLogger(
25 MethodBase.GetCurrentMethod().DeclaringType);
26
27 private IUserAgentService m_HomeUsersService;
28
29 public UserAgentServerConnector(IConfigSource config, IHttpServer server) :
30 base(config, server, String.Empty)
31 {
32 IConfig gridConfig = config.Configs["UserAgentService"];
33 if (gridConfig != null)
34 {
35 string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty);
36 Object[] args = new Object[] { config };
37 m_HomeUsersService = ServerUtils.LoadPlugin<IUserAgentService>(serviceDll, args);
38 }
39 if (m_HomeUsersService == null)
40 throw new Exception("UserAgent server connector cannot proceed because of missing service");
41
42 server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false);
43 server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false);
44 server.AddXmlRPCHandler("verify_agent", VerifyAgent, false);
45 server.AddXmlRPCHandler("verify_client", VerifyClient, false);
46 server.AddXmlRPCHandler("logout_agent", LogoutAgent, false);
47
48 server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService).Handler);
49 }
50
51 public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient)
52 {
53 Hashtable requestData = (Hashtable)request.Params[0];
54 //string host = (string)requestData["host"];
55 //string portstr = (string)requestData["port"];
56 string userID_str = (string)requestData["userID"];
57 UUID userID = UUID.Zero;
58 UUID.TryParse(userID_str, out userID);
59
60 Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY;
61 GridRegion regInfo = m_HomeUsersService.GetHomeRegion(userID, out position, out lookAt);
62
63 Hashtable hash = new Hashtable();
64 if (regInfo == null)
65 hash["result"] = "false";
66 else
67 {
68 hash["result"] = "true";
69 hash["uuid"] = regInfo.RegionID.ToString();
70 hash["x"] = regInfo.RegionLocX.ToString();
71 hash["y"] = regInfo.RegionLocY.ToString();
72 hash["region_name"] = regInfo.RegionName;
73 hash["hostname"] = regInfo.ExternalHostName;
74 hash["http_port"] = regInfo.HttpPort.ToString();
75 hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
76 hash["position"] = position.ToString();
77 hash["lookAt"] = lookAt.ToString();
78 }
79 XmlRpcResponse response = new XmlRpcResponse();
80 response.Value = hash;
81 return response;
82
83 }
84
85 public XmlRpcResponse AgentIsComingHome(XmlRpcRequest request, IPEndPoint remoteClient)
86 {
87 Hashtable requestData = (Hashtable)request.Params[0];
88 //string host = (string)requestData["host"];
89 //string portstr = (string)requestData["port"];
90 string sessionID_str = (string)requestData["sessionID"];
91 UUID sessionID = UUID.Zero;
92 UUID.TryParse(sessionID_str, out sessionID);
93 string gridName = (string)requestData["externalName"];
94
95 bool success = m_HomeUsersService.AgentIsComingHome(sessionID, gridName);
96
97 Hashtable hash = new Hashtable();
98 hash["result"] = success.ToString();
99 XmlRpcResponse response = new XmlRpcResponse();
100 response.Value = hash;
101 return response;
102
103 }
104
105 public XmlRpcResponse VerifyAgent(XmlRpcRequest request, IPEndPoint remoteClient)
106 {
107 Hashtable requestData = (Hashtable)request.Params[0];
108 //string host = (string)requestData["host"];
109 //string portstr = (string)requestData["port"];
110 string sessionID_str = (string)requestData["sessionID"];
111 UUID sessionID = UUID.Zero;
112 UUID.TryParse(sessionID_str, out sessionID);
113 string token = (string)requestData["token"];
114
115 bool success = m_HomeUsersService.VerifyAgent(sessionID, token);
116
117 Hashtable hash = new Hashtable();
118 hash["result"] = success.ToString();
119 XmlRpcResponse response = new XmlRpcResponse();
120 response.Value = hash;
121 return response;
122
123 }
124
125 public XmlRpcResponse VerifyClient(XmlRpcRequest request, IPEndPoint remoteClient)
126 {
127 Hashtable requestData = (Hashtable)request.Params[0];
128 //string host = (string)requestData["host"];
129 //string portstr = (string)requestData["port"];
130 string sessionID_str = (string)requestData["sessionID"];
131 UUID sessionID = UUID.Zero;
132 UUID.TryParse(sessionID_str, out sessionID);
133 string token = (string)requestData["token"];
134
135 bool success = m_HomeUsersService.VerifyClient(sessionID, token);
136
137 Hashtable hash = new Hashtable();
138 hash["result"] = success.ToString();
139 XmlRpcResponse response = new XmlRpcResponse();
140 response.Value = hash;
141 return response;
142
143 }
144
145 public XmlRpcResponse LogoutAgent(XmlRpcRequest request, IPEndPoint remoteClient)
146 {
147 Hashtable requestData = (Hashtable)request.Params[0];
148 //string host = (string)requestData["host"];
149 //string portstr = (string)requestData["port"];
150 string sessionID_str = (string)requestData["sessionID"];
151 UUID sessionID = UUID.Zero;
152 UUID.TryParse(sessionID_str, out sessionID);
153 string userID_str = (string)requestData["userID"];
154 UUID userID = UUID.Zero;
155 UUID.TryParse(userID_str, out userID);
156
157 m_HomeUsersService.LogoutAgent(userID, sessionID);
158
159 Hashtable hash = new Hashtable();
160 hash["result"] = "true";
161 XmlRpcResponse response = new XmlRpcResponse();
162 response.Value = hash;
163 return response;
164
165 }
166
167 }
168}