Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ServerConfig Class Reference

This class holds the bulk of the runtime configuration for the ircd. More...

#include <inspircd_io.h>

Inheritance diagram for ServerConfig:

Inheritance graph
[legend]
Collaboration diagram for ServerConfig:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ServerConfig ()
void ClearStack ()
 Clears the include stack in preperation for a Read() call.
void Read (bool bail, userrec *user)
 Read the entire configuration into memory and initialize this class.
bool LoadConf (const char *filename, std::stringstream *target, std::stringstream *errorstream)
int ConfValue (char *tag, char *var, int index, char *result, std::stringstream *config)
int ReadConf (std::stringstream *config_f, const char *tag, const char *var, int index, char *result)
int ConfValueEnum (char *tag, std::stringstream *config)
int EnumConf (std::stringstream *config_f, const char *tag)
int EnumValues (std::stringstream *config, const char *tag, int index)

Public Attributes

char ServerName [MAXBUF]
 Holds the server name of the local server as defined by the administrator.
char Network [MAXBUF]
char ServerDesc [MAXBUF]
 Holds the description of the local server as defined by the administrator.
char AdminName [MAXBUF]
 Holds the admin's name, for output in the /ADMIN command.
char AdminEmail [MAXBUF]
 Holds the email address of the admin, for output in the /ADMIN command.
char AdminNick [MAXBUF]
 Holds the admin's nickname, for output in the /ADMIN command.
char diepass [MAXBUF]
 The admin-configured /DIE password.
char restartpass [MAXBUF]
 The admin-configured /RESTART password.
char motd [MAXBUF]
 The pathname and filename of the message of the day file, as defined by the administrator.
char rules [MAXBUF]
 The pathname and filename of the rules file, as defined by the administrator.
char PrefixQuit [MAXBUF]
 The quit prefix in use, or an empty string.
char DieValue [MAXBUF]
 The last string found within a <die> tag, or an empty string.
char DNSServer [MAXBUF]
 The DNS server to use for DNS queries.
char DisabledCommands [MAXBUF]
 This variable contains a space-seperated list of commands which are disabled by the administrator of the server for non-opers.
char ModPath [1024]
 The full path to the modules directory.
char MyExecutable [1024]
 The full pathname to the executable, as given in argv[0] when the program starts.
FILE * log_file
 The file handle of the logfile.
bool nofork
 If this value is true, the owner of the server specified -nofork on the command line, causing the daemon to stay in the foreground.
bool unlimitcore
 If this value is true, the owner of the server has chosen to unlimit the coredump size to as large a value as his account settings will allow.
bool AllowHalfop
 If this value is true, halfops have been enabled in the configuration file.
int dns_timeout
 The number of seconds the DNS subsystem will wait before timing out any request.
int NetBufferSize
 The size of the read() buffer in the user handling code, used to read data into a user's recvQ.
int MaxConn
 The value to be used for listen() backlogs as default.
unsigned int SoftLimit
 The soft limit value assigned to the irc server.
int MaxWhoResults
 The maximum number of /WHO results allowed in any single /WHO command.
int debugging
 True if the DEBUG loglevel is selected.
int LogLevel
 The loglevel in use by the IRC server.
int DieDelay
 How many seconds to wait before exiting the program when /DIE is correctly issued.
char addrs [MAXBUF][255]
 A list of IP addresses the server is listening on.
file_cache MOTD
 The MOTD file, cached in a file_cache type.
file_cache RULES
 The RULES file, cached in a file_cache type.
char PID [1024]
 The full pathname and filename of the PID file as defined in the configuration.
std::stringstream config_f
 The parsed configuration file as a stringstream.
ClassVector Classes
 The connect classes in use by the IRC server.
std::vector< std::stringmodule_names
 A list of module names (names only, no paths) which are currently loaded by the server.
int ports [255]
 A list of ports which the server is listening on.

Private Member Functions

int fgets_safe (char *buffer, size_t maxsize, FILE *&file)
 Used by the config file subsystem to safely read a C-style string without dependency upon any certain style of linefeed, e.g.
std::string ConfProcess (char *buffer, long linenumber, std::stringstream *errorstream, bool &error, std::string filename)
 This private method processes one line of configutation, appending errors to errorstream and setting error if an error has occured.

Private Attributes

std::vector< std::stringinclude_stack
 This variable holds the names of all files included from the main one.

Detailed Description

