Exemplo n.º 1
1
        public Config()
        {
            //check if there is any config file, if not create a new one with some defaults...
            if (File.Exists(AppPath + "\\dufftv.ini"))
            {
                //declare new source ini file
                source = new IniConfigSource(AppPath + "\\dufftv.ini");

                //turn on autosaving, no need to save manually
                source.AutoSave = true;

                // Creates two Boolean aliases.
                source.Alias.AddAlias("On", true);
                source.Alias.AddAlias("Off", false);

                _Version = source.Configs["defaults"].GetString("Version");
                _AutoUpdate = source.Configs["defaults"].GetBoolean("AutoUpdate", false);
                _ConnectionCheckURI = source.Configs["defaults"].GetString("ConnectionCheckURI", "http://www.google.se");
                _LastUpdate = _Version = source.Configs["defaults"].GetString("LastUpdate");
                _IconSize =  source.Configs["defaults"].GetInt("IconSize");
                _XMLTVSourceURI = source.Configs["xmltv"].GetString("SourceURI");
                _Country = source.Configs["xmltv"].GetString("Country");
                _ChannelList = source.Configs["xmltv"].Get("ChannelList").Split('|');

                _CreatedNewFile = false;
            }
            else
            {
                CreateNewConfigFile();
            }
        }
Exemplo n.º 2
1
 public void Initialise(IConfigSource config)
 {
     try 
     {
         m_config = config.Configs["SimianGrid"];
        
         if (m_config != null)
         {
             m_simianURL = m_config.GetString("SimianServiceURL");
             if (String.IsNullOrEmpty(m_simianURL))
             {
                 // m_log.DebugFormat("[SimianGrid] service URL is not defined");
                 return;
             }
             
             InitialiseSimCap();
             SimulatorCapability = SimulatorCapability.Trim();
             m_log.InfoFormat("[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability);
         }
     }
     catch (Exception e)
     {
         m_log.ErrorFormat("[SimianExternalCaps] initialization error: {0}",e.Message);
         return;
     }
 }
Exemplo n.º 3
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 void Initialise(IConfigSource source) 
 {
     try
     {
         IConfig statConfig = source.Configs["Statistics.Binary"];
         if (statConfig != null)
         {
             if (statConfig.Contains("enabled") && statConfig.GetBoolean("enabled"))
             {
                 if (statConfig.Contains("collect_region_stats"))
                 {
                     if (statConfig.GetBoolean("collect_region_stats"))
                     {
                         m_collectStats = true;
                     }
                 }
                 if (statConfig.Contains("region_stats_period_seconds"))
                 {
                     m_statLogPeriod = TimeSpan.FromSeconds(statConfig.GetInt("region_stats_period_seconds"));
                 }
                 if (statConfig.Contains("stats_dir"))
                 {
                     m_statsDir = statConfig.GetString("stats_dir");
                 }
             }
         }
     }
     catch
     {
         // if it doesn't work, we don't collect anything
     }
 }
        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));
        }
        public virtual void Initialize(Scene scene, IConfigSource config)
        {
            if (!initialized)
            {
                initialized = true;

                IConfig netConfig = config.Configs["Network"];

                if (netConfig != null)
                {
                    _gridSendKey = netConfig.GetString("grid_send_key");
                }


                IConfig startupConfig = config.Configs["Communications"];
                if ((startupConfig == null)
                    || (startupConfig != null)
                    && (startupConfig.GetString("InterregionComms", "RESTComms") == "RESTComms"))
                {
                    m_log.Info("[REST COMMS]: Enabling InterregionComms RESTComms module");
                    m_enabled = true;

                    InitOnce(scene);
                }
            }

            if (!m_enabled)
                return;

            InitEach(scene);

        }
 public void Initialize(IConfigSource config, IRegistryCore registry)
 {
     ReadConfig(config);
     IConfig handlers = config.Configs["Handlers"];
     if (handlers.GetString("NeighborHandler", "") == Name)
         registry.RegisterModuleInterface<INeighborService>(this);
 }
Exemplo n.º 8
0
        public TomlTable Load(IConfigSource source)
        {
#pragma warning disable SA1312
            IPersistableConfig _;
            return this.LoadInternal(source, out _);
#pragma warning restore SA1312
        }
Exemplo n.º 9
0
        public virtual void Initialize(IConfigSource config, IRegistryCore registry)
        {
            _config = config;
            m_registry = registry;
            IConfig agentConfig = config.Configs["AgentProcessing"];
            if (agentConfig != null)
            {
                m_enabled = agentConfig.GetString("Module", "AgentProcessing") == "AgentProcessing";
                VariableRegionSight = agentConfig.GetBoolean("UseVariableRegionSightDistance", VariableRegionSight);
                MaxVariableRegionSight = agentConfig.GetInt("MaxDistanceVariableRegionSightDistance",
                                                            MaxVariableRegionSight);
            }
            if (m_enabled)
            {
                m_registry.RegisterModuleInterface<IAgentProcessing>(this);

                IConfig auroraConfig = _config.Configs["AuroraConnectors"];
                IGenericsConnector genericsConnector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
                if (!auroraConfig.GetBoolean("CapsServiceDoRemoteCalls", false))
                {
                    genericsConnector.AddGeneric(UUID.Zero, "CapsServiceURL", "CapsURL", new OSDWrapper { Info = MainServer.Instance.ServerURI }.ToOSD());
                    genericsConnector.AddGeneric(UUID.Zero, "CapsServiceURL", "CapsPassword", new OSDWrapper { Info = new System.Random().NextDouble() * 1000 }.ToOSD());
                }

                Init(registry, "CapsService");
            }
        }
        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.º 11
0
        public virtual void Initialise(IConfigSource source)
        {
            IConfig config = source.Configs["InventoryService"];
            if (config == null)
            {
                m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
                throw new Exception("Inventory connector init error");
            }

            string serviceURI = config.GetString("InventoryServerURI",
                    String.Empty);

            if (serviceURI == String.Empty)
            {
                m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService");
                throw new Exception("Inventory connector init error");
            }
            m_ServerURI = serviceURI;

            m_requestTimeoutSecs = config.GetInt("RemoteRequestTimeout", m_requestTimeoutSecs);

            StatsManager.RegisterStat(
                new Stat(
                "RequestsMade", 
                "Requests made", 
                "Number of requests made to the remove inventory service", 
                "requests", 
                "inventory", 
                serviceURI, 
                StatType.Pull, 
                MeasuresOfInterest.AverageChangeOverTime,
                s => s.Value = RequestsMade,
                StatVerbosity.Debug));
        }
        public void LoadLibrary(ILibraryService service, IConfigSource source, IRegistryCore registry)
        {
            m_service = service;
            m_registry = registry;
            m_Database = Framework.Utilities.DataManager.RequestPlugin<IInventoryData>();

            IConfig libConfig = source.Configs["InventoryIARLoader"];
            const string pLibrariesLocation = "DefaultInventory/";
            AddDefaultAssetTypes();
            if (libConfig != null)
            {
                if (libConfig.GetBoolean("WipeLibrariesOnNextLoad", false))
                {
                    service.ClearDefaultInventory(); //Nuke it
                    libConfig.Set("WipeLibrariesOnNextLoad", false);
                    source.Save();
                }
                if (libConfig.GetBoolean("PreviouslyLoaded", false))
                    return; //If it is loaded, don't reload
                foreach (string iarFileName in Directory.GetFiles(pLibrariesLocation, "*.iar"))
                {
                    LoadLibraries(iarFileName);
                }
            }
        }
        public void Initialize(IConfigSource source)
        {
            IConfig config = source.Configs["SimulatorFeatures"];
            if (config != null)
            {
                m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
                if (m_MapImageServerURL != string.Empty)
                {
                    m_MapImageServerURL = m_MapImageServerURL.Trim();
                    if (!m_MapImageServerURL.EndsWith("/"))
                        m_MapImageServerURL = m_MapImageServerURL + "/";
                }

                m_SearchURL = config.GetString("SearchServerURI", string.Empty);
                m_MeshEnabled = config.GetBoolean("MeshEnabled", m_MeshEnabled);
                m_PhysicsMaterialsEnabled = config.GetBoolean("PhysicsMaterialsEnabled", m_MeshEnabled);
                m_DynamicPathfindingEnabled = config.GetBoolean("DynamicPathfindingEnabled", m_DynamicPathfindingEnabled);
                m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported);
            }

            // Now the chat params to be returned by the SimulatorFeatures response
            config = source.Configs["Chat"];
            if (config != null)
            {
                m_whisperdistance = config.GetInt("whisper_distance", m_whisperdistance);
                m_saydistance = config.GetInt("say_distance", m_saydistance);
                m_shoutdistance = config.GetInt("shout_distance", m_shoutdistance);
            }

            AddDefaultFeatures();
        }
