Exemplo n.º 1
1
 public void FinishedStartup()
 {
     if (m_registry == null)
         return; //Not enabled
     m_CapsService = m_registry.RequestModuleInterface<ICapsService> ();
     m_GridService = m_registry.RequestModuleInterface<IGridService> ();
     m_PresenceService = m_registry.RequestModuleInterface<IAgentInfoService> ();
     m_UserAccountService = m_registry.RequestModuleInterface<IUserAccountService> ();
     m_UserAgentService = m_registry.RequestModuleInterface<IUserAgentService> ();
     m_SimulationService = m_registry.RequestModuleInterface<ISimulationService> ();
     m_DefaultGatewayRegion = FindDefaultRegion ();
 }
Exemplo n.º 2
0
        // TODO: unused: private bool m_AllowForeignGuests;

        public AgentPostHandler(ISimulationService service, IAuthenticationService authentication, bool foreignGuests) :
            base("POST", "/agent")
        {
            m_SimulationService = service;
            m_AuthenticationService = authentication;
            // TODO: unused: m_AllowForeignGuests = foreignGuests;
        }
 public GatekeeperAgentHandler(IGatekeeperService gatekeeper, ISimulationService service, bool proxy)
     : base("POST", "/foreignagent")
 {
     m_SimulationService = service;
     m_GatekeeperService = gatekeeper;
     m_Proxy = proxy;
 }
Exemplo n.º 4
0
 public ObjectHandler(ISimulationService sim, IConfigSource source)
 {
     IConfig simulationConfig = source.Configs["Handlers"];
     if(simulationConfig != null)
          m_allowForeignIncomingObjects = simulationConfig.GetBoolean("AllowIncomingForeignObjects", m_allowForeignIncomingObjects );
     m_SimulationService = sim;
 }
        public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
                base(config, server, String.Empty)
        {
            //IConfig serverConfig = config.Configs["SimulationService"];
            //if (serverConfig == null)
            //    throw new Exception("No section 'SimulationService' in config file");

            //string simService = serverConfig.GetString("LocalServiceModule",
            //        String.Empty);

            //if (simService == String.Empty)
            //    throw new Exception("No SimulationService in config file");

            //Object[] args = new Object[] { config };
            m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>();
            m_LocalSimulationService = m_LocalSimulationService.GetInnerService();
                    //ServerUtils.LoadPlugin<ISimulationService>(simService, args);

            //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no"));
            //server.AddStreamHandler(new AgentGetHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentPostHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentPutHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentDeleteHandler(m_SimulationService, m_AuthenticationService));
            server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler);
            server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler);

            //server.AddStreamHandler(new ObjectPostHandler(m_SimulationService, authentication));
        }
Exemplo n.º 6
0
 public RexLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
     : base(config, simService, libraryService)
 {
     //TODO: Read configuration about m_UseOSInventory
     //TODO: Read configuration about rexavatar
     //TODO: Load rexavatar plugin
 }
        object EventManager_OnGenericEvent(string FunctionName, object parameters)
        {
            if (FunctionName != "PreRegisterRegion")
                return null;
            IConfig handlerConfig = m_config.Configs["Handlers"];
            if (handlerConfig.GetString("SimulationInHandler", "") != Name)
                return null;

            if (m_LocalSimulationService != null)
                return null;

            bool secure = handlerConfig.GetBoolean("SecureSimulation", true);
            IHttpServer server = m_registry.RequestModuleInterface<ISimulationBase>().GetHttpServer((uint)handlerConfig.GetInt("SimulationInHandlerPort"));

            m_LocalSimulationService = m_registry.RequestModuleInterface<ISimulationService>();

            string path = "/" + UUID.Random().ToString() + "/agent/";

            IGridRegisterModule registerModule = m_registry.RequestModuleInterface<IGridRegisterModule>();
            if (registerModule != null && secure)
                registerModule.AddGenericInfo("SimulationAgent", path);
            else
            {
                secure = false;
                path = "/agent/";
            }

            server.AddHTTPHandler(path, new AgentHandler(m_LocalSimulationService.GetInnerService(), secure).Handler);
            server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService.GetInnerService(), m_config).Handler);
            return null;
        }
        public void PostStart(IConfigSource config, IRegistryCore registry)
        {
            IConfig handlerConfig = config.Configs["Handlers"];
            if (handlerConfig.GetString("SimulationInHandler", "") != Name)
                return;

            bool secure = handlerConfig.GetBoolean("SecureSimulation", true);
            IHttpServer server = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer((uint)handlerConfig.GetInt("SimulationInHandlerPort"));

            m_LocalSimulationService = registry.RequestModuleInterface<ISimulationService>();
            
            string path = "/" + UUID.Random().ToString() + "/agent/";

            IGridRegisterModule registerModule = registry.RequestModuleInterface<IGridRegisterModule>();
            if (registerModule != null && secure)
                registerModule.AddGenericInfo("SimulationAgent", path);
            else
            {
                secure = false;
                path = "/agent/";
            }

            server.AddHTTPHandler(path, new AgentHandler(m_LocalSimulationService.GetInnerService(), secure).Handler);
            server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService.GetInnerService()).Handler);
        }
Exemplo n.º 9
0
        public GatekeeperService(IConfigSource config, ISimulationService simService)
        {
            if (!m_Initialized)
            {
                m_Initialized = true;

                IConfig serverConfig = config.Configs["GatekeeperService"];
                if (serverConfig == null)
                    throw new Exception(String.Format("No section GatekeeperService in config file"));

                string accountService = serverConfig.GetString("UserAccountService", String.Empty);
                string homeUsersService = serverConfig.GetString("UserAgentService", string.Empty);
                string gridService = serverConfig.GetString("GridService", String.Empty);
                string presenceService = serverConfig.GetString("PresenceService", String.Empty);
                string simulationService = serverConfig.GetString("SimulationService", String.Empty);
                string gridUserService = serverConfig.GetString("GridUserService", String.Empty);

                // These are mandatory, the others aren't
                if (gridService == string.Empty || presenceService == string.Empty)
                    throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
                
                string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
                UUID.TryParse(scope, out m_ScopeID);
                //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
                m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
                m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);
                if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
                    m_ExternalName = m_ExternalName + "/";

                Object[] args = new Object[] { config };
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
                m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);

                if (accountService != string.Empty)
                    m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
                if (homeUsersService != string.Empty)
                    m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
                if (gridUserService != string.Empty)
                    m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);

                if (simService != null)
                    m_SimulationService = simService;
                else if (simulationService != string.Empty)
                        m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);

                m_AllowedClients = serverConfig.GetString("AllowedClients", string.Empty);
                m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty);
                m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true);

                LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions);
                LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions);

                if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
                    throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");

                m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
            }
        }
Exemplo n.º 10
0
        public ISimulationService GetService()
        {
            if (_service == null)
            {
                _service = new SimulationService(null);
            }

            return _service;
        }
//        private IAuthenticationService m_AuthenticationService;

        public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
                base(config, server, String.Empty)
        {
            m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>();
            m_LocalSimulationService = m_LocalSimulationService.GetInnerService();

            // This one MUST be a stream handler because compressed fatpacks
            // are pure binary and shoehorning that into a string with UTF-8
            // encoding breaks it
            server.AddStreamHandler(new AgentPostHandler(m_LocalSimulationService));
            server.AddStreamHandler(new AgentPutHandler(m_LocalSimulationService));
            server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler);
            server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler);
        }
Exemplo n.º 12
0
        public GatekeeperService(IConfigSource config, ISimulationService simService)
        {
            IConfig serverConfig = config.Configs["GatekeeperService"];
            if (serverConfig == null)
                throw new Exception(String.Format("No section GatekeeperService in config file"));

            string accountService = serverConfig.GetString("UserAccountService", String.Empty);
            string homeUsersService = serverConfig.GetString("HomeUsersSecurityService", string.Empty);
            string gridService = serverConfig.GetString("GridService", String.Empty);
            string presenceService = serverConfig.GetString("PresenceService", String.Empty);
            string simulationService = serverConfig.GetString("SimulationService", String.Empty);

            //m_AuthDll = serverConfig.GetString("AuthenticationService", String.Empty);

            // These 3 are mandatory, the others aren't
            if (gridService == string.Empty || presenceService == string.Empty || m_AuthDll == string.Empty)
                throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
            
            string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
            UUID.TryParse(scope, out m_ScopeID);
            //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
            m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
            m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);

            Object[] args = new Object[] { config };
            m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
            m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);

            if (accountService != string.Empty)
                m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
            if (homeUsersService != string.Empty)
                m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);

            if (simService != null)
                m_SimulationService = simService;
            else if (simulationService != string.Empty)
                    m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);

            if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
                throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");

            m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
        }
        public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) :
                base(config, server, String.Empty)
        {
            IConfig gridConfig = config.Configs["GatekeeperService"];
            if (gridConfig != null)
            {
                string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty);
                Object[] args = new Object[] { config, simService };
                m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(serviceDll, args);

            }
            if (m_GatekeeperService == null)
                throw new Exception("Gatekeeper server connector cannot proceed because of missing service");

            HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService);
            server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false);
            server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false);

            server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService).Handler);
        }
        public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
                base(config, server, String.Empty)
        {
            IConfig serverConfig = config.Configs["SimulationService"];
            if (serverConfig == null)
                throw new Exception("No section 'SimulationService' in config file");

            bool authentication = serverConfig.GetBoolean("RequireAuthentication", false);

            if (authentication)
                m_AuthenticationService = scene.RequestModuleInterface<IAuthenticationService>();

            bool foreignGuests = serverConfig.GetBoolean("AllowForeignGuests", false);

            //string simService = serverConfig.GetString("LocalServiceModule",
            //        String.Empty);

            //if (simService == String.Empty)
            //    throw new Exception("No SimulationService in config file");

            //Object[] args = new Object[] { config };
            m_SimulationService = scene.RequestModuleInterface<ISimulationService>();
                    //ServerUtils.LoadPlugin<ISimulationService>(simService, args);
            if (m_SimulationService == null)
                throw new Exception("No Local ISimulationService Module");



            //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no"));
            server.AddStreamHandler(new AgentGetHandler(m_SimulationService, m_AuthenticationService));
            server.AddStreamHandler(new AgentPostHandler(m_SimulationService, m_AuthenticationService, foreignGuests));
            server.AddStreamHandler(new AgentPutHandler(m_SimulationService, m_AuthenticationService));
            server.AddStreamHandler(new AgentDeleteHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new ObjectPostHandler(m_SimulationService, authentication));
            //server.AddStreamHandler(new NeighborPostHandler(m_SimulationService, authentication));
        }