This class holds the bulk of the runtime configuration for the ircd.

It allows for reading new config values, accessing configuration files, and storage of the configuration data needed to run the ircd, such as the servername, connect classes, /ADMIN data, MOTDs and filenames etc.

Definition at line 39 of file inspircd_io.h.


Constructor & Destructor Documentation

ServerConfig::ServerConfig  ) 
 


Member Function Documentation

void ServerConfig::ClearStack  ) 
 

Clears the include stack in preperation for a Read() call.

Referenced by ConfigReader::ConfigReader().

std::string ServerConfig::ConfProcess char *  buffer,
long  linenumber,
std::stringstream *  errorstream,
bool &  error,
std::string  filename
[private]
 

This private method processes one line of configutation, appending errors to errorstream and setting error if an error has occured.

int ServerConfig::ConfValue char *  tag,
char *  var,
int  index,
char *  result,
std::stringstream *  config
 

Referenced by userrec::HasPermission().

int ServerConfig::ConfValueEnum char *  tag,
std::stringstream *  config
 

int ServerConfig::EnumConf std::stringstream *  config_f,
const char *  tag
 

Referenced by ConfigReader::Enumerate().

int ServerConfig::EnumValues std::stringstream *  config,
const char *  tag,
int  index
 

Referenced by ConfigReader::EnumerateValues().

int ServerConfig::fgets_safe char *  buffer,
size_t  maxsize,
FILE *&  file
[private]
 

Used by the config file subsystem to safely read a C-style string without dependency upon any certain style of linefeed, e.g.

it can read both windows and UNIX style linefeeds transparently.

bool ServerConfig::LoadConf const char *  filename,
std::stringstream *  target,
std::stringstream *  errorstream
 

Referenced by ConfigReader::ConfigReader().

void ServerConfig::Read bool  bail,
userrec user
 

Read the entire configuration into memory and initialize this class.

All other methods should be used only by the core.

Referenced by Server::RehashServer().

int ServerConfig::ReadConf std::stringstream *  config_f,
const char *  tag,
const char *  var,
int  index,
char *  result
 

Referenced by ConfigReader::ReadFlag(), ConfigReader::ReadInteger(), and ConfigReader::ReadValue().


Member Data Documentation

char ServerConfig::addrs[MAXBUF][255]
 

A list of IP addresses the server is listening on.

Definition at line 216 of file inspircd_io.h.

char ServerConfig::AdminEmail[MAXBUF]
 

Holds the email address of the admin, for output in the /ADMIN command.

Definition at line 89 of file inspircd_io.h.

Referenced by Server::GetAdmin().

char ServerConfig::AdminName[MAXBUF]
 

Holds the admin's name, for output in the /ADMIN command.

Definition at line 84 of file inspircd_io.h.

Referenced by Server::GetAdmin().

char ServerConfig::AdminNick[MAXBUF]
 

Holds the admin's nickname, for output in the /ADMIN command.

Definition at line 94 of file inspircd_io.h.

Referenced by Server::GetAdmin().

bool ServerConfig::AllowHalfop
 

If this value is true, halfops have been enabled in the configuration file.

Definition at line 171 of file inspircd_io.h.

ClassVector ServerConfig::Classes
 

The connect classes in use by the IRC server.

Definition at line 242 of file inspircd_io.h.

std::stringstream ServerConfig::config_f
 

The parsed configuration file as a stringstream.

You should pass this to any configuration methods of this class, and not access it directly. It is recommended that modules use ConfigReader instead which provides a simpler abstraction of configuration files.

Definition at line 238 of file inspircd_io.h.

Referenced by userrec::HasPermission().

int ServerConfig::debugging
 

True if the DEBUG loglevel is selected.

Definition at line 202 of file inspircd_io.h.

int ServerConfig::DieDelay
 

How many seconds to wait before exiting the program when /DIE is correctly issued.

Definition at line 211 of file inspircd_io.h.

char ServerConfig::diepass[MAXBUF]
 

The admin-configured /DIE password.

Definition at line 98 of file inspircd_io.h.

char ServerConfig::DieValue[MAXBUF]
 

The last string found within a <die> tag, or an empty string.

Definition at line 121 of file inspircd_io.h.

char ServerConfig::DisabledCommands[MAXBUF]
 

This variable contains a space-seperated list of commands which are disabled by the administrator of the server for non-opers.

Definition at line 131 of file inspircd_io.h.