Exemplo n.º 14
0
        public void Initialise(IConfigSource config)
        {
            IConfig groupsConfig = config.Configs["Groups"];

            if (groupsConfig == null)
            {
                // Do not run this module by default.
                return;
            }
            else
            {
                m_groupsEnabled = groupsConfig.GetBoolean("Enabled", false);
                if (!m_groupsEnabled)
                {
                    return;
                }

                if (groupsConfig.GetString("Module", "Default") != Name)
                {
                    m_groupsEnabled = false;

                    return;
                }

                m_log.InfoFormat("[Groups]: Initializing {0}", this.Name);

                m_groupNoticesEnabled   = groupsConfig.GetBoolean("NoticesEnabled", true);
                m_debugEnabled          = groupsConfig.GetBoolean("DebugEnabled", false);
                m_levelGroupCreate      = groupsConfig.GetInt("LevelGroupCreate", 0);
            }
        }
Exemplo n.º 15
0
        public void Initialise(IConfigSource config)
        {
            IConfig groupsConfig = config.Configs["Groups"];

            if (groupsConfig == null)
            {
                m_Enabled = false;
                //m_log.Info("[GROUPS]: No configuration found. Using defaults");
            }
            else
            {
                if (!groupsConfig.GetBoolean("Enabled", false))
                {
                    m_Enabled = false;
                    //m_log.Info("[GROUPS]: Groups disabled in configuration");
                    return;
                }

                if (groupsConfig.GetString("Module", "Default") != "Default")
                {
                    m_Enabled = false;
                    return;
                }
            }
            m_Enabled = true;
        }
        public void Initialise(IConfigSource config)
        {
            IConfig conf = config.Configs["TSU.CCIR.OpenSim"];

            m_enabled = (conf != null && conf.GetBoolean("Enabled", false));
            m_log.Info(m_enabled ? "Enabled" : "Disabled");
        }
        public void Initialize(IConfigSource config, IRegistryCore registry)
        {
            registry.RegisterModuleInterface<IAuthorizationService>(this);
            m_registry = registry;

            MainConsole.Instance.Debug("[Authorization Service]: Local Authorization service enabled");
        }
        public SimulationDataService(IConfigSource config)
            : base(config)
        {
            string dllName = String.Empty;
            string connString = String.Empty;

            // Try reading the [DatabaseService] section, if it exists
            IConfig dbConfig = config.Configs["DatabaseService"];
            if (dbConfig != null)
            {
                dllName = dbConfig.GetString("StorageProvider", String.Empty);
                connString = dbConfig.GetString("ConnectionString", String.Empty);
            }

            // Try reading the [SimulationDataStore] section
            IConfig simConfig = config.Configs["SimulationDataStore"];
            if (simConfig != null)
            {
                dllName = simConfig.GetString("StorageProvider", dllName);
                connString = simConfig.GetString("ConnectionString", connString);
            }

            // We tried, but this doesn't exist. We can't proceed
            if (dllName == String.Empty)
                throw new Exception("No StorageProvider configured");

            m_database = LoadPlugin<ISimulationDataStore>(dllName, new Object[] { connString });
            if (m_database == null)
                throw new Exception("Could not find a storage interface in the given module");
        }
        public void Initialize(IConfigSource config, IRegistryCore registry)
        {
            if (MainConsole.Instance != null)
            {
                MainConsole.Instance.Commands.AddCommand(
                    "save archive",
                    "save archive",
                    "Saves a WhiteCore '.abackup' archive (deprecated)",
                    SaveWhiteCoreArchive, true, false);

                MainConsole.Instance.Commands.AddCommand(
                    "load archive",
                    "load archive",
                    "Loads a WhiteCore '.abackupArchive",
                    LoadWhiteCoreArchive, true, false);
            }
            //Register the extension
            const string ext = ".abackup";
            try
            {
                if(Util.IsWindows())
                {
                    RegistryKey key = Registry.ClassesRoot.CreateSubKey(ext + "\\DefaultIcon");
                    key.SetValue("", Application.StartupPath + "\\CrateDownload.ico");
                    key.Close();
                }
            }
            catch
            {
            }
            //Register the interface
            registry.RegisterModuleInterface<IWhiteCoreBackupArchiver>(this);
        }
        public UserAccountServiceBase(IConfigSource config) : base(config)
        {
            string dllName = String.Empty;
            string connString = String.Empty;
            string realm = "UserAccounts";

            IConfig dbConfig = config.Configs["DatabaseService"];
            if (dbConfig != null)
            {
                dllName = dbConfig.GetString("StorageProvider", String.Empty);
                connString = dbConfig.GetString("ConnectionString", String.Empty);
            }

            IConfig userConfig = config.Configs["UserAccountService"];
            if (userConfig == null)
                throw new Exception("No UserAccountService configuration");

            dllName = userConfig.GetString("StorageProvider", dllName);

            if (dllName == String.Empty)
                throw new Exception("No StorageProvider configured");

            connString = userConfig.GetString("ConnectionString", connString);

            realm = userConfig.GetString("Realm", realm);

            m_Database = LoadPlugin<IUserAccountData>(dllName, new Object[] {connString, realm});

            if (m_Database == null)
                throw new Exception("Could not find a storage interface in the given module");
        }
