public HGInventoryServiceClient(string inventoryServerUrl, UserProfileCacheService userProfileCacheService, bool gridmode)
 {
     _inventoryServerUrl = HGNetworkServersInfo.ServerURI(inventoryServerUrl);
     //m_Uri = new Uri(_inventoryServerUrl);
     //m_userProfileCache = userProfileCacheService;
     m_gridmode = gridmode;
 }
Esempio n. 2
0
        /// <summary>
        /// Contructor.  Adds "expect_hg_user" and "check" xmlrpc method handlers
        /// </summary>
        /// <param name="servers_info"></param>
        /// <param name="httpServe"></param>
        public HGGridServices(NetworkServersInfo servers_info, BaseHttpServer httpServe, IAssetCache asscache, SceneManager sman)
        {
            serversInfo  = servers_info;
            httpServer   = httpServe;
            m_assetcache = asscache;
            m_sceneman   = sman;

            random = new Random();

            httpServer.AddXmlRPCHandler("link_region", LinkRegionRequest);
            httpServer.AddXmlRPCHandler("expect_hg_user", ExpectHGUser);

            HGNetworkServersInfo.Init(servers_info.AssetURL, servers_info.InventoryURL, servers_info.UserURL);
        }
Esempio n. 3
0
        protected bool IsGoingHome(CachedUserInfo uinfo, RegionInfo rinfo)
        {
            if (uinfo.UserProfile == null)
            {
                return(false);
            }

            string userUserServerURI = String.Empty;

            if (uinfo.UserProfile is ForeignUserProfileData)
            {
                userUserServerURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
            }

            return((uinfo.UserProfile.HomeRegionID == rinfo.RegionID) &&
                   (userUserServerURI != HGNetworkServersInfo.Singleton.LocalUserServerURI));
        }
        private string GetUserInventoryURI(UUID userID)
        {
            string invURI = _inventoryServerUrl;

            CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(userID);

            if ((uinfo == null) || (uinfo.UserProfile == null))
            {
                return(invURI);
            }

            string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);

            if ((userInventoryServerURI != null) &&
                (userInventoryServerURI != ""))
            {
                invURI = userInventoryServerURI;
            }
            return(invURI);
        }
        private bool IsLocalStandaloneUser(UUID userID)
        {
            if (m_userProfileCache == null)
            {
                return(false);
            }

            CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(userID);

            if (uinfo == null)
            {
                return(true);
            }

            string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);

            if ((!m_gridmode) && ((userInventoryServerURI == _inventoryServerUrl)) || (userInventoryServerURI == ""))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 6
0
        private bool IsLocalGridUser(UUID userID)
        {
            if (m_UserProfileService == null)
            {
                return(false);
            }

            CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID);

            if (uinfo == null)
            {
                return(true);
            }

            string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);

            if ((userInventoryServerURI == m_LocalGridInventoryURI) || (userInventoryServerURI == ""))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 7
