Пример #1
0
        internal void SendIncomingAgent(ConnectionIdentifier connection, UUID userID, UUID regionID)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["METHOD"] = "sendincomingagent";
            sendData["USERID"] = userID;
            sendData["REGIONID"] = regionID;

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                SynchronousRestFormsRequester.MakeRequest("POST",
                        connection.ConnectionPath + connection.ForeignURL, //The full secure URL
                        reqString);
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[IWCOutgoingConnector]: Exception when contacting server: {0}", e.Message);
            }
        }
Пример #2
0
        internal UserAccount GetUserAccount(ConnectionIdentifier connection, UUID userID)
        {
            Dictionary<string, object> sendData = new Dictionary<string,object>();

            sendData["METHOD"] = "getuseraccount";
            sendData["USERID"] = userID;

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        connection.ConnectionPath + connection.ForeignURL, //The full secure URL
                        reqString);

                if (reply != string.Empty)
                {
                    Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                    if (replyData != null)
                    {
                        UserAccount account = new UserAccount(replyData);
                        return account;
                    }
                    else
                    {
                        m_log.Warn("[IWC]: Unable to connect successfully to " + connection.ConnectionPath);
                    }
                }
                else
                {
                    m_log.Warn("[IWC]: Unable to connect successfully to " + connection.ConnectionPath);
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[IWCOutgoingConnector]: Exception when contacting server: {0}", e.Message);
            }
            return null;
        }
Пример #3
0
 public IWCIncomingPrivateConnection(IWComms iwc, string URL, ConnectionIdentifier connection) :
     base("POST", URL)
 {
     IWC = iwc;
     Connection = connection;
 }
Пример #4
0
        /// <summary>
        /// This contacts the foreign server and sends all the SimMaps of the local regions 
        /// to the foreign server. This will either get back a refused connection, or a 
        /// successful connection with a List of SimMap's that are that server's local regions
        /// </summary>
        /// <param name="connection">Foreign server to connect to</param>
        public bool GetRegions(ConnectionIdentifier connection)
        {
            Dictionary<string, object> sendData = IWC.BuildOurLocalRegions();

            sendData["METHOD"] = "getregions";

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        connection.ConnectionPath + connection.ForeignURL, //The full secure URL
                        reqString);

                if (reply != string.Empty)
                {
                    Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                    if (replyData != null)
                    {
                        IWC.RetriveOtherServersRegions(replyData);
                    }
                    else
                    {
                        m_log.Warn("[IWC]: Unable to connect successfully to " + connection.ConnectionPath);
                        return false;
                    }
                }
                else
                {
                    m_log.Warn("[IWC]: Unable to connect successfully to " + connection.ConnectionPath);
                    return false;
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[IWCOutgoingConnector]: Exception when contacting server: {0}", e.Message);
                return false;
            }
            return false;
        }
Пример #5
0
 private string BuildNewSecretURL(ConnectionIdentifier connector)
 {
     string URL = "/" + connector.SessionHash + "/" + UUID.Random() + "/";
     MainServer.Instance.AddStreamHandler(new IWCIncomingPrivateConnection(IWC, URL, connector));
     return URL;
 }
Пример #6
0
        /// <summary>
        /// This deals with incoming requests to add this server to their map.
        /// This refuses or successfully allows the foreign server to interact with
        /// this region.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private byte[] NewConnection(Dictionary<string, object> request)
        {
            ConnectionIdentifier connector = new ConnectionIdentifier(request);

            Dictionary<string, object> result = new Dictionary<string, object>();

            if (connector.ForeignPassword != IWC.OurPassword)
            {
                result["result"] = "WrongPassword";
            }

            result["result"] = "Successful";
            result["URL"] = BuildNewSecretURL(connector);

            return Return(result);
        }
Пример #7
0
        /// <summary>
        /// This contacts the foreign server and sends all the SimMaps of the local regions 
        /// to the foreign server. This will either get back a refused connection, or a 
        /// successful connection with a List of SimMap's that are that server's local regions
        /// </summary>
        /// <param name="connection">Foreign server to connect to</param>
        public bool AskOtherServerForConnection(ConnectionIdentifier connector)
        {
            Dictionary<string, object> sendData = IWC.BuildOurLocalRegions();

            sendData["Password"] = connector.ForeignPassword;
            foreach(KeyValuePair<string, object> pair in connector.ToKVP())
            {
                sendData.Add(pair.Key, pair.Value);
            }

            sendData["METHOD"] = "newconnection";

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        connector.ConnectionPath + "/iwcconnection",
                        reqString);

                if (reply != string.Empty)
                {
                    Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                    if (replyData != null)
                    {
                        if (!replyData.ContainsKey("result"))
                        {
                            m_log.Warn("[IWC]: Unable to connect successfully to " + connector.ConnectionPath + ", connection did not have all the required data.");
                            return false;
                        }

                        if (replyData["result"].ToString() == "Refused")
                        {
                            m_log.Warn("[IWC]: Unable to connect successfully to " + connector.ConnectionPath + ", the connection was refused.");
                            return false;
                        }

                        if (replyData["result"].ToString() == "WrongPassword")
                        {
                            m_log.Warn("[IWC]: Unable to connect successfully to " + connector.ConnectionPath + ", the foreign password was incorrect.");
                            return false;
                        }

                        if (replyData["result"].ToString() == "Successful")
                        {
                            connector.ForeignURL = (string)replyData["URL"];
                            m_log.Warn("[IWC]: Connected successfully to " + connector.ConnectionPath);
                            return true;
                        }
                    }
                    else
                    {
                        m_log.Warn("[IWC]: Unable to connect successfully to " + connector.ConnectionPath);
                        return false;
                    }
                }
                else
                {
                    m_log.Warn("[IWC]: Unable to connect successfully to " + connector.ConnectionPath);
                    return false;
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[IWCOutgoingConnector]: Exception when contacting server: {0}", e.Message);
                return false;
            }
            return false;
        }
Пример #8
0
 public void IncomingIWCBasedAgent(ConnectionIdentifier connection, UUID userID, UUID regionID)
 {
     /*bool success = */m_scenes[0].PresenceService.LoginAgent(userID.ToString(), UUID.Random(), UUID.Random());
     UserAccount account = OutgoingPrivateComms.GetUserAccount(connection, userID);
     m_scenes[0].UserAccountService.StoreUserAccount(account);
 }
Пример #9
0
 private List<ConnectionIdentifier> BuildConnections()
 {
     string connections = m_config.GetString("WorldsToInformOnStartup", "");
     string[] tempConn = connections.Split(',');
     string identifiers = m_config.GetString("WorldsToInformPasswords", "");
     string[] tempIdent = identifiers.Split(',');
     string trustLevels = m_config.GetString("WorldsToInformTrustLevels", "");
     string[] tempTrustLev = trustLevels.Split(',');
     int a = 0;
     List<ConnectionIdentifier> ConnectingTo = new List<ConnectionIdentifier>();
     foreach (string unnneeded in tempConn)
     {
         ConnectionIdentifier ident = new ConnectionIdentifier();
         ident.ConnectionPath = tempConn[a];
         ident.ForeignPassword = tempIdent[a];
         ident.TrustLevel = (TrustLevel)int.Parse(tempTrustLev[a]);
         ident.SessionHash = UUID.Random().ToString();
         ConnectingTo.Add(ident);
         a++;
     }
     return ConnectingTo;
 }