Exemplo n.º 21
0
        public void Initialize(IGenericData GenericData, IConfigSource source, string defaultConnectionString)
        {
            if (source.Configs["AuroraConnectors"].GetString("ProfileConnector", "LocalConnector") == "LocalConnector")
            {
                GD = GenericData;

                if (source.Configs[Name] != null)
                    defaultConnectionString = source.Configs[Name].GetString("ConnectionString", defaultConnectionString);

                GD.ConnectToDatabase(defaultConnectionString);

                DataManager.DataManager.RegisterPlugin(Name, this);
            }
            else
            {
                //Check to make sure that something else exists
                string m_ServerURI = source.Configs["AuroraData"].GetString("RemoteServerURI", "");
                if (m_ServerURI == "") //Blank, not set up
                {
                    OpenSim.Framework.Console.MainConsole.Instance.Output("[AuroraDataService]: Falling back on local connector for " + "ProfileConnector", "None");
                    GD = GenericData;

                    if (source.Configs[Name] != null)
                        defaultConnectionString = source.Configs[Name].GetString("ConnectionString", defaultConnectionString);

                    GD.ConnectToDatabase(defaultConnectionString);

                    DataManager.DataManager.RegisterPlugin(Name, this);
                }
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="config">Config source to load defaults from</param>
        public ThrottleRates(IConfigSource config)
        {
            try
            {
                IConfig throttleConfig = config.Configs["ClientStack.LindenUDP"];

                // Current default total is 66750
                Resend = throttleConfig.GetInt("resend_default", 6625);
                Land = throttleConfig.GetInt("land_default", 9125);
                Wind = throttleConfig.GetInt("wind_default", 1750);
                Cloud = throttleConfig.GetInt("cloud_default", 1750);
                Task = throttleConfig.GetInt("task_default", 18500);
                Texture = throttleConfig.GetInt("texture_default", 18500);
                Asset = throttleConfig.GetInt("asset_default", 10500);

                Total = throttleConfig.GetInt("client_throttle_max_bps", 0);

                AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false);
                MinimumAdaptiveThrottleRate = throttleConfig.GetInt("adaptive_throttle_min_bps", 32000);

                CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f);
                CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9);
            }
            catch (Exception) { }
        }
        public virtual void Initialise(Scene scene, IConfigSource config)
        {
            m_gConfig = config;

            IConfig startupConfig = m_gConfig.Configs["Startup"];

            ReadConfigAndPopulate(scene, startupConfig, "Startup");

            if (enabledYN)
            {
                m_scene = scene;
                scene.RegisterModuleInterface<IEventQueue>(this);
                
                // Register fallback handler
                // Why does EQG Fail on region crossings!
                
                //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack);

                scene.EventManager.OnNewClient += OnNewClient;

                // TODO: Leaving these open, or closing them when we
                // become a child is incorrect. It messes up TP in a big
                // way. CAPS/EQ need to be active as long as the UDP
                // circuit is there.

                scene.EventManager.OnClientClosed += ClientClosed;
                scene.EventManager.OnMakeChildAgent += MakeChildAgent;
                scene.EventManager.OnRegisterCaps += OnRegisterCaps;
            }
            else
            {
                m_gConfig = null;
            }
        
        }
        public void Initialise(IConfigSource config)
        {
            IConfig groupsConfig = config.Configs["Groups"];

            if (groupsConfig == null)
            {
                // Do not run this module by default.
                return;
            }
            else
            {
                // if groups aren't enabled, we're not needed.
                // if we're not specified as the connector to use, then we're not wanted
                if ((groupsConfig.GetBoolean("Enabled", false) == false)
                    || (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name))
                {
                    m_connectorEnabled = false;
                    return;
                }

                //m_log.InfoFormat("[AURORA-GROUPS-CONNECTOR]: Initializing {0}", this.Name);

                m_connectorEnabled = true;
            }
        }
Exemplo n.º 25
0
        private bool m_enabled = false; // Module is only enabled if running in grid mode

        #region IRegionModule Members

        public void Initialize(Scene scene, IConfigSource source)
        {
            if (m_firstScene == null)
            {
                m_firstScene = scene;

                IConfig startupConfig = source.Configs["Startup"];
                if (startupConfig != null)
                {
                    m_enabled = startupConfig.GetBoolean("gridmode", false);
                }

                IConfig netConfig = source.Configs["Network"];

                if (netConfig != null)
                {
                    _gridSendKey = netConfig.GetString("grid_send_key");
                }
                else
                {
                    throw new Exception("LLProxyLoginModule: Network configuration not found");
                }

                if (m_enabled)
                {
                    AddHttpHandlers();
                }
            }

            if (m_enabled)
            {
                AddScene(scene);
            }
        }
        public void Initialise(IConfigSource config)
        {
            IConfig cnf = config.Configs["Messaging"];
            if (cnf == null)
            {
                enabled = false;
                return;
            }
            if (cnf != null && cnf.GetString("OfflineMessageModule", "None") !=
                    "OfflineMessageModule")
            {
                enabled = false;
                return;
            }

            m_RestURL = cnf.GetString("OfflineMessageURL", "");
            if (m_RestURL == "")
            {
                m_log.Error("[OFFLINE MESSAGING] Module was enabled, but no URL is given, disabling");
                enabled = false;
                return;
            }

            m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
        }
        public void Initialise(IConfigSource configSource, ISimulationBase openSim)
        {
            m_configSource = configSource;
            m_openSim = openSim;
            
            IConfig config = configSource.Configs["RegionStartup"];
            if (config != null)
            {
                m_enabled = config.GetBoolean(Name + "_Enabled", m_enabled);
                if (!m_enabled)
                    return;
                if (MainConsole.Instance != null)
                    MainConsole.Instance.Commands.AddCommand("open region manager", "open region manager", "Opens the region manager", OpenRegionManager);
                m_default = config.GetString("Default") == Name;

                //Add the console command if it is the default
                if (m_default)
                    if (MainConsole.Instance != null)
                        MainConsole.Instance.Commands.AddCommand ("create region", "create region", "Create a new region.", AddRegion);
            }
            IConfig startupconfig = configSource.Configs["Startup"];
            if (startupconfig != null)
                m_noGUI = startupconfig.GetBoolean("NoGUI", false);

            m_openSim.ApplicationRegistry.StackModuleInterface<IRegionLoader>(this);
        }
Exemplo n.º 28
0
        public virtual void Initialise(IConfigSource config)
        {
            IConfig cnfg = config.Configs["WebStats"];

            if (cnfg != null)
                enabled = cnfg.GetBoolean("enabled", false);
        }
        public InventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
                base(config, server, configName)
        {
            if (configName != string.Empty)
                m_ConfigName = configName;
    
            IConfig serverConfig = config.Configs[m_ConfigName];
            if (serverConfig == null)
                throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));

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

            if (inventoryService == String.Empty)
                throw new Exception("No LocalServiceModule in config file");

            Object[] args = new Object[] { config };
            m_InventoryService =
                    ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args);

            m_userserver_url = serverConfig.GetString("UserServerURI", String.Empty);
            m_doLookup = serverConfig.GetBoolean("SessionAuthentication", false);

            AddHttpHandlers(server);
            m_log.Debug("[INVENTORY HANDLER]: handlers initialized");
        }
Exemplo n.º 30
0
        // -----------------------------------------------------------------
        /// <summary>
        /// Initialise this shared module
        /// </summary>
        /// <param name="scene">this region is getting initialised</param>
        /// <param name="source">nini config, we are not using this</param>
        // -----------------------------------------------------------------
        public void Initialise(IConfigSource config)
        {
            try 
            {
                if ((m_config = config.Configs["JsonStore"]) == null)
                {
                    // There is no configuration, the module is disabled
                    // m_log.InfoFormat("[JsonStore] no configuration info");
                    return;
                }

                m_enabled = m_config.GetBoolean("Enabled", m_enabled);
                m_enableObjectStore = m_config.GetBoolean("EnableObjectStore", m_enableObjectStore);
                m_maxStringSpace = m_config.GetInt("MaxStringSpace", m_maxStringSpace);
                if (m_maxStringSpace == 0)
                    m_maxStringSpace = Int32.MaxValue;
            }
            catch (Exception e)
            {
                m_log.Error("[JsonStore]: initialization error: {0}", e);
                return;
            }

            if (m_enabled)
                m_log.DebugFormat("[JsonStore]: module is enabled");
        }
