From 1955b797598d61548521c444ea8d3721fd5435ba Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 19 Aug 2010 18:55:30 -0700 Subject: Partial rewrite of client IP verification. Not completely finished yet, and untested. Committing to move to my other computer. --- .../Hypergrid/GatekeeperServiceConnector.cs | 44 ++++++++++++++++++++++ .../Hypergrid/UserAgentServiceConnector.cs | 7 ++++ 2 files changed, 51 insertions(+) (limited to 'OpenSim/Services/Connectors/Hypergrid') diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index c426bba..291dd73 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -38,6 +38,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenMetaverse; using OpenMetaverse.Imaging; +using OpenMetaverse.StructuredData; using Nwc.XmlRpc; using log4net; @@ -268,5 +269,48 @@ namespace OpenSim.Services.Connectors.Hypergrid return null; } + public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason) + { + HttpWebRequest AgentCreateRequest = null; + myipaddress = String.Empty; + reason = String.Empty; + + if (SendRequest(destination, aCircuit, flags, out reason, out AgentCreateRequest)) + { + string response = GetResponse(AgentCreateRequest, out reason); + bool success = true; + UnpackResponse(response, out success, out reason, out myipaddress); + return success; + } + + return false; + } + + protected void UnpackResponse(string response, out bool result, out string reason, out string ipaddress) + { + result = true; + reason = string.Empty; + ipaddress = string.Empty; + + if (!String.IsNullOrEmpty(response)) + { + try + { + // we assume we got an OSDMap back + OSDMap r = Util.GetOSDMap(response); + result = r["success"].AsBoolean(); + reason = r["reason"].AsString(); + ipaddress = r["your_ip"].AsString(); + } + catch (NullReferenceException e) + { + m_log.InfoFormat("[GATEKEEPER SERVICE CONNECTOR]: exception on UnpackResponse of DoCreateChildAgentCall {0}", e.Message); + reason = "Internal error"; + result = false; + } + } + } + + } } diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 69dff3c..c1e5949 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -73,6 +73,13 @@ namespace OpenSim.Services.Connectors.Hypergrid { } + public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason) + { + // not available over remote calls + reason = "Method not available over remote calls"; + return false; + } + public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) { reason = String.Empty; -- cgit v1.1