Exemplo n.º 15
0
 public SimulationApp(ISimulationService simulationService) : base(simulationService)
 {
     _simulationService = simulationService;
 }
Exemplo n.º 16
0
 public AgentPutHandler(string path) :
     base("PUT", path)
 {
     m_SimulationService = null;
 }
        public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) :
            base(config, server, String.Empty)
        {
            IConfig gridConfig = config.Configs["GatekeeperService"];

            if (gridConfig != null)
            {
                string   serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty);
                Object[] args       = new Object[] { config, simService };
                m_GatekeeperService = ServerUtils.LoadPlugin <IGatekeeperService>(serviceDll, args);
            }
            if (m_GatekeeperService == null)
            {
                throw new Exception("Gatekeeper server connector cannot proceed because of missing service");
            }

            m_Proxy = gridConfig.GetBoolean("HasProxy", false);

            HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService);

            server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false);
            server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false);

            server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService, m_Proxy).Handler);
        }
Exemplo n.º 18
0
        private byte[] TeleportLocation(Stream request, UUID agentID)
        {
            OSDMap retVal = new OSDMap();

            if (_isInTeleportCurrently)
            {
                retVal.Add("reason", "Duplicate teleport request.");
                retVal.Add("success", OSD.FromBoolean(false));
                return(OSDParser.SerializeLLSDXmlBytes(retVal));
            }
            _isInTeleportCurrently = true;

            OSDMap  rm       = (OSDMap)OSDParser.DeserializeLLSDXml(HttpServerHandlerHelpers.ReadFully(request));
            OSDMap  pos      = rm["LocationPos"] as OSDMap;
            Vector3 position = new Vector3((float)pos["X"].AsReal(),
                                           (float)pos["Y"].AsReal(),
                                           (float)pos["Z"].AsReal());

            ulong      RegionHandle = rm["RegionHandle"].AsULong();
            const uint tpFlags      = 16;

            if (m_service.ClientCaps.GetRootCapsService().RegionHandle != m_service.RegionHandle)
            {
                retVal.Add("reason", "Contacted by non-root region for teleport. Protocol implemention is wrong.");
                retVal.Add("success", OSD.FromBoolean(false));
                return(OSDParser.SerializeLLSDXmlBytes(retVal));
            }

            string reason = "";
            int    x, y;

            Util.UlongToInts(RegionHandle, out x, out y);
            GridRegion destination = m_service.Registry.RequestModuleInterface <IGridService>().GetRegionByPosition(
                m_service.ClientCaps.AccountInfo.AllScopeIDs, x, y);
            ISimulationService simService  = m_service.Registry.RequestModuleInterface <ISimulationService>();
            AgentData          ad          = new AgentData();
            AgentCircuitData   circuitData = null;

            if (destination != null)
            {
                simService.RetrieveAgent(m_service.Region, m_service.AgentID, true, out ad, out circuitData);
                if (ad != null)
                {
                    ad.Position = position;
                    ad.Center   = position;
                    circuitData.StartingPosition = position;
                }
            }
            if (destination == null || circuitData == null)
            {
                retVal.Add("reason", "Could not find the destination region.");
                retVal.Add("success", OSD.FromBoolean(false));
                return(OSDParser.SerializeLLSDXmlBytes(retVal));
            }
            circuitData.IsChildAgent = false;

            if (m_agentProcessing.TeleportAgent(ref destination, tpFlags, circuitData, ad,
                                                m_service.AgentID, m_service.RegionID, out reason) || reason == "")
            {
                retVal.Add("success", OSD.FromBoolean(true));
            }
            else
            {
                if (reason != "Already in a teleport")
                {
                    //If this error occurs... don't kick them out of their current region
                    simService.FailedToMoveAgentIntoNewRegion(m_service.AgentID, destination);
                }
                retVal.Add("reason", reason);
                retVal.Add("success", OSD.FromBoolean(false));
            }

            //Send back data
            _isInTeleportCurrently = false;
            return(OSDParser.SerializeLLSDXmlBytes(retVal));
        }
Exemplo n.º 19
0
 public AgentHandler(ISimulationService sim)
 {
     m_SimulationService = sim;
 }
Exemplo n.º 20
0
 public AgentHandler(ISimulationService sim, bool secure)
 {
     m_SimulationService = sim;
     m_secure            = secure;
 }
Exemplo n.º 21
0
 public SimulationController(ISimulationService simulationService, ILogger <SimulationController> logger)
 {
     this.simulationService = simulationService;
     this.logger            = logger;
 }
Exemplo n.º 22
0
        public GatekeeperService(IConfigSource config, ISimulationService simService)
        {
            if (!m_Initialized)
            {
                m_Initialized = true;

                IConfig serverConfig = config.Configs["GatekeeperService"];
                if (serverConfig == null)
                {
                    throw new Exception(String.Format("No section GatekeeperService in config file"));
                }

                string accountService    = serverConfig.GetString("UserAccountService", String.Empty);
                string homeUsersService  = serverConfig.GetString("UserAgentService", string.Empty);
                string gridService       = serverConfig.GetString("GridService", String.Empty);
                string presenceService   = serverConfig.GetString("PresenceService", String.Empty);
                string simulationService = serverConfig.GetString("SimulationService", String.Empty);

                // These 3 are mandatory, the others aren't
                if (gridService == string.Empty || presenceService == string.Empty)
                {
                    throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
                }

                string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
                UUID.TryParse(scope, out m_ScopeID);
                //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
                m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
                m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);
                if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
                {
                    m_ExternalName = m_ExternalName + "/";
                }

                Object[] args = new Object[] { config };
                m_GridService     = ServerUtils.LoadPlugin <IGridService>(gridService, args);
                m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);

                if (accountService != string.Empty)
                {
                    m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args);
                }
                if (homeUsersService != string.Empty)
                {
                    m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(homeUsersService, args);
                }

                if (simService != null)
                {
                    m_SimulationService = simService;
                }
                else if (simulationService != string.Empty)
                {
                    m_SimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args);
                }

                if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
                {
                    throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
                }

                m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
            }
        }
Exemplo n.º 23
0
        private Hashtable TeleportLocation(Hashtable mDhttpMethod, UUID agentID)
        {
            OSDMap    retVal       = new OSDMap();
            Hashtable responsedata = new Hashtable();

            responsedata["int_response_code"] = 200; //501; //410; //404;
            responsedata["content_type"]      = "text/plain";
            responsedata["keepalive"]         = false;

            if (_isInTeleportCurrently)
            {
                retVal.Add("reason", "Duplicate teleport request.");
                retVal.Add("success", OSD.FromBoolean(false));
                responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(retVal);
                return(responsedata);
            }
            _isInTeleportCurrently = true;

            OSDMap  rm       = (OSDMap)OSDParser.DeserializeLLSDXml((string)mDhttpMethod["requestbody"]);
            OSDMap  pos      = rm["LocationPos"] as OSDMap;
            Vector3 position = new Vector3((float)pos["X"].AsReal(),
                                           (float)pos["Y"].AsReal(),
                                           (float)pos["Z"].AsReal());
            OSDMap lookat = rm["LocationLookAt"] as OSDMap;
            // this vector does not appear to be used
            Vector3 lookAt = new Vector3((float)lookat["X"].AsReal(),
                                         (float)lookat["Y"].AsReal(),
                                         (float)lookat["Z"].AsReal());
            ulong      RegionHandle = rm["RegionHandle"].AsULong();
            const uint tpFlags      = 16;

            if (m_service.ClientCaps.GetRootCapsService().RegionHandle != m_service.RegionHandle)
            {
                retVal.Add("reason", "Contacted by non-root region for teleport. Protocol implemention is wrong.");
                retVal.Add("success", OSD.FromBoolean(false));
                responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(retVal);
                return(responsedata);
            }

            string reason = "";
            int    x, y;

            Util.UlongToInts(RegionHandle, out x, out y);
            GridRegion destination = m_service.Registry.RequestModuleInterface <IGridService>().GetRegionByPosition(UUID.Zero,
                                                                                                                    x, y);
            ISimulationService simService  = m_service.Registry.RequestModuleInterface <ISimulationService>();
            AgentData          ad          = new AgentData();
            AgentCircuitData   circuitData = null;

            if (destination != null)
            {
                simService.RetrieveAgent(m_service.Region, m_service.AgentID, true, out ad, out circuitData);
                if (ad != null)
                {
                    ad.Position = position;
                }
            }
            if (destination == null || circuitData == null)
            {
                retVal.Add("reason", "Could not find the destination region.");
                retVal.Add("success", OSD.FromBoolean(false));
                responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(retVal);
                return(responsedata);
            }
            circuitData.reallyischild = false;
            circuitData.child         = false;

            if (m_service.RegionHandle != destination.RegionHandle)
            {
                simService.MakeChildAgent(m_service.AgentID, m_service.Region);
            }

            if (m_agentProcessing.TeleportAgent(ref destination, tpFlags, ad == null ? 0 : (int)ad.Far, circuitData, ad,
                                                m_service.AgentID, m_service.RegionHandle, out reason) || reason == "")
            {
                retVal.Add("success", OSD.FromBoolean(true));
            }
            else
            {
                if (reason != "Already in a teleport")//If this error occurs... don't kick them out of their current region
                {
                    simService.FailedToMoveAgentIntoNewRegion(m_service.AgentID, destination.RegionID);
                }
                retVal.Add("reason", reason);
                retVal.Add("success", OSD.FromBoolean(false));
            }

            //Send back data
            responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(retVal);
            _isInTeleportCurrently = false;
            return(responsedata);
        }
 private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
 {
     return(simConnector.CreateAgent(region, aCircuit, (uint)flags, out reason));
 }