Exemplo n.º 31
0
        public override void Initialise(IConfigSource config)
        {
            m_config = config.Configs["Concierge"];

            if (null == m_config)
            {
                return;
            }

            if (!m_config.GetBoolean("enabled", false))
            {
                return;
            }

            m_enabled = true;


            // check whether ChatModule has been disabled: if yes,
            // then we'll "stand in"
            try
            {
                if (config.Configs["Chat"] == null)
                {
                    // if Chat module has not been configured it's
                    // enabled by default, so we are not going to
                    // replace it.
                    m_replacingChatModule = false;
                }
                else
                {
                    m_replacingChatModule = !config.Configs["Chat"].GetBoolean("enabled", true);
                }
            }
            catch (Exception)
            {
                m_replacingChatModule = false;
            }

            m_log.InfoFormat("[Concierge] {0} ChatModule", m_replacingChatModule ? "replacing" : "not replacing");

            // take note of concierge channel and of identity
            m_conciergeChannel    = config.Configs["Concierge"].GetInt("concierge_channel", m_conciergeChannel);
            m_whoami              = m_config.GetString("whoami", "conferencier");
            m_welcomes            = m_config.GetString("welcomes", m_welcomes);
            m_announceEntering    = m_config.GetString("announce_entering", m_announceEntering);
            m_announceLeaving     = m_config.GetString("announce_leaving", m_announceLeaving);
            m_xmlRpcPassword      = m_config.GetString("password", m_xmlRpcPassword);
            m_brokerURI           = m_config.GetString("broker", m_brokerURI);
            m_brokerUpdateTimeout = m_config.GetInt("broker_timeout", m_brokerUpdateTimeout);

            m_log.InfoFormat("[Concierge] reporting as \"{0}\" to our users", m_whoami);

            // calculate regions Regex
            if (m_regions == null)
            {
                string regions = m_config.GetString("regions", String.Empty);
                if (!String.IsNullOrEmpty(regions))
                {
                    m_regions = new Regex(@regions, RegexOptions.Compiled | RegexOptions.IgnoreCase);
                }
            }
        }
Exemplo n.º 32
0
 /// <summary>
 ///     Load other IService modules now that this is set up
 /// </summary>
 /// <param name="config">Config file</param>
 /// <param name="registry">Place to register and retrieve module interfaces</param>
 public void Start(IConfigSource config, IRegistryCore registry)
 {
 }
Exemplo n.º 33
0
 public void Initialize(IConfigSource config, IRegistryCore registry)
 {
 }
Exemplo n.º 34
0
 public void Initialise(IConfigSource source)
 {
 }
Exemplo n.º 35
0
 public void Initialize(ILoginService service, IConfigSource source, IRegistryCore registry)
 {
     m_module = new BanCheck(source, registry.RequestModuleInterface <IUserAccountService>());
 }
Exemplo n.º 36
0
        private static bool _IsHandlingException; // Make sure we don't go recursive on ourself

        //could move our main function into OpenSimMain and kill this class
        public static void BaseMain(string[] args, string defaultIniFile, ISimulationBase simBase)
        {
            // First line, hook the appdomain to the crash reporter
            AppDomain.CurrentDomain.UnhandledException +=
                CurrentDomain_UnhandledException;

            // Add the arguments supplied when running the application to the configuration
            ArgvConfigSource configSource = new ArgvConfigSource(args);

            if (!args.Contains("-skipconfig"))
            {
                Configure(false);
            }

            // Increase the number of IOCP threads available. Mono defaults to a tragically low number
            int workerThreads, iocpThreads;

            ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
            //MainConsole.Instance.InfoFormat("[OPENSIM MAIN]: Runtime gave us {0} worker threads and {1} IOCP threads", workerThreads, iocpThreads);
            if (workerThreads < 500 || iocpThreads < 1000)
            {
                workerThreads = 500;
                iocpThreads   = 1000;
                //MainConsole.Instance.Info("[OPENSIM MAIN]: Bumping up to 500 worker threads and 1000 IOCP threads");
                ThreadPool.SetMaxThreads(workerThreads, iocpThreads);
            }

            BinMigratorService service = new BinMigratorService();

            service.MigrateBin();
            // Configure nIni aliases and localles
            Culture.SetCurrentCulture();
            configSource.Alias.AddAlias("On", true);
            configSource.Alias.AddAlias("Off", false);
            configSource.Alias.AddAlias("True", true);
            configSource.Alias.AddAlias("False", false);

            //Command line switches
            configSource.AddSwitch("Startup", "inifile");
            configSource.AddSwitch("Startup", "inimaster");
            configSource.AddSwitch("Startup", "inigrid");
            configSource.AddSwitch("Startup", "inisim");
            configSource.AddSwitch("Startup", "inidirectory");
            configSource.AddSwitch("Startup", "oldoptions");
            configSource.AddSwitch("Startup", "inishowfileloading");
            configSource.AddSwitch("Startup", "mainIniDirectory");
            configSource.AddSwitch("Startup", "mainIniFileName");
            configSource.AddSwitch("Startup", "secondaryIniFileName");
            configSource.AddSwitch("Startup", "RegionDataFileName");
            configSource.AddSwitch("Console", "Console");
            configSource.AddSwitch("Console", "LogAppendName");
            configSource.AddSwitch("Network", "http_listener_port");

            IConfigSource m_configSource = Configuration(configSource, defaultIniFile);

            // Check if we're saving crashes
            m_saveCrashDumps = m_configSource.Configs["Startup"].GetBoolean("save_crashes", m_saveCrashDumps);

            // load Crash directory config
            m_crashDir = m_configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);

            //Initialize the sim base now
            Startup(configSource, m_configSource, simBase.Copy(), args);
        }
Exemplo n.º 37
0
 //not in use, should swap to nini though.
 public void LoadFromNiniSource(IConfigSource source)
 {
     LoadFromNiniSource(source, "RegionInfo");
 }
Exemplo n.º 38
0
 public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource)
 {
     //m_configSource = configSource;
     configMember =
         new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
     configMember.performConfigurationRetrieve();
 }
 public GroupsService(IConfigSource config, string configName)
     : base(config, configName)
 {
 }
Exemplo n.º 40
0
 /// <summary>
 ///     Set up and register the module
 /// </summary>
 /// <param name="config">Config file</param>
 /// <param name="registry">Place to register the modules into</param>
 public void Initialize(IConfigSource config, IRegistryCore registry)
 {
     registry.RegisterModuleInterface <IScheduleService>(this);
     base.Init(registry, "Scheduler");
 }