int ServerConfig::dns_timeout
 

The number of seconds the DNS subsystem will wait before timing out any request.

Definition at line 176 of file inspircd_io.h.

char ServerConfig::DNSServer[MAXBUF]
 

The DNS server to use for DNS queries.

Definition at line 125 of file inspircd_io.h.

std::vector<std::string> ServerConfig::include_stack [private]
 

This variable holds the names of all files included from the main one.

This is used to make sure that no files are recursively included.

Definition at line 47 of file inspircd_io.h.

FILE* ServerConfig::log_file
 

The file handle of the logfile.

If this value is NULL, the log file is not open, probably due to a permissions error on startup (this should not happen in normal operation!).

Definition at line 151 of file inspircd_io.h.

int ServerConfig::LogLevel
 

The loglevel in use by the IRC server.

Definition at line 206 of file inspircd_io.h.

int ServerConfig::MaxConn
 

The value to be used for listen() backlogs as default.

Definition at line 187 of file inspircd_io.h.

int ServerConfig::MaxWhoResults
 

The maximum number of /WHO results allowed in any single /WHO command.

Definition at line 198 of file inspircd_io.h.

char ServerConfig::ModPath[1024]
 

The full path to the modules directory.

This is either set at compile time, or overridden in the configuration file via the <options> tag.

Definition at line 138 of file inspircd_io.h.

std::vector<std::string> ServerConfig::module_names
 

A list of module names (names only, no paths) which are currently loaded by the server.

Definition at line 247 of file inspircd_io.h.

Referenced by Server::FindModule().

file_cache ServerConfig::MOTD
 

The MOTD file, cached in a file_cache type.

Definition at line 220 of file inspircd_io.h.

char ServerConfig::motd[MAXBUF]
 

The pathname and filename of the message of the day file, as defined by the administrator.

Definition at line 107 of file inspircd_io.h.

char ServerConfig::MyExecutable[1024]
 

The full pathname to the executable, as given in argv[0] when the program starts.

Definition at line 143 of file inspircd_io.h.

int ServerConfig::NetBufferSize
 

The size of the read() buffer in the user handling code, used to read data into a user's recvQ.

Definition at line 182 of file inspircd_io.h.

char ServerConfig::Network[MAXBUF]
 

Definition at line 74 of file inspircd_io.h.

Referenced by Server::GetNetworkName().

bool ServerConfig::nofork
 

If this value is true, the owner of the server specified -nofork on the command line, causing the daemon to stay in the foreground.

Definition at line 158 of file inspircd_io.h.

char ServerConfig::PID[1024]
 

The full pathname and filename of the PID file as defined in the configuration.

Definition at line 229 of file inspircd_io.h.

int ServerConfig::ports[255]
 

A list of ports which the server is listening on.

Definition at line 251 of file inspircd_io.h.

char ServerConfig::PrefixQuit[MAXBUF]
 

The quit prefix in use, or an empty string.

Definition at line 116 of file inspircd_io.h.

char ServerConfig::restartpass[MAXBUF]
 

The admin-configured /RESTART password.

Definition at line 102 of file inspircd_io.h.

file_cache ServerConfig::RULES
 

The RULES file, cached in a file_cache type.

Definition at line 224 of file inspircd_io.h.

char ServerConfig::rules[MAXBUF]
 

The pathname and filename of the rules file, as defined by the administrator.

Definition at line 112 of file inspircd_io.h.

char ServerConfig::ServerDesc[MAXBUF]
 

Holds the description of the local server as defined by the administrator.

Definition at line 79 of file inspircd_io.h.

Referenced by Server::GetServerDescription().

char ServerConfig::ServerName[MAXBUF]
 

Holds the server name of the local server as defined by the administrator.

Definition at line 68 of file inspircd_io.h.

Referenced by Server::GetServerName(), and userrec::userrec().

unsigned int ServerConfig::SoftLimit
 

The soft limit value assigned to the irc server.

The IRC server will not allow more than this number of local users.

Definition at line 193 of file inspircd_io.h.

bool ServerConfig::unlimitcore
 

If this value is true, the owner of the server has chosen to unlimit the coredump size to as large a value as his account settings will allow.

This is often used when debugging.

Definition at line 166 of file inspircd_io.h.


The documentation for this class was generated from the following file:
Generated on Wed Dec 14 19:16:28 2005 for InspIRCd by  doxygen 1.4.4-20050815