0
        public bool InformRegionOfUser(RegionInfo regInfo, AgentCircuitData agentData)
        {
            //ulong regionHandle = regInfo.RegionHandle;
            try
            {
                //regionHandle = Convert.ToUInt64(regInfo.regionSecret);
                m_log.Info("[HGrid]: InformRegionOfUser: Remote hyperlinked region " + regInfo.regionSecret);
            }
            catch
            {
                m_log.Info("[HGrid]: InformRegionOfUser: Local grid region " + regInfo.regionSecret);
            }

            string    capsPath    = agentData.CapsPath;
            Hashtable loginParams = new Hashtable();

            loginParams["session_id"]        = agentData.SessionID.ToString();
            loginParams["secure_session_id"] = agentData.SecureSessionID.ToString();

            loginParams["firstname"] = agentData.firstname;
            loginParams["lastname"]  = agentData.lastname;

            loginParams["agent_id"]     = agentData.AgentID.ToString();
            loginParams["circuit_code"] = agentData.circuitcode.ToString();
            loginParams["startpos_x"]   = agentData.startpos.X.ToString();
            loginParams["startpos_y"]   = agentData.startpos.Y.ToString();
            loginParams["startpos_z"]   = agentData.startpos.Z.ToString();
            loginParams["caps_path"]    = capsPath;

            CachedUserInfo u = m_userProfileCache.GetUserDetails(agentData.AgentID);

            if (u != null && u.UserProfile != null)
            {
                loginParams["region_uuid"] = u.UserProfile.HomeRegionID.ToString(); // This seems to be always Zero
                //m_log.Debug("  --------- Home Region UUID -------");
                //m_log.Debug("  >> " + loginParams["region_uuid"] + " <<");
                //m_log.Debug("  --------- ---------------- -------");

                string serverURI = "";
                if (u.UserProfile is ForeignUserProfileData)
                {
                    serverURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)u.UserProfile).UserServerURI);
                }
                loginParams["userserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalUserServerURI : serverURI;

                serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserAssetURI);
                loginParams["assetserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalAssetServerURI : serverURI;

                serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserInventoryURI);
                loginParams["inventoryserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalInventoryServerURI : serverURI;

                loginParams["root_folder_id"] = u.UserProfile.RootInventoryFolderID;

                RegionInfo rinfo = RequestNeighbourInfo(u.UserProfile.HomeRegion);
                if (rinfo != null)
                {
                    loginParams["internal_port"] = rinfo.InternalEndPoint.Port.ToString();
                    if (!IsLocalUser(u))
                    {
                        loginParams["regionhandle"] = rinfo.regionSecret; // user.CurrentAgent.Handle.ToString();
                        //m_log.Debug("XXX--- informregionofuser (foreign user) here handle: " + rinfo.regionSecret);

                        loginParams["home_address"]  = ((ForeignUserProfileData)(u.UserProfile)).UserHomeAddress;
                        loginParams["home_port"]     = ((ForeignUserProfileData)(u.UserProfile)).UserHomePort;
                        loginParams["home_remoting"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomeRemotingPort;
                    }
                    else
                    {
                        //m_log.Debug("XXX--- informregionofuser (local user) here handle: " + rinfo.regionSecret);

                        //// local user about to jump out, let's process the name
                        // On second thoughts, let's not do this for the *user*; let's only do it for the *agent*
                        //loginParams["firstname"] = agentData.firstname + "." + agentData.lastname;
                        //loginParams["lastname"] = serversInfo.UserURL;

                        // local user, first time out. let's ask the grid about this user's home region
                        loginParams["regionhandle"] = u.UserProfile.HomeRegion.ToString(); // user.CurrentAgent.Handle.ToString();

                        loginParams["home_address"] = rinfo.ExternalHostName;
                        m_log.Debug("  --------- Home Address -------");
                        m_log.Debug("  >> " + loginParams["home_address"] + " <<");
                        m_log.Debug("  --------- ------------ -------");
                        loginParams["home_port"]     = rinfo.HttpPort.ToString();
                        loginParams["home_remoting"] = ConfigSettings.DefaultRegionRemotingPort.ToString();;
                    }
                }
                else
                {
                    m_log.Warn("[HGrid]: User's home region info not found: " + u.UserProfile.HomeRegionX + ", " + u.UserProfile.HomeRegionY);
                }
            }

            ArrayList SendParams = new ArrayList();

            SendParams.Add(loginParams);

            // Send
            string uri = "http://" + regInfo.ExternalHostName + ":" + regInfo.HttpPort + "/";
            //m_log.Debug("XXX uri: " + uri);
            XmlRpcRequest  request = new XmlRpcRequest("expect_hg_user", SendParams);
            XmlRpcResponse reply;

            try
            {
                reply = request.Send(uri, 6000);
            }
            catch (Exception e)
            {
                m_log.Warn("[HGrid]: Failed to notify region about user. Reason: " + e.Message);
                return(false);
            }

            if (!reply.IsFault)
            {
                bool responseSuccess = true;
                if (reply.Value != null)
                {
                    Hashtable resp = (Hashtable)reply.Value;
                    if (resp.ContainsKey("success"))
                    {
                        if ((string)resp["success"] == "FALSE")
                        {
                            responseSuccess = false;
                        }
                    }
                }
                if (responseSuccess)
                {
                    m_log.Info("[HGrid]: Successfully informed remote region about user " + agentData.AgentID);
                    return(true);
                }
                else
                {
                    m_log.ErrorFormat("[HGrid]: Region responded that it is not available to receive clients");
                    return(false);
                }
            }
            else
            {
                m_log.ErrorFormat("[HGrid]: XmlRpc request to region failed with message {0}, code {1} ", reply.FaultString, reply.FaultCode);
                return(false);
            }
        }