Exemplo n.º 41
0
 public void Initialize(IConfigSource config, ISimulationBase simBase, string configName, IRegistryCore sim)
 {
 }
        public void Initialise(IConfigSource config)
        {
            m_Config = config.Configs["FreeSwitchVoice"];

            if (m_Config == null)
            {
                return;
            }

            if (!m_Config.GetBoolean("Enabled", false))
            {
                return;
            }

            try
            {
                string serviceDll = m_Config.GetString("LocalServiceModule",
                                                       String.Empty);

                if (serviceDll == String.Empty)
                {
                    m_log.Error("[FreeSwitchVoice]: No LocalServiceModule named in section FreeSwitchVoice.  Not starting.");
                    return;
                }

                Object[] args = new Object[] { config };
                m_FreeswitchService = ServerUtils.LoadPlugin <IFreeswitchService>(serviceDll, args);

                string jsonConfig = m_FreeswitchService.GetJsonConfig();
                //m_log.Debug("[FreeSwitchVoice]: Configuration string: " + jsonConfig);
                OSDMap map = (OSDMap)OSDParser.DeserializeJson(jsonConfig);

                m_freeSwitchAPIPrefix          = map["APIPrefix"].AsString();
                m_freeSwitchRealm              = map["Realm"].AsString();
                m_freeSwitchSIPProxy           = map["SIPProxy"].AsString();
                m_freeSwitchAttemptUseSTUN     = map["AttemptUseSTUN"].AsBoolean();
                m_freeSwitchEchoServer         = map["EchoServer"].AsString();
                m_freeSwitchEchoPort           = map["EchoPort"].AsInteger();
                m_freeSwitchDefaultWellKnownIP = map["DefaultWellKnownIP"].AsString();
                m_freeSwitchDefaultTimeout     = map["DefaultTimeout"].AsInteger();
                m_freeSwitchUrlResetPassword   = String.Empty;
//                m_freeSwitchContext = map["Context"].AsString();

                if (String.IsNullOrEmpty(m_freeSwitchRealm) ||
                    String.IsNullOrEmpty(m_freeSwitchAPIPrefix))
                {
                    m_log.Error("[FreeSwitchVoice]: Freeswitch service mis-configured.  Not starting.");
                    return;
                }

                // set up http request handlers for
                // - prelogin: viv_get_prelogin.php
                // - signin: viv_signin.php
                // - buddies: viv_buddy.php
                // - ???: viv_watcher.php
                // - signout: viv_signout.php
                MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix),
                                                   FreeSwitchSLVoiceGetPreloginHTTPHandler);

                MainServer.Instance.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix), FreeSwitchConfigHTTPHandler);

                // RestStreamHandler h = new
                // RestStreamHandler("GET",
                // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
                //  MainServer.Instance.AddStreamHandler(h);

                MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix),
                                                   FreeSwitchSLVoiceSigninHTTPHandler);

                MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix),
                                                   FreeSwitchSLVoiceBuddyHTTPHandler);

                MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_watcher.php", m_freeSwitchAPIPrefix),
                                                   FreeSwitchSLVoiceWatcherHTTPHandler);

                m_log.InfoFormat("[FreeSwitchVoice]: using FreeSwitch server {0}", m_freeSwitchRealm);

                m_Enabled = true;

                m_log.Info("[FreeSwitchVoice]: plugin enabled");
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[FreeSwitchVoice]: plugin initialization failed: {0} {1}", e.Message, e.StackTrace);
                return;
            }

            // This here is a region module trying to make a global setting.
            // Not really a good idea but it's Windows only, so I can't test.
            try
            {
                ServicePointManager.ServerCertificateValidationCallback += CustomCertificateValidation;
            }
            catch (NotImplementedException)
            {
                try
                {
#pragma warning disable 0612, 0618
                    // Mono does not implement the ServicePointManager.ServerCertificateValidationCallback yet!  Don't remove this!
                    ServicePointManager.CertificatePolicy = new MonoCert();
#pragma warning restore 0612, 0618
                }
                catch (Exception)
                {
                    // COmmented multiline spam log message
                    //m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported.  You may get ssl certificate validation errors teleporting from your region to some SSL regions.");
                }
            }
        }
Exemplo n.º 43
0
        public UserAccountService(IConfigSource config)
            : base(config)
        {
            IConfig userConfig = config.Configs["UserAccountService"];

            if (userConfig == null)
            {
                throw new Exception("No UserAccountService configuration");
            }

            string gridServiceDll = userConfig.GetString("GridService", string.Empty);

            if (gridServiceDll != string.Empty)
            {
                m_GridService = LoadPlugin <IGridService>(gridServiceDll, new Object[] { config });
            }

            string authServiceDll = userConfig.GetString("AuthenticationService", string.Empty);

            if (authServiceDll != string.Empty)
            {
                m_AuthenticationService = LoadPlugin <IAuthenticationService>(authServiceDll, new Object[] { config });
            }

            string presenceServiceDll = userConfig.GetString("GridUserService", string.Empty);

            if (presenceServiceDll != string.Empty)
            {
                m_GridUserService = LoadPlugin <IGridUserService>(presenceServiceDll, new Object[] { config });
            }

            string invServiceDll = userConfig.GetString("InventoryService", string.Empty);

            if (invServiceDll != string.Empty)
            {
                m_InventoryService = LoadPlugin <IInventoryService>(invServiceDll, new Object[] { config });
            }

            string avatarServiceDll = userConfig.GetString("AvatarService", string.Empty);

            if (avatarServiceDll != string.Empty)
            {
                m_AvatarService = LoadPlugin <IAvatarService>(avatarServiceDll, new Object[] { config });
            }

            m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false);

            // In case there are several instances of this class in the same process,
            // the console commands are only registered for the root instance
            if (m_RootInstance == null && MainConsole.Instance != null)
            {
                m_RootInstance = this;
                MainConsole.Instance.Commands.AddCommand("Users", false,
                                                         "create user",
                                                         "create user [<first> [<last> [<pass> [<email> [<user id> [<model>]]]]]]",
                                                         "Create a new user", HandleCreateUser);

                MainConsole.Instance.Commands.AddCommand("Users", false,
                                                         "reset user password",
                                                         "reset user password [<first> [<last> [<password>]]]",
                                                         "Reset a user password", HandleResetUserPassword);

                MainConsole.Instance.Commands.AddCommand("Users", false,
                                                         "reset user email",
                                                         "reset user email [<first> [<last> [<email>]]]",
                                                         "Reset a user email address", HandleResetUserEmail);

                MainConsole.Instance.Commands.AddCommand("Users", false,
                                                         "set user level",
                                                         "set user level [<first> [<last> [<level>]]]",
                                                         "Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, "
                                                         + "this account will be treated as god-moded. "
                                                         + "It will also affect the 'login level' command. ",
                                                         HandleSetUserLevel);

                MainConsole.Instance.Commands.AddCommand("Users", false,
                                                         "show account",
                                                         "show account <first> <last>",
                                                         "Show account details for the given user", HandleShowAccount);
            }
        }
Exemplo n.º 44
0
 public AgentPreferencesServicesConnector(IConfigSource source)
     : base(source, "AgentPreferencesService")
 {
     Initialise(source);
 }
Exemplo n.º 45
0
 private void Init(IConfigSource config)
 {
     m_GroupsService = new GroupsServiceRemoteConnector(config);
     m_Scenes        = new List <Scene>();
 }
