Пример #1
0
 public void Startup(ConfigurationLoader loader)
 {
     m_Scenes           = loader.Scenes;
     m_IMService        = loader.GetService <IMServiceInterface>(m_IMServiceName);
     m_FriendsPlugins   = loader.GetServicesByValue <IFriendsServicePlugin>();
     m_UserAgentPlugins = loader.GetServicesByValue <IUserAgentServicePlugin>();
     ThreadManager.CreateThread(HandlerThread).Start();
 }
Пример #2
0
 public void Startup(ConfigurationLoader loader)
 {
     m_Scenes = loader.Scenes;
     m_UserAgentServicePlugins = loader.GetServicesByValue <IUserAgentServicePlugin>();
     m_AssetServicePlugins     = loader.GetServicesByValue <IAssetServicePlugin>();
     m_InventoryServicePlugins = loader.GetServicesByValue <IInventoryServicePlugin>();
     m_IMService = loader.GetService <IMServiceInterface>(m_IMServiceName);
 }
Пример #3
0
 public void Startup(ConfigurationLoader loader)
 {
     m_UserAgentServices     = loader.GetServicesByValue <IUserAgentServicePlugin>();
     m_ProfileServices       = loader.GetServicesByValue <IProfileServicePlugin>();
     m_CleanupTimer.Elapsed += CleanupTimer;
     m_CleanupTimer.Start();
     ThreadManager.CreateThread(HandlerThread).Start();
 }
Пример #4
0
 public void Startup(ConfigurationLoader loader)
 {
     m_Loader = loader;
     if (loader.GetServicesByValue <TestRunner>().Count != 1)
     {
         throw new Exception("Too many TestRunner instances");
     }
     m_Tests = loader.GetServicesByValue <ITest>();
 }
Пример #5
0
        public void Startup(ConfigurationLoader loader)
        {
            m_Loader = loader;
            loader.GetService(m_AssetServiceName, out m_AssetService);
            m_TestRunner = m_Loader.GetServicesByValue <TestRunner>()[0];
            List <RunScript> scriptrunners = m_Loader.GetServicesByValue <RunScript>();

            if (scriptrunners.Count > 0)
            {
                m_ScriptRunner = scriptrunners[0];
            }
        }
Пример #6
0
        public void Startup(ConfigurationLoader loader)
        {
            m_ReferenceServices = loader.GetServicesByValue <IAssetReferenceInfoServiceInterface>();
            m_PurgeServices     = loader.GetServicesByValue <IAssetPurgeServiceInterface>();

            if (m_Enabled && m_ReferenceServices.Count > 0 && m_PurgeServices.Count > 0)
            {
                loader.CommandRegistry.Commands.Add("purge-assets", PurgeAssetsCmd);
                m_Timer.Elapsed += TimerTriggered;
                TimerTriggered(null, null);
                m_Timer.Start();
            }
        }
Пример #7
0
 public void Startup(ConfigurationLoader loader)
 {
     m_UserAccountService    = loader.GetService <UserAccountServiceInterface>(m_UserAccountServiceName);
     m_InventoryService      = loader.GetService <InventoryServiceInterface>(m_InventoryServiceName);
     m_AccountDeleteServices = loader.GetServicesByValue <IUserAccountDeleteServiceInterface>();
     m_AuthInfoService       = loader.GetService <AuthInfoServiceInterface>(m_AuthInfoServiceName);
     m_ServiceURLsGetters    = loader.GetServicesByValue <IServiceURLsGetInterface>();
     loader.CommandRegistry.AddCreateCommand("user", CreateUserCommand);
     loader.CommandRegistry.AddDeleteCommand("user", DeleteUserCommand);
     loader.CommandRegistry.AddChangeCommand("user", ChangeUserCommand);
     loader.CommandRegistry.AddShowCommand("user", ShowUserCommand);
     loader.CommandRegistry.AddShowCommand("serviceurls", ShowServiceUrlsCommand);
     loader.CommandRegistry.AddResetCommand("user", ResetUserPasswordCommand);
 }
