From d6e571517f1a4cefbf51ec0bc6410e7c13c3d795 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 23 Feb 2008 03:36:50 +0000 Subject: [PATCH] * Rex merge, OGS1 Merged fairly cleanly. --- .../Communications/OGS1/CommunicationsOGS1.cs | 98 +- .../Communications/OGS1/OGS1GridServices.cs | 2466 +++++++++-------- .../Communications/OGS1/OGS1InterSimComms.cs | 481 ++-- .../OGS1/OGS1InventoryService.cs | 399 +-- .../Communications/OGS1/OGS1UserServices.cs | 1036 +++---- .../OGS1/Properties/AssemblyInfo.cs | 104 +- 6 files changed, 2489 insertions(+), 2095 deletions(-) diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index 0568a15fb9..a0d806bfd0 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -1,49 +1,49 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Servers; - -namespace OpenSim.Region.Communications.OGS1 -{ - public class CommunicationsOGS1 : CommunicationsManager - { - public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache) - : base(serversInfo, httpServer, assetCache, false) - { - OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); - m_gridService = gridInterComms; - m_interRegion = gridInterComms; - - m_inventoryService = new OGS1InventoryService(serversInfo.InventoryURL); - m_userService = new OGS1UserServices(this); - } - } -} \ No newline at end of file +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Communications.Cache; +using OpenSim.Framework.Servers; + +namespace OpenSim.Region.Communications.OGS1 +{ + public class CommunicationsOGS1 : CommunicationsManager + { + public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache) + : base(serversInfo, httpServer, assetCache, false) + { + OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); + m_gridService = gridInterComms; + m_interRegion = gridInterComms; + + m_inventoryService = new OGS1InventoryService(serversInfo.InventoryURL); + m_userService = new OGS1UserServices(this); + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 4c0059af82..22acc4a47c 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -1,1096 +1,1370 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Net; -using System.Net.Sockets; -using System.Runtime.Remoting; -using System.Runtime.Remoting.Channels; -using System.Runtime.Remoting.Channels.Tcp; -using System.Security.Authentication; -using libsecondlife; -using Nwc.XmlRpc; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; -using OpenSim.Region.Communications.Local; - -namespace OpenSim.Region.Communications.OGS1 -{ - public class OGS1GridServices : IGridServices, IInterRegionCommunications - { - private LocalBackEndServices m_localBackend = new LocalBackEndServices(); - private Dictionary m_remoteRegionInfoCache = new Dictionary(); - private List m_knownRegions = new List(); - private Dictionary m_queuedGridSettings = new Dictionary(); - - public BaseHttpServer httpListener; - public NetworkServersInfo serversInfo; - public BaseHttpServer httpServer; - public string _gdebugRegionName = ""; - - public string gdebugRegionName - { - get { return _gdebugRegionName; } - set { _gdebugRegionName = value; } - } - - public string _rdebugRegionName = ""; - - public string rdebugRegionName - { - get { return _rdebugRegionName; } - set { _rdebugRegionName = value; } - } - - /// - /// - /// - /// - /// - public OGS1GridServices(NetworkServersInfo servers_info, BaseHttpServer httpServe) - { - serversInfo = servers_info; - httpServer = httpServe; - //Respond to Grid Services requests - httpServer.AddXmlRPCHandler("expect_user", ExpectUser); - httpServer.AddXmlRPCHandler("check", PingCheckReply); - - StartRemoting(); - } - - /// - /// - /// - /// - /// - public RegionCommsListener RegisterRegion(RegionInfo regionInfo) - { - Hashtable GridParams = new Hashtable(); - // Login / Authentication - - GridParams["authkey"] = serversInfo.GridSendKey; - GridParams["UUID"] = regionInfo.RegionID.ToString(); - GridParams["sim_ip"] = regionInfo.ExternalHostName; - GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); - GridParams["region_locx"] = regionInfo.RegionLocX.ToString(); - GridParams["region_locy"] = regionInfo.RegionLocY.ToString(); - GridParams["sim_name"] = regionInfo.RegionName; - GridParams["http_port"] = serversInfo.HttpListenerPort.ToString(); - GridParams["remoting_port"] = NetworkServersInfo.RemotingListenerPort.ToString(); - GridParams["map-image-id"] = regionInfo.EstateSettings.terrainImageID.ToString(); - - // Package into an XMLRPC Request - ArrayList SendParams = new ArrayList(); - SendParams.Add(GridParams); - - // Send Request - XmlRpcRequest GridReq; - XmlRpcResponse GridResp; - try - { - GridReq = new XmlRpcRequest("simulator_login", SendParams); - GridResp = GridReq.Send(serversInfo.GridURL, 10000); - } catch (Exception ex) - { - MainLog.Instance.Error("Unable to connect to grid. Grid server not running?"); - throw(ex); - } - Hashtable GridRespData = (Hashtable)GridResp.Value; - Hashtable griddatahash = GridRespData; - - // Process Response - if (GridRespData.ContainsKey("error")) - { - string errorstring = (string) GridRespData["error"]; - MainLog.Instance.Error("Unable to connect to grid: " + errorstring); - return null; - } - else - { - m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY); - if (GridRespData.ContainsKey("allow_forceful_banlines")) - { - if ((string) GridRespData["allow_forceful_banlines"] != "TRUE") - { - //m_localBackend.SetForcefulBanlistsDisallowed(regionInfo.RegionHandle); - m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE"); - } - } - } - return m_localBackend.RegisterRegion(regionInfo); - } - - public bool DeregisterRegion(RegionInfo regionInfo) - { - return false; - } - - public virtual Dictionary GetGridSettings() - { - Dictionary returnGridSettings = new Dictionary(); - lock (m_queuedGridSettings) - { - foreach (string Dictkey in m_queuedGridSettings.Keys) - { - returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]); - } - - - m_queuedGridSettings.Clear(); - } - - return returnGridSettings; - } - - /// - /// - /// - /// - /// - public List RequestNeighbours(uint x, uint y) - { - Hashtable respData = MapBlockQuery((int) x - 1, (int) y - 1, (int) x + 1, (int) y + 1); - - List neighbours = new List(); - - foreach (ArrayList neighboursList in respData.Values) - { - foreach (Hashtable neighbourData in neighboursList) - { - uint regX = Convert.ToUInt32(neighbourData["x"]); - uint regY = Convert.ToUInt32(neighbourData["y"]); - if ((x != regX) || (y != regY)) - { - string simIp = (string) neighbourData["sim_ip"]; - - uint port = Convert.ToUInt32(neighbourData["sim_port"]); - string externalUri = (string) neighbourData["sim_uri"]; - - string externalIpStr = Util.GetHostFromDNS(simIp).ToString(); - SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port); - sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]); - sri.RegionID = new LLUUID((string) neighbourData["uuid"]); - - neighbours.Add(sri); - } - } - } - - return neighbours; - } - - /// - /// - /// - /// - /// - public RegionInfo RequestNeighbourInfo(LLUUID Region_UUID) - { - RegionInfo regionInfo; - Hashtable requestData = new Hashtable(); - requestData["region_UUID"] = Region_UUID.ToString(); - requestData["authkey"] = serversInfo.GridSendKey; - ArrayList SendParams = new ArrayList(); - SendParams.Add(requestData); - XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); - XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); - - Hashtable responseData = (Hashtable) GridResp.Value; - - if (responseData.ContainsKey("error")) - { - Console.WriteLine("error received from grid server" + responseData["error"]); - return null; - } - - uint regX = Convert.ToUInt32((string) responseData["region_locx"]); - uint regY = Convert.ToUInt32((string) responseData["region_locy"]); - string internalIpStr = (string) responseData["sim_ip"]; - uint port = Convert.ToUInt32(responseData["sim_port"]); - string externalUri = (string) responseData["sim_uri"]; - - IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); - string neighbourExternalUri = externalUri; - regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); - - regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); - regionInfo.RemotingAddress = internalIpStr; - - regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); - regionInfo.RegionName = (string) responseData["region_name"]; - - if (requestData.ContainsKey("regionHandle")) - { - m_remoteRegionInfoCache.Add(Convert.ToUInt64((string) requestData["regionHandle"]), regionInfo); - } - - return regionInfo; - } - - /// - /// - /// - /// - /// - public RegionInfo RequestNeighbourInfo(ulong regionHandle) - { - RegionInfo regionInfo = m_localBackend.RequestNeighbourInfo(regionHandle); - - if (regionInfo != null) - { - return regionInfo; - } - - if (m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo)) - { - } - else - { - try - { - Hashtable requestData = new Hashtable(); - requestData["region_handle"] = regionHandle.ToString(); - requestData["authkey"] = serversInfo.GridSendKey; - ArrayList SendParams = new ArrayList(); - SendParams.Add(requestData); - XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); - XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); - - Hashtable responseData = (Hashtable) GridResp.Value; - - if (responseData.ContainsKey("error")) - { - Console.WriteLine("error received from grid server" + responseData["error"]); - return null; - } - - uint regX = Convert.ToUInt32((string) responseData["region_locx"]); - uint regY = Convert.ToUInt32((string) responseData["region_locy"]); - string internalIpStr = (string) responseData["sim_ip"]; - uint port = Convert.ToUInt32(responseData["sim_port"]); - string externalUri = (string) responseData["sim_uri"]; - - IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); - string neighbourExternalUri = externalUri; - regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); - - regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); - regionInfo.RemotingAddress = internalIpStr; - - regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); - regionInfo.RegionName = (string) responseData["region_name"]; - - m_remoteRegionInfoCache.Add(regionHandle, regionInfo); - } - catch (WebException) - { - MainLog.Instance.Error("GRID", - "Region lookup failed for: " + regionHandle.ToString() + - " - Is the GridServer down?"); - return null; - } - } - - return regionInfo; - } - - /// - /// - /// - /// - /// - /// - /// - /// - public List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) - { - int temp = 0; - - if (minX > maxX) - { - temp = minX; - minX = maxX; - maxX = temp; - } - if (minY > maxY) - { - temp = minY; - minY = maxY; - maxY = temp; - } - - Hashtable respData = MapBlockQuery(minX, minY, maxX, maxY); - - List neighbours = new List(); - - foreach (ArrayList a in respData.Values) - { - foreach (Hashtable n in a) - { - MapBlockData neighbour = new MapBlockData(); - - neighbour.X = Convert.ToUInt16(n["x"]); - neighbour.Y = Convert.ToUInt16(n["y"]); - - neighbour.Name = (string) n["name"]; - neighbour.Access = Convert.ToByte(n["access"]); - neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]); - neighbour.WaterHeight = Convert.ToByte(n["water-height"]); - neighbour.MapImageId = new LLUUID((string) n["map-image-id"]); - - neighbours.Add(neighbour); - } - } - - return neighbours; - } - - /// - /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates - /// - /// REDUNDANT - OGS1 is to be phased out in favour of OGS2 - /// Minimum X value - /// Minimum Y value - /// Maximum X value - /// Maximum Y value - /// Hashtable of hashtables containing map data elements - private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY) - { - Hashtable param = new Hashtable(); - param["xmin"] = minX; - param["ymin"] = minY; - param["xmax"] = maxX; - param["ymax"] = maxY; - IList parameters = new ArrayList(); - parameters.Add(param); - try - { - XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); - XmlRpcResponse resp = req.Send(serversInfo.GridURL, 10000); - Hashtable respData = (Hashtable) resp.Value; - return respData; - } - catch (Exception e) - { - MainLog.Instance.Error("MapBlockQuery XMLRPC failure: " + e.ToString()); - return new Hashtable(); - } - } - - /// - /// A ping / version check - /// - /// - /// - public XmlRpcResponse PingCheckReply(XmlRpcRequest request) - { - XmlRpcResponse response = new XmlRpcResponse(); - - Hashtable respData = new Hashtable(); - respData["online"] = "true"; - - m_localBackend.PingCheckReply(respData); - - response.Value = respData; - - return response; - } - - - // Grid Request Processing - /// - /// - /// - /// - /// - public XmlRpcResponse ExpectUser(XmlRpcRequest request) - { - Console.WriteLine("Expecting User..."); - Hashtable requestData = (Hashtable) request.Params[0]; - AgentCircuitData agentData = new AgentCircuitData(); - agentData.SessionID = new LLUUID((string) requestData["session_id"]); - agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]); - agentData.firstname = (string) requestData["firstname"]; - agentData.lastname = (string) requestData["lastname"]; - agentData.AgentID = new LLUUID((string) requestData["agent_id"]); - agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); - agentData.CapsPath = (string) requestData["caps_path"]; - agentData.ClientVersion = (string)requestData["version"]; //rex - - if (requestData.ContainsKey("auth_addr")) { - agentData.authenticationAddr = (string)requestData["auth_addr"]; - } - if (requestData.ContainsKey("as_addr")) { - agentData.asAddress = (string)requestData["as_addr"]; - } - - if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) - { - agentData.child = true; - } - else - { - agentData.startpos = - new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), - Convert.ToUInt32(requestData["startpos_y"]), - Convert.ToUInt32(requestData["startpos_z"])); - agentData.child = false; - } - - ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]); - - m_localBackend.TriggerExpectUser(regionHandle, agentData); - - MainLog.Instance.Verbose("GRID", "Welcoming new user..."); - - return new XmlRpcResponse(); - } - - #region m_interRegion Comms - - /// - /// - /// - private void StartRemoting() - { - TcpChannel ch = new TcpChannel((int) NetworkServersInfo.RemotingListenerPort); - ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesnt support this. - - WellKnownServiceTypeEntry wellType = - new WellKnownServiceTypeEntry(typeof (OGS1InterRegionRemoting), "InterRegions", - WellKnownObjectMode.Singleton); - RemotingConfiguration.RegisterWellKnownServiceType(wellType); - InterRegionSingleton.Instance.OnArrival += TriggerExpectAvatarCrossing; - InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; - InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; - InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; - InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; - InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate; - //InterRegionSingleton.Instance.OnRegionUp += RegionUp; - } - - #region Methods called by regions in this instance - - public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) - { - RegionInfo regInfo = null; - try - { - if (m_localBackend.ChildAgentUpdate(regionHandle, cAgentData)) - { - return true; - } - - regInfo = RequestNeighbourInfo(regionHandle); - if (regInfo != null) - { - //don't want to be creating a new link to the remote instance every time like we are here - bool retValue = false; - - - OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( - typeof (OGS1InterRegionRemoting), - "tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); - - if (remObject != null) - { - retValue = remObject.ChildAgentUpdate(regionHandle, cAgentData); - } - else - { - Console.WriteLine("remoting object not found"); - } - remObject = null; - MainLog.Instance.Verbose("INTER", - gdebugRegionName + - ": OGS1 tried to Update Child Agent data on outside region and got " + - retValue.ToString()); - - return retValue; - } - - return false; - } - catch (RemotingException e) - { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (SocketException e) - { - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + - regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (InvalidCredentialException e) - { - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (AuthenticationException e) - { - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + - regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (Exception e) - { - MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - } - - /// - /// - /// - /// - /// - /// - public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) - { - RegionInfo regInfo = null; - try - { - if (m_localBackend.InformRegionOfChildAgent(regionHandle, agentData)) - { - return true; - } - - regInfo = RequestNeighbourInfo(regionHandle); - if (regInfo != null) - { - //don't want to be creating a new link to the remote instance every time like we are here - bool retValue = false; - - - OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( - typeof (OGS1InterRegionRemoting), - "tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); - - if (remObject != null) - { - retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData)); - } - else - { - Console.WriteLine("remoting object not found"); - } - remObject = null; - MainLog.Instance.Verbose("INTER", - gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + - agentData.firstname + " " + agentData.lastname + " and got " + - retValue.ToString()); - - return retValue; - } - - return false; - } - catch (RemotingException e) - { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (SocketException e) - { - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + - regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (InvalidCredentialException e) - { - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (AuthenticationException e) - { - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + - regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (Exception e) - { - MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - } - - // UGLY! - public bool RegionUp(SearializableRegionInfo region, ulong regionhandle) - { - SearializableRegionInfo regInfo = null; - try - { - // You may ask why this is in here... - // The region asking the grid services about itself.. - // And, surprisingly, the reason is.. it doesn't know - // it's own remoting port! How special. - region = new SearializableRegionInfo(RequestNeighbourInfo(region.RegionHandle)); - region.RemotingAddress = region.ExternalHostName; - region.RemotingPort = NetworkServersInfo.RemotingListenerPort; - if (m_localBackend.RegionUp(region, regionhandle)) - { - return true; - } - - regInfo = new SearializableRegionInfo(RequestNeighbourInfo(regionhandle)); - if (regInfo != null) - { - // If we're not trying to remote to ourselves. - if (regInfo.RemotingAddress != region.RemotingAddress && region.RemotingAddress != null) - { - //don't want to be creating a new link to the remote instance every time like we are here - bool retValue = false; - - - OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( - typeof ( - OGS1InterRegionRemoting), - "tcp://" + - regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); - - if (remObject != null) - { - retValue = remObject.RegionUp(region, regionhandle); - } - else - { - Console.WriteLine("remoting object not found"); - } - remObject = null; - MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to inform region I'm up"); - - return retValue; - } - else - { - // We're trying to inform ourselves via remoting. - // This is here because we're looping over the listeners before we get here. - // Odd but it should work. - return true; - } - } - - return false; - } - catch (RemotingException e) - { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region using tcp://" + - regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + - " - Is this neighbor up?"); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (SocketException e) - { - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region using tcp://" + - regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + - " - Is this neighbor up?"); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (InvalidCredentialException e) - { - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" + - regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (AuthenticationException e) - { - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" + - regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (Exception e) - { - // This line errors with a Null Reference Exception.. Why? @.@ - //MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + - // ":" + regInfo.RemotingPort + - //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); - MainLog.Instance.Debug(e.ToString()); - return false; - } - } - - /// - /// - /// - /// - /// - /// - public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) - { - RegionInfo regInfo = null; - try - { - if (m_localBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData)) - { - return true; - } - - regInfo = RequestNeighbourInfo(regionHandle); - if (regInfo != null) - { - //don't want to be creating a new link to the remote instance every time like we are here - bool retValue = false; - - - OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( - typeof (OGS1InterRegionRemoting), - "tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); - - if (remObject != null) - { - retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.UUID, objData); - } - else - { - Console.WriteLine("remoting object not found"); - } - remObject = null; - - - return retValue; - } - - return false; - } - catch (RemotingException e) - { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (SocketException e) - { - MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + - regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (InvalidCredentialException e) - { - MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (AuthenticationException e) - { - MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + - regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch (Exception e) - { - MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - } - - /// - /// - /// - /// - /// - /// - /// - public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) - { - RegionInfo regInfo = null; - try - { - if (m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying)) - { - return true; - } - - regInfo = RequestNeighbourInfo(regionHandle); - if (regInfo != null) - { - bool retValue = false; - OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( - typeof (OGS1InterRegionRemoting), - "tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); - if (remObject != null) - { - retValue = - remObject.ExpectAvatarCrossing(regionHandle, agentID.UUID, new sLLVector3(position), - isFlying); - } - else - { - Console.WriteLine("remoting object not found"); - } - remObject = null; - - return retValue; - } - //TODO need to see if we know about where this region is and use .net remoting - // to inform it. - return false; - } - catch (RemotingException e) - { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch - { - return false; - } - } - - public bool ExpectPrimCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isPhysical) - { - RegionInfo regInfo = null; - try - { - if (m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical)) - { - return true; - } - - regInfo = RequestNeighbourInfo(regionHandle); - if (regInfo != null) - { - bool retValue = false; - OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( - typeof (OGS1InterRegionRemoting), - "tcp://" + regInfo.RemotingAddress + - ":" + regInfo.RemotingPort + - "/InterRegions"); - if (remObject != null) - { - retValue = - remObject.ExpectAvatarCrossing(regionHandle, agentID.UUID, new sLLVector3(position), - isPhysical); - } - else - { - Console.WriteLine("remoting object not found"); - } - remObject = null; - - return retValue; - } - //TODO need to see if we know about where this region is and use .net remoting - // to inform it. - return false; - } - catch (RemotingException e) - { - MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + - " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); - MainLog.Instance.Debug(e.ToString()); - return false; - } - catch - { - return false; - } - } - - public void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) - { - } - - public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId) - { - return m_localBackend.AcknowledgeAgentCrossed(regionHandle, agentId); - } - - public bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primId) - { - return m_localBackend.AcknowledgePrimCrossed(regionHandle, primId); - } - - #endregion - - #region Methods triggered by calls from external instances - - /// - /// - /// - /// - /// - /// - public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) - { - //MainLog.Instance.Verbose("INTER", gdebugRegionName + ": Incoming OGS1 Agent " + agentData.firstname + " " + agentData.lastname); - - try - { - return m_localBackend.IncomingChildAgent(regionHandle, agentData); - } - catch (RemotingException) - { - //MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); - return false; - } - } - - public bool TriggerRegionUp(SearializableRegionInfo regionData, ulong regionhandle) - { - MainLog.Instance.Verbose("INTER", - gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.RegionLocX + - "," + regionData.RegionLocY + ")"); - - try - { - return m_localBackend.TriggerRegionUp(new RegionInfo(regionData), regionhandle); - } - - catch (RemotingException e) - { - MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); - return false; - } - } - - public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) - { - MainLog.Instance.Verbose("INTER", "Incoming OGS1 Child Agent Data Update"); - - try - { - return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData); - } - catch (RemotingException e) - { - MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); - return false; - } - } - - /// - /// - /// - /// - /// - /// - public bool IncomingPrim(ulong regionHandle, LLUUID primID, string objData) - { - // Is this necessary? - try - { - //return m_localBackend.TriggerExpectPrim(regionHandle,primID, objData); - //m_localBackend. - return false; - } - catch (RemotingException e) - { - MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); - return false; - } - } - - /// - /// - /// - /// - /// - /// - /// - public bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) - { - try - { - return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); - } - catch (RemotingException e) - { - MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); - return false; - } - } - - public bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isPhysical) - { - try - { - return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical); - } - catch (RemotingException e) - { - MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); - return false; - } - } - - #endregion - - #endregion - } -} \ No newline at end of file +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Net; +using System.Net.Sockets; +using System.Runtime.Remoting; +using System.Runtime.Remoting.Channels; +using System.Runtime.Remoting.Channels.Tcp; +using System.Security.Authentication; +using libsecondlife; +using Nwc.XmlRpc; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; +using OpenSim.Region.Communications.Local; + +namespace OpenSim.Region.Communications.OGS1 +{ + public class OGS1GridServices : IGridServices, IInterRegionCommunications + { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + + private LocalBackEndServices m_localBackend = new LocalBackEndServices(); + private Dictionary m_remoteRegionInfoCache = new Dictionary(); + private List m_knownRegions = new List(); + private Dictionary m_deadRegionCache = new Dictionary(); + private Dictionary m_queuedGridSettings = new Dictionary(); + + public BaseHttpServer httpListener; + public NetworkServersInfo serversInfo; + public BaseHttpServer httpServer; + public string _gdebugRegionName = String.Empty; + + public string gdebugRegionName + { + get { return _gdebugRegionName; } + set { _gdebugRegionName = value; } + } + + public string _rdebugRegionName = String.Empty; + + public string rdebugRegionName + { + get { return _rdebugRegionName; } + set { _rdebugRegionName = value; } + } + + /// + /// Contructor. Adds "expect_user" and "check" xmlrpc method handlers + /// + /// + /// + public OGS1GridServices(NetworkServersInfo servers_info, BaseHttpServer httpServe) + { + serversInfo = servers_info; + httpServer = httpServe; + //Respond to Grid Services requests + httpServer.AddXmlRPCHandler("expect_user", ExpectUser); + httpServer.AddXmlRPCHandler("check", PingCheckReply); + + StartRemoting(); + } + + /// + /// + /// + /// + /// + public RegionCommsListener RegisterRegion(RegionInfo regionInfo) + { + Hashtable GridParams = new Hashtable(); + // Login / Authentication + + GridParams["authkey"] = serversInfo.GridSendKey; + GridParams["recvkey"] = serversInfo.GridRecvKey; + GridParams["UUID"] = regionInfo.RegionID.ToString(); + GridParams["sim_ip"] = regionInfo.ExternalHostName; + GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); + GridParams["region_locx"] = regionInfo.RegionLocX.ToString(); + GridParams["region_locy"] = regionInfo.RegionLocY.ToString(); + GridParams["sim_name"] = regionInfo.RegionName; + GridParams["http_port"] = serversInfo.HttpListenerPort.ToString(); + GridParams["remoting_port"] = NetworkServersInfo.RemotingListenerPort.ToString(); + GridParams["map-image-id"] = regionInfo.EstateSettings.terrainImageID.ToString(); + + // part of an initial brutish effort to provide accurate information (as per the xml region spec) + // wrt the ownership of a given region + // the (very bad) assumption is that this value is being read and handled inconsistently or + // not at all. Current strategy is to put the code in place to support the validity of this information + // and to roll forward debugging any issues from that point + // + // this particular section of the mod attempts to supply a value from the region's xml file to the grid + // server for the UUID of the region's owner (master avatar) + GridParams["master_avatar_uuid"] = regionInfo.MasterAvatarAssignedUUID.ToString(); + + // Package into an XMLRPC Request + ArrayList SendParams = new ArrayList(); + SendParams.Add(GridParams); + + // Send Request + XmlRpcRequest GridReq; + XmlRpcResponse GridResp; + try + { + GridReq = new XmlRpcRequest("simulator_login", SendParams); + GridResp = GridReq.Send(serversInfo.GridURL, 16000); + } catch (Exception ex) + { + m_log.Error("Unable to connect to grid. Grid server not running?"); + throw(ex); + } + Hashtable GridRespData = (Hashtable)GridResp.Value; + Hashtable griddatahash = GridRespData; + + // Process Response + if (GridRespData.ContainsKey("error")) + { + string errorstring = (string) GridRespData["error"]; + m_log.Error("Unable to connect to grid: " + errorstring); + return null; + } + else + { + m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY); + if (GridRespData.ContainsKey("allow_forceful_banlines")) + { + if ((string) GridRespData["allow_forceful_banlines"] != "TRUE") + { + //m_localBackend.SetForcefulBanlistsDisallowed(regionInfo.RegionHandle); + m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE"); + } + } + } + return m_localBackend.RegisterRegion(regionInfo); + } + + public bool DeregisterRegion(RegionInfo regionInfo) + { + return false; + } + + public virtual Dictionary GetGridSettings() + { + Dictionary returnGridSettings = new Dictionary(); + lock (m_queuedGridSettings) + { + foreach (string Dictkey in m_queuedGridSettings.Keys) + { + returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]); + } + + + m_queuedGridSettings.Clear(); + } + + return returnGridSettings; + } + + /// + /// + /// + /// + /// + public List RequestNeighbours(uint x, uint y) + { + Hashtable respData = MapBlockQuery((int) x - 1, (int) y - 1, (int) x + 1, (int) y + 1); + + List neighbours = new List(); + + foreach (ArrayList neighboursList in respData.Values) + { + foreach (Hashtable neighbourData in neighboursList) + { + uint regX = Convert.ToUInt32(neighbourData["x"]); + uint regY = Convert.ToUInt32(neighbourData["y"]); + if ((x != regX) || (y != regY)) + { + string simIp = (string) neighbourData["sim_ip"]; + + uint port = Convert.ToUInt32(neighbourData["sim_port"]); + string externalUri = (string) neighbourData["sim_uri"]; + + string externalIpStr = Util.GetHostFromDNS(simIp).ToString(); + SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port); + sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]); + sri.RegionID = new LLUUID((string) neighbourData["uuid"]); + + neighbours.Add(sri); + } + } + } + + return neighbours; + } + + /// + /// + /// + /// + /// + public RegionInfo RequestNeighbourInfo(LLUUID Region_UUID) + { + RegionInfo regionInfo; + Hashtable requestData = new Hashtable(); + requestData["region_UUID"] = Region_UUID.ToString(); + requestData["authkey"] = serversInfo.GridSendKey; + ArrayList SendParams = new ArrayList(); + SendParams.Add(requestData); + XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); + XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); + + Hashtable responseData = (Hashtable) GridResp.Value; + + if (responseData.ContainsKey("error")) + { + Console.WriteLine("error received from grid server" + responseData["error"]); + return null; + } + + uint regX = Convert.ToUInt32((string) responseData["region_locx"]); + uint regY = Convert.ToUInt32((string) responseData["region_locy"]); + string internalIpStr = (string) responseData["sim_ip"]; + uint port = Convert.ToUInt32(responseData["sim_port"]); + string externalUri = (string) responseData["sim_uri"]; + + IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); + string neighbourExternalUri = externalUri; + regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); + + regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); + regionInfo.RemotingAddress = internalIpStr; + + regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); + regionInfo.RegionName = (string) responseData["region_name"]; + + if (requestData.ContainsKey("regionHandle")) + { + m_remoteRegionInfoCache.Add(Convert.ToUInt64((string) requestData["regionHandle"]), regionInfo); + } + + return regionInfo; + } + + /// + /// + /// + /// + /// + public RegionInfo RequestNeighbourInfo(ulong regionHandle) + { + RegionInfo regionInfo = m_localBackend.RequestNeighbourInfo(regionHandle); + + if (regionInfo != null) + { + return regionInfo; + } + + if (m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo)) + { + } + else + { + try + { + Hashtable requestData = new Hashtable(); + requestData["region_handle"] = regionHandle.ToString(); + requestData["authkey"] = serversInfo.GridSendKey; + ArrayList SendParams = new ArrayList(); + SendParams.Add(requestData); + XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); + XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); + + Hashtable responseData = (Hashtable) GridResp.Value; + + if (responseData.ContainsKey("error")) + { + Console.WriteLine("error received from grid server" + responseData["error"]); + return null; + } + + uint regX = Convert.ToUInt32((string) responseData["region_locx"]); + uint regY = Convert.ToUInt32((string) responseData["region_locy"]); + string internalIpStr = (string) responseData["sim_ip"]; + uint port = Convert.ToUInt32(responseData["sim_port"]); + string externalUri = (string) responseData["sim_uri"]; + + IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); + string neighbourExternalUri = externalUri; + regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); + + regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); + regionInfo.RemotingAddress = internalIpStr; + + regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); + regionInfo.RegionName = (string) responseData["region_name"]; + + m_remoteRegionInfoCache.Add(regionHandle, regionInfo); + } + catch (WebException) + { + m_log.Error("[GRID]: " + + "Region lookup failed for: " + regionHandle.ToString() + + " - Is the GridServer down?"); + return null; + } + } + + return regionInfo; + } + + /// + /// + /// + /// + /// + /// + /// + /// + public List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) + { + int temp = 0; + + if (minX > maxX) + { + temp = minX; + minX = maxX; + maxX = temp; + } + if (minY > maxY) + { + temp = minY; + minY = maxY; + maxY = temp; + } + + Hashtable respData = MapBlockQuery(minX, minY, maxX, maxY); + + List neighbours = new List(); + + foreach (ArrayList a in respData.Values) + { + foreach (Hashtable n in a) + { + MapBlockData neighbour = new MapBlockData(); + + neighbour.X = Convert.ToUInt16(n["x"]); + neighbour.Y = Convert.ToUInt16(n["y"]); + + neighbour.Name = (string) n["name"]; + neighbour.Access = Convert.ToByte(n["access"]); + neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]); + neighbour.WaterHeight = Convert.ToByte(n["water-height"]); + neighbour.MapImageId = new LLUUID((string) n["map-image-id"]); + + neighbours.Add(neighbour); + } + } + + return neighbours; + } + + + + + /// + /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates + /// + /// REDUNDANT - OGS1 is to be phased out in favour of OGS2 + /// Minimum X value + /// Minimum Y value + /// Maximum X value + /// Maximum Y value + /// Hashtable of hashtables containing map data elements + private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY) + { + Hashtable param = new Hashtable(); + param["xmin"] = minX; + param["ymin"] = minY; + param["xmax"] = maxX; + param["ymax"] = maxY; + IList parameters = new ArrayList(); + parameters.Add(param); + try + { + XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); + XmlRpcResponse resp = req.Send(serversInfo.GridURL, 10000); + Hashtable respData = (Hashtable) resp.Value; + return respData; + } + catch (Exception e) + { + m_log.Error("MapBlockQuery XMLRPC failure: " + e.ToString()); + return new Hashtable(); + } + } + + /// + /// A ping / version check + /// + /// + /// + public XmlRpcResponse PingCheckReply(XmlRpcRequest request) + { + XmlRpcResponse response = new XmlRpcResponse(); + + Hashtable respData = new Hashtable(); + respData["online"] = "true"; + + m_localBackend.PingCheckReply(respData); + + response.Value = respData; + + return response; + } + + + // Grid Request Processing + /// + /// Received from the user server when a user starts logging in. This call allows + /// the region to prepare for direct communication from the client. Sends back an empty + /// xmlrpc response on completion. + /// + /// + /// + public XmlRpcResponse ExpectUser(XmlRpcRequest request) + { + m_log.Debug("[CONNECTION DEBUGGING]: Expect User called, starting agent setup ... "); + Hashtable requestData = (Hashtable) request.Params[0]; + AgentCircuitData agentData = new AgentCircuitData(); + agentData.SessionID = new LLUUID((string) requestData["session_id"]); + agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]); + agentData.firstname = (string) requestData["firstname"]; + agentData.lastname = (string) requestData["lastname"]; + agentData.AgentID = new LLUUID((string) requestData["agent_id"]); + agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); + agentData.CapsPath = (string) requestData["caps_path"]; + agentData.ClientVersion = (string)requestData["version"]; //rex + + if (requestData.ContainsKey("auth_addr")) { + agentData.authenticationAddr = (string)requestData["auth_addr"]; + } + if (requestData.ContainsKey("as_addr")) { + agentData.asAddress = (string)requestData["as_addr"]; + } + + if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) + { + m_log.Debug("[CONNECTION DEBUGGING]: Child agent detected"); + agentData.child = true; + } + else + { + m_log.Debug("[CONNECTION DEBUGGING]: Main agent detected"); + agentData.startpos = + new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), + Convert.ToUInt32(requestData["startpos_y"]), + Convert.ToUInt32(requestData["startpos_z"])); + agentData.child = false; + } + + ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]); + + m_log.Debug("[CONNECTION DEBUGGING]: Triggering welcome for " + agentData.AgentID.ToString() + " into " + regionHandle.ToString()); + m_localBackend.TriggerExpectUser(regionHandle, agentData); + + m_log.Info("[GRID]: Welcoming new user..."); + + return new XmlRpcResponse(); + } + + #region m_interRegion Comms + + /// + /// + /// + private void StartRemoting() + { + TcpChannel ch; + try + { + ch = new TcpChannel((int)NetworkServersInfo.RemotingListenerPort); + ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesnt support this. + } + catch (Exception ex) + { + m_log.Error("Exception while attempting to listen on TCP port " + (int)NetworkServersInfo.RemotingListenerPort + "."); + throw (ex); + } + + WellKnownServiceTypeEntry wellType = + new WellKnownServiceTypeEntry(typeof (OGS1InterRegionRemoting), "InterRegions", + WellKnownObjectMode.Singleton); + RemotingConfiguration.RegisterWellKnownServiceType(wellType); + InterRegionSingleton.Instance.OnArrival += TriggerExpectAvatarCrossing; + InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; + InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; + InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; + InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; + InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate; + InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection; + + } + + #region Methods called by regions in this instance + + public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) + { + int failures = 0; + lock (m_deadRegionCache) + { + if (m_deadRegionCache.ContainsKey(regionHandle)) + { + failures = m_deadRegionCache[regionHandle]; + } + } + if (failures <= 3) + { + RegionInfo regInfo = null; + try + { + if (m_localBackend.ChildAgentUpdate(regionHandle, cAgentData)) + { + return true; + } + + regInfo = RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + //don't want to be creating a new link to the remote instance every time like we are here + bool retValue = false; + + + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( + typeof(OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); + + if (remObject != null) + { + retValue = remObject.ChildAgentUpdate(regionHandle, cAgentData); + } + else + { + Console.WriteLine("remoting object not found"); + } + remObject = null; + //m_log.Info("[INTER]: " + + //gdebugRegionName + + //": OGS1 tried to Update Child Agent data on outside region and got " + + //retValue.ToString()); + + return retValue; + } + NoteDeadRegion(regionHandle); + + return false; + } + catch (RemotingException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Remoting Error: Unable to connect to adjacent region: " + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (SocketException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Socket Error: Unable to connect to adjacent region: " + " " + + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (InvalidCredentialException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Invalid Credentials: Unable to connect to adjacent region: " + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (AuthenticationException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Authentication exception: Unable to connect to adjacent region: " + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (Exception e) + { + NoteDeadRegion(regionHandle); + m_log.Debug(e.ToString()); + return false; + } + } + else + { + //m_log.Info("[INTERREGION]: Skipped Sending Child Update to a region because it failed too many times:" + regionHandle.ToString()); + return false; + } + } + + /// + /// + /// + /// + /// + /// + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + RegionInfo regInfo = null; + try + { + if (m_localBackend.InformRegionOfChildAgent(regionHandle, agentData)) + { + return true; + } + + regInfo = RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + //don't want to be creating a new link to the remote instance every time like we are here + bool retValue = false; + + + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( + typeof(OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); + + if (remObject != null) + { + retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData)); + } + else + { + Console.WriteLine("remoting object not found"); + } + remObject = null; + m_log.Info("[INTER]: " + + gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + + agentData.firstname + " " + agentData.lastname + " and got " + + retValue.ToString()); + + return retValue; + + } + NoteDeadRegion(regionHandle); + return false; + } + catch (RemotingException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (SocketException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (InvalidCredentialException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (AuthenticationException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Authentication exception: Unable to connect to adjacent region: " + + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (Exception e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + } + + // UGLY! + public bool RegionUp(SearializableRegionInfo region, ulong regionhandle) + { + SearializableRegionInfo regInfo = null; + try + { + // You may ask why this is in here... + // The region asking the grid services about itself.. + // And, surprisingly, the reason is.. it doesn't know + // it's own remoting port! How special. + region = new SearializableRegionInfo(RequestNeighbourInfo(region.RegionHandle)); + region.RemotingAddress = region.ExternalHostName; + region.RemotingPort = NetworkServersInfo.RemotingListenerPort; + if (m_localBackend.RegionUp(region, regionhandle)) + { + return true; + } + + regInfo = new SearializableRegionInfo(RequestNeighbourInfo(regionhandle)); + if (regInfo != null) + { + // If we're not trying to remote to ourselves. + if (regInfo.RemotingAddress != region.RemotingAddress && region.RemotingAddress != null) + { + //don't want to be creating a new link to the remote instance every time like we are here + bool retValue = false; + + + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( + typeof ( + OGS1InterRegionRemoting), + "tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); + + if (remObject != null) + { + retValue = remObject.RegionUp(region, regionhandle); + } + else + { + Console.WriteLine("remoting object not found"); + } + remObject = null; + m_log.Info("[INTER]: " + gdebugRegionName + ": OGS1 tried to inform region I'm up"); + + return retValue; + } + else + { + // We're trying to inform ourselves via remoting. + // This is here because we're looping over the listeners before we get here. + // Odd but it should work. + return true; + } + } + + return false; + } + catch (RemotingException e) + { + m_log.Warn("Remoting Error: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + + " - Is this neighbor up?"); + m_log.Debug(e.ToString()); + return false; + } + catch (SocketException e) + { + m_log.Warn("Socket Error: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + + " - Is this neighbor up?"); + m_log.Debug(e.ToString()); + return false; + } + catch (InvalidCredentialException e) + { + m_log.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (AuthenticationException e) + { + m_log.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (Exception e) + { + // This line errors with a Null Reference Exception.. Why? @.@ + //m_log.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + + // ":" + regInfo.RemotingPort + + //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); + m_log.Debug(e.ToString()); + return false; + } + } + + /// + /// + /// + /// + /// + /// + public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) + { + int failures = 0; + lock (m_deadRegionCache) + { + if (m_deadRegionCache.ContainsKey(regionHandle)) + { + failures = m_deadRegionCache[regionHandle]; + } + } + if (failures <= 1) + { + RegionInfo regInfo = null; + try + { + if (m_localBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData)) + { + return true; + } + + regInfo = RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + //don't want to be creating a new link to the remote instance every time like we are here + bool retValue = false; + + + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( + typeof(OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); + + if (remObject != null) + { + retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.UUID, objData); + } + else + { + Console.WriteLine("remoting object not found"); + } + remObject = null; + + + return retValue; + } + NoteDeadRegion(regionHandle); + return false; + } + catch (RemotingException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Remoting Error: Unable to connect to adjacent region: " + regionHandle); + m_log.Debug(e.ToString()); + return false; + } + catch (SocketException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Remoting Error: Unable to connect to adjacent region: " + regionHandle); + m_log.Debug(e.ToString()); + return false; + } + catch (InvalidCredentialException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Invalid Credential Exception: Invalid Credentials : " + regionHandle); + m_log.Debug(e.ToString()); + return false; + } + catch (AuthenticationException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Authentication exception: Unable to connect to adjacent region: " + regionHandle); + + m_log.Debug(e.ToString()); + return false; + } + catch (Exception e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Unknown exception: Unable to connect to adjacent region: " + regionHandle); + m_log.Debug(e.ToString()); + return false; + } + } + else + { + return false; + } + } + + /// + /// + /// + /// + /// + /// + /// + public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) + { + RegionInfo regInfo = null; + try + { + if (m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying)) + { + return true; + } + + regInfo = RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + bool retValue = false; + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( + typeof (OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); + if (remObject != null) + { + retValue = + remObject.ExpectAvatarCrossing(regionHandle, agentID.UUID, new sLLVector3(position), + isFlying); + } + else + { + Console.WriteLine("remoting object not found"); + } + remObject = null; + + return retValue; + } + //TODO need to see if we know about where this region is and use .net remoting + // to inform it. + NoteDeadRegion(regionHandle); + return false; + } + catch (RemotingException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch + { + NoteDeadRegion(regionHandle); + return false; + } + } + + public bool ExpectPrimCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isPhysical) + { + RegionInfo regInfo = null; + try + { + if (m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical)) + { + return true; + } + + regInfo = RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + bool retValue = false; + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( + typeof (OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); + if (remObject != null) + { + retValue = + remObject.ExpectAvatarCrossing(regionHandle, agentID.UUID, new sLLVector3(position), + isPhysical); + } + else + { + Console.WriteLine("remoting object not found"); + } + remObject = null; + + return retValue; + } + //TODO need to see if we know about where this region is and use .net remoting + // to inform it. + NoteDeadRegion(regionHandle); + return false; + } + catch (RemotingException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Remoting Error: Unable to connect to adjacent region: " + regionHandle); + m_log.Debug(e.ToString()); + return false; + } + catch (SocketException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Remoting Error: Unable to connect to adjacent region: " + regionHandle); + m_log.Debug(e.ToString()); + return false; + } + catch (InvalidCredentialException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Invalid Credential Exception: Invalid Credentials : " + regionHandle); + m_log.Debug(e.ToString()); + return false; + } + catch (AuthenticationException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Authentication exception: Unable to connect to adjacent region: " + regionHandle); + + m_log.Debug(e.ToString()); + return false; + } + catch (Exception e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Unknown exception: Unable to connect to adjacent region: " + regionHandle); + m_log.Debug(e.ToString()); + return false; + } + } + + public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) + { + RegionInfo regInfo = null; + try + { + if (m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID)) + { + return true; + } + + regInfo = RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + bool retValue = false; + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( + typeof(OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); + if (remObject != null) + { + retValue = + remObject.TellRegionToCloseChildConnection(regionHandle, agentID.UUID); + } + else + { + Console.WriteLine("remoting object not found"); + } + remObject = null; + + return true; + } + //TODO need to see if we know about where this region is and use .net remoting + // to inform it. + NoteDeadRegion(regionHandle); + return false; + } + catch (RemotingException) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName + + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + //m_log.Debug(e.ToString()); + return false; + } + + catch (SocketException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Socket Error: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + + " - Is this neighbor up?"); + m_log.Debug(e.ToString()); + return false; + } + catch (InvalidCredentialException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (AuthenticationException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (WebException e) + { + NoteDeadRegion(regionHandle); + m_log.Warn("WebException exception: Unable to connect to adjacent region using tcp://" + + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); + m_log.Debug(e.ToString()); + return false; + } + catch (Exception e) + { + NoteDeadRegion(regionHandle); + // This line errors with a Null Reference Exception.. Why? @.@ + //m_log.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + + // ":" + regInfo.RemotingPort + + //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); + m_log.Debug(e.ToString()); + return false; + } + } + + public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId) + { + return m_localBackend.AcknowledgeAgentCrossed(regionHandle, agentId); + } + + public bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primId) + { + return m_localBackend.AcknowledgePrimCrossed(regionHandle, primId); + } + + #endregion + + #region Methods triggered by calls from external instances + + /// + /// + /// + /// + /// + /// + public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + //m_log.Info("[INTER]: " + gdebugRegionName + ": Incoming OGS1 Agent " + agentData.firstname + " " + agentData.lastname); + + try + { + return m_localBackend.IncomingChildAgent(regionHandle, agentData); + } + catch (RemotingException) + { + //m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); + return false; + } + } + + public bool TriggerRegionUp(SearializableRegionInfo regionData, ulong regionhandle) + { + m_log.Info("[INTER]: " + + gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.RegionLocX + + "," + regionData.RegionLocY + "). Giving this region a fresh set of 'dead' tries"); + + try + { + lock (m_deadRegionCache) + { + if (m_deadRegionCache.ContainsKey(regionData.RegionHandle)) + { + + m_deadRegionCache.Remove(regionData.RegionHandle); + } + } + + return m_localBackend.TriggerRegionUp(new RegionInfo(regionData), regionhandle); + + } + + catch (RemotingException e) + { + m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); + return false; + } + } + + public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) + { + //m_log.Info("[INTER]: Incoming OGS1 Child Agent Data Update"); + + try + { + return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData); + } + catch (RemotingException e) + { + m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); + return false; + } + } + + /// + /// + /// + /// + /// + /// + public bool IncomingPrim(ulong regionHandle, LLUUID primID, string objData) + { + // Is this necessary? + try + { + m_localBackend.TriggerExpectPrim(regionHandle, primID, objData); + return true; + //m_localBackend. + + } + catch (RemotingException e) + { + m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); + return false; + } + return false; + } + + /// + /// + /// + /// + /// + /// + /// + public bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) + { + try + { + return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); + } + catch (RemotingException e) + { + m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); + return false; + } + } + + public bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isPhysical) + { + try + { + return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical); + } + catch (RemotingException e) + { + m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); + return false; + } + } + + public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) + { + try + { + return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID); + } + catch (RemotingException) + { + m_log.Info("[INTERREGION]: Remoting Error: Unable to connect to neighbour to tell it to close a child connection"); + return false; + } + + } + + #endregion + + #endregion + + // helper to see if remote region is up + bool m_bAvailable = false; + int timeOut = 10; //10 seconds + + public void CheckRegion(string address, uint port) + { + m_bAvailable = false; + IPAddress ia = null; + IPAddress.TryParse(address, out ia); + IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port); + AsyncCallback ConnectedMethodCallback = new AsyncCallback(ConnectedMethod); + Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + IAsyncResult ar = socket.BeginConnect(m_EndPoint, ConnectedMethodCallback, socket); + ar.AsyncWaitHandle.WaitOne(timeOut*1000, false); + } + + public bool Available + { + get { return m_bAvailable; } + } + + void ConnectedMethod(IAsyncResult ar) + { + Socket socket = (Socket)ar.AsyncState; + try + { + socket.EndConnect(ar); + m_bAvailable = true; + } + catch (Exception) + { + } + socket.Close(); + } + public void NoteDeadRegion(ulong regionhandle) + { + lock (m_deadRegionCache) + { + if (m_deadRegionCache.ContainsKey(regionhandle)) + { + m_deadRegionCache[regionhandle] = m_deadRegionCache[regionhandle] + 1; + } + else + { + m_deadRegionCache.Add(regionhandle, 1); + } + } + } + } + +} diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs index 8625835f31..d21852d173 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs @@ -1,219 +1,262 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -using System; -using System.Runtime.Remoting; -using libsecondlife; -using OpenSim.Framework; - -namespace OpenSim.Region.Communications.OGS1 -{ - public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); - - public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); - - public delegate bool InformRegionPrimGroup(ulong regionHandle, LLUUID primID, LLVector3 Positon, bool isPhysical); - - public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); - - public delegate bool RegionUp(SearializableRegionInfo region, ulong regionhandle); - - public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate); - - public sealed class InterRegionSingleton - { - private static readonly InterRegionSingleton instance = new InterRegionSingleton(); - - public event InformRegionChild OnChildAgent; - public event ExpectArrival OnArrival; - public event InformRegionPrimGroup OnPrimGroupNear; - public event PrimGroupArrival OnPrimGroupArrival; - public event RegionUp OnRegionUp; - public event ChildAgentUpdate OnChildAgentUpdate; - - - static InterRegionSingleton() - { - } - - private InterRegionSingleton() - { - } - - public static InterRegionSingleton Instance - { - get { return instance; } - } - - public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) - { - if (OnChildAgent != null) - { - return OnChildAgent(regionHandle, agentData); - } - return false; - } - - public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) - { - if (OnRegionUp != null) - { - return OnRegionUp(sregion, regionhandle); - } - return false; - } - - public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate) - { - if (OnChildAgentUpdate != null) - { - return OnChildAgentUpdate(regionHandle, cAgentUpdate); - } - return false; - } - - public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) - { - if (OnArrival != null) - { - return OnArrival(regionHandle, agentID, position, isFlying); - } - return false; - } - - public bool InformRegionPrim(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) - { - if (OnPrimGroupNear != null) - { - return OnPrimGroupNear(regionHandle, primID, position, isPhysical); - } - return false; - } - - public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData) - { - if (OnPrimGroupArrival != null) - { - return OnPrimGroupArrival(regionHandle, primID, objData); - } - return false; - } - } - - public class OGS1InterRegionRemoting : MarshalByRefObject - { - public OGS1InterRegionRemoting() - { - } - - public bool InformRegionOfChildAgent(ulong regionHandle, sAgentCircuitData agentData) - { - try - { - return - InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData)); - } - catch (RemotingException e) - { - Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); - return false; - } - } - - public bool RegionUp(SearializableRegionInfo region, ulong regionhandle) - { - try - { - return InterRegionSingleton.Instance.RegionUp(region, regionhandle); - } - catch (RemotingException e) - { - Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); - return false; - } - } - - public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) - { - try - { - return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle, cAgentData); - } - catch (RemotingException e) - { - Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString()); - return false; - } - } - - public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying) - { - try - { - return - InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new LLUUID(agentID), - new LLVector3(position.x, position.y, position.z), - isFlying); - } - catch (RemotingException e) - { - Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); - return false; - } - } - - public bool InformRegionPrim(ulong regionHandle, Guid SceneObjectGroupID, sLLVector3 position, bool isPhysical) - { - try - { - return - InterRegionSingleton.Instance.InformRegionPrim(regionHandle, new LLUUID(SceneObjectGroupID), - new LLVector3(position.x, position.y, position.z), - isPhysical); - } - catch (RemotingException e) - { - Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); - return false; - } - } - - public bool InformRegionOfPrimCrossing(ulong regionHandle, Guid primID, string objData) - { - try - { - return InterRegionSingleton.Instance.ExpectPrimCrossing(regionHandle, new LLUUID(primID), objData); - } - catch (RemotingException e) - { - Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); - return false; - } - } - } -} \ No newline at end of file +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using System; +using System.Runtime.Remoting; +using libsecondlife; +using OpenSim.Framework; + +namespace OpenSim.Region.Communications.OGS1 +{ + public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); + + public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); + + public delegate bool InformRegionPrimGroup(ulong regionHandle, LLUUID primID, LLVector3 Positon, bool isPhysical); + + public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); + + public delegate bool RegionUp(SearializableRegionInfo region, ulong regionhandle); + + public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate); + + public delegate bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID); + + public sealed class InterRegionSingleton + { + private static readonly InterRegionSingleton instance = new InterRegionSingleton(); + + public event InformRegionChild OnChildAgent; + public event ExpectArrival OnArrival; + public event InformRegionPrimGroup OnPrimGroupNear; + public event PrimGroupArrival OnPrimGroupArrival; + public event RegionUp OnRegionUp; + public event ChildAgentUpdate OnChildAgentUpdate; + public event TellRegionToCloseChildConnection OnTellRegionToCloseChildConnection; + + private InformRegionChild handler001 = null; // OnChildAgent; + private ExpectArrival handler002 = null; // OnArrival; + private InformRegionPrimGroup handler003 = null; // OnPrimGroupNear; + private PrimGroupArrival handler004 = null; // OnPrimGroupArrival; + private RegionUp handler005 = null; // OnRegionUp; + private ChildAgentUpdate handler006 = null; // OnChildAgentUpdate; + private TellRegionToCloseChildConnection handler007 = null; // OnTellRegionToCloseChildConnection; + + + static InterRegionSingleton() + { + } + + private InterRegionSingleton() + { + } + + public static InterRegionSingleton Instance + { + get { return instance; } + } + + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + handler001 = OnChildAgent; + if (handler001 != null) + { + return handler001(regionHandle, agentData); + } + return false; + } + + public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) + { + handler005 = OnRegionUp; + if (handler005 != null) + { + return handler005(sregion, regionhandle); + } + return false; + } + + public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate) + { + handler006 = OnChildAgentUpdate; + if (handler006 != null) + { + return handler006(regionHandle, cAgentUpdate); + } + return false; + } + + public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) + { + handler002 = OnArrival; + if (handler002 != null) + { + return handler002(regionHandle, agentID, position, isFlying); + } + return false; + } + + public bool InformRegionPrim(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) + { + handler003 = OnPrimGroupNear; + if (handler003 != null) + { + return handler003(regionHandle, primID, position, isPhysical); + } + return false; + } + + public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData) + { + handler004 = OnPrimGroupArrival; + if (handler004 != null) + { + return handler004(regionHandle, primID, objData); + } + return false; + } + + public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) + { + handler007 = OnTellRegionToCloseChildConnection; + if (handler007 != null) + { + return handler007(regionHandle, agentID); + } + return false; + } + } + + public class OGS1InterRegionRemoting : MarshalByRefObject + { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + + public OGS1InterRegionRemoting() + { + } + + public bool InformRegionOfChildAgent(ulong regionHandle, sAgentCircuitData agentData) + { + try + { + return + InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData)); + } + catch (RemotingException e) + { + Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + } + + public bool RegionUp(SearializableRegionInfo region, ulong regionhandle) + { + try + { + return InterRegionSingleton.Instance.RegionUp(region, regionhandle); + } + catch (RemotingException e) + { + Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + } + + public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) + { + try + { + return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle, cAgentData); + } + catch (RemotingException e) + { + Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString()); + return false; + } + } + + + public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying) + { + try + { + return + InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new LLUUID(agentID), + new LLVector3(position.x, position.y, position.z), + isFlying); + } + catch (RemotingException e) + { + Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + } + + public bool InformRegionPrim(ulong regionHandle, Guid SceneObjectGroupID, sLLVector3 position, bool isPhysical) + { + try + { + return + InterRegionSingleton.Instance.InformRegionPrim(regionHandle, new LLUUID(SceneObjectGroupID), + new LLVector3(position.x, position.y, position.z), + isPhysical); + } + catch (RemotingException e) + { + Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + } + + public bool InformRegionOfPrimCrossing(ulong regionHandle, Guid primID, string objData) + { + try + { + return InterRegionSingleton.Instance.ExpectPrimCrossing(regionHandle, new LLUUID(primID), objData); + } + catch (RemotingException e) + { + Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + } + + public bool TellRegionToCloseChildConnection(ulong regionHandle, Guid agentID) + { + try + { + return InterRegionSingleton.Instance.TellRegionToCloseChildConnection(regionHandle, new LLUUID(agentID)); + } + catch (RemotingException) + { + m_log.Info("[INTERREGION]: Remoting Error: Unable to connect to remote region: " + regionHandle.ToString()); + return false; + } + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 1521092c4b..067dc43459 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -1,191 +1,208 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using libsecondlife; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; - -namespace OpenSim.Region.Communications.OGS1 -{ - public class OGS1InventoryService : IInventoryServices - { - private string _inventoryServerUrl; - private Dictionary m_RequestingInventory = new Dictionary(); - - public OGS1InventoryService(string inventoryServerUrl) - { - _inventoryServerUrl = inventoryServerUrl; - } - - #region IInventoryServices Members - - // See IInventoryServices - public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, - InventoryItemInfo itemCallBack) - { - if (!m_RequestingInventory.ContainsKey(userID)) - { - InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack); - m_RequestingInventory.Add(userID, request); - RequestInventory(userID); - } - } - - /// - /// Request the entire user's inventory (folders and items) from the inventory server. - /// - /// XXX May want to change this so that we don't end up shuffling over data which might prove - /// entirely unnecessary. - /// - /// - private void RequestInventory(LLUUID userID) - { - try - { - MainLog.Instance.Verbose( - "INVENTORY", "Requesting inventory from {0}/GetInventory/ for user {1}", - _inventoryServerUrl, userID); - - RestObjectPosterResponse requester - = new RestObjectPosterResponse(); - requester.ResponseCallback = InventoryResponse; - - requester.BeginPostObject(_inventoryServerUrl + "/GetInventory/", userID.UUID); - } - catch (Exception e) - { - MainLog.Instance.Error("INVENTORY", e.ToString()); - } - } - - /// - /// Callback used by the inventory server GetInventory request - /// - /// - private void InventoryResponse(InventoryCollection response) - { - LLUUID userID = response.UserID; - if (m_RequestingInventory.ContainsKey(userID)) - { - MainLog.Instance.Verbose("INVENTORY", - "Received inventory response for user {0} containing {1} folders and {2} items", - userID, response.Folders.Count, response.AllItems.Count); - - InventoryFolderImpl rootFolder = null; - InventoryRequest request = m_RequestingInventory[userID]; - foreach (InventoryFolderBase folder in response.Folders) - { - if (folder.parentID == LLUUID.Zero) - { - InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); - rootFolder = newfolder; - request.FolderCallBack(userID, newfolder); - } - } - - if (rootFolder != null) - { - foreach (InventoryFolderBase folder in response.Folders) - { - if (folder.folderID != rootFolder.folderID) - { - InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); - request.FolderCallBack(userID, newfolder); - } - } - - foreach (InventoryItemBase item in response.AllItems) - { - request.ItemCallBack(userID, item); - } - } - m_RequestingInventory.Remove(userID); - } - else - { - MainLog.Instance.Warn( - "INVENTORY", - "Received inventory response for {0} for which we do not have a record of requesting!", - userID); - } - } - - public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) - { - SynchronousRestObjectPoster.BeginPostObject( - "POST", _inventoryServerUrl + "/NewFolder/", folder); - } - - public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder) - { - SynchronousRestObjectPoster.BeginPostObject( - "POST", _inventoryServerUrl + "/MoveFolder/", folder); - } - - public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) - { - SynchronousRestObjectPoster.BeginPostObject( - "POST", _inventoryServerUrl + "/NewItem/", item); - } - - public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) - { - SynchronousRestObjectPoster.BeginPostObject( - "POST", _inventoryServerUrl + "/DeleteItem/", item); - } - - public void CreateNewUserInventory(LLUUID user) - { - } - - public List RequestFirstLevelFolders(LLUUID userID) - { - return new List(); - } - - #endregion - - public class InventoryRequest - { - public LLUUID UserID; - public InventoryFolderInfo FolderCallBack; - public InventoryItemInfo ItemCallBack; - - public InventoryRequest(LLUUID userId, InventoryFolderInfo folderCall, InventoryItemInfo itemCall) - { - UserID = userId; - FolderCallBack = folderCall; - ItemCallBack = itemCall; - } - } - } -} \ No newline at end of file +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using libsecondlife; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Communications.Cache; +using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; + +namespace OpenSim.Region.Communications.OGS1 +{ + public class OGS1InventoryService : IInventoryServices + { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + + private string _inventoryServerUrl; + private Dictionary m_RequestingInventory = new Dictionary(); + + public OGS1InventoryService(string inventoryServerUrl) + { + _inventoryServerUrl = inventoryServerUrl; + } + + #region IInventoryServices Members + + // See IInventoryServices + public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, + InventoryItemInfo itemCallBack) + { + if (!m_RequestingInventory.ContainsKey(userID)) + { + InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack); + m_RequestingInventory.Add(userID, request); + RequestInventory(userID); + } + } + + /// + /// Request the entire user's inventory (folders and items) from the inventory server. + /// + /// XXX May want to change this so that we don't end up shuffling over data which might prove + /// entirely unnecessary. + /// + /// + private void RequestInventory(LLUUID userID) + { + try + { + m_log.InfoFormat( + "[INVENTORY]: Requesting inventory from {0}/GetInventory/ for user {1}", + _inventoryServerUrl, userID); + + RestObjectPosterResponse requester + = new RestObjectPosterResponse(); + requester.ResponseCallback = InventoryResponse; + + requester.BeginPostObject(_inventoryServerUrl + "/GetInventory/", userID.UUID); + } + catch (Exception e) + { + m_log.Error("[INVENTORY]: " + e.ToString()); + } + } + + /// + /// Callback used by the inventory server GetInventory request + /// + /// + private void InventoryResponse(InventoryCollection response) + { + LLUUID userID = response.UserID; + if (m_RequestingInventory.ContainsKey(userID)) + { + m_log.InfoFormat("[INVENTORY]: " + + "Received inventory response for user {0} containing {1} folders and {2} items", + userID, response.Folders.Count, response.AllItems.Count); + + InventoryFolderImpl rootFolder = null; + InventoryRequest request = m_RequestingInventory[userID]; + foreach (InventoryFolderBase folder in response.Folders) + { + if (folder.parentID == LLUUID.Zero) + { + InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); + rootFolder = newfolder; + request.FolderCallBack(userID, newfolder); + } + } + + if (rootFolder != null) + { + foreach (InventoryFolderBase folder in response.Folders) + { + if (folder.folderID != rootFolder.folderID) + { + InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); + request.FolderCallBack(userID, newfolder); + } + } + + foreach (InventoryItemBase item in response.AllItems) + { + request.ItemCallBack(userID, item); + } + } + m_RequestingInventory.Remove(userID); + } + else + { + m_log.WarnFormat( + "[INVENTORY]: " + + "Received inventory response for {0} for which we do not have a record of requesting!", + userID); + } + } + + public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) + { + SynchronousRestObjectPoster.BeginPostObject( + "POST", _inventoryServerUrl + "/NewFolder/", folder); + } + + public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder) + { + SynchronousRestObjectPoster.BeginPostObject( + "POST", _inventoryServerUrl + "/MoveFolder/", folder); + } + + public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) + { + SynchronousRestObjectPoster.BeginPostObject( + "POST", _inventoryServerUrl + "/NewItem/", item); + } + + public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) + { + SynchronousRestObjectPoster.BeginPostObject( + "POST", _inventoryServerUrl + "/DeleteItem/", item); + } + + public bool HasInventoryForUser(LLUUID userID) + { + return false; + } + + public InventoryFolderBase RequestRootFolder(LLUUID userID) + { + return null; + } + + public virtual InventoryFolderBase RequestNamedFolder(LLUUID userID, string folderName) + { + return null; + } + + public void CreateNewUserInventory(LLUUID user) + { + } + + public List RequestFirstLevelFolders(LLUUID userID) + { + return new List(); + } + + #endregion + + public class InventoryRequest + { + public LLUUID UserID; + public InventoryFolderInfo FolderCallBack; + public InventoryItemInfo ItemCallBack; + + public InventoryRequest(LLUUID userId, InventoryFolderInfo folderCall, InventoryItemInfo itemCall) + { + UserID = userId; + FolderCallBack = folderCall; + ItemCallBack = itemCall; + } + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 54caeafdb5..57b04cc850 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -1,502 +1,534 @@ -/* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Net; -using System.Text.RegularExpressions; -using libsecondlife; -using Nwc.XmlRpc; -using OpenSim.Framework; -using OpenSim.Framework.Console; - -namespace OpenSim.Region.Communications.OGS1 -{ - public class OGS1UserServices : IUserService - { - private CommunicationsOGS1 m_parent; - - public OGS1UserServices(CommunicationsOGS1 parent) - { - m_parent = parent; - } - - public void UpdateUserAgentData(LLUUID agentId, bool agentOnline, LLVector3 currentPos, int logoutTime, string authAddr) - { - try - { - Hashtable param = new Hashtable(); - param["agentID"] = agentId.ToString(); - param["agentOnline"] = agentOnline.ToString(); - param["logoutTime"] = logoutTime.ToString(); - param["agent_currentPosX"] = Convert.ToSingle(currentPos.X).ToString(); - param["agent_currentPosY"] = Convert.ToSingle(currentPos.Y).ToString(); - param["agent_currentPosZ"] = Convert.ToSingle(currentPos.Z).ToString(); - param["AuthenticationAddress"] = authAddr; - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("update_user_agent", parameters); - XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - - if ("success" == (string)respData["update"]) - { - MainLog.Instance.Verbose("INTERGRID", "Agent updated with agentID : " + agentId); - } - - } - catch (WebException e) - { - MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " + - e.Message); - } - } - - - public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) - { - if (data.Contains("error_type")) - { - MainLog.Instance.Warn("GRID", - "Error sent by user server when trying to get user profile: (" + - data["error_type"] + - "): " + data["error_desc"]); - return null; - } - - UserProfileData userData = new UserProfileData(); - userData.username = (string) data["firstname"]; - userData.surname = (string) data["lastname"]; - userData.UUID = new LLUUID((string) data["uuid"]); - userData.userInventoryURI = (string) data["server_inventory"]; - userData.userAssetURI = (string) data["server_asset"]; - userData.profileFirstText = (string) data["profile_firstlife_about"]; - userData.profileFirstImage = new LLUUID((string) data["profile_firstlife_image"]); - userData.profileCanDoMask = Convert.ToUInt32((string) data["profile_can_do"]); - userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]); - userData.profileImage = new LLUUID((string) data["profile_image"]); - userData.lastLogin = Convert.ToInt32((string) data["profile_lastlogin"]); - userData.homeRegion = Convert.ToUInt64((string) data["home_region"]); - userData.homeLocation = - new LLVector3((float) Convert.ToDecimal((string) data["home_coordinates_x"]), - (float) Convert.ToDecimal((string) data["home_coordinates_y"]), - (float) Convert.ToDecimal((string) data["home_coordinates_z"])); - userData.homeLookAt = - new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]), - (float) Convert.ToDecimal((string) data["home_look_y"]), - (float) Convert.ToDecimal((string) data["home_look_z"])); - - return userData; - } - - public List ConvertXMLRPCDataToAvatarPickerList(LLUUID queryID, Hashtable data) - { - List pickerlist = new List(); - int pickercount = Convert.ToInt32((string) data["avcount"]); - LLUUID respqueryID = new LLUUID((string) data["queryid"]); - if (queryID == respqueryID) - { - for (int i = 0; i < pickercount; i++) - { - AvatarPickerAvatar apicker = new AvatarPickerAvatar(); - LLUUID avatarID = new LLUUID((string) data["avatarid" + i.ToString()]); - string firstname = (string) data["firstname" + i.ToString()]; - string lastname = (string) data["lastname" + i.ToString()]; - apicker.AvatarID = avatarID; - apicker.firstName = firstname; - apicker.lastName = lastname; - pickerlist.Add(apicker); - } - } - else - { - MainLog.Instance.Warn("INTERGRID", "Got invalid queryID from userServer"); - } - return pickerlist; - } - - public List ConvertXMLRPCDataToFriendListItemList(Hashtable data) - { - List buddylist = new List(); - int buddycount = Convert.ToInt32((string)data["avcount"]); - - - for (int i = 0; i < buddycount; i++) - { - FriendListItem buddylistitem = new FriendListItem(); - - buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]); - buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]); - buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); - buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); - - buddylist.Add(buddylistitem); - } - - - return buddylist; - } - - public UserProfileData GetUserProfile(string firstName, string lastName, string authAddr) - { - return GetUserProfile(firstName + " " + lastName, authAddr); - } - - public UserProfileData GetUserProfile(string name, string authAddr) - { - try - { - Hashtable param = new Hashtable(); - param["avatar_name"] = name; - param["AuthenticationAddress"] = authAddr; - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); - XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - - return ConvertXMLRPCDataToUserProfile(respData); - } - catch (WebException e) - { - MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " + - e.Message); - } - return null; - } - - - public List GenerateAgentPickerRequestResponse(LLUUID queryID, string query) - { - List pickerlist = new List(); - Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9 ]"); - try - { - Hashtable param = new Hashtable(); - param["queryid"] = (string) queryID.ToString(); - param["avquery"] = objAlphaNumericPattern.Replace(query, ""); - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_avatar_picker_avatar", parameters); - XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable) resp.Value; - pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID, respData); - } - catch (WebException e) - { - MainLog.Instance.Warn("Error when trying to fetch Avatar Picker Response: " + - e.Message); - // Return Empty picker list (no results) - } - return pickerlist; - } - - - public UserProfileData GetUserProfile(LLUUID avatarID, string authAddr) - { - try - { - Hashtable param = new Hashtable(); - param["avatar_uuid"] = avatarID.ToString(); - param["AuthenticationAddress"] = authAddr; - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); - XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable) resp.Value; - - return ConvertXMLRPCDataToUserProfile(respData); - } - catch (Exception e) - { - Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + - e.Message); - } - return null; - } - - public UserProfileData GetUserProfileByAccount(string account) - { - return null; - } - - public void clearUserAgent(LLUUID avatarID, string authAddr) - { - try - { - Hashtable param = new Hashtable(); - param["agentID"] = avatarID.ToString(); - param["AuthenticationAddress"] = authAddr; - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("remove_user_agent", parameters); - XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - - Hashtable resh = (Hashtable)resp.Value; - if ("success" == (string)resh["remove"]) - { - MainLog.Instance.Verbose("INTERGRID", "Agent removed with agentID : " + avatarID); - } - } - catch (Exception e) - { - Console.WriteLine("Error when trying to remove agent data by uuid from remote user server: " + - e.Message); - } - } - - public UserProfileData SetupMasterUser(string firstName, string lastName) - { - return SetupMasterUser(firstName, lastName, ""); - } - - public UserProfileData SetupMasterUser(string firstName, string lastName, string password) - { - UserProfileData profile = GetUserProfile(firstName, lastName, ""); - return profile; - } - - public UserProfileData SetupMasterUser(LLUUID uuid) - { - UserProfileData data = GetUserProfile(uuid, ""); - if (data == null) - { - throw new Exception("Unknown master user UUID"); - } - return data; - } - - public LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) - { - throw new Exception("The method or operation is not implemented."); - } - - #region IUserServices Friend Methods - /// - /// Adds a new friend to the database for XUser - /// - /// The agent that who's friends list is being added to - /// The agent that being added to the friends list of the friends list owner - /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects - public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) - { - try - { - Hashtable param = new Hashtable(); - param["ownerID"] = friendlistowner.UUID.ToString(); - param["friendID"] = friend.UUID.ToString(); - param["friendPerms"] = perms.ToString(); - IList parameters = new ArrayList(); - parameters.Add(param); - - XmlRpcRequest req = new XmlRpcRequest("add_new_user_friend", parameters); - XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - if (respData != null) - { - if (respData.Contains("returnString")) - { - if ((string)respData["returnString"] == "TRUE") - { - - } - else - { - MainLog.Instance.Warn("GRID", "Unable to add new friend, User Server Reported an issue"); - } - } - else - { - MainLog.Instance.Warn("GRID", "Unable to add new friend, UserServer didn't understand me!"); - } - } - else - { - MainLog.Instance.Warn("GRID", "Unable to add new friend, UserServer didn't understand me!"); - - } - } - catch (WebException e) - { - MainLog.Instance.Warn("GRID","Error when trying to AddNewUserFriend: " + - e.Message); - - } - - } - - /// - /// Delete friend on friendlistowner's friendlist. - /// - /// The agent that who's friends list is being updated - /// The Ex-friend agent - public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) - { - try - { - Hashtable param = new Hashtable(); - param["ownerID"] = friendlistowner.UUID.ToString(); - param["friendID"] = friend.UUID.ToString(); - - - IList parameters = new ArrayList(); - parameters.Add(param); - - XmlRpcRequest req = new XmlRpcRequest("remove_user_friend", parameters); - XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - if (respData != null) - { - if (respData.Contains("returnString")) - { - if ((string)respData["returnString"] == "TRUE") - { - - } - else - { - MainLog.Instance.Warn("GRID", "Unable to remove friend, User Server Reported an issue"); - } - } - else - { - MainLog.Instance.Warn("GRID", "Unable to remove friend, UserServer didn't understand me!"); - } - } - else - { - MainLog.Instance.Warn("GRID", "Unable to remove friend, UserServer didn't understand me!"); - - } - } - catch (WebException e) - { - MainLog.Instance.Warn("GRID", "Error when trying to RemoveUserFriend: " + - e.Message); - - } - } - - /// - /// Update permissions for friend on friendlistowner's friendlist. - /// - /// The agent that who's friends list is being updated - /// The agent that is getting or loosing permissions - /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects - public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) - { - try - { - Hashtable param = new Hashtable(); - param["ownerID"] = friendlistowner.UUID.ToString(); - param["friendID"] = friend.UUID.ToString(); - param["friendPerms"] = perms.ToString(); - IList parameters = new ArrayList(); - parameters.Add(param); - - XmlRpcRequest req = new XmlRpcRequest("update_user_friend_perms", parameters); - XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - if (respData != null) - { - if (respData.Contains("returnString")) - { - if ((string)respData["returnString"] == "TRUE") - { - - } - else - { - MainLog.Instance.Warn("GRID", "Unable to update_user_friend_perms, User Server Reported an issue"); - } - } - else - { - MainLog.Instance.Warn("GRID", "Unable to update_user_friend_perms, UserServer didn't understand me!"); - } - } - else - { - MainLog.Instance.Warn("GRID", "Unable to update_user_friend_perms, UserServer didn't understand me!"); - - } - } - catch (WebException e) - { - MainLog.Instance.Warn("GRID", "Error when trying to update_user_friend_perms: " + - e.Message); - - } - } - /// - /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner - /// - /// The agent that we're retreiving the friends Data. - public List GetUserFriendList(LLUUID friendlistowner) - { - List buddylist = new List(); - - try - { - Hashtable param = new Hashtable(); - param["ownerID"] = friendlistowner.UUID.ToString(); - - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); - XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable) resp.Value; - - if (respData.Contains("avcount")) - { - buddylist = ConvertXMLRPCDataToFriendListItemList(respData); - } - - } - catch (WebException e) - { - MainLog.Instance.Warn("Error when trying to fetch Avatar's friends list: " + - e.Message); - // Return Empty list (no friends) - } - return buddylist; - - } - - #endregion - - public virtual bool AuthenticateUser(LLUUID agentId, String sessionhash, out String avatarstorage) - { - avatarstorage = ""; - return true; - } - - } -} \ No newline at end of file +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Net; +using System.Text.RegularExpressions; +using libsecondlife; +using Nwc.XmlRpc; +using OpenSim.Framework; +using OpenSim.Framework.Console; + +namespace OpenSim.Region.Communications.OGS1 +{ + public class OGS1UserServices : IUserService + { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + + private CommunicationsOGS1 m_parent; + + public OGS1UserServices(CommunicationsOGS1 parent) + { + m_parent = parent; + } + + public void UpdateUserAgentData(LLUUID agentId, bool agentOnline, LLVector3 currentPos, int logoutTime, string authAddr) + { + try + { + Hashtable param = new Hashtable(); + param["agentID"] = agentId.ToString(); + param["agentOnline"] = agentOnline.ToString(); + param["logoutTime"] = logoutTime.ToString(); + param["agent_currentPosX"] = Convert.ToSingle(currentPos.X).ToString(); + param["agent_currentPosY"] = Convert.ToSingle(currentPos.Y).ToString(); + param["agent_currentPosZ"] = Convert.ToSingle(currentPos.Z).ToString(); + param["AuthenticationAddress"] = authAddr; + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("update_user_agent", parameters); + XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + + if ("success" == (string)respData["update"]) + { + MainLog.Instance.Verbose("INTERGRID", "Agent updated with agentID : " + agentId); + } + + } + catch (WebException e) + { + MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " + + e.Message); + } + } + + + public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) + { + if (data.Contains("error_type")) + { + m_log.Warn("[GRID]: " + + "Error sent by user server when trying to get user profile: (" + + data["error_type"] + + "): " + data["error_desc"]); + return null; + } + + UserProfileData userData = new UserProfileData(); + userData.username = (string) data["firstname"]; + userData.surname = (string) data["lastname"]; + userData.UUID = new LLUUID((string) data["uuid"]); + userData.userInventoryURI = (string) data["server_inventory"]; + userData.userAssetURI = (string) data["server_asset"]; + userData.profileFirstText = (string) data["profile_firstlife_about"]; + userData.profileFirstImage = new LLUUID((string) data["profile_firstlife_image"]); + userData.profileCanDoMask = Convert.ToUInt32((string) data["profile_can_do"]); + userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]); + userData.profileImage = new LLUUID((string) data["profile_image"]); + userData.lastLogin = Convert.ToInt32((string) data["profile_lastlogin"]); + userData.homeRegion = Convert.ToUInt64((string) data["home_region"]); + userData.homeLocation = + new LLVector3((float) Convert.ToDecimal((string) data["home_coordinates_x"]), + (float) Convert.ToDecimal((string) data["home_coordinates_y"]), + (float) Convert.ToDecimal((string) data["home_coordinates_z"])); + userData.homeLookAt = + new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]), + (float) Convert.ToDecimal((string) data["home_look_y"]), + (float) Convert.ToDecimal((string) data["home_look_z"])); + + return userData; + } + + public List ConvertXMLRPCDataToAvatarPickerList(LLUUID queryID, Hashtable data) + { + List pickerlist = new List(); + int pickercount = Convert.ToInt32((string) data["avcount"]); + LLUUID respqueryID = new LLUUID((string) data["queryid"]); + if (queryID == respqueryID) + { + for (int i = 0; i < pickercount; i++) + { + AvatarPickerAvatar apicker = new AvatarPickerAvatar(); + LLUUID avatarID = new LLUUID((string) data["avatarid" + i.ToString()]); + string firstname = (string) data["firstname" + i.ToString()]; + string lastname = (string) data["lastname" + i.ToString()]; + apicker.AvatarID = avatarID; + apicker.firstName = firstname; + apicker.lastName = lastname; + pickerlist.Add(apicker); + } + } + else + { + m_log.Warn("[INTERGRID]: Got invalid queryID from userServer"); + } + return pickerlist; + } + + public List ConvertXMLRPCDataToFriendListItemList(Hashtable data) + { + List buddylist = new List(); + int buddycount = Convert.ToInt32((string)data["avcount"]); + + + for (int i = 0; i < buddycount; i++) + { + FriendListItem buddylistitem = new FriendListItem(); + + buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]); + buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]); + buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); + buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); + + buddylist.Add(buddylistitem); + } + + + return buddylist; + } + + /// + /// Logs off a user on the user server + /// + /// UUID of the user + /// UUID of the Region + /// final position x + /// final position y + /// final position z + public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz) + { + Hashtable param = new Hashtable(); + param["avatar_uuid"] = userid.UUID.ToString(); + param["region_uuid"] = regionid.UUID.ToString(); + param["region_handle"] = regionhandle.ToString(); + param["region_pos_x"] = posx.ToString(); + param["region_pos_y"] = posy.ToString(); + param["region_pos_z"] = posz.ToString(); + + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("logout_of_simulator", parameters); + try + { + XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); + } + catch (System.Net.WebException) + { + m_log.Warn("[LOGOFF]: Unable to notify grid server of user logoff"); + } + + + } + public UserProfileData GetUserProfile(string firstName, string lastName) + { + return GetUserProfile(firstName + " " + lastName, authAddr); + } + + public UserProfileData GetUserProfile(string name, string authAddr) + { + try + { + Hashtable param = new Hashtable(); + param["avatar_name"] = name; + param["AuthenticationAddress"] = authAddr; + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); + XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + + return ConvertXMLRPCDataToUserProfile(respData); + } + catch (WebException e) + { + MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " + + e.Message); + } + return null; + } + + + public List GenerateAgentPickerRequestResponse(LLUUID queryID, string query) + { + List pickerlist = new List(); + Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9 ]"); + try + { + Hashtable param = new Hashtable(); + param["queryid"] = (string) queryID.ToString(); + param["avquery"] = objAlphaNumericPattern.Replace(query, String.Empty); + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_avatar_picker_avatar", parameters); + XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable) resp.Value; + pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID, respData); + } + catch (WebException e) + { + m_log.Warn("Error when trying to fetch Avatar Picker Response: " + + e.Message); + // Return Empty picker list (no results) + } + return pickerlist; + } + + + public UserProfileData GetUserProfile(LLUUID avatarID, string authAddr) + { + try + { + Hashtable param = new Hashtable(); + param["avatar_uuid"] = avatarID.ToString(); + param["AuthenticationAddress"] = authAddr; + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); + XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable) resp.Value; + + return ConvertXMLRPCDataToUserProfile(respData); + } + catch (Exception e) + { + m_log.Warn("Error when trying to fetch profile data by name from remote user server: " + + e.Message); + } + return null; + } + + public UserProfileData GetUserProfileByAccount(string account) + { + return null; + } + + public void clearUserAgent(LLUUID avatarID, string authAddr) + { + try + { + Hashtable param = new Hashtable(); + param["agentID"] = avatarID.ToString(); + param["AuthenticationAddress"] = authAddr; + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("remove_user_agent", parameters); + XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + + Hashtable resh = (Hashtable)resp.Value; + if ("success" == (string)resh["remove"]) + { + MainLog.Instance.Verbose("INTERGRID", "Agent removed with agentID : " + avatarID); + } + } + catch (Exception e) + { + Console.WriteLine("Error when trying to remove agent data by uuid from remote user server: " + + e.Message); + } + } + + public UserProfileData SetupMasterUser(string firstName, string lastName) + { + return SetupMasterUser(firstName, lastName, String.Empty); + } + + public UserProfileData SetupMasterUser(string firstName, string lastName, string password) + { + UserProfileData profile = GetUserProfile(firstName, lastName, ""); + return profile; + } + + public UserProfileData SetupMasterUser(LLUUID uuid) + { + UserProfileData data = GetUserProfile(uuid, ""); + if (data == null) + { + throw new Exception("Unknown master user UUID"); + } + return data; + } + + public LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) + { + throw new Exception("The method or operation is not implemented."); + } + + #region IUserServices Friend Methods + /// + /// Adds a new friend to the database for XUser + /// + /// The agent that who's friends list is being added to + /// The agent that being added to the friends list of the friends list owner + /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects + public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) + { + try + { + Hashtable param = new Hashtable(); + param["ownerID"] = friendlistowner.UUID.ToString(); + param["friendID"] = friend.UUID.ToString(); + param["friendPerms"] = perms.ToString(); + IList parameters = new ArrayList(); + parameters.Add(param); + + XmlRpcRequest req = new XmlRpcRequest("add_new_user_friend", parameters); + XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + if (respData != null) + { + if (respData.Contains("returnString")) + { + if ((string)respData["returnString"] == "TRUE") + { + + } + else + { + m_log.Warn("[GRID]: Unable to add new friend, User Server Reported an issue"); + } + } + else + { + m_log.Warn("[GRID]: Unable to add new friend, UserServer didn't understand me!"); + } + } + else + { + m_log.Warn("[GRID]: Unable to add new friend, UserServer didn't understand me!"); + + } + } + catch (WebException e) + { + m_log.Warn("[GRID]: Error when trying to AddNewUserFriend: " + + e.Message); + + } + + } + + /// + /// Delete friend on friendlistowner's friendlist. + /// + /// The agent that who's friends list is being updated + /// The Ex-friend agent + public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) + { + try + { + Hashtable param = new Hashtable(); + param["ownerID"] = friendlistowner.UUID.ToString(); + param["friendID"] = friend.UUID.ToString(); + + + IList parameters = new ArrayList(); + parameters.Add(param); + + XmlRpcRequest req = new XmlRpcRequest("remove_user_friend", parameters); + XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + if (respData != null) + { + if (respData.Contains("returnString")) + { + if ((string)respData["returnString"] == "TRUE") + { + + } + else + { + m_log.Warn("[GRID]: Unable to remove friend, User Server Reported an issue"); + } + } + else + { + m_log.Warn("[GRID]: Unable to remove friend, UserServer didn't understand me!"); + } + } + else + { + m_log.Warn("[GRID]: Unable to remove friend, UserServer didn't understand me!"); + + } + } + catch (WebException e) + { + m_log.Warn("[GRID]: Error when trying to RemoveUserFriend: " + + e.Message); + + } + } + + /// + /// Update permissions for friend on friendlistowner's friendlist. + /// + /// The agent that who's friends list is being updated + /// The agent that is getting or loosing permissions + /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects + public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) + { + try + { + Hashtable param = new Hashtable(); + param["ownerID"] = friendlistowner.UUID.ToString(); + param["friendID"] = friend.UUID.ToString(); + param["friendPerms"] = perms.ToString(); + IList parameters = new ArrayList(); + parameters.Add(param); + + XmlRpcRequest req = new XmlRpcRequest("update_user_friend_perms", parameters); + XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + if (respData != null) + { + if (respData.Contains("returnString")) + { + if ((string)respData["returnString"] == "TRUE") + { + + } + else + { + m_log.Warn("[GRID]: Unable to update_user_friend_perms, User Server Reported an issue"); + } + } + else + { + m_log.Warn("[GRID]: Unable to update_user_friend_perms, UserServer didn't understand me!"); + } + } + else + { + m_log.Warn("[GRID]: Unable to update_user_friend_perms, UserServer didn't understand me!"); + + } + } + catch (WebException e) + { + m_log.Warn("[GRID]: Error when trying to update_user_friend_perms: " + + e.Message); + } + } + /// + /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner + /// + /// The agent that we're retreiving the friends Data. + public List GetUserFriendList(LLUUID friendlistowner) + { + List buddylist = new List(); + + try + { + Hashtable param = new Hashtable(); + param["ownerID"] = friendlistowner.UUID.ToString(); + + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); + XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable) resp.Value; + + if (respData.Contains("avcount")) + { + buddylist = ConvertXMLRPCDataToFriendListItemList(respData); + } + + } + catch (WebException e) + { + m_log.Warn("Error when trying to fetch Avatar's friends list: " + + e.Message); + // Return Empty list (no friends) + } + return buddylist; + } + + #endregion + + public virtual bool AuthenticateUser(LLUUID agentId, String sessionhash, out String avatarstorage) + { + avatarstorage = ""; + return true; + } + + } +} diff --git a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs index d17ffb289e..4c042d0c6e 100644 --- a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs @@ -1,38 +1,66 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly : AssemblyTitle("OpenGrid.Framework.Communications.OGS1")] -[assembly : AssemblyDescription("")] -[assembly : AssemblyConfiguration("")] -[assembly : AssemblyCompany("")] -[assembly : AssemblyProduct("OpenGrid.Framework.Communications.OGS1")] -[assembly : AssemblyCopyright("Copyright © 2007")] -[assembly : AssemblyTrademark("")] -[assembly : AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. - -[assembly : ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM - -[assembly : Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +/* +* Copyright (c) Contributors, http://opensimulator.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly : AssemblyTitle("OpenGrid.Framework.Communications.OGS1")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenGrid.Framework.Communications.OGS1")] +[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly : ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly : Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly : AssemblyVersion("1.0.0.0")] +[assembly : AssemblyFileVersion("1.0.0.0")]