Exemplo n.º 46
0
        /// <summary>
        ///     Read the configuration
        /// </summary>
        /// <param name="configSource"></param>
        public virtual void Configuration(IConfigSource configSource)
        {
            IConfig startupConfig = m_config.Configs["Startup"];

            int stpMinThreads = 15;
            int stpMaxThreads = 300;

            if (startupConfig != null)
            {
                m_defaultDataPath = startupConfig.GetString("DataDirectory", Constants.DEFAULT_DATA_DIR);
                if (m_defaultDataPath == "")
                {
                    m_defaultDataPath = Constants.DEFAULT_DATA_DIR;
                }

                m_startupCommandsFile  = startupConfig.GetString("startup_console_commands_file", "");
                m_shutdownCommandsFile = startupConfig.GetString("shutdown_console_commands_file", "");

                m_TimerScriptFileName = startupConfig.GetString("timer_Script", "disabled");
                m_TimerScriptTime     = startupConfig.GetInt("timer_time", m_TimerScriptTime);

                string pidFile = startupConfig.GetString("PIDFile", string.Empty);
                if (pidFile != string.Empty)
                {
                    CreatePIDFile(pidFile);
                }
            }

            IConfig SystemConfig = m_config.Configs["System"];

            if (SystemConfig != null)
            {
                string asyncCallMethodStr = SystemConfig.GetString("AsyncCallMethod", string.Empty);
                FireAndForgetMethod asyncCallMethod;
                if (!string.IsNullOrEmpty(asyncCallMethodStr) &&
                    Utils.EnumTryParse(asyncCallMethodStr, out asyncCallMethod))
                {
                    Util.FireAndForgetMethod = asyncCallMethod;
                }

                stpMinThreads = SystemConfig.GetInt("MinPoolThreads", stpMinThreads);
                stpMaxThreads = SystemConfig.GetInt("MaxPoolThreads", stpMaxThreads);

                if (stpMinThreads < 2)
                {
                    stpMinThreads = 2;
                }
                if (stpMaxThreads < 2)
                {
                    stpMaxThreads = 2;
                }
                if (stpMinThreads > stpMaxThreads)
                {
                    stpMinThreads = stpMaxThreads;
                }
            }

            var mapConfig = m_config.Configs ["WebInterface"];

            if (mapConfig != null)
            {
                m_mapcenter_x = mapConfig.GetInt("mapcenter_x", m_mapcenter_x);
                m_mapcenter_y = mapConfig.GetInt("mapcenter_y", m_mapcenter_y);
            }

            if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
            {
                Util.InitThreadPool(stpMinThreads, stpMaxThreads);
            }
        }
        public void Initialise(IConfigSource source)
        {
            IConfig moduleConfig = source.Configs["Modules"];

            if (moduleConfig != null)
            {
                string name = moduleConfig.GetString("AssetCaching", String.Empty);

                if (name == Name)
                {
                    m_MemoryCache = new ExpiringCache <string, AssetBase>();
                    m_Enabled     = true;

                    m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} enabled", this.Name);

                    IConfig assetConfig = source.Configs["AssetCache"];
                    if (assetConfig == null)
                    {
                        m_log.Warn("[FLOTSAM ASSET CACHE]: AssetCache missing from OpenSim.ini, using defaults.");
                        m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory);
                        return;
                    }

                    m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory);
                    m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory);

                    m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", false);
                    m_MemoryExpiration   = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration));

#if WAIT_ON_INPROGRESS_REQUESTS
                    m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000);
#endif

                    m_LogLevel       = assetConfig.GetInt("LogLevel", 0);
                    m_HitRateDisplay = (ulong)assetConfig.GetInt("HitRateDisplay", 1000);

                    m_FileExpiration             = TimeSpan.FromHours(assetConfig.GetDouble("FileCacheTimeout", m_DefaultFileExpiration));
                    m_FileExpirationCleanupTimer = TimeSpan.FromHours(assetConfig.GetDouble("FileCleanupTimer", m_DefaultFileExpiration));
                    if ((m_FileExpiration > TimeSpan.Zero) && (m_FileExpirationCleanupTimer > TimeSpan.Zero))
                    {
                        m_CacheCleanTimer           = new System.Timers.Timer(m_FileExpirationCleanupTimer.TotalMilliseconds);
                        m_CacheCleanTimer.AutoReset = true;
                        m_CacheCleanTimer.Elapsed  += CleanupExpiredFiles;
                        lock (m_CacheCleanTimer)
                            m_CacheCleanTimer.Start();
                    }

                    m_CacheDirectoryTiers = assetConfig.GetInt("CacheDirectoryTiers", 1);
                    if (m_CacheDirectoryTiers < 1)
                    {
                        m_CacheDirectoryTiers = 1;
                    }
                    else if (m_CacheDirectoryTiers > 3)
                    {
                        m_CacheDirectoryTiers = 3;
                    }

                    m_CacheDirectoryTierLen = assetConfig.GetInt("CacheDirectoryTierLength", 3);
                    if (m_CacheDirectoryTierLen < 1)
                    {
                        m_CacheDirectoryTierLen = 1;
                    }
                    else if (m_CacheDirectoryTierLen > 4)
                    {
                        m_CacheDirectoryTierLen = 4;
                    }

                    m_CacheWarnAt = assetConfig.GetInt("CacheWarnAt", 30000);

                    m_DeepScanBeforePurge = assetConfig.GetBoolean("DeepScanBeforePurge", false);

                    MainConsole.Instance.Commands.AddCommand(this.Name, true, "fcache status", "fcache status", "Display cache status", HandleConsoleCommand);
                    MainConsole.Instance.Commands.AddCommand(this.Name, true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the file and/or memory cache", HandleConsoleCommand);
                    MainConsole.Instance.Commands.AddCommand(this.Name, true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand);
                    MainConsole.Instance.Commands.AddCommand(this.Name, true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand);
                }
            }
        }
Exemplo n.º 48
0
 public GroupsServiceRemoteConnectorModule(IConfigSource config, IUserManagement uman)
 {
     Init(config);
     m_UserManagement = uman;
     m_CacheWrapper   = new RemoteConnectorCacheWrapper(m_UserManagement);
 }
Exemplo n.º 49
0
 public void PostFinishStartup(IScene scene, IConfigSource source, ISimulationBase openSimBase)
 {
 }
Exemplo n.º 50
0
 public void Initialise(IScene scene, IConfigSource source, ISimulationBase openSimBase)
 {
     scene.StackModuleInterface <IAuroraBackupModule>(this);
 }
Exemplo n.º 51
0
        public void Initialise(IConfigSource source)
        {
//            m_log.DebugFormat("[OBJECT COMMANDS MODULE]: INITIALIZED MODULE");
        }
Exemplo n.º 52
0
 public void PostInitialise(IScene scene, IConfigSource source, ISimulationBase openSimBase)
 {
 }
Exemplo n.º 53
0
        // The web loader uses this
        //
        public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource)
        {
            XmlElement      elem   = (XmlElement)xmlNode;
            string          name   = elem.GetAttribute("Name");
            string          xmlstr = "<Nini>" + xmlNode.OuterXml + "</Nini>";
            XmlConfigSource source = new XmlConfigSource(XmlReader.Create(new StringReader(xmlstr)));

            ReadNiniConfig(source, name);

            m_serverURI = string.Empty;
        }
