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)
ModuleGetIOHook (int port)
bool AddIOHook (int port, Module *iomod)
bool DelIOHook (int port)

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.
std::map< int, Module * > IOHookModule
 A list of ports claimed by IO Modules.

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 40 of file inspircd_io.h.


Constructor & Destructor Documentation

ServerConfig::ServerConfig  ) 
 


Member Function Documentation

bool ServerConfig::AddIOHook int  port,
Module iomod
 

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
 

bool ServerConfig::DelIOHook int  port  ) 
 

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.

Module* ServerConfig::GetIOHook int  port  ) 
 

Referenced by kill_link(), and kill_link_silent().

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 217 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 90 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 85 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 95 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 172 of file inspircd_io.h.

ClassVector ServerConfig::Classes
 

The connect classes in use by the IRC server.

Definition at line 243 of file inspircd_io.h.

Referenced by AddClient().

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 239 of file inspircd_io.h.

Referenced by userrec::HasPermission().

int ServerConfig::debugging
 

True if the DEBUG loglevel is selected.

Definition at line 203 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 212 of file inspircd_io.h.

char ServerConfig::diepass[MAXBUF]
 

The admin-configured /DIE password.

Definition at line 99 of file inspircd_io.h.

char ServerConfig::DieValue[MAXBUF]
 

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

Definition at line 122 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 132 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 177 of file inspircd_io.h.

Referenced by AddClient().

char ServerConfig::DNSServer[MAXBUF]
 

The DNS server to use for DNS queries.

Definition at line 126 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 48 of file inspircd_io.h.

std::map<int,Module*> ServerConfig::IOHookModule
 

A list of ports claimed by IO Modules.

Definition at line 256 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 152 of file inspircd_io.h.

int ServerConfig::LogLevel
 

The loglevel in use by the IRC server.

Definition at line 207 of file inspircd_io.h.

int ServerConfig::MaxConn
 

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

Definition at line 188 of file inspircd_io.h.

int ServerConfig::MaxWhoResults
 

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

Definition at line 199 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 139 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 248 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 221 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 108 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 144 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 183 of file inspircd_io.h.

char ServerConfig::Network[MAXBUF]
 

Definition at line 75 of file inspircd_io.h.

Referenced by FullConnectUser(), and 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 159 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 230 of file inspircd_io.h.

int ServerConfig::ports[255]
 

A list of ports which the server is listening on.

Definition at line 252 of file inspircd_io.h.

char ServerConfig::PrefixQuit[MAXBUF]
 

The quit prefix in use, or an empty string.

Definition at line 117 of file inspircd_io.h.

char ServerConfig::restartpass[MAXBUF]
 

The admin-configured /RESTART password.

Definition at line 103 of file inspircd_io.h.

file_cache ServerConfig::RULES
 

The RULES file, cached in a file_cache type.

Definition at line 225 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 113 of file inspircd_io.h.

char ServerConfig::ServerDesc[MAXBUF]
 

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

Definition at line 80 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 69 of file inspircd_io.h.

Referenced by AddClient(), FullConnectUser(), 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 194 of file inspircd_io.h.

Referenced by AddClient().

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 167 of file inspircd_io.h.


The documentation for this class was generated from the following file:
Generated on Mon Dec 19 18:05:23 2005 for InspIRCd by  doxygen 1.4.4-20050815