Exemplo n.º 25
0
        public SimulationsModule(ISimulationService service, IUserService userService, IClusterService clusterService, IMapService mapService, IVehicleService vehicleService) : base("simulations")
        {
            this.RequiresAuthentication();

            Get("/", x =>
            {
                Debug.Log($"Listing simulations");
                try
                {
                    int page = Request.Query["page"];
                    // TODO: Items per page should be read from personal user settings.
                    //       This value should be independent for each module: maps, vehicles and simulation.
                    //       But for now 5 is just an arbitrary value to ensure that we don't try and Page a count of 0
                    int count = Request.Query["count"] > 0 ? Request.Query["count"] : Config.DefaultPageSize;
                    return(service.List(page, count, this.Context.CurrentUser.Identity.Name).Select(sim =>
                    {
                        sim.Status = service.GetActualStatus(sim, false);
                        return SimulationResponse.Create(sim);
                    }).ToArray());
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to list simulations: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });

            Get("/{id:long}", x =>
            {
                long id = x.id;
                Debug.Log($"Getting simulation with id {id}");
                try
                {
                    var simulation = service.Get(id, this.Context.CurrentUser.Identity.Name);
                    if (simulation.TimeOfDay.HasValue)
                    {
                        simulation.TimeOfDay = DateTime.SpecifyKind(simulation.TimeOfDay.Value, DateTimeKind.Utc);
                    }
                    simulation.Status = service.GetActualStatus(simulation, false);
                    return(SimulationResponse.Create(simulation));
                }
                catch (IndexOutOfRangeException)
                {
                    Debug.Log($"Simulation with id {id} does not exist");
                    return(Response.AsJson(new { error = $"Simulation with id {id} does not exist" }, HttpStatusCode.NotFound));
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to get simulation with id {id}: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });

            Post("/", x =>
            {
                Debug.Log($"Adding new simulation");
                try
                {
                    var req = this.BindAndValidate <SimulationRequest>();
                    if (!ModelValidationResult.IsValid)
                    {
                        var message = ModelValidationResult.Errors.First().Value.First().ErrorMessage;
                        Debug.Log($"Wrong request: {message}");
                        return(Response.AsJson(new { error = $"Failed to add simulation: {message}" }, HttpStatusCode.BadRequest));
                    }

                    var simulation = req.ToModel(this.Context.CurrentUser.Identity.Name);

                    simulation.Status = service.GetActualStatus(simulation, true);
                    if (simulation.Status != "Valid")
                    {
                        throw new Exception($"Simulation is invalid");
                    }

                    simulation.Status = service.GetActualStatus(simulation, false);
                    long id           = service.Add(simulation);
                    Debug.Log($"Simulation added with id {id}");
                    simulation.Id = id;

                    SIM.LogWeb(SIM.Web.SimulationAddName, simulation.Name);
                    try
                    {
                        SIM.LogWeb(SIM.Web.SimulationAddMapName, mapService.Get(simulation.Map.Value, this.Context.CurrentUser.Identity.Name).Name);

                        if (simulation.Vehicles != null)
                        {
                            foreach (var vehicle in simulation.Vehicles)
                            {
                                var vehicleModel = vehicleService.Get(vehicle.Vehicle, this.Context.CurrentUser.Identity.Name);
                                SIM.LogWeb(SIM.Web.SimulationAddVehicleName, vehicleModel.Name);
                                SIM.LogWeb(SIM.Web.SimulationAddBridgeType, vehicleModel.BridgeType);
                            }
                        }

                        SIM.LogWeb(SIM.Web.SimulationAddAPIOnly, simulation.ApiOnly.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddInteractiveMode, simulation.Interactive.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddHeadlessMode, simulation.Headless.ToString());
                        try
                        {
                            SIM.LogWeb(SIM.Web.SimulationAddClusterName, clusterService.Get(simulation.Cluster.Value, this.Context.CurrentUser.Identity.Name).Name);
                        }
                        catch { };
                        SIM.LogWeb(SIM.Web.SimulationAddUsePredefinedSeed, simulation.Seed.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddEnableNPC, simulation.UseTraffic.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddRandomPedestrians, simulation.UsePedestrians.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddTimeOfDay, simulation.TimeOfDay.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddRain, simulation.Rain.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddWetness, simulation.Wetness.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddFog, simulation.Fog.ToString());
                        SIM.LogWeb(SIM.Web.SimulationAddCloudiness, simulation.Cloudiness.ToString());
                    }
                    catch { };

                    return(SimulationResponse.Create(simulation));
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to add simulation: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });

            Put("/{id:long}", x =>
            {
                long id = x.id;
                Debug.Log($"Updating simulation with id {id}");
                try
                {
                    var req = this.BindAndValidate <SimulationRequest>();
                    if (!ModelValidationResult.IsValid)
                    {
                        var message = ModelValidationResult.Errors.First().Value.First().ErrorMessage;
                        Debug.Log($"Wrong request: {message}");
                        return(Response.AsJson(new { error = $"Failed to update simulation: {message}" }, HttpStatusCode.BadRequest));
                    }

                    var original = service.Get(id, Context.CurrentUser.Identity.Name);

                    var simulation = req.ToModel(original.Owner);
                    simulation.Id  = id;

                    simulation.Status = service.GetActualStatus(simulation, true);
                    if (simulation.Status != "Valid")
                    {
                        throw new Exception($"Simulation is invalid");
                    }

                    simulation.Status = service.GetActualStatus(simulation, false);
                    int result        = service.Update(simulation);

                    SIM.LogWeb(SIM.Web.SimulationEditName, simulation.Name);
                    try
                    {
                        SIM.LogWeb(SIM.Web.SimulationEditMapName, mapService.Get(simulation.Map.Value, this.Context.CurrentUser.Identity.Name).Name);

                        if (simulation.Vehicles != null)
                        {
                            foreach (var vehicle in simulation.Vehicles)
                            {
                                try
                                {
                                    var vehicleModel = vehicleService.Get(vehicle.Vehicle, this.Context.CurrentUser.Identity.Name);
                                    SIM.LogWeb(SIM.Web.SimulationEditVehicleName, vehicleModel.Name);
                                    SIM.LogWeb(SIM.Web.SimulationEditBridgeType, vehicleModel.BridgeType);
                                }
                                catch
                                {
                                }
                            }
                        }

                        SIM.LogWeb(SIM.Web.SimulationEditAPIOnly, simulation.ApiOnly.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditInteractiveMode, simulation.Interactive.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditHeadlessMode, simulation.Headless.ToString());
                        try
                        {
                            SIM.LogWeb(SIM.Web.SimulationEditClusterName, clusterService.Get(simulation.Cluster.Value, this.Context.CurrentUser.Identity.Name).Name);
                        }
                        catch { };
                        SIM.LogWeb(SIM.Web.SimulationEditUsePredefinedSeed, simulation.Seed.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditEnableNPC, simulation.UseTraffic.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditRandomPedestrians, simulation.UsePedestrians.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditTimeOfDay, simulation.TimeOfDay.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditRain, simulation.Rain.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditWetness, simulation.Wetness.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditFog, simulation.Fog.ToString());
                        SIM.LogWeb(SIM.Web.SimulationEditCloudiness, simulation.Cloudiness.ToString());
                    }
                    catch
                    {
                    }

                    if (result > 1)
                    {
                        throw new Exception($"More than one simulation has id {id}");
                    }
                    else if (result < 1)
                    {
                        throw new IndexOutOfRangeException();
                    }

                    return(SimulationResponse.Create(simulation));
                }
                catch (IndexOutOfRangeException)
                {
                    Debug.Log($"Simulation with id {id} does not exist");
                    return(Response.AsJson(new { error = $"Simulation with id {id} does not exist" }, HttpStatusCode.NotFound));
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to update simulation with id {id}: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });

            Delete("/{id:long}", x =>
            {
                long id = x.id;
                Debug.Log($"Removing simulation with id {id}");
                try
                {
                    int result = service.Delete(id, this.Context.CurrentUser.Identity.Name);
                    SIM.LogWeb(SIM.Web.SimulationDelete);
                    if (result > 1)
                    {
                        throw new Exception($"More than one simulation has id {id}");
                    }

                    if (result < 1)
                    {
                        throw new IndexOutOfRangeException();
                    }

                    return(new { });
                }
                catch (IndexOutOfRangeException)
                {
                    Debug.Log($"Simulation with id {id} does not exist");
                    return(Response.AsJson(new { error = $"Simulation with id {id} does not exist" }, HttpStatusCode.NotFound));
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to remove simulation with id {id}: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });

            Post("/{id:long}/start", x =>
            {
                long id = x.id;
                Debug.Log($"Starting simulation with id {id}");
                try
                {
                    var current = service.GetCurrent(this.Context.CurrentUser.Identity.Name);
                    if (current != null)
                    {
                        throw new Exception($"Simulation with id {current.Id} is already running");
                    }

                    var simulation = service.Get(id, this.Context.CurrentUser.Identity.Name);
                    if (service.GetActualStatus(simulation, false) != "Valid")
                    {
                        simulation.Status = "Invalid";
                        service.Update(simulation);

                        throw new Exception("Cannot start an invalid simulation");
                    }

                    service.Start(simulation);
                    SIM.LogWeb(SIM.Web.WebClick, "SimulationStart");
                    return(new { });
                }
                catch (IndexOutOfRangeException)
                {
                    Debug.Log($"Simulation with id {id} does not exist");
                    return(Response.AsJson(new { error = $"Simulation with id {id} does not exist" }, HttpStatusCode.NotFound));
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to start simulation with id {id}: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });

            Post("/{id:long}/stop", x =>
            {
                long id = x.id;
                Debug.Log($"Stopping simulation with id {id}");
                try
                {
                    var simulation = service.GetCurrent(this.Context.CurrentUser.Identity.Name);
                    if (simulation == null || simulation.Id != id)
                    {
                        throw new Exception($"Simulation with id {id} is not running");
                    }

                    service.Stop();
                    SIM.LogWeb(SIM.Web.WebClick, "SimulationStop");
                    return(new { });
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    return(Response.AsJson(new { error = $"Failed to stop simulation with id {id}: {ex.Message}" }, HttpStatusCode.InternalServerError));
                }
            });
        }
//        IConfig m_ClientsConfig;

        public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
        {
            m_LoginServerConfig = config.Configs["LoginService"];
            if (m_LoginServerConfig == null)
            {
                throw new Exception(String.Format("No section LoginService in config file"));
            }

            string accountService    = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
            string gridUserService   = m_LoginServerConfig.GetString("GridUserService", String.Empty);
            string agentService      = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
            string authService       = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
            string invService        = m_LoginServerConfig.GetString("InventoryService", String.Empty);
            string gridService       = m_LoginServerConfig.GetString("GridService", String.Empty);
            string presenceService   = m_LoginServerConfig.GetString("PresenceService", String.Empty);
            string libService        = m_LoginServerConfig.GetString("LibraryService", String.Empty);
            string friendsService    = m_LoginServerConfig.GetString("FriendsService", String.Empty);
            string avatarService     = m_LoginServerConfig.GetString("AvatarService", String.Empty);
            string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty);

            m_DefaultRegionName        = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
            m_WelcomeMessage           = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
            m_RequireInventory         = m_LoginServerConfig.GetBoolean("RequireInventory", true);
            m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
            m_MinLoginLevel            = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
            m_GatekeeperURL            = Util.GetConfigVarFromSections <string>(config, "GatekeeperURI",
                                                                                new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty);
            m_MapTileURL       = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
            m_ProfileURL       = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty);
            m_OpenIDURL        = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty);
            m_SearchURL        = m_LoginServerConfig.GetString("SearchURL", string.Empty);
            m_Currency         = m_LoginServerConfig.GetString("Currency", string.Empty);
            m_ClassifiedFee    = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty);
            m_DestinationGuide = m_LoginServerConfig.GetString("DestinationGuide", string.Empty);
            m_AvatarPicker     = m_LoginServerConfig.GetString("AvatarPicker", string.Empty);

            m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
            m_DeniedClients  = m_LoginServerConfig.GetString("DeniedClients", string.Empty);

            m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time");

            // Clean up some of these vars
            if (m_MapTileURL != String.Empty)
            {
                m_MapTileURL = m_MapTileURL.Trim();
                if (!m_MapTileURL.EndsWith("/"))
                {
                    m_MapTileURL = m_MapTileURL + "/";
                }
            }

            // These are required; the others aren't
            if (accountService == string.Empty || authService == string.Empty)
            {
                throw new Exception("LoginService is missing service specifications");
            }

            // replace newlines in welcome message
            m_WelcomeMessage = m_WelcomeMessage.Replace("\\n", "\n");

            Object[] args = new Object[] { config };
            m_UserAccountService    = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args);
            m_GridUserService       = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
            m_AuthenticationService = ServerUtils.LoadPlugin <IAuthenticationService>(authService, args);
            m_InventoryService      = ServerUtils.LoadPlugin <IInventoryService>(invService, args);

            if (gridService != string.Empty)
            {
                m_GridService = ServerUtils.LoadPlugin <IGridService>(gridService, args);
            }
            if (presenceService != string.Empty)
            {
                m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);
            }
            if (avatarService != string.Empty)
            {
                m_AvatarService = ServerUtils.LoadPlugin <IAvatarService>(avatarService, args);
            }
            if (friendsService != string.Empty)
            {
                m_FriendsService = ServerUtils.LoadPlugin <IFriendsService>(friendsService, args);
            }
            if (simulationService != string.Empty)
            {
                m_RemoteSimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args);
            }
            if (agentService != string.Empty)
            {
                m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(agentService, args);
            }

            //
            // deal with the services given as argument
            //
            m_LocalSimulationService = simService;
            if (libraryService != null)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using LibraryService given as argument");
                m_LibraryService = libraryService;
            }
            else if (libService != string.Empty)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using instantiated LibraryService");
                m_LibraryService = ServerUtils.LoadPlugin <ILibraryService>(libService, args);
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }

            m_log.DebugFormat("[LLOGIN SERVICE]: Starting...");
        }