Exemplo n.º 54
0
        /// <summary>
        /// Loads the region configuration
        /// </summary>
        /// <param name="argvSource">Parameters passed into the process when started</param>
        /// <param name="configSettings"></param>
        /// <param name="networkInfo"></param>
        /// <returns>A configuration that gets passed to modules</returns>
        public OpenSimConfigSource LoadConfigSettings(
            IConfigSource argvSource, EnvConfigSource envConfigSource, out ConfigSettings configSettings,
            out NetworkServersInfo networkInfo)
        {
            m_configSettings     = configSettings = new ConfigSettings();
            m_networkServersInfo = networkInfo = new NetworkServersInfo();

            bool iniFileExists = false;

            IConfig startupConfig = argvSource.Configs["Startup"];

            List <string> sources = new List <string>();

            string masterFileName =
                startupConfig.GetString("inimaster", "OpenSimDefaults.ini");

            if (masterFileName == "none")
            {
                masterFileName = String.Empty;
            }

            if (IsUri(masterFileName))
            {
                if (!sources.Contains(masterFileName))
                {
                    sources.Add(masterFileName);
                }
            }
            else
            {
                string masterFilePath = Path.GetFullPath(
                    Path.Combine(Util.configDir(), masterFileName));

                if (masterFileName != String.Empty)
                {
                    if (File.Exists(masterFilePath))
                    {
                        if (!sources.Contains(masterFilePath))
                        {
                            sources.Add(masterFilePath);
                        }
                    }
                    else
                    {
                        m_log.ErrorFormat("Master ini file {0} not found", Path.GetFullPath(masterFilePath));
                        Environment.Exit(1);
                    }
                }
            }

            string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini");

            if (IsUri(iniFileName))
            {
                if (!sources.Contains(iniFileName))
                {
                    sources.Add(iniFileName);
                }
                Application.iniFilePath = iniFileName;
            }
            else
            {
                Application.iniFilePath = Path.GetFullPath(
                    Path.Combine(Util.configDir(), iniFileName));

                if (!File.Exists(Application.iniFilePath))
                {
                    iniFileName             = "OpenSim.xml";
                    Application.iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), iniFileName));
                }

                if (File.Exists(Application.iniFilePath))
                {
                    if (!sources.Contains(Application.iniFilePath))
                    {
                        sources.Add(Application.iniFilePath);
                    }
                }
            }

            string iniDirName = startupConfig.GetString("inidirectory", "config");
            string iniDirPath = Path.Combine(Util.configDir(), iniDirName);

            if (Directory.Exists(iniDirPath))
            {
                m_log.InfoFormat("Searching folder {0} for config ini files", iniDirPath);

                string[] fileEntries = Directory.GetFiles(iniDirName);
                foreach (string filePath in fileEntries)
                {
                    if (Path.GetExtension(filePath).ToLower() == ".ini")
                    {
                        if (!sources.Contains(Path.GetFullPath(filePath)))
                        {
                            sources.Add(Path.GetFullPath(filePath));
                        }
                    }
                }
            }

            m_config        = new OpenSimConfigSource();
            m_config.Source = new IniConfigSource();
            m_config.Source.Merge(DefaultConfig());

            m_log.Info("[CONFIG]: Reading configuration settings");

            if (sources.Count == 0)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                Environment.Exit(1);
            }

            for (int i = 0; i < sources.Count; i++)
            {
                if (ReadConfig(sources[i]))
                {
                    iniFileExists = true;
                    AddIncludes(sources);
                }
            }

            if (!iniFileExists)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!");
                Environment.Exit(1);
            }

            // Make sure command line options take precedence
            m_config.Source.Merge(argvSource);

            IConfig enVars = m_config.Source.Configs["Environment"];

            if (enVars != null)
            {
                string[] env_keys = enVars.GetKeys();

                foreach (string key in env_keys)
                {
                    envConfigSource.AddEnv(key, string.Empty);
                }

                envConfigSource.LoadEnv();
                m_config.Source.Merge(envConfigSource);
                m_config.Source.ExpandKeyValues();
            }


            ReadConfigSettings();

            return(m_config);
        }
Exemplo n.º 55
0
        private void WriteNiniConfig(IConfigSource source)
        {
            IConfig config = source.Configs[RegionName];

            if (config != null)
            {
                source.Configs.Remove(config);
            }

            config = source.AddConfig(RegionName);

            config.Set("RegionUUID", RegionID.ToString());

            string location = String.Format("{0},{1}", RegionLocX, RegionLocY);

            config.Set("Location", location);

            if (DataStore != String.Empty)
            {
                config.Set("Datastore", DataStore);
            }

            config.Set("DisallowResidents", m_disallowResidents.ToString());
            config.Set("DisallowForeigners", m_disallowForeigners.ToString());

            if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize)
            {
                config.Set("SizeX", RegionSizeX);
                config.Set("SizeY", RegionSizeY);
                //            if (RegionSizeZ > 0)
                //                config.Set("SizeZ", RegionSizeZ);
            }

            config.Set("InternalAddress", m_internalEndPoint.Address.ToString());
            config.Set("InternalPort", m_internalEndPoint.Port);

            config.Set("ExternalHostName", m_externalHostName);

            if (m_nonphysPrimMin > 0)
            {
                config.Set("NonphysicalPrimMax", m_nonphysPrimMin);
            }

            if (m_nonphysPrimMax > 0)
            {
                config.Set("NonphysicalPrimMax", m_nonphysPrimMax);
            }

            if (m_physPrimMin > 0)
            {
                config.Set("PhysicalPrimMax", m_physPrimMin);
            }

            if (m_physPrimMax > 0)
            {
                config.Set("PhysicalPrimMax", m_physPrimMax);
            }

            config.Set("ClampPrimSize", m_clampPrimSize.ToString());

            if (m_objectCapacity > 0)
            {
                config.Set("MaxPrims", m_objectCapacity);
            }

            if (m_maxPrimsPerUser > -1)
            {
                config.Set("MaxPrimsPerUser", m_maxPrimsPerUser);
            }

            if (m_linksetCapacity > 0)
            {
                config.Set("LinksetPrims", m_linksetCapacity);
            }

            if (AgentCapacity > 0)
            {
                config.Set("MaxAgents", AgentCapacity);
            }

            if (ScopeID != UUID.Zero)
            {
                config.Set("ScopeID", ScopeID.ToString());
            }

            if (RegionType != String.Empty)
            {
                config.Set("RegionType", RegionType);
            }

            if (m_maptileStaticUUID != UUID.Zero)
            {
                config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
            }

            if (MaptileStaticFile != null && MaptileStaticFile != String.Empty)
            {
                config.Set("MaptileStaticFile", MaptileStaticFile);
            }
        }
Exemplo n.º 56
0
 public void ReloadConfiguration(IConfigSource config)
 {
 }