Пример #8
0
        public void Startup(ConfigurationLoader loader)
        {
            HomeURI = loader.HomeURI;

            m_AgentInventoryService = loader.GetService <InventoryServiceInterface>(m_AgentInventoryServiceName);
            m_AgentAssetService     = loader.GetService <AssetServiceInterface>(m_AgentAssetServiceName);
            if (m_AgentProfileServiceName?.Length != 0)
            {
                m_AgentProfileService = loader.GetService <ProfileServiceInterface>(m_AgentProfileServiceName);
            }
            m_AgentFriendsService = loader.GetService <FriendsServiceInterface>(m_AgentFriendsServiceName);
            m_UserSessionService  = loader.GetService <UserSessionServiceInterface>(m_UserSessionServiceName);
            m_GridService         = loader.GetService <GridServiceInterface>(m_GridServiceName);
            if (m_OfflineIMServiceName?.Length != 0)
            {
                m_OfflineIMService = loader.GetService <OfflineIMServiceInterface>(m_OfflineIMServiceName);
            }
            if (m_AgentExperienceServiceName?.Length != 0)
            {
                loader.GetService(m_AgentExperienceServiceName, out m_AgentExperienceService);
            }
            if (m_AgentGroupsServiceName?.Length != 0)
            {
                loader.GetService(m_AgentGroupsServiceName, out m_AgentGroupsService);
            }
            m_UserAccountService    = loader.GetService <UserAccountServiceInterface>(m_UserAccountServiceName);
            m_AgentUserAgentService = new LocalUserAgentService(m_UserSessionService, m_UserAccountService, m_RequiresInventoryIDAsIMSessionID, HomeURI);

            m_Scenes               = loader.Scenes;
            m_Commands             = loader.CommandRegistry;
            m_CapsRedirector       = loader.CapsRedirector;
            m_PacketHandlerPlugins = loader.GetServicesByValue <IProtocolExtender>();
        }
Пример #9
0
        public void Startup(ConfigurationLoader loader)
        {
            m_Scenes = loader.Scenes;
            m_ForeignGridConnectorPlugins = loader.GetServicesByValue <IForeignGridConnectorPlugin>();

            ThreadManager.CreateThread(HandlerThread).Start(MapBlocksRequestQueue);
            ThreadManager.CreateThread(HandlerThread).Start(MapDetailsRequestQueue);
        }
Пример #10
0
        public static IAdminWebIF GetAdminWebIF(this ConfigurationLoader loader)
        {
            List <IAdminWebIF> webIF = loader.GetServicesByValue <IAdminWebIF>();

            if (webIF.Count == 0)
            {
                throw new ConfigurationLoader.ConfigurationErrorException("No Admin WebIF service configured");
            }
            return(webIF[0]);
        }
Пример #11
0
 public void Startup(ConfigurationLoader loader)
 {
     m_Scenes = loader.Scenes;
     m_GroupsServicePlugins     = loader.GetServicesByValue <IGroupsServicePlugin>();
     m_UserAgentServicePlugins  = loader.GetServicesByValue <IUserAgentServicePlugin>();
     m_GroupsChatServicePlugins = loader.GetServicesByValue <IGroupsChatServicePlugin>();
     loader.GetService(m_GroupsNameServiceName, out m_GroupsNameService);
     if (!string.IsNullOrEmpty(m_GroupsServiceName))
     {
         loader.GetService(m_GroupsServiceName, out m_GroupsService);
     }
     if (!string.IsNullOrEmpty(m_GroupIMRouterName))
     {
         loader.GetService(m_GroupIMRouterName, out m_GroupIMRouter);
     }
     m_GroupsHomeURI  = loader.HomeURI;
     m_Timer.Elapsed += ExpireHandler;
     m_Timer.Start();
 }
Пример #12
0
        public void Startup(ConfigurationLoader loader)
        {
            m_Scenes = loader.Scenes;
            loader.CommandRegistry.AddLoadCommand("terrain", LoadTerrainCommand);
            loader.CommandRegistry.AddSaveCommand("terrain", SaveTerrainCommand);

            foreach (ITerrainFileStorage iface in loader.GetServicesByValue <ITerrainFileStorage>())
            {
                m_TerrainFileStorages.Add(iface.Name, iface);
            }
        }
Пример #13
0
        public void Startup(ConfigurationLoader loader)
        {
            IConfig config = loader.Config.Configs[GetType().FullName];

            foreach (string key in config.GetKeys())
            {
                DataBlocks.Add(new KeyValuePair <string, byte[]>(key, config.GetString(key).FromHexStringToByteArray()));
            }
            m_Runner = loader.GetServicesByValue <TestRunner>()[0];
            m_Runner.ExcludeSummaryCount = true;
        }
Пример #14
0
 public void Startup(ConfigurationLoader loader)
 {
     m_GatekeeperURI = loader.GatekeeperURI;
     loader.GetService(m_UserSessionServiceName, out m_UserSessionService);
     loader.GetService(m_FriendsServiceName, out m_FriendsService);
     if (!string.IsNullOrEmpty(m_FriendsSimStatusNotifierServiceName))
     {
         loader.GetService(m_FriendsSimStatusNotifierServiceName, out m_FriendsSimStatusNotifierService);
     }
     m_UserAgentServicePlugins = loader.GetServicesByValue <IUserAgentServicePlugin>();
 }