Exemplo n.º 27
0
 public SimulationController(ILogger logger, ISimulationService simulationService)
 {
     _logger            = logger;
     _simulationService = simulationService;
 }
 public SimulationController(ISimulationService simulationService)
 {
     _simulationService = simulationService;
 }
Exemplo n.º 29
0
 public AgentPutHandler(string path) :
         base("PUT", path)
 {
     m_SimulationService = null;
 }
Exemplo n.º 30
0
 public DefaultPickService(ISimulationService _simulationService, bool _canMove = true)
 {
     simulationService = _simulationService;
     canMove           = _canMove;
 }
Exemplo n.º 31
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            m_UserAccountService = registry.RequestModuleInterface<IUserAccountService>().InnerService;
            m_agentInfoService = registry.RequestModuleInterface<IAgentInfoService>().InnerService;
            m_AuthenticationService = registry.RequestModuleInterface<IAuthenticationService>();
            m_InventoryService = registry.RequestModuleInterface<IInventoryService>();
            m_GridService = registry.RequestModuleInterface<IGridService>();
            m_AvatarService = registry.RequestModuleInterface<IAvatarService>().InnerService;
            m_FriendsService = registry.RequestModuleInterface<IFriendsService>();
            m_SimulationService = registry.RequestModuleInterface<ISimulationService>();
            m_AssetService = registry.RequestModuleInterface<IAssetService>().InnerService;
            m_LibraryService = registry.RequestModuleInterface<ILibraryService>();
            m_CapsService = registry.RequestModuleInterface<ICapsService>();
            m_ArchiveService = registry.RequestModuleInterface<IAvatarAppearanceArchiver>();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }

            LoginModules = WhiteCoreModuleLoader.PickupModules<ILoginModule>();
            foreach (ILoginModule module in LoginModules)
            {
                module.Initialize(this, m_config, registry);
            }

            MainConsole.Instance.DebugFormat("[LLOGIN SERVICE]: Starting...");
        }
