mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
HG 1.5 is in place. Tested in standalone only.
This commit is contained in:
@@ -49,12 +49,12 @@ using log4net;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Hypergrid
|
||||
{
|
||||
public class AgentHandler : OpenSim.Server.Handlers.Simulation.AgentHandler
|
||||
public class GatekeeperAgentHandler : OpenSim.Server.Handlers.Simulation.AgentHandler
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private IGatekeeperService m_GatekeeperService;
|
||||
|
||||
public AgentHandler(IGatekeeperService gatekeeper)
|
||||
public GatekeeperAgentHandler(IGatekeeperService gatekeeper)
|
||||
{
|
||||
m_GatekeeperService = gatekeeper;
|
||||
}
|
||||
|
||||
@@ -68,9 +68,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService);
|
||||
server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false);
|
||||
server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false);
|
||||
server.AddXmlRPCHandler("get_home_region", hghandlers.GetHomeRegion, false);
|
||||
|
||||
server.AddHTTPHandler("/foreignagent/", new AgentHandler(m_GatekeeperService).Handler);
|
||||
server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService).Handler);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
using log4net;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Hypergrid
|
||||
{
|
||||
public class HomeUsersSecurityServerConnector : ServiceConnector
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IHomeUsersSecurityService m_HomeUsersService;
|
||||
|
||||
public HomeUsersSecurityServerConnector(IConfigSource config, IHttpServer server) :
|
||||
base(config, server, String.Empty)
|
||||
{
|
||||
IConfig gridConfig = config.Configs["HomeUsersSecurityService"];
|
||||
if (gridConfig != null)
|
||||
{
|
||||
string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty);
|
||||
Object[] args = new Object[] { config };
|
||||
m_HomeUsersService = ServerUtils.LoadPlugin<IHomeUsersSecurityService>(serviceDll, args);
|
||||
}
|
||||
if (m_HomeUsersService == null)
|
||||
throw new Exception("HomeUsersSecurity server connector cannot proceed because of missing service");
|
||||
|
||||
server.AddXmlRPCHandler("ep_get", GetEndPoint, false);
|
||||
server.AddXmlRPCHandler("ep_set", SetEndPoint, false);
|
||||
server.AddXmlRPCHandler("ep_remove", RemoveEndPoint, false);
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse GetEndPoint(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
//string host = (string)requestData["host"];
|
||||
//string portstr = (string)requestData["port"];
|
||||
string sessionID_str = (string)requestData["sessionID"];
|
||||
UUID sessionID = UUID.Zero;
|
||||
UUID.TryParse(sessionID_str, out sessionID);
|
||||
|
||||
IPEndPoint ep = m_HomeUsersService.GetEndPoint(sessionID);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
if (ep == null)
|
||||
hash["result"] = "false";
|
||||
else
|
||||
{
|
||||
hash["result"] = "true";
|
||||
hash["ep_addr"] = ep.Address.ToString();
|
||||
hash["ep_port"] = ep.Port.ToString();
|
||||
}
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse SetEndPoint(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
string host = (string)requestData["ep_addr"];
|
||||
string portstr = (string)requestData["ep_port"];
|
||||
string sessionID_str = (string)requestData["sessionID"];
|
||||
UUID sessionID = UUID.Zero;
|
||||
UUID.TryParse(sessionID_str, out sessionID);
|
||||
int port = 0;
|
||||
Int32.TryParse(portstr, out port);
|
||||
|
||||
IPEndPoint ep = null;
|
||||
try
|
||||
{
|
||||
ep = new IPEndPoint(IPAddress.Parse(host), port);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.Debug("[HOME USERS SECURITY]: Exception in creating EndPoint");
|
||||
}
|
||||
|
||||
m_HomeUsersService.SetEndPoint(sessionID, ep);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["result"] = "true";
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse RemoveEndPoint(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
string sessionID_str = (string)requestData["sessionID"];
|
||||
UUID sessionID = UUID.Zero;
|
||||
UUID.TryParse(sessionID_str, out sessionID);
|
||||
|
||||
m_HomeUsersService.RemoveEndPoint(sessionID);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["result"] = "true";
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -113,38 +113,5 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
//string host = (string)requestData["host"];
|
||||
//string portstr = (string)requestData["port"];
|
||||
string userID_str = (string)requestData["userID"];
|
||||
UUID userID = UUID.Zero;
|
||||
UUID.TryParse(userID_str, out userID);
|
||||
|
||||
Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY;
|
||||
GridRegion regInfo = m_GatekeeperService.GetHomeRegion(userID, out position, out lookAt);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
if (regInfo == null)
|
||||
hash["result"] = "false";
|
||||
else
|
||||
{
|
||||
hash["result"] = "true";
|
||||
hash["uuid"] = regInfo.RegionID.ToString();
|
||||
hash["x"] = regInfo.RegionLocX.ToString();
|
||||
hash["y"] = regInfo.RegionLocY.ToString();
|
||||
hash["region_name"] = regInfo.RegionName;
|
||||
hash["hostname"] = regInfo.ExternalHostName;
|
||||
hash["http_port"] = regInfo.HttpPort.ToString();
|
||||
hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
|
||||
hash["position"] = position.ToString();
|
||||
hash["lookAt"] = lookAt.ToString();
|
||||
}
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
168
OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
Normal file
168
OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
Normal file
@@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
using log4net;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Hypergrid
|
||||
{
|
||||
public class UserAgentServerConnector : ServiceConnector
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IUserAgentService m_HomeUsersService;
|
||||
|
||||
public UserAgentServerConnector(IConfigSource config, IHttpServer server) :
|
||||
base(config, server, String.Empty)
|
||||
{
|
||||
IConfig gridConfig = config.Configs["UserAgentService"];
|
||||
if (gridConfig != null)
|
||||
{
|
||||
string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty);
|
||||
Object[] args = new Object[] { config };
|
||||
m_HomeUsersService = ServerUtils.LoadPlugin<IUserAgentService>(serviceDll, args);
|
||||
}
|
||||
if (m_HomeUsersService == null)
|
||||
throw new Exception("UserAgent server connector cannot proceed because of missing service");
|
||||
|
||||
server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false);
|
||||
server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false);
|
||||
server.AddXmlRPCHandler("verify_agent", VerifyAgent, false);
|
||||
server.AddXmlRPCHandler("verify_client", VerifyClient, false);
|
||||
server.AddXmlRPCHandler("logout_agent", LogoutAgent, false);
|
||||
|
||||
server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService).Handler);
|
||||
}
|
||||
|
||||
public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
//string host = (string)requestData["host"];
|
||||
//string portstr = (string)requestData["port"];
|
||||
string userID_str = (string)requestData["userID"];
|
||||
UUID userID = UUID.Zero;
|
||||
UUID.TryParse(userID_str, out userID);
|
||||
|
||||
Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY;
|
||||
GridRegion regInfo = m_HomeUsersService.GetHomeRegion(userID, out position, out lookAt);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
if (regInfo == null)
|
||||
hash["result"] = "false";
|
||||
else
|
||||
{
|
||||
hash["result"] = "true";
|
||||
hash["uuid"] = regInfo.RegionID.ToString();
|
||||
hash["x"] = regInfo.RegionLocX.ToString();
|
||||
hash["y"] = regInfo.RegionLocY.ToString();
|
||||
hash["region_name"] = regInfo.RegionName;
|
||||
hash["hostname"] = regInfo.ExternalHostName;
|
||||
hash["http_port"] = regInfo.HttpPort.ToString();
|
||||
hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
|
||||
hash["position"] = position.ToString();
|
||||
hash["lookAt"] = lookAt.ToString();
|
||||
}
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse AgentIsComingHome(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
//string host = (string)requestData["host"];
|
||||
//string portstr = (string)requestData["port"];
|
||||
string sessionID_str = (string)requestData["sessionID"];
|
||||
UUID sessionID = UUID.Zero;
|
||||
UUID.TryParse(sessionID_str, out sessionID);
|
||||
string gridName = (string)requestData["externalName"];
|
||||
|
||||
bool success = m_HomeUsersService.AgentIsComingHome(sessionID, gridName);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["result"] = success.ToString();
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse VerifyAgent(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
//string host = (string)requestData["host"];
|
||||
//string portstr = (string)requestData["port"];
|
||||
string sessionID_str = (string)requestData["sessionID"];
|
||||
UUID sessionID = UUID.Zero;
|
||||
UUID.TryParse(sessionID_str, out sessionID);
|
||||
string token = (string)requestData["token"];
|
||||
|
||||
bool success = m_HomeUsersService.VerifyAgent(sessionID, token);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["result"] = success.ToString();
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse VerifyClient(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
//string host = (string)requestData["host"];
|
||||
//string portstr = (string)requestData["port"];
|
||||
string sessionID_str = (string)requestData["sessionID"];
|
||||
UUID sessionID = UUID.Zero;
|
||||
UUID.TryParse(sessionID_str, out sessionID);
|
||||
string token = (string)requestData["token"];
|
||||
|
||||
bool success = m_HomeUsersService.VerifyClient(sessionID, token);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["result"] = success.ToString();
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse LogoutAgent(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
//string host = (string)requestData["host"];
|
||||
//string portstr = (string)requestData["port"];
|
||||
string sessionID_str = (string)requestData["sessionID"];
|
||||
UUID sessionID = UUID.Zero;
|
||||
UUID.TryParse(sessionID_str, out sessionID);
|
||||
string userID_str = (string)requestData["userID"];
|
||||
UUID userID = UUID.Zero;
|
||||
UUID.TryParse(userID_str, out userID);
|
||||
|
||||
m_HomeUsersService.LogoutAgent(userID, sessionID);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["result"] = "true";
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user