Пример #15
0
        public void Startup(ConfigurationLoader loader)
        {
            IConfig config = loader.Config.Configs[GetType().FullName];

            foreach (string key in config.GetKeys())
            {
                Filenames.Add(config.GetString(key));
            }
            m_Runner = loader.GetServicesByValue <TestRunner>()[0];
            m_Runner.ExcludeSummaryCount = true;
        }
 public void Startup(ConfigurationLoader loader)
 {
     if (m_ExperienceServiceName.Length != 0)
     {
         loader.GetService(m_ExperienceServiceName, out m_ExperienceService);
     }
     m_ExperienceServicePlugins = loader.GetServicesByValue <IExperienceServicePlugin>();
     m_ExperienceHomeURI        = loader.HomeURI;
     m_Scenes = loader.Scenes;
     loader.GetService(m_ExperienceNameServiceName, out m_ExperienceNameService);
     m_Timer.Elapsed += ExpireHandler;
     m_Timer.Start();
 }
Пример #17
0
        public void Startup(ConfigurationLoader loader)
        {
            IConfig config = loader.Config.Configs[GetType().FullName];

            if (config == null)
            {
                m_MigratorTestControl = loader.GetService <DBMigratorTestInterface>("MigratorTestControl");
            }
            else
            {
                m_MigratorTestControl = loader.GetService <DBMigratorTestInterface>(config.GetString("MigratorTestControl", "MigratorTestControl"));
            }
            m_MigratableServices = loader.GetServicesByValue <IDBServiceInterface>();
        }
Пример #18
0
        public void Startup(ConfigurationLoader loader)
        {
            m_CommandRegistry           = loader.CommandRegistry;
            m_TeleportProtocols         = loader.GetServicesByValue <ITeleportHandlerFactoryServiceInterface>();
            m_UserSessionStatusServices = loader.GetServicesByValue <IUserSessionStatusHandler>();
            m_Scenes                = loader.Scenes;
            m_CapsRedirector        = loader.CapsRedirector;
            m_AuthorizationServices = loader.GetServicesByValue <AuthorizationServiceInterface>();
            m_HttpServer            = loader.HttpServer;
            m_GridService           = loader.GetService <GridServiceInterface>(m_GridServiceName);
            Commands                = loader.CommandRegistry;
            m_PacketHandlerPlugins  = loader.GetServicesByValue <IProtocolExtender>();
            m_GatekeeperURI         = loader.GatekeeperURI;

            loader.GetService(m_LocalUserAccountServiceName, out m_LocalUserAccountService);
            loader.GetService(m_LocalAssetServiceName, out m_LocalAssetService);
            loader.GetService(m_LocalInventoryServiceName, out m_LocalInventoryService);
            if (!string.IsNullOrEmpty(m_LocalProfileServiceName))
            {
                loader.GetService(m_LocalProfileServiceName, out m_LocalProfileService);
            }
            loader.GetService(m_LocalFriendsServiceName, out m_LocalFriendsService);
            loader.GetService(m_LocalUserSessionServiceName, out m_LocalUserSessionService);
            loader.GetService(m_LocalOfflineIMServiceName, out m_LocalOfflineIMService);
            if (!string.IsNullOrEmpty(m_LocalGroupsServiceName))
            {
                loader.GetService(m_LocalGroupsServiceName, out m_LocalGroupsService);
            }
            if (!string.IsNullOrEmpty(m_LocalExperienceServiceName))
            {
                loader.GetService(m_LocalExperienceServiceName, out m_LocalExperienceService);
            }
            if (!loader.TryGetService(m_LocalEconomyServiceName, out m_LocalEconomyService))
            {
                m_LocalEconomyService = null;
            }
        }