Exemplo n.º 32
0
        /// <summary>
        /// Async component for informing client of which neighbors exist
        /// </summary>
        /// <remarks>
        /// This needs to run asynchronously, as a network timeout may block the thread for a long while
        /// </remarks>
        /// <param name="remoteClient"></param>
        /// <param name="a"></param>
        /// <param name="regionHandle"></param>
        /// <param name="endPoint"></param>
        private bool InformClientOfNeighbor(UUID AgentID, ulong requestingRegion, AgentCircuitData circuitData, GridRegion neighbor,
                                            uint TeleportFlags, AgentData agentData, out string reason)
        {
            if (neighbor == null)
            {
                reason = "Could not find neighbor to inform";
                return(false);
            }
            m_log.Info("[AgentProcessing]: Starting to inform client about neighbor " + neighbor.RegionName);

            //Notes on this method
            // 1) the SimulationService.CreateAgent MUST have a fixed CapsUrl for the region, so we have to create (if needed)
            //       a new Caps handler for it.
            // 2) Then we can call the methods (EnableSimulator and EstatablishAgentComm) to tell the client the new Urls
            // 3) This allows us to make the Caps on the grid server without telling any other regions about what the
            //       Urls are.

            ISimulationService SimulationService = m_registry.RequestModuleInterface <ISimulationService>();

            if (SimulationService != null)
            {
                ICapsService       capsService = m_registry.RequestModuleInterface <ICapsService>();
                IClientCapsService clientCaps  = capsService.GetClientCapsService(AgentID);

                IRegionClientCapsService oldRegionService = clientCaps.GetCapsService(neighbor.RegionHandle);

                //If its disabled, it should be removed, so kill it!
                if (oldRegionService != null && oldRegionService.Disabled)
                {
                    clientCaps.RemoveCAPS(neighbor.RegionHandle);
                    oldRegionService = null;
                }

                bool newAgent = oldRegionService == null;
                IRegionClientCapsService otherRegionService = clientCaps.GetOrCreateCapsService(neighbor.RegionHandle,
                                                                                                CapsUtil.GetCapsSeedPath(CapsUtil.GetRandomCapsObjectPath()), circuitData);

                if (!newAgent)
                {
                    //Note: if the agent is already there, send an agent update then
                    bool result = true;
                    if (agentData != null)
                    {
                        result = SimulationService.UpdateAgent(neighbor, agentData);
                        if (result)
                        {
                            oldRegionService.Disabled = false;
                        }
                    }
                    reason = "";
                    return(result);
                }

                ICommunicationService commsService = m_registry.RequestModuleInterface <ICommunicationService>();
                if (commsService != null)
                {
                    circuitData.OtherInformation["UserUrls"] = commsService.GetUrlsForUser(neighbor, circuitData.AgentID);
                }

                #region OpenSim teleport compatibility!

                if (!m_useCallbacks)
                {
                    circuitData.CapsPath    = CapsUtil.GetRandomCapsObjectPath();
                    circuitData.startpos.X += (neighbor.RegionLocX - clientCaps.GetRootCapsService().RegionX);
                    circuitData.startpos.Y += (neighbor.RegionLocY - clientCaps.GetRootCapsService().RegionY);
                }

                #endregion

                bool regionAccepted = SimulationService.CreateAgent(neighbor, circuitData,
                                                                    TeleportFlags, agentData, out reason);
                if (regionAccepted)
                {
                    string otherRegionsCapsURL;
                    //If the region accepted us, we should get a CAPS url back as the reason, if not, its not updated or not an Aurora region, so don't touch it.
                    if (reason != "")
                    {
                        OSDMap responseMap = (OSDMap)OSDParser.DeserializeJson(reason);
                        OSDMap SimSeedCaps = (OSDMap)responseMap["CapsUrls"];
                        otherRegionService.AddCAPS(SimSeedCaps);
                        otherRegionsCapsURL = otherRegionService.CapsUrl;
                    }
                    else
                    {
                        //We are assuming an OpenSim region now!
                        #region OpenSim teleport compatibility!

                        otherRegionsCapsURL = "http://" + otherRegionService.Region.ExternalEndPoint.ToString() +
                                              CapsUtil.GetCapsSeedPath(circuitData.CapsPath);
                        otherRegionService.CapsUrl = otherRegionsCapsURL;

                        #endregion
                    }

                    IEventQueueService EQService = m_registry.RequestModuleInterface <IEventQueueService>();

                    EQService.EnableSimulator(neighbor.RegionHandle,
                                              neighbor.ExternalEndPoint.Address.GetAddressBytes(),
                                              neighbor.ExternalEndPoint.Port, AgentID,
                                              neighbor.RegionSizeX, neighbor.RegionSizeY, requestingRegion);

                    // EnableSimulator makes the client send a UseCircuitCode message to the destination,
                    // which triggers a bunch of things there.
                    // So let's wait
                    Thread.Sleep(300);
                    EQService.EstablishAgentCommunication(AgentID, neighbor.RegionHandle,
                                                          neighbor.ExternalEndPoint.Address.GetAddressBytes(),
                                                          neighbor.ExternalEndPoint.Port, otherRegionsCapsURL, neighbor.RegionSizeX,
                                                          neighbor.RegionSizeY,
                                                          requestingRegion);

                    if (!m_useCallbacks)
                    {
                        Thread.Sleep(3000);  //Give it a bit of time
                    }
                    m_log.Info("[AgentProcessing]: Completed inform client about neighbor " + neighbor.RegionName);
                }
                else
                {
                    m_log.Error("[AgentProcessing]: Failed to inform client about neighbor " + neighbor.RegionName + ", reason: " + reason);
                    return(false);
                }
                return(true);
            }
            reason = "SimulationService does not exist";
            m_log.Error("[AgentProcessing]: Failed to inform client about neighbor " + neighbor.RegionName + ", reason: " + reason + "!");
            return(false);
        }
Exemplo n.º 33
0
 private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, out string reason)
 {
     return(simConnector.CreateAgent(region, aCircuit, (int)Constants.TeleportFlags.ViaLogin, out reason));
 }
Exemplo n.º 34
0
        public bool CrossAgent(GridRegion crossingRegion, Vector3 pos,
                               Vector3 velocity, AgentCircuitData circuit, AgentData cAgent, UUID AgentID, ulong requestingRegion, out string reason)
        {
            try
            {
                IClientCapsService       clientCaps           = m_registry.RequestModuleInterface <ICapsService>().GetClientCapsService(AgentID);
                IRegionClientCapsService requestingRegionCaps = clientCaps.GetCapsService(requestingRegion);
                ISimulationService       SimulationService    = m_registry.RequestModuleInterface <ISimulationService>();
                if (SimulationService != null)
                {
                    //Note: we have to pull the new grid region info as the one from the region cannot be trusted
                    IGridService GridService = m_registry.RequestModuleInterface <IGridService>();
                    if (GridService != null)
                    {
                        //Set the user in transit so that we block duplicate tps and reset any cancelations
                        if (!SetUserInTransit(AgentID))
                        {
                            reason = "Already in a teleport";
                            return(false);
                        }

                        bool result = false;

                        crossingRegion = GridService.GetRegionByUUID(UUID.Zero, crossingRegion.RegionID);
                        if (!SimulationService.UpdateAgent(crossingRegion, cAgent))
                        {
                            m_log.Warn("[AgentProcessing]: Failed to cross agent " + AgentID + " because region did not accept it. Resetting.");
                            reason = "Failed to update an agent";
                        }
                        else
                        {
                            IEventQueueService EQService = m_registry.RequestModuleInterface <IEventQueueService>();

                            //Add this for the viewer, but not for the sim, seems to make the viewer happier
                            int XOffset = crossingRegion.RegionLocX - requestingRegionCaps.RegionX;
                            pos.X += XOffset;

                            int YOffset = crossingRegion.RegionLocY - requestingRegionCaps.RegionY;
                            pos.Y += YOffset;

                            IRegionClientCapsService otherRegion = clientCaps.GetCapsService(crossingRegion.RegionHandle);
                            //Tell the client about the transfer
                            EQService.CrossRegion(crossingRegion.RegionHandle, pos, velocity, crossingRegion.ExternalEndPoint, otherRegion.CapsUrl,
                                                  AgentID, circuit.SessionID,
                                                  crossingRegion.RegionSizeX, crossingRegion.RegionSizeY,
                                                  requestingRegion);

                            result = WaitForCallback(AgentID);
                            if (!result)
                            {
                                m_log.Warn("[AgentProcessing]: Callback never came in crossing agent " + circuit.AgentID + ". Resetting.");
                                reason = "Crossing timed out";
                            }
                            else
                            {
                                // Next, let's close the child agent connections that are too far away.
                                INeighborService service = m_registry.RequestModuleInterface <INeighborService>();
                                if (service != null)
                                {
                                    //Fix the root agent status
                                    otherRegion.RootAgent          = true;
                                    requestingRegionCaps.RootAgent = false;

                                    CloseNeighborAgents(requestingRegionCaps.Region, crossingRegion, AgentID);
                                }
                                reason = "";
                            }
                        }

                        //All done
                        ResetFromTransit(AgentID);
                        return(result);
                    }
                    else
                    {
                        reason = "Could not find the GridService";
                    }
                }
                else
                {
                    reason = "Could not find the SimulationService";
                }
            }
            catch (Exception ex)
            {
                m_log.WarnFormat("[AgentProcessing]: Failed to cross an agent into a new region. {0}", ex.ToString());
            }
            ResetFromTransit(AgentID);
            reason = "Exception occured";
            return(false);
        }
Exemplo n.º 35
0
 public AgentSimpleHandler(ISimulationService service) : base("/agent")
 {
     m_SimulationService = service;
 }
