|
|||
|
|||
|
#include <modules.h>
Inheritance diagram for ConfigReader:


Public Member Functions | |
| ConfigReader (InspIRCd *Instance) | |
| Default constructor. | |
| ConfigReader (InspIRCd *Instance, const std::string &filename) | |
| Overloaded constructor. | |
| ~ConfigReader () | |
| Default destructor. | |
| std::string | ReadValue (const std::string &tag, const std::string &name, int index, bool allow_linefeeds=false) |
| Retrieves a value from the config file. | |
| std::string | ReadValue (const std::string &tag, const std::string &name, const std::string &default_value, int index, bool allow_linefeeds=false) |
| Retrieves a value from the config file. | |
| bool | ReadFlag (const std::string &tag, const std::string &name, int index) |
| Retrieves a boolean value from the config file. | |
| bool | ReadFlag (const std::string &tag, const std::string &name, const std::string &default_value, int index) |
| Retrieves a boolean value from the config file. | |
| int | ReadInteger (const std::string &tag, const std::string &name, int index, bool need_positive) |
| Retrieves an integer value from the config file. | |
| int | ReadInteger (const std::string &tag, const std::string &name, const std::string &default_value, int index, bool need_positive) |
| Retrieves an integer value from the config file. | |
| long | GetError () |
| Returns the last error to occur. | |
| int | Enumerate (const std::string &tag) |
| Counts the number of times a given tag appears in the config file. | |
| bool | Verify () |
| Returns true if a config file is valid. | |
| void | DumpErrors (bool bail, User *user) |
| Dumps the list of errors in a config file to an output location. | |
| int | EnumerateValues (const std::string &tag, int index) |
| Returns the number of items within a tag. | |
Protected Attributes | |
| InspIRCd * | ServerInstance |
| ConfigDataHash * | data |
| The contents of the configuration file This protected member should never be accessed by a module (and cannot be accessed unless the core is changed). | |
| std::ostringstream * | errorlog |
| Used to store errors. | |
| bool | privatehash |
| If we're using our own config data hash or not. | |
| bool | readerror |
| True if an error occured reading the config file. | |
| long | error |
| Error code. | |
It may either be instantiated with one parameter or none. Constructing the class using one parameter allows you to specify a path to your own configuration file, otherwise, inspircd.conf is read.
Definition at line 1410 of file modules.h.
|
|
Default constructor. This constructor initialises the ConfigReader class to read the inspircd.conf file as specified when running ./configure. Definition at line 810 of file modules.cpp. References CONF_NO_ERROR, InspIRCd::Config, ServerConfig::config_data, data, error, errorlog, privatehash, and ServerInstance. |
|
||||||||||||
|
Overloaded constructor. This constructor initialises the ConfigReader class to read a user-specified config file Definition at line 829 of file modules.cpp. References ServerConfig::ClearStack(), CONF_FILE_NOT_FOUND, CONF_NO_ERROR, InspIRCd::Config, data, ServerConfig::DoInclude(), error, errorlog, privatehash, readerror, and ServerInstance. |
|
|
Default destructor. This method destroys the ConfigReader class. Definition at line 820 of file modules.cpp. References data, errorlog, and privatehash. |
|
||||||||||||
|
Dumps the list of errors in a config file to an output location. If bail is true, then the program will abort. If bail is false and user points to a valid user record, the error report will be spooled to the given user by means of NOTICE. if bool is false AND user is false, the error report will be spooled to all opers by means of a NOTICE to all opers. Definition at line 904 of file modules.cpp. References InspIRCd::Config, ServerConfig::ReportConfigError(), ServerInstance, and User::uuid. |
|
|
||||||||||||
|
Returns the number of items within a tag. For example if the tag was <test tag="blah" data="foo"> then this function would return 2. Spaces and newlines both qualify as valid seperators between values. Definition at line 915 of file modules.cpp. References InspIRCd::Config, ServerConfig::ConfVarEnum(), and ServerInstance. |
|
|
Returns the last error to occur. Valid errors can be found by looking in modules.h. Any nonzero value indicates an error condition. A call to GetError() resets the error flag back to 0. Definition at line 897 of file modules.cpp. References error. Referenced by ModuleWaitPong::OnRehash(), ModuleCgiIRC::OnRehash(), and ModuleBlockAmsg::OnRehash(). |
|
||||||||||||||||||||
|
Retrieves a boolean value from the config file. This method retrieves a boolean value from the config file. Where multiple copies of the tag exist in the config file, index indicates which of the values to retrieve. The values "1", "yes" and "true" in the config file count as true to ReadFlag, and any other value counts as false. If the tag is not found, the default value is used instead. Definition at line 862 of file modules.cpp. References InspIRCd::Config, ServerConfig::ConfValueBool(), and ServerInstance. |
|
||||||||||||||||
|
||||||||||||||||||||||||
|
Retrieves an integer value from the config file. This method retrieves an integer value from the config file. Where multiple copies of the tag exist in the config file, index indicates which of the values to retrieve. Any invalid integer values in the tag will cause the objects error value to be set, and any call to GetError() will return CONF_INVALID_NUMBER to be returned. needs_unsigned is set if the number must be unsigned. If a signed number is placed into a tag which is specified unsigned, 0 will be returned and GetError() will return CONF_NOT_UNSIGNED. If the tag is not found, the default value is used instead. Definition at line 873 of file modules.cpp. References CONF_INT_NEGATIVE, CONF_VALUE_NOT_FOUND, InspIRCd::Config, ServerConfig::ConfValueInteger(), error, and ServerInstance. |
|
||||||||||||||||||||
|
Retrieves an integer value from the config file. This method retrieves an integer value from the config file. Where multiple copies of the tag exist in the config file, index indicates which of the values to retrieve. Any invalid integer values in the tag will cause the objects error value to be set, and any call to GetError() will return CONF_INVALID_NUMBER to be returned. need_positive is set if the number must be non-negative. If a negative number is placed into a tag which is specified positive, 0 will be returned and GetError() will return CONF_INT_NEGATIVE. Note that need_positive is not suitable to get an unsigned int - you should cast the result to achieve that effect. Definition at line 892 of file modules.cpp. Referenced by ListModeBase::DoRehash(), CloakUser::DoRehash(), ModuleSQLite3::HostInConf(), ModulePgSQL::HostInConf(), HostInConf(), ModuleMsSQL::HostInConf(), ModuleConnFlood::InitConf(), LoadDatabases(), ModuleOperLevels::OnKill(), Modulewatch::OnRehash(), ModuleSSLGnuTLS::OnRehash(), ModuleSilence::OnRehash(), ModuleSecureList::OnRehash(), ModuleSafeList::OnRehash(), ModuleIdent::OnRehash(), ModuleConnectBan::OnRehash(), ModuleCallerID::OnRehash(), ModuleBlockAmsg::OnRehash(), ModuleSQLite3::ReadConf(), ModulePgSQL::ReadConf(), ModuleMsSQL::ReadConf(), ModuleDNSBL::ReadConf(), ModuleBlockCAPS::ReadConf(), and SpanningTreeUtilities::ReadConfiguration(). |
|
||||||||||||||||||||||||
|
Retrieves a value from the config file. This method retrieves a value from the config file. Where multiple copies of the tag exist in the config file, index indicates which of the values to retrieve. If the tag is not found the default value is returned instead. Definition at line 845 of file modules.cpp. References CONF_VALUE_NOT_FOUND, InspIRCd::Config, ServerConfig::ConfValue(), error, and ServerInstance. |
|
||||||||||||||||||||
|
|
Returns true if a config file is valid. This method is partially implemented and will only return false if the config file does not exist or could not be opened. Definition at line 920 of file modules.cpp. References readerror. |
|
|
The contents of the configuration file This protected member should never be accessed by a module (and cannot be accessed unless the core is changed). It will contain a pointer to the configuration file data with unneeded data (such as comments) stripped from it. Definition at line 1419 of file modules.h. Referenced by ConfigReader(), and ~ConfigReader(). |
|
|
Error code.
Definition at line 1431 of file modules.h. Referenced by ConfigReader(), GetError(), ReadInteger(), and ReadValue(). |
|
|
Used to store errors.
Definition at line 1422 of file modules.h. Referenced by ConfigReader(), and ~ConfigReader(). |
|
|
If we're using our own config data hash or not.
Definition at line 1425 of file modules.h. Referenced by ConfigReader(), and ~ConfigReader(). |
|
|
True if an error occured reading the config file.
Definition at line 1428 of file modules.h. Referenced by ConfigReader(), and Verify(). |
|
|
Definition at line 1413 of file modules.h. Referenced by ConfigReader(), DumpErrors(), Enumerate(), EnumerateValues(), ReadFlag(), ReadInteger(), and ReadValue(). |