Exemplo n.º 57
0
        public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource, string configName)
        {
            // m_configSource = configSource;
            if (filename.ToLower().EndsWith(".ini"))
            {
                if (!File.Exists(filename)) // New region config request
                {
                    IniConfigSource newFile = new IniConfigSource();
                    ReadNiniConfig(newFile, configName);

                    newFile.Save(filename);

                    RegionFile = filename;

                    return;
                }

                IniConfigSource source = new IniConfigSource(filename);

                bool saveFile = false;
                if (source.Configs[configName] == null)
                {
                    saveFile = true;
                }

                ReadNiniConfig(source, configName);

                if (configName != String.Empty && saveFile)
                {
                    source.Save(filename);
                }

                RegionFile = filename;
                return;
            }

            try
            {
                // This will throw if it's not legal Nini XML format
                //
                IConfigSource xmlsource = new XmlConfigSource(filename);

                ReadNiniConfig(xmlsource, configName);

                RegionFile = filename;

                return;
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 58
0
 public void Initialize(Scene scene, IConfigSource config)
 {
     m_scene = scene;
     m_scene.EventManager.OnNewClient += NewClient;
 }
Exemplo n.º 59
0
        // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.

        // MT: Yes. Estates can't span trust boundaries. Therefore, it can be
        // assumed that all instances belonging to one estate are able to
        // access the same database server. Since estate settings are lodaed
        // from there, that should be sufficient for full remote administration

        // File based loading
        //
        public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource) :
            this(description, filename, skipConsoleConfig, configSource, String.Empty)
        {
        }
Exemplo n.º 60
0
        private void ReadNiniConfig(IConfigSource source, string name)
        {
            bool creatingNew = false;

            if (source.Configs.Count == 0)
            {
                MainConsole.Instance.Output("=====================================\n");
                MainConsole.Instance.Output("We are now going to ask a couple of questions about your region.\n");
                MainConsole.Instance.Output("You can press 'enter' without typing anything to use the default\n");
                MainConsole.Instance.Output("the default is displayed between [ ] brackets.\n");
                MainConsole.Instance.Output("=====================================\n");

                if (name == String.Empty)
                {
                    while (name.Trim() == string.Empty)
                    {
                        name = MainConsole.Instance.Prompt("New region name", name);
                        if (name.Trim() == string.Empty)
                        {
                            MainConsole.Instance.Output("Cannot interactively create region with no name");
                        }
                    }
                }

                source.AddConfig(name);

                creatingNew = true;
            }

            if (name == String.Empty)
            {
                name = source.Configs[0].Name;
            }

            if (source.Configs[name] == null)
            {
                source.AddConfig(name);
            }

            RegionName = name;
            IConfig config = source.Configs[name];

            // Track all of the keys in this config and remove as they are processed
            // The remaining keys will be added to generic key-value storage for
            // whoever might need it
            HashSet <String> allKeys = new HashSet <String>();

            foreach (string s in config.GetKeys())
            {
                allKeys.Add(s);
            }

            // RegionUUID
            //
            allKeys.Remove("RegionUUID");
            string regionUUID = config.GetString("RegionUUID", string.Empty);

            if (!UUID.TryParse(regionUUID.Trim(), out RegionID))
            {
                UUID newID = UUID.Random();
                while (RegionID == UUID.Zero)
                {
                    regionUUID = MainConsole.Instance.Prompt("RegionUUID", newID.ToString());
                    if (!UUID.TryParse(regionUUID.Trim(), out RegionID))
                    {
                        MainConsole.Instance.Output("RegionUUID must be a valid UUID");
                    }
                }
                config.Set("RegionUUID", regionUUID);
            }

            originRegionID = RegionID; // What IS this?! (Needed for RegionCombinerModule?)

            // Location
            //
            allKeys.Remove("Location");
            string location = config.GetString("Location", String.Empty);

            if (location == String.Empty)
            {
                location = MainConsole.Instance.Prompt("Region Location", "1000,1000");
                config.Set("Location", location);
            }

            string[] locationElements = location.Split(new char[] { ',' });

            RegionLocX = Convert.ToUInt32(locationElements[0]);
            RegionLocY = Convert.ToUInt32(locationElements[1]);

            // Region size
            // Default to legacy region size if not specified.
            allKeys.Remove("SizeX");
            string configSizeX = config.GetString("SizeX", Constants.RegionSize.ToString());

            config.Set("SizeX", configSizeX);
            RegionSizeX = Convert.ToUInt32(configSizeX);
            allKeys.Remove("SizeY");
            string configSizeY = config.GetString("SizeY", Constants.RegionSize.ToString());

            config.Set("SizeY", configSizeX);
            RegionSizeY = Convert.ToUInt32(configSizeY);
            allKeys.Remove("SizeZ");
            string configSizeZ = config.GetString("SizeZ", Constants.RegionHeight.ToString());

            config.Set("SizeZ", configSizeX);
            RegionSizeZ = Convert.ToUInt32(configSizeZ);

            DoRegionSizeSanityChecks();

            // InternalAddress
            //
            IPAddress address;

            allKeys.Remove("InternalAddress");
            if (config.Contains("InternalAddress"))
            {
                address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty));
            }
            else
            {
                address = IPAddress.Parse(MainConsole.Instance.Prompt("Internal IP address", "0.0.0.0"));
                config.Set("InternalAddress", address.ToString());
            }

            // InternalPort
            //
            int port;

            allKeys.Remove("InternalPort");
            if (config.Contains("InternalPort"))
            {
                port = config.GetInt("InternalPort", 9000);
            }
            else
            {
                port = Convert.ToInt32(MainConsole.Instance.Prompt("Internal port", "9000"));
                config.Set("InternalPort", port);
            }
            m_internalEndPoint = new IPEndPoint(address, port);

            // ResolveAddress
            //
            allKeys.Remove("ResolveAddress");
            if (config.Contains("ResolveAddress"))
            {
                m_resolveAddress = config.GetBoolean("ResolveAddress", false);
            }
            else
            {
                if (creatingNew)
                {
                    m_resolveAddress = Convert.ToBoolean(MainConsole.Instance.Prompt("Resolve hostname to IP on start (for running inside Docker)", "False"));
                }

                config.Set("ResolveAddress", m_resolveAddress.ToString());
            }

            // ExternalHostName
            //
            allKeys.Remove("ExternalHostName");
            string externalName;

            if (config.Contains("ExternalHostName"))
            {
                externalName = config.GetString("ExternalHostName", "SYSTEMIP");
            }
            else
            {
                externalName = MainConsole.Instance.Prompt("External host name", "SYSTEMIP");
                config.Set("ExternalHostName", externalName);
            }
            if (externalName == "SYSTEMIP")
            {
                m_externalHostName = Util.GetLocalHost().ToString();
                m_log.InfoFormat(
                    "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}",
                    m_externalHostName, name);
            }
            else if (!m_resolveAddress)
            {
                m_externalHostName = externalName;
            }
            else
            {
                IPAddress[] addrs = Dns.GetHostAddresses(externalName);
                if (addrs.Length != 1) // If it is ambiguous or not resolveable, use it literally
                {
                    m_externalHostName = externalName;
                }
                else
                {
                    m_externalHostName = addrs[0].ToString();
                }
            }

            // RegionType
            m_regionType = config.GetString("RegionType", String.Empty);
            allKeys.Remove("RegionType");

            // Get Default Landing Location (Defaults to 128,128)
            string  temp_location = config.GetString("DefaultLanding", "<128, 128, 30>");
            Vector3 temp_vector;

            if (Vector3.TryParse(temp_location, out temp_vector))
            {
                DefaultLandingPoint = temp_vector;
            }
            else
            {
                m_log.ErrorFormat("[RegionInfo]: Unable to parse DefaultLanding for '{0}'. The value given was '{1}'", RegionName, temp_location);
            }

            allKeys.Remove("DefaultLanding");

            DoDefaultLandingSanityChecks();

            #region Access Restrictions

            m_disallowResidents = config.GetBoolean("DisallowResidents", false);
            allKeys.Remove("DisallowResidents");

            m_disallowForeigners = config.GetBoolean("DisallowForeigners", false);
            allKeys.Remove("DisallowForeigners");

            #endregion

            #region Prim and map stuff

            m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0);
            allKeys.Remove("NonPhysicalPrimMin");

            m_nonphysPrimMax = config.GetInt("NonPhysicalPrimMax", 0);
            allKeys.Remove("NonPhysicalPrimMax");

            m_physPrimMin = config.GetFloat("PhysicalPrimMin", 0);
            allKeys.Remove("PhysicalPrimMin");

            m_physPrimMax = config.GetInt("PhysicalPrimMax", 0);
            allKeys.Remove("PhysicalPrimMax");

            m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
            allKeys.Remove("ClampPrimSize");

            m_objectCapacity = config.GetInt("MaxPrims", m_objectCapacity);
            allKeys.Remove("MaxPrims");

            m_maxPrimsPerUser = config.GetInt("MaxPrimsPerUser", -1);
            allKeys.Remove("MaxPrimsPerUser");

            m_linksetCapacity = config.GetInt("LinksetPrims", 0);
            allKeys.Remove("LinksetPrims");

            allKeys.Remove("MaptileStaticUUID");
            string mapTileStaticUUID = config.GetString("MaptileStaticUUID", UUID.Zero.ToString());
            if (UUID.TryParse(mapTileStaticUUID.Trim(), out m_maptileStaticUUID))
            {
                config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
            }

            MaptileStaticFile = config.GetString("MaptileStaticFile", String.Empty);
            allKeys.Remove("MaptileStaticFile");

            #endregion

            AgentCapacity = config.GetInt("MaxAgents", 100);
            allKeys.Remove("MaxAgents");

            // Multi-tenancy
            //
            ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString()));
            allKeys.Remove("ScopeID");

            foreach (String s in allKeys)
            {
                SetExtraSetting(s, config.GetString(s));
            }
        }