Exemplo n.º 36
0
        public GatekeeperService(IConfigSource config, ISimulationService simService)
        {
            if (!m_Initialized)
            {
                m_Initialized = true;

                IConfig serverConfig = config.Configs["GatekeeperService"];
                if (serverConfig == null)
                {
                    throw new Exception(String.Format("No section GatekeeperService in config file"));
                }

                string accountService    = serverConfig.GetString("UserAccountService", string.Empty);
                string homeUsersService  = serverConfig.GetString("UserAgentService", string.Empty);
                string gridService       = serverConfig.GetString("GridService", string.Empty);
                string presenceService   = serverConfig.GetString("PresenceService", string.Empty);
                string simulationService = serverConfig.GetString("SimulationService", string.Empty);
                string gridUserService   = serverConfig.GetString("GridUserService", string.Empty);
                string bansService       = serverConfig.GetString("BansService", string.Empty);
                // These are mandatory, the others aren't
                if (gridService == string.Empty || presenceService == string.Empty)
                {
                    throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
                }

                string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
                UUID.TryParse(scope, out m_ScopeID);
                //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
                m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);

                string[] sections     = new string[] { "Const, Startup", "Hypergrid", "GatekeeperService" };
                string   externalName = Util.GetConfigVarFromSections <string>(config, "GatekeeperURI", sections, string.Empty);
                if (string.IsNullOrEmpty(externalName))
                {
                    externalName = serverConfig.GetString("ExternalName", string.Empty);
                }

                m_gatekeeperHost = new OSHHTPHost(externalName, true);
                if (!m_gatekeeperHost.IsResolvedHost)
                {
                    m_log.Error((m_gatekeeperHost.IsValidHost ? "Could not resolve GatekeeperURI" : "GatekeeperURI is a invalid host ") + externalName ?? "");
                    throw new Exception("GatekeeperURI is invalid");
                }
                m_gatekeeperURL = m_gatekeeperHost.URIwEndSlash;

                string gatekeeperURIAlias = Util.GetConfigVarFromSections <string>(config, "GatekeeperURIAlias", sections, string.Empty);

                if (!string.IsNullOrWhiteSpace(gatekeeperURIAlias))
                {
                    string[] alias = gatekeeperURIAlias.Split(',');
                    for (int i = 0; i < alias.Length; ++i)
                    {
                        OSHHTPHost tmp = new OSHHTPHost(alias[i].Trim(), false);
                        if (tmp.IsValidHost)
                        {
                            if (m_gateKeeperAlias == null)
                            {
                                m_gateKeeperAlias = new HashSet <OSHHTPHost>();
                            }
                            m_gateKeeperAlias.Add(tmp);
                        }
                    }
                }

                object[] args = new object[] { config };
                m_GridService     = ServerUtils.LoadPlugin <IGridService>(gridService, args);
                m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);

                if (accountService != string.Empty)
                {
                    m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args);
                }
                if (homeUsersService != string.Empty)
                {
                    m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(homeUsersService, args);
                }
                if (gridUserService != string.Empty)
                {
                    m_GridUserService = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
                }
                if (bansService != string.Empty)
                {
                    m_BansService = ServerUtils.LoadPlugin <IBansService>(bansService, args);
                }

                if (simService != null)
                {
                    m_SimulationService = simService;
                }
                else if (simulationService != string.Empty)
                {
                    m_SimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args);
                }

                string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "GatekeeperService" };
                m_AllowedClients = Util.GetConfigVarFromSections <string>(
                    config, "AllowedClients", possibleAccessControlConfigSections, string.Empty);
                m_DeniedClients = Util.GetConfigVarFromSections <string>(
                    config, "DeniedClients", possibleAccessControlConfigSections, string.Empty);
                m_DeniedMacs = Util.GetConfigVarFromSections <string>(
                    config, "DeniedMacs", possibleAccessControlConfigSections, string.Empty);
                m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true);

                LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions);
                LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions);

                if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
                {
                    throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
                }

                IConfig presenceConfig = config.Configs["PresenceService"];
                if (presenceConfig != null)
                {
                    m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences);
                }

                IConfig messagingConfig = config.Configs["Messaging"];
                if (messagingConfig != null)
                {
                    m_messageKey = messagingConfig.GetString("MessageKey", String.Empty);
                }
                m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
            }
        }
Exemplo n.º 37
0
        public bool TeleportAgent(GridRegion destination, uint TeleportFlags, int DrawDistance,
                                  AgentCircuitData circuit, AgentData agentData, UUID AgentID, ulong requestingRegion,
                                  out string reason)
        {
            IClientCapsService       clientCaps = m_registry.RequestModuleInterface <ICapsService>().GetClientCapsService(AgentID);
            IRegionClientCapsService regionCaps = clientCaps.GetCapsService(requestingRegion);

            if (regionCaps == null || !regionCaps.RootAgent)
            {
                reason = "";
                return(false);
            }

            bool result = false;

            try
            {
                bool callWasCanceled = false;

                ISimulationService SimulationService = m_registry.RequestModuleInterface <ISimulationService>();
                if (SimulationService != null)
                {
                    //Set the user in transit so that we block duplicate tps and reset any cancelations
                    if (!SetUserInTransit(AgentID))
                    {
                        reason = "Already in a teleport";
                        return(false);
                    }

                    //Note: we have to pull the new grid region info as the one from the region cannot be trusted
                    IGridService GridService = m_registry.RequestModuleInterface <IGridService>();
                    if (GridService != null)
                    {
                        destination = GridService.GetRegionByUUID(UUID.Zero, destination.RegionID);
                        //Inform the client of the neighbor if needed
                        circuit.child = false; //Force child status to the correct type

                        if (!InformClientOfNeighbor(AgentID, requestingRegion, circuit, destination, TeleportFlags,
                                                    agentData, out reason))
                        {
                            ResetFromTransit(AgentID);
                            return(false);
                        }
                    }
                    else
                    {
                        reason = "Could not find the grid service";
                        ResetFromTransit(AgentID);
                        return(false);
                    }

                    IEventQueueService EQService = m_registry.RequestModuleInterface <IEventQueueService>();

                    IRegionClientCapsService otherRegion = clientCaps.GetCapsService(destination.RegionHandle);

                    EQService.TeleportFinishEvent(destination.RegionHandle, destination.Access, destination.ExternalEndPoint, otherRegion.CapsUrl,
                                                  4, AgentID, TeleportFlags,
                                                  destination.RegionSizeX, destination.RegionSizeY,
                                                  requestingRegion);

                    // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
                    // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
                    // that the client contacted the destination before we send the attachments and close things here.

                    result = WaitForCallback(AgentID, out callWasCanceled);
                    if (!result)
                    {
                        //It says it failed, lets call the sim and check
                        IAgentData data = null;
                        result = SimulationService.RetrieveAgent(destination, AgentID, out data);
                    }
                    if (!result)
                    {
                        if (!callWasCanceled)
                        {
                            m_log.Warn("[AgentProcessing]: Callback never came for teleporting agent " +
                                       AgentID + ". Resetting.");
                        }
                        INeighborService service = m_registry.RequestModuleInterface <INeighborService>();
                        if (service != null)
                        {
                            //Close the agent at the place we just created if it isn't a neighbor
                            if (service.IsOutsideView(regionCaps.RegionX, destination.RegionLocX, regionCaps.Region.RegionSizeX, destination.RegionSizeX,
                                                      regionCaps.RegionY, destination.RegionLocY, regionCaps.Region.RegionSizeY, destination.RegionSizeY))
                            {
                                SimulationService.CloseAgent(destination, AgentID);
                            }
                        }
                        clientCaps.RemoveCAPS(destination.RegionHandle);
                        if (!callWasCanceled)
                        {
                            reason = "The teleport timed out";
                        }
                        else
                        {
                            reason = "Cancelled";
                        }
                    }
                    else
                    {
                        //Fix the root agent status
                        otherRegion.RootAgent = true;
                        regionCaps.RootAgent  = false;

                        // Next, let's close the child agent connections that are too far away.
                        CloseNeighborAgents(regionCaps.Region, destination, AgentID);
                        reason = "";
                    }
                }
                else
                {
                    reason = "No SimulationService found!";
                }
            }
            catch (Exception ex)
            {
                m_log.WarnFormat("[AgentProcessing]: Exception occured during agent teleport, {0}", ex.ToString());
                reason = "Exception occured.";
            }
            //All done
            ResetFromTransit(AgentID);
            return(result);
        }
 public void Start(IConfigSource config, IRegistryCore registry)
 {
     m_gridService = registry.RequestModuleInterface <IGridService>();
     m_simService  = registry.RequestModuleInterface <ISimulationService>();
 }
Exemplo n.º 39
0
 public ObjectHandler(ISimulationService sim)
 {
     m_SimulationService = sim;
 }
Exemplo n.º 40
0
 private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, out string reason)
 {
     return simConnector.CreateAgent(region, aCircuit, (int)Constants.TeleportFlags.ViaLogin, out reason);
 }
Exemplo n.º 41
0
 public AgentPutHandler(ISimulationService service) :
     base("PUT", "/agent")
 {
     m_SimulationService = service;
 }
Exemplo n.º 42
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            m_UserAccountService = registry.RequestModuleInterface<IUserAccountService>().InnerService;
            m_agentInfoService = registry.RequestModuleInterface<IAgentInfoService>().InnerService;
            m_AuthenticationService = registry.RequestModuleInterface<IAuthenticationService>();
            m_InventoryService = registry.RequestModuleInterface<IInventoryService>();
            m_GridService = registry.RequestModuleInterface<IGridService>();
            m_AvatarService = registry.RequestModuleInterface<IAvatarService>().InnerService;
            m_FriendsService = registry.RequestModuleInterface<IFriendsService>();
            m_SimulationService = registry.RequestModuleInterface<ISimulationService>();
            m_AssetService = registry.RequestModuleInterface<IAssetService> ().InnerService;
            m_LibraryService = registry.RequestModuleInterface<ILibraryService>();
            m_CapsService = registry.RequestModuleInterface<ICapsService>();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }
            //Start the grid profile archiver.
            new GridAvatarProfileArchiver(m_UserAccountService);
            archiver = new GridAvatarArchiver(m_UserAccountService, m_AvatarService, m_InventoryService, m_AssetService);

            LoginModules = Aurora.Framework.AuroraModuleLoader.PickupModules<ILoginModule>();
            foreach (ILoginModule module in LoginModules)
            {
                module.Initialize(this, m_config, m_UserAccountService);
            }

            m_log.DebugFormat("[LLOGIN SERVICE]: Starting...");
        }