Пример #19
0
 public void Startup(ConfigurationLoader loader)
 {
     m_Loader = loader;
     foreach (string name in m_AvatarNameServiceNames.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
     {
         if (!string.IsNullOrEmpty(name))
         {
             AvatarNameServiceInterface avatarNameService;
             loader.GetService(name, out avatarNameService);
             m_AvatarNameServices.Add(avatarNameService);
         }
     }
     m_UserAgentServicePlugins = loader.GetServicesByValue <IUserAgentServicePlugin>();
     loader.IMRouter.GridIM.Add(RouteIM);
 }
        public void Startup(ConfigurationLoader loader)
        {
            IConfig config = loader.Config.Configs[GetType().FullName];

            foreach (string key in config.GetKeys())
            {
                if (key.StartsWith("Archive"))
                {
                    Archives.Add(config.GetString(key));
                }
            }
            CompilerRegistry.ScriptCompilers.DefaultCompilerName = config.GetString("DefaultCompiler");
            m_Runner = loader.GetServicesByValue <TestRunner>()[0];
            m_Runner.ExcludeSummaryCount = true;
        }
Пример #21
0
        public void Startup(ConfigurationLoader loader)
        {
            List <IAdminWebIF> webifs = loader.GetServicesByValue <IAdminWebIF>();

            if (webifs.Count > 0)
            {
                m_AdminWebIF = webifs[0];
                m_AdminWebIF.JsonMethods.Add("npcs.show", HandleShowNpcs);
                m_AdminWebIF.JsonMethods.Add("npc.remove", HandleRemoveNpc);
                m_AdminWebIF.JsonMethods.Add("npc.get", HandleGetNpc);
                m_AdminWebIF.AutoGrantRights["npcs.manage"].Add("npcs.view");
                m_AdminWebIF.ModuleNames.Add("npcs");
            }
            /* non persistent inventory is needed for baking logic */
            m_NonpersistentInventoryService = loader.GetService <InventoryServiceInterface>(m_NonpersistentInventoryServiceName);
            m_NonpersistentAgentServices.Add(m_NonpersistentInventoryService);
            m_NonpersistentAgentServices.Add(new NpcNonPersistentPresenceService());

            /* persistence is optional */
            if (!string.IsNullOrEmpty(m_NpcPresenceServiceName) || !string.IsNullOrEmpty(m_PersistentInventoryServiceName))
            {
                m_NpcPresenceService = loader.GetService <NpcPresenceServiceInterface>(m_NpcPresenceServiceName);
                m_PersistentAgentServices.Add(m_NpcPresenceService);
                m_PersistentInventoryService = loader.GetService <InventoryServiceInterface>(m_PersistentInventoryServiceName);
                m_PersistentAgentServices.Add(m_PersistentInventoryService);

                /* profile is optional */
                if (!string.IsNullOrEmpty(m_PersistentProfileServiceName))
                {
                    m_PersistentProfileService = loader.GetService <ProfileServiceInterface>(m_PersistentProfileServiceName);
                    m_PersistentAgentServices.Add(m_PersistentProfileService);
                }
            }

            /* profile is optional */
            if (!string.IsNullOrEmpty(m_NonpersistentProfileServiceName))
            {
                m_NonpersistentProfileService = loader.GetService <ProfileServiceInterface>(m_NonpersistentProfileServiceName);
                m_NonpersistentAgentServices.Add(m_NonpersistentProfileService);
            }
            loader.Scenes.OnRegionAdd    += OnSceneAdded;
            loader.Scenes.OnRegionRemove += OnSceneRemoved;

            loader.CommandRegistry.AddShowCommand("npcs", ShowNpcsCommand);
            loader.CommandRegistry.AddRemoveCommand("npc", RemoveNpcCommand);
            loader.CommandRegistry.AddCreateCommand("npc", CreateNpcCommand);
            loader.CommandRegistry.AddRemoveAllCommand("npcs", RemoveAllNpcsCommand);
        }
Пример #22
0
        public void Startup(ConfigurationLoader loader)
        {
            m_Runner = loader.GetServicesByValue <TestRunner>()[0];
            m_Runner.ExcludeSummaryCount = true;

            IConfig config = loader.Config.Configs[GetType().FullName];

            foreach (string key in config.GetKeys())
            {
                UUID uuid;
                if (UUID.TryParse(key, out uuid))
                {
                    Assets[uuid] = config.GetString(key);
                }
            }
        }
Пример #23
0
        public void Startup(ConfigurationLoader loader)
        {
            IConfig config = loader.Config.Configs[GetType().FullName];

            foreach (string key in config.GetKeys())
            {
                UUID uuid;
                if (UUID.TryParse(key, out uuid))
                {
                    Files[uuid] = config.GetString(key);
                }
            }
            CompilerRegistry.ScriptCompilers.DefaultCompilerName = config.GetString("DefaultCompiler");
            m_Runner = loader.GetServicesByValue <TestRunner>()[0];
            m_Runner.ExcludeSummaryCount = true;
        }
Пример #24
0
        public void Startup(ConfigurationLoader loader)
        {
            IConfig config = loader.Config.Configs[GetType().FullName];

            m_ScriptFile = config.Get("ScriptFile", string.Empty);
            foreach (string key in config.GetKeys())
            {
                int line;
                if (int.TryParse(key, out line))
                {
                    m_ExpectedErrors.Add(line, config.GetString(key));
                }
            }
            CompilerRegistry.ScriptCompilers.DefaultCompilerName = config.GetString("DefaultCompiler");
            m_Runner = loader.GetServicesByValue <TestRunner>()[0];
            m_Runner.ExcludeSummaryCount = true;
        }
Пример #25
0
        public void Startup(ConfigurationLoader loader)
        {
            m_AccountDeleteServices = loader.GetServicesByValue <IUserAccountDeleteServiceInterface>();

            m_UserAccountService = loader.GetService <UserAccountServiceInterface>(m_UserAccountServiceName);
            m_AuthInfoService    = loader.GetService <AuthInfoServiceInterface>(m_AuthInfoServiceName);
            var webif = loader.GetAdminWebIF();

            m_WebIF = webif;
            webif.ModuleNames.Add("useraccounts");
            webif.AutoGrantRights["useraccounts.manage"].Add("useraccounts.view");
            webif.AutoGrantRights["useraccounts.delete"].Add("useraccounts.view");
            webif.AutoGrantRights["useraccounts.create"].Add("useraccounts.view");

            webif.JsonMethods.Add("useraccounts.search", HandleUserAccountSearch);
            webif.JsonMethods.Add("useraccount.get", HandleUserAccountGet);
            webif.JsonMethods.Add("useraccount.change", HandleUserAccountChange);
            webif.JsonMethods.Add("useraccount.delete", HandleUserAccountDelete);
            webif.JsonMethods.Add("useraccount.changepassword", HandleUserAccountChangePassword);
            webif.JsonMethods.Add("useraccount.create", HandleUserAccountCreate);
        }
Пример #26
0
        public void Startup(ConfigurationLoader loader)
        {
            m_Scenes        = loader.Scenes;
            m_Loader        = loader;
            m_GatekeeperURI = loader.GatekeeperURI;
            IConfig config = loader.Config.Configs[GetType().FullName];

            /* we use same asset id keying here so to make them compatible with the other scripts */
            foreach (string key in config.GetKeys())
            {
                if (UUID.TryParse(key, out m_AssetID))
                {
                    m_ScriptFile = config.GetString(key);
                    break;
                }
            }

            m_ObjectPermissionsBase     = GetPermissions(config, "ObjectPermisionsBase");
            m_ObjectPermissionsOwner    = GetPermissions(config, "ObjectPermisionsOwner");
            m_ObjectPermissionsGroup    = GetPermissions(config, "ObjectPermisionsGroup");
            m_ObjectPermissionsNext     = GetPermissions(config, "ObjectPermisionsNext");
            m_ObjectPermissionsEveryone = GetPermissions(config, "ObjectPermisionsEveryone");

            m_ScriptPermissionsBase     = GetPermissions(config, "ScriptPermisionsBase");
            m_ScriptPermissionsOwner    = GetPermissions(config, "ScriptPermisionsOwner");
            m_ScriptPermissionsGroup    = GetPermissions(config, "ScriptPermisionsGroup");
            m_ScriptPermissionsNext     = GetPermissions(config, "ScriptPermisionsNext");
            m_ScriptPermissionsEveryone = GetPermissions(config, "ScriptPermisionsEveryone");

            m_LoadOarFileName = config.GetString("OarFilename", string.Empty);

            m_TimeoutMs   = config.GetInt("RunTimeout", 1000);
            m_RegionID    = UUID.Parse(config.GetString("RegionID"));
            m_RegionOwner = new UGUIWithName(config.GetString("RegionOwner"))
            {
                IsAuthoritative = true
            };
            m_EstateOwner = new UGUIWithName(config.GetString("EstateOwner", m_RegionOwner.ToString()))
            {
                IsAuthoritative = true
            };
            m_EstateID   = (uint)config.GetInt("EstateID", 100);
            m_EstateName = config.GetString("EstateName", "My Estate");

            m_ObjectID       = UUID.Parse(config.GetString("ID", UUID.Random.ToString()));
            m_RegionName     = config.GetString("RegionName", "Testing Region");
            m_ProductName    = config.GetString("RegionProductName", "Mainland");
            m_RegionLocation = new GridVector(config.GetString("RegionLocation", "10000,10000"), 256);
            m_RegionSize     = new GridVector(config.GetString("RegionSize", "1,1"), 256);
            m_RegionAccess   = (RegionAccess)Enum.Parse(typeof(RegionAccess), config.GetString("RegionAccess", "PG"));
            m_RegionPort     = config.GetInt("RegionPort", 9300);
            m_Runner         = loader.GetServicesByValue <TestRunner>()[0];
            m_Position       = Vector3.Parse(config.GetString("Position", "<128, 128, 23>"));
            m_Rotation       = Quaternion.Parse(config.GetString("Rotation", "<0,0,0,1>"));

            m_ItemID       = UUID.Parse(config.GetString("ScriptItemID", UUID.Random.ToString()));
            m_RezzingObjID = UUID.Parse(config.GetString("RezzingObjectID", UUID.Zero.ToString()));
            m_ObjectName   = config.GetString("ObjectName", "Object");
            m_ScriptName   = config.GetString("ScriptName", "Script");
            string experienceName = config.GetString("ExperienceName", "My Experience");
            UUID   experienceID;

            UUID.TryParse(config.GetString("ExperienceID", UUID.Zero.ToString()), out experienceID);
            m_ExperienceID = new UEI(experienceID, experienceName, null);

            m_ObjectDescription = config.GetString("ObjectDescription", "");
            m_ScriptDescription = config.GetString("ScriptDescription", "");

            m_RegionStorage      = loader.GetService <GridServiceInterface>("RegionStorage");
            m_SceneFactory       = loader.GetService <SceneFactoryInterface>("DefaultSceneImplementation");
            m_EstateService      = loader.GetService <EstateServiceInterface>("EstateService");
            m_AvatarNameService  = loader.GetService <AvatarNameServiceInterface>("AvatarNameStorage");
            m_UserAccountService = loader.GetService <UserAccountServiceInterface>("UserAccountService");

            m_AvatarNameService.Store(m_RegionOwner);
            m_AvatarNameService.Store(m_EstateOwner);
            try
            {
                m_UserAccountService.Add(new UserAccount
                {
                    Principal     = m_RegionOwner,
                    IsLocalToGrid = true,
                });
            }
            catch
            {
                m_Log.Info("UserAccount creation failed for RegionOwner");
            }

            if (!m_EstateOwner.EqualsGrid(m_RegionOwner))
            {
                try
                {
                    m_UserAccountService.Add(new UserAccount
                    {
                        Principal     = m_RegionOwner,
                        IsLocalToGrid = true,
                    });
                }
                catch
                {
                    m_Log.Info("UserAccount creation failed for EstateOwner");
                }
            }

            m_ObjectOwner = new UGUIWithName(config.GetString("ObjectOwner"))
            {
                IsAuthoritative = true
            };
            m_AvatarNameService.Store(m_ObjectOwner);
            if (config.Contains("ObjectCreator"))
            {
                m_ObjectCreator = new UGUIWithName(config.GetString("ObjectCreator"))
                {
                    IsAuthoritative = true
                };
                m_AvatarNameService.Store(m_ObjectCreator);
                try
                {
                    m_UserAccountService.Add(new UserAccount
                    {
                        Principal     = m_ObjectCreator,
                        IsLocalToGrid = true,
                    });
                }
                catch
                {
                    /* intentionally ignored */
                }
            }
            else
            {
                m_ObjectCreator = m_ObjectOwner;
            }
            if (config.Contains("ObjectLastOwner"))
            {
                m_ObjectLastOwner = new UGUIWithName(config.GetString("ObjectLastOwner"))
                {
                    IsAuthoritative = true
                };
                m_AvatarNameService.Store(m_ObjectLastOwner);
                try
                {
                    m_UserAccountService.Add(new UserAccount
                    {
                        Principal     = m_ObjectLastOwner,
                        IsLocalToGrid = true,
                    });
                }
                catch
                {
                    /* intentionally ignored */
                }
            }
            else
            {
                m_ObjectLastOwner = m_ObjectOwner;
            }

            m_ScriptOwner = new UGUIWithName(config.GetString("ScriptOwner"))
            {
                IsAuthoritative = true
            };
            m_AvatarNameService.Store(m_ScriptOwner);
            if (config.Contains("ScriptCreator"))
            {
                m_ScriptCreator = new UGUIWithName(config.GetString("ScriptCreator"))
                {
                    IsAuthoritative = true
                };
                m_AvatarNameService.Store(m_ScriptCreator);
                try
                {
                    m_UserAccountService.Add(new UserAccount
                    {
                        Principal     = m_ScriptCreator,
                        IsLocalToGrid = true,
                    });
                }
                catch
                {
                    /* intentionally ignored */
                }
            }
            else
            {
                m_ScriptCreator = m_ScriptOwner;
            }
            if (config.Contains("ScriptLastOwner"))
            {
                m_ScriptLastOwner = new UGUIWithName(config.GetString("ScriptLastOwner"))
                {
                    IsAuthoritative = true
                };
                m_AvatarNameService.Store(m_ScriptLastOwner);
                try
                {
                    m_UserAccountService.Add(new UserAccount
                    {
                        Principal     = m_ScriptLastOwner,
                        IsLocalToGrid = true,
                    });
                }
                catch
                {
                    /* intentionally ignored */
                }
            }
            else
            {
                m_ScriptLastOwner = m_ScriptOwner;
            }

            m_StartParameter = config.GetInt("StartParameter", 0);

            if (string.IsNullOrEmpty(m_ScriptFile))
            {
                throw new ArgumentException("Script filename and UUID missing");
            }

            m_AdditionalObjectConfigs = config.GetString("AdditionalObjects", string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            if (m_AdditionalObjectConfigs.Length == 1 && m_AdditionalObjectConfigs[0] == string.Empty)
            {
                m_AdditionalObjectConfigs = new string[0];
            }

            m_AdditionalInventoryConfigs = config.GetString("AdditionalInventories", string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            if (m_AdditionalInventoryConfigs.Length == 1 && m_AdditionalInventoryConfigs[0] == string.Empty)
            {
                m_AdditionalInventoryConfigs = new string[0];
            }

            m_AssetSourcesConfig = config.GetString("AssetSources", string.Empty);

            m_ScriptStatesConfig = config.GetString("ScriptStates", string.Empty);

            CompilerRegistry.ScriptCompilers.DefaultCompilerName = config.GetString("DefaultCompiler");
        }
Пример #27
0
        public BaseHttpServer(IConfig httpConfig, ConfigurationLoader loader, bool useSsl = false)
        {
            m_PortControlServices = loader.GetServicesByValue <IPortControlServiceInterface>();
            Port            = (uint)httpConfig.GetInt("Port", useSsl ? 9001 : 9000);
            m_IsBehindProxy = httpConfig.GetBoolean("HasProxy", false);
            m_CertificateObtainServiceName = httpConfig.GetString("CertificateObtainService", string.Empty);
            /* prevent Mono from lazy loading SslStream at shutdown */
            m_SslStreamPreload = typeof(SslStream);

            if (httpConfig.Contains("ServerCertificate"))
            {
                m_CertificateFileName = httpConfig.GetString("ServerCertificate");
                Scheme  = Uri.UriSchemeHttps;
                m_IsSsl = true;
            }
            else if (useSsl)
            {
                m_CertificateFileName = "../data/server-cert.p12";
                Scheme  = Uri.UriSchemeHttps;
                m_IsSsl = true;
            }
            else
            {
                Scheme = Uri.UriSchemeHttp;
            }

            if (httpConfig.GetBoolean("AllowDualMode", true) && Socket.OSSupportsIPv6)
            {
                m_ListenerSocket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp)
                {
                    DualMode = true
                };
            }
            else
            {
                m_ListenerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            }

            try
            {
                if (m_ListenerSocket.Ttl < 128)
                {
                    m_ListenerSocket.Ttl = 128;
                }
            }
            catch (SocketException)
            {
                m_Log.Debug("Failed to increase default TTL");
            }

            /* since Win 2000, there is a WSAECONNRESET, we do not want that in our code */
            try
            {
                const int SIO_UDP_CONNRESET = -1744830452;

                m_ListenerSocket.IOControl(SIO_UDP_CONNRESET, new byte[] { 0 }, null);
            }
            catch (SocketException)
            {
                /* however, mono does not have an idea about what this is all about, so we catch that here */
            }

            var ep = new IPEndPoint(m_ListenerSocket.DualMode ? IPAddress.IPv6Any : IPAddress.Any, (int)Port);

            m_ListenerSocket.Bind(ep);
            m_ListenerSocket.Listen(128);

            foreach (IPortControlServiceInterface iface in m_PortControlServices)
            {
                iface.EnablePort(new AddressFamily[] { AddressFamily.InterNetwork }, ProtocolType.Tcp, (int)Port);
                if (m_ListenerSocket.DualMode)
                {
                    iface.EnablePort(new AddressFamily[] { AddressFamily.InterNetworkV6 }, ProtocolType.Tcp, (int)Port);
                }
            }

            m_ListenerThread = ThreadManager.CreateThread(AcceptThread);
            m_ListenerThread.Start();

            if (Scheme == Uri.UriSchemeHttps)
            {
                if (httpConfig.GetBoolean("EnableTls1.0", false))
                {
                    m_SslProtocols |= SslProtocols.Tls;
                    loader.KnownConfigurationIssues.Add("Please set EnableTls1.0 in [HTTPS] to false. TLS V1.0 is susceptible to POODLE attack. Only enable if explicitly needed for certain old applications.");
                }
                if (httpConfig.GetBoolean("EnableTls1.1", false))
                {
                    m_SslProtocols |= SslProtocols.Tls11;
                    loader.KnownConfigurationIssues.Add("Please set EnableTls1.0 in [HTTPS] to false. TLS V1.1 is susceptible to POODLE attack. Only enable if explicitly needed for certain old applications.");
                }
                m_Log.InfoFormat("Adding HTTPS Server at port {0} (DualMode={1})", Port, m_ListenerSocket.DualMode);
            }
            else
            {
                m_Log.InfoFormat("Adding HTTP Server at port {0} (DualMode={1})", Port, m_ListenerSocket.DualMode);
            }
        }
 public void Startup(ConfigurationLoader loader)
 {
     m_RegionDefaultServices = loader.GetServicesByValue <RegionDefaultFlagsServiceInterface>();
 }
Пример #29
0
        public void Startup(ConfigurationLoader loader)
        {
            if (!string.IsNullOrEmpty(m_WindModelFactoryName))
            {
                WindModelFactory = loader.GetService <IWindModelFactory>(m_WindModelFactoryName);
            }
            if (!string.IsNullOrEmpty(m_PathfindingServiceFactoryName))
            {
                PathfindingServiceFactory = loader.GetService <IPathfindingServiceFactory>(m_PathfindingServiceFactoryName);
            }
            HttpServer              = loader.HttpServer;
            PortControlServices     = loader.GetServicesByValue <IPortControlServiceInterface>();
            ExternalHostNameService = loader.ExternalHostNameService;
            Scenes        = loader.Scenes;
            IMRouter      = loader.IMRouter;
            RegionStorage = loader.GetService <GridServiceInterface>(m_RegionStorageName);
            ChatFactory   = loader.GetService <ChatServiceFactoryInterface>(m_ChatFactoryName);
            if (m_GroupsNameServiceName.Length != 0)
            {
                GroupsNameService = loader.GetService <GroupsNameServiceInterface>(m_GroupsNameServiceName);
            }
            if (m_GroupsServiceName.Length != 0)
            {
                GroupsService = loader.GetService <GroupsServiceInterface>(m_GroupsServiceName);
            }
            if (m_PhysicsName.Length != 0)
            {
                PhysicsFactory = loader.GetService <IPhysicsSceneFactory>(m_PhysicsName);
            }
            if (m_NeighborServiceName.Length != 0)
            {
                NeighborService = loader.GetService <NeighborServiceInterface>(m_NeighborServiceName);
            }
            if (m_ExperienceServiceName.Length != 0)
            {
                ExperienceService = loader.GetService <ExperienceServiceInterface>(m_ExperienceServiceName);
            }
            if (m_ExperienceNameServiceName.Length != 0)
            {
                ExperienceNameService = loader.GetService <ExperienceNameServiceInterface>(m_ExperienceNameServiceName);
            }
            AssetService          = loader.GetService <AssetServiceInterface>(m_AssetServiceName);
            AssetCacheService     = loader.GetService <AssetServiceInterface>(m_AssetCacheServiceName);
            GridService           = loader.GetService <GridServiceInterface>(m_GridServiceName);
            IMService             = loader.GetService <IMServiceInterface>(m_IMServiceName);
            SimulationDataStorage = loader.GetService <SimulationDataStorageInterface>(m_SimulationDataStorageName);
            EstateService         = loader.GetService <EstateServiceInterface>(m_EstateServiceName);
            foreach (string servicename in m_AvatarNameServiceNames)
            {
                AvatarNameServices.Add(loader.GetService <AvatarNameServiceInterface>(servicename));
            }
            UserAgentServicePlugins = loader.GetServicesByValue <IUserAgentServicePlugin>();
            AssetServicePlugins     = loader.GetServicesByValue <IAssetServicePlugin>();
            InventoryServicePlugins = loader.GetServicesByValue <IInventoryServicePlugin>();
            IScriptWorkerThreadPoolFactory scriptWorkerFactory;

            ScriptWorkerThreadPoolFactory = ScriptWorkerThreadPool.Factory;
            if (m_ScriptWorkerThreadPoolName?.Length != 0)
            {
                if (!loader.TryGetService(m_ScriptWorkerThreadPoolName, out scriptWorkerFactory))
                {
                    m_Log.WarnFormat("Script worker thread pool \"{0\" not found. Using default implementation.", m_ScriptWorkerThreadPoolName);
                    ScriptWorkerThreadPoolFactory = ScriptWorkerThreadPool.Factory;
                }
                else
                {
                    ScriptWorkerThreadPoolFactory = scriptWorkerFactory;
                }
            }
        }