Exemplo n.º 43
0
        bool CreateAgent(GridRegion region, IRegionClientCapsService regionCaps, ref AgentCircuitData aCircuit,
            ISimulationService SimulationService, List<UUID> friendsToInform, out CreateAgentResponse response)
        {
            CachedUserInfo info = new CachedUserInfo();
            IAgentConnector con = Framework.Utilities.DataManager.RequestPlugin<IAgentConnector>();

            if (con != null)
                info.AgentInfo = con.GetAgent(aCircuit.AgentID);

            if (regionCaps != null)
                info.UserAccount = regionCaps.ClientCaps.AccountInfo;

            IGroupsServiceConnector groupsConn = Framework.Utilities.DataManager.RequestPlugin<IGroupsServiceConnector>();

            if (groupsConn != null)
            {
                info.ActiveGroup = groupsConn.GetGroupMembershipData(aCircuit.AgentID, UUID.Zero, aCircuit.AgentID);
                info.GroupMemberships = groupsConn.GetAgentGroupMemberships(aCircuit.AgentID, aCircuit.AgentID);
            }

            IOfflineMessagesConnector offlineMessConn =
                Framework.Utilities.DataManager.RequestPlugin<IOfflineMessagesConnector>();

            if (offlineMessConn != null)
                info.OfflineMessages = offlineMessConn.GetOfflineMessages(aCircuit.AgentID);

            IMuteListConnector muteConn = Framework.Utilities.DataManager.RequestPlugin<IMuteListConnector>();

            if (muteConn != null)
                info.MuteList = muteConn.GetMuteList(aCircuit.AgentID);

            IAvatarService avatarService = m_registry.RequestModuleInterface<IAvatarService>();

            if (avatarService != null)
                info.Appearance = avatarService.GetAppearance(aCircuit.AgentID);

            info.FriendOnlineStatuses = friendsToInform;
            IFriendsService friendsService = m_registry.RequestModuleInterface<IFriendsService>();

            if (friendsService != null)
                info.Friends = friendsService.GetFriends(aCircuit.AgentID);

            aCircuit.CachedUserInfo = info;
            return SimulationService.CreateAgent(region, aCircuit, aCircuit.TeleportFlags, out response);
        }
Exemplo n.º 44
0
        private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
        {
            string version;

            if (
                !simConnector.QueryAccess(
                    region, aCircuit.AgentID, null, true, aCircuit.startpos, "SIMULATION/0.3", out version, out reason))
                return false;

            return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason);
        }
Exemplo n.º 45
0
 public MainController(ISimulationService simulation)
 {
     _simulationService = simulation;
 }
Exemplo n.º 46
0
 public AgentHandler(ISimulationService sim, IRegistryCore registry, bool secure)
 {
     m_registry          = registry;
     m_SimulationService = sim;
     m_secure            = secure;
 }
Exemplo n.º 47
0
 public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
     : base(config, simService, libraryService)
 {
     m_log.Debug("[DIVA LLOGIN SERVICE]: Starting...");
 }
Exemplo n.º 48
0
//        IConfig m_ClientsConfig;

        public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
        {
            m_LoginServerConfig = config.Configs["LoginService"];
            if (m_LoginServerConfig == null)
                throw new Exception(String.Format("No section LoginService in config file"));

            string accountService = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
            string gridUserService = m_LoginServerConfig.GetString("GridUserService", String.Empty);
            string agentService = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
            string authService = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
            string invService = m_LoginServerConfig.GetString("InventoryService", String.Empty);
            string gridService = m_LoginServerConfig.GetString("GridService", String.Empty);
            string presenceService = m_LoginServerConfig.GetString("PresenceService", String.Empty);
            string libService = m_LoginServerConfig.GetString("LibraryService", String.Empty);
            string friendsService = m_LoginServerConfig.GetString("FriendsService", String.Empty);
            string avatarService = m_LoginServerConfig.GetString("AvatarService", String.Empty);
            string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty);

            m_DefaultRegionName = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
            m_WelcomeMessage = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
            m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true);
            m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
            m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
            m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
                new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty);
            m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
            m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty);
            m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty);
            m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
            m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty);
            m_ClassifiedFee = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty);
            m_DestinationGuide = m_LoginServerConfig.GetString ("DestinationGuide", string.Empty);
            m_AvatarPicker = m_LoginServerConfig.GetString ("AvatarPicker", string.Empty);

            m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
            m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty);

            m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time");

            // Clean up some of these vars
            if (m_MapTileURL != String.Empty)
            {
                m_MapTileURL = m_MapTileURL.Trim();
                if (!m_MapTileURL.EndsWith("/"))
                    m_MapTileURL = m_MapTileURL + "/";
            }

            // These are required; the others aren't
            if (accountService == string.Empty || authService == string.Empty)
                throw new Exception("LoginService is missing service specifications");

            // replace newlines in welcome message
            m_WelcomeMessage = m_WelcomeMessage.Replace("\\n", "\n");

            Object[] args = new Object[] { config };
            m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
            m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
            m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
            m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);

            if (gridService != string.Empty)
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
            if (presenceService != string.Empty)
                m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
            if (avatarService != string.Empty)
                m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args);
            if (friendsService != string.Empty)
                m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(friendsService, args);
            if (simulationService != string.Empty)
                m_RemoteSimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
            if (agentService != string.Empty)
                m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(agentService, args);

            // Get the Hypergrid inventory service (exists only if Hypergrid is enabled)
            string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty);
            if (hgInvServicePlugin != string.Empty)
            {
                string hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty);
                Object[] args2 = new Object[] { config, hgInvServiceArg };
                m_HGInventoryService = ServerUtils.LoadPlugin<IInventoryService>(hgInvServicePlugin, args2);
            }

            //
            // deal with the services given as argument
            //
            m_LocalSimulationService = simService;
            if (libraryService != null)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using LibraryService given as argument");
                m_LibraryService = libraryService;
            }
            else if (libService != string.Empty)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using instantiated LibraryService");
                m_LibraryService = ServerUtils.LoadPlugin<ILibraryService>(libService, args);
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }

            m_log.DebugFormat("[LLOGIN SERVICE]: Starting...");

        }
Exemplo n.º 49
0
 public AgentHandler(ISimulationService sim, IRegistryCore registry, bool secure)
 {
     m_registry = registry;
     m_SimulationService = sim;
     m_secure = secure;
 }
Exemplo n.º 50
0
 public void Start(IConfigSource config, IRegistryCore registry)
 {
     m_gridService = registry.RequestModuleInterface<IGridService>();
     m_simService = registry.RequestModuleInterface<ISimulationService>();
 }
Exemplo n.º 51
0
 public AgentPutHandler(ISimulationService service) :
         base("PUT", "/agent")
 {
     m_SimulationService = service;
 }
Exemplo n.º 52
0
        protected AgentCircuitData LaunchAgentAtGrid(GridRegion gatekeeper, GridRegion destination, UserAccount account, AvatarAppearance avatar,
                                                     UUID session, UUID secureSession, Vector3 position, string currentWhere, string viewer, string channel, string mac, string id0,
                                                     IPEndPoint clientIP, out string where, out string reason, out GridRegion dest)
        {
            where = currentWhere;
            ISimulationService simConnector = null;

            reason = string.Empty;
            uint             circuitCode = 0;
            AgentCircuitData aCircuit    = null;

            if (m_UserAgentService == null)
            {
                // HG standalones have both a localSimulatonDll and a remoteSimulationDll
                // non-HG standalones have just a localSimulationDll
                // independent login servers have just a remoteSimulationDll
                if (m_LocalSimulationService != null)
                {
                    simConnector = m_LocalSimulationService;
                }
                else if (m_RemoteSimulationService != null)
                {
                    simConnector = m_RemoteSimulationService;
                }
            }
            else // User Agent Service is on
            {
                if (gatekeeper == null) // login to local grid
                {
                    if (hostName == string.Empty)
                    {
                        SetHostAndPort(m_GatekeeperURL);
                    }

                    gatekeeper = new GridRegion(destination);
                    gatekeeper.ExternalHostName = hostName;
                    gatekeeper.HttpPort         = (uint)port;
                }
                else // login to foreign grid
                {
                }
            }

            bool success = false;

            if (m_UserAgentService == null && simConnector != null)
            {
                circuitCode = (uint)Util.RandomClass.Next();;
                aCircuit    = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0);
                success     = LaunchAgentDirectly(simConnector, destination, aCircuit, out reason);
                if (!success && m_GridService != null)
                {
                    // Try the fallback regions
                    List <GridRegion> fallbacks = m_GridService.GetFallbackRegions(account.ScopeID, destination.RegionLocX, destination.RegionLocY);
                    if (fallbacks != null)
                    {
                        foreach (GridRegion r in fallbacks)
                        {
                            success = LaunchAgentDirectly(simConnector, r, aCircuit, out reason);
                            if (success)
                            {
                                where       = "safe";
                                destination = r;
                                break;
                            }
                        }
                    }
                }
            }

            if (m_UserAgentService != null)
            {
                circuitCode = (uint)Util.RandomClass.Next();;
                aCircuit    = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0);
                success     = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason);
                if (!success && m_GridService != null)
                {
                    // Try the fallback regions
                    List <GridRegion> fallbacks = m_GridService.GetFallbackRegions(account.ScopeID, destination.RegionLocX, destination.RegionLocY);
                    if (fallbacks != null)
                    {
                        foreach (GridRegion r in fallbacks)
                        {
                            success = LaunchAgentIndirectly(gatekeeper, r, aCircuit, clientIP, out reason);
                            if (success)
                            {
                                where       = "safe";
                                destination = r;
                                break;
                            }
                        }
                    }
                }
            }
            dest = destination;
            if (success)
            {
                return(aCircuit);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 53
0
 public AgentHandler(ISimulationService sim)
 {
     m_SimulationService = sim;
 }
Exemplo n.º 54
0
        public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
        {
            m_LoginServerConfig = config.Configs["LoginService"];
            if (m_LoginServerConfig == null)
            {
                throw new Exception(String.Format("No section LoginService in config file"));
            }

            string accountService    = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
            string gridUserService   = m_LoginServerConfig.GetString("GridUserService", String.Empty);
            string agentService      = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
            string authService       = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
            string invService        = m_LoginServerConfig.GetString("InventoryService", String.Empty);
            string gridService       = m_LoginServerConfig.GetString("GridService", String.Empty);
            string presenceService   = m_LoginServerConfig.GetString("PresenceService", String.Empty);
            string libService        = m_LoginServerConfig.GetString("LibraryService", String.Empty);
            string friendsService    = m_LoginServerConfig.GetString("FriendsService", String.Empty);
            string avatarService     = m_LoginServerConfig.GetString("AvatarService", String.Empty);
            string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty);

            m_DefaultRegionName        = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
            m_WelcomeMessage           = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
            m_RequireInventory         = m_LoginServerConfig.GetBoolean("RequireInventory", true);
            m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
            m_MinLoginLevel            = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
            m_GatekeeperURL            = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
            m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
            m_SearchURL  = m_LoginServerConfig.GetString("SearchURL", string.Empty);

            // These are required; the others aren't
            if (accountService == string.Empty || authService == string.Empty)
            {
                throw new Exception("LoginService is missing service specifications");
            }

            Object[] args = new Object[] { config };
            m_UserAccountService    = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args);
            m_GridUserService       = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
            m_AuthenticationService = ServerUtils.LoadPlugin <IAuthenticationService>(authService, args);
            m_InventoryService      = ServerUtils.LoadPlugin <IInventoryService>(invService, args);

            if (gridService != string.Empty)
            {
                m_GridService = ServerUtils.LoadPlugin <IGridService>(gridService, args);
            }
            if (presenceService != string.Empty)
            {
                m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);
            }
            if (avatarService != string.Empty)
            {
                m_AvatarService = ServerUtils.LoadPlugin <IAvatarService>(avatarService, args);
            }
            if (friendsService != string.Empty)
            {
                m_FriendsService = ServerUtils.LoadPlugin <IFriendsService>(friendsService, args);
            }
            if (simulationService != string.Empty)
            {
                m_RemoteSimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args);
            }
            if (agentService != string.Empty)
            {
                m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(agentService, args);
            }

            //
            // deal with the services given as argument
            //
            m_LocalSimulationService = simService;
            if (libraryService != null)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using LibraryService given as argument");
                m_LibraryService = libraryService;
            }
            else if (libService != string.Empty)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using instantiated LibraryService");
                m_LibraryService = ServerUtils.LoadPlugin <ILibraryService>(libService, args);
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }

            m_log.DebugFormat("[LLOGIN SERVICE]: Starting...");
        }
        public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
        {
            m_LoginServerConfig = config.Configs["LoginService"];
            if (m_LoginServerConfig == null)
                throw new Exception(String.Format("No section LoginService in config file"));

            string accountService = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
            string gridUserService = m_LoginServerConfig.GetString("GridUserService", String.Empty);
            string agentService = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
            string authService = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
            string invService = m_LoginServerConfig.GetString("InventoryService", String.Empty);
            string gridService = m_LoginServerConfig.GetString("GridService", String.Empty);
            string presenceService = m_LoginServerConfig.GetString("PresenceService", String.Empty);
            string libService = m_LoginServerConfig.GetString("LibraryService", String.Empty);
            string friendsService = m_LoginServerConfig.GetString("FriendsService", String.Empty);
            string avatarService = m_LoginServerConfig.GetString("AvatarService", String.Empty);
            string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty);

            m_DefaultRegionName = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
            m_WelcomeMessage = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
            m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true);
            m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
            m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
            m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
            m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
            m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);

            m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
            m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty);

            // These are required; the others aren't
            if (accountService == string.Empty || authService == string.Empty)
                throw new Exception("LoginService is missing service specifications");

            Object[] args = new Object[] { config };
            m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
            m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
            m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
            m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);

            if (gridService != string.Empty)
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
            if (presenceService != string.Empty)
                m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
            if (avatarService != string.Empty)
                m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args);
            if (friendsService != string.Empty)
                m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(friendsService, args);
            if (simulationService != string.Empty)
                m_RemoteSimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
            if (agentService != string.Empty)
                m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(agentService, args);

            //
            // deal with the services given as argument
            //
            m_LocalSimulationService = simService;
            if (libraryService != null)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using LibraryService given as argument");
                m_LibraryService = libraryService;
            }
            else if (libService != string.Empty)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using instantiated LibraryService");
                m_LibraryService = ServerUtils.LoadPlugin<ILibraryService>(libService, args);
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }

            m_log.DebugFormat("[LLOGIN SERVICE]: Starting...");

        }
Exemplo n.º 56
0
 public ObjectSimpleHandler(ISimulationService service) : base("/object")
 {
     m_SimulationService = service;
 }
Exemplo n.º 57
0
 private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
 {
     return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason);
 }
Exemplo n.º 58
0
        private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
        {
            EntityTransferContext ctx = new EntityTransferContext();

            if (!simConnector.QueryAccess(
                    region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), ctx, out reason))
                return false;

            return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, ctx, out reason);
        }
Exemplo n.º 59
0
        private bool CreateAgent(GridRegion region, IRegionClientCapsService regionCaps, ref AgentCircuitData aCircuit,
            ISimulationService SimulationService, ref int requestedUDPPort, out string reason)
        {
            CachedUserInfo info = new CachedUserInfo();
            IAgentConnector con = Aurora.DataManager.DataManager.RequestPlugin<IAgentConnector>();
            if (con != null)
                info.AgentInfo = con.GetAgent(aCircuit.AgentID);
            info.UserAccount = regionCaps.ClientCaps.AccountInfo;

            IGroupsServiceConnector groupsConn = Aurora.DataManager.DataManager.RequestPlugin<IGroupsServiceConnector>();
            if (groupsConn != null)
            {
                info.ActiveGroup = groupsConn.GetGroupMembershipData(aCircuit.AgentID, UUID.Zero, aCircuit.AgentID);
                info.GroupMemberships = groupsConn.GetAgentGroupMemberships(aCircuit.AgentID, aCircuit.AgentID);
            }
            aCircuit.OtherInformation["CachedUserInfo"] = info.ToOSD();
            return SimulationService.CreateAgent(region, aCircuit, aCircuit.teleportFlags, null,
                                                    out requestedUDPPort, out reason);
        }
Exemplo n.º 60
0
        public GatekeeperService(IConfigSource config, ISimulationService simService)
        {
            if (!m_Initialized)
            {
                m_Initialized = true;

                IConfig serverConfig = config.Configs["GatekeeperService"];
                if (serverConfig == null)
                {
                    throw new Exception(String.Format("No section GatekeeperService in config file"));
                }

                string accountService    = serverConfig.GetString("UserAccountService", String.Empty);
                string homeUsersService  = serverConfig.GetString("UserAgentService", string.Empty);
                string gridService       = serverConfig.GetString("GridService", String.Empty);
                string presenceService   = serverConfig.GetString("PresenceService", String.Empty);
                string simulationService = serverConfig.GetString("SimulationService", String.Empty);
                string gridUserService   = serverConfig.GetString("GridUserService", String.Empty);
                string bansService       = serverConfig.GetString("BansService", String.Empty);

                // These are mandatory, the others aren't
                if (gridService == string.Empty || presenceService == string.Empty)
                {
                    throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
                }

                string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
                UUID.TryParse(scope, out m_ScopeID);
                //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
                m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
                m_ExternalName = Util.GetConfigVarFromSections <string>(config, "GatekeeperURI",
                                                                        new string[] { "Startup", "Hypergrid", "GatekeeperService" }, String.Empty);
                m_ExternalName = serverConfig.GetString("ExternalName", m_ExternalName);
                if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
                {
                    m_ExternalName = m_ExternalName + "/";
                }

                try
                {
                    m_Uri = new Uri(m_ExternalName);
                }
                catch
                {
                    m_log.WarnFormat("[GATEKEEPER SERVICE]: Malformed gatekeeper address {0}", m_ExternalName);
                }

                Object[] args = new Object[] { config };
                m_GridService     = ServerUtils.LoadPlugin <IGridService>(gridService, args);
                m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);

                if (accountService != string.Empty)
                {
                    m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args);
                }
                if (homeUsersService != string.Empty)
                {
                    m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(homeUsersService, args);
                }
                if (gridUserService != string.Empty)
                {
                    m_GridUserService = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
                }
                if (bansService != string.Empty)
                {
                    m_BansService = ServerUtils.LoadPlugin <IBansService>(bansService, args);
                }

                if (simService != null)
                {
                    m_SimulationService = simService;
                }
                else if (simulationService != string.Empty)
                {
                    m_SimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args);
                }

                m_AllowedClients       = serverConfig.GetString("AllowedClients", string.Empty);
                m_DeniedClients        = serverConfig.GetString("DeniedClients", string.Empty);
                m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true);

                LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions);
                LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions);

                if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
                {
                    throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
                }

                m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
            }
        }