The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download | Blog | Stats
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

configreader.h File Reference

#include <sstream>
#include <string>
#include <vector>
#include <map>
#include "inspircd.h"
#include "globals.h"
#include "modules.h"
#include "socketengine.h"
#include "socket.h"

Include dependency graph for configreader.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ValueItem
 Holds a config value, either string, integer or boolean. More...
class  ValueContainerBase
 The base class of the container 'ValueContainer' used internally by the core to hold core values. More...
class  ValueContainer< T >
 ValueContainer is used to contain pointers to different core values such as the server name, maximum number of clients etc. More...
struct  InitialConfig
 Holds a core configuration item and its callbacks. More...
struct  MultiConfig
 Holds a core configuration item and its callbacks where there may be more than one item. More...
class  ServerConfig
 This class holds the bulk of the runtime configuration for the ircd. More...

Defines

#define CHANOPS_EXEMPT(s, m)   (s->Config->ExemptChanOps[(unsigned char)m])
 Determines if a channel op is exempt from given mode m, in config of server instance s.

Typedefs

typedef ValueContainer< bool * > ValueContainerBool
 A specialization of ValueContainer to hold a pointer to a bool.
typedef ValueContainer< unsigned
int * > 
ValueContainerUInt
 A specialization of ValueContainer to hold a pointer to an unsigned int.
typedef ValueContainer< char * > ValueContainerChar
 A specialization of ValueContainer to hold a pointer to a char array.
typedef ValueContainer< int * > ValueContainerInt
 A specialization of ValueContainer to hold a pointer to an int.
typedef std::deque< ValueItemValueList
 A set of ValueItems used by multi-value validator functions.
typedef bool(* Validator )(ServerConfig *conf, const char *, const char *, ValueItem &)
 A callback for validating a single value.
typedef bool(* MultiValidator )(ServerConfig *conf, const char *, char **, ValueList &, int *)
 A callback for validating multiple value entries.
typedef bool(* MultiNotify )(ServerConfig *conf, const char *)
 A callback indicating the end of a group of entries.
typedef std::map< irc::string,
char * > 
opertype_t
 A set of oper types.
typedef std::map< irc::string,
char * > 
operclass_t
 A Set of oper classes.

Enumerations

enum  ConfigDataType {
  DT_NOTHING = 0, DT_INTEGER = 1, DT_CHARPTR = 2, DT_BOOLEAN = 3,
  DT_ALLOW_NEWLINE = 128
}
 Types of data in the core config. More...

Functions

CoreExport bool InitializeDisabledCommands (const char *data, InspIRCd *ServerInstance)
 Initialize the disabled commands list.
bool InitTypes (ServerConfig *conf, const char *tag)
 Initialize the oper types.
bool InitClasses (ServerConfig *conf, const char *tag)
 Initialize the oper classes.
bool DoType (ServerConfig *conf, const char *tag, char **entries, ValueList &values, int *types)
 Initialize an oper type.
bool DoClass (ServerConfig *conf, const char *tag, char **entries, ValueList &values, int *types)
 Initialize an oper class.
bool DoneClassesAndTypes (ServerConfig *conf, const char *tag)
 Finish initializing the oper types and classes.


Define Documentation

#define CHANOPS_EXEMPT s,
 )     (s->Config->ExemptChanOps[(unsigned char)m])
 

Determines if a channel op is exempt from given mode m, in config of server instance s.

Definition at line 22 of file configreader.h.

Referenced by ModuleStripColor::OnUserPreMessage(), ModuleBlockColour::OnUserPreMessage(), ModuleNoNickChange::OnUserPreNick(), ModuleNickFlood::OnUserPreNick(), ModuleMsgFlood::ProcessMessages(), and ModuleChanFilter::ProcessMessages().


Typedef Documentation

typedef bool(* MultiNotify)(ServerConfig *conf, const char *)
 

A callback indicating the end of a group of entries.

Definition at line 157 of file configreader.h.

typedef bool(* MultiValidator)(ServerConfig *conf, const char *, char **, ValueList &, int *)
 

A callback for validating multiple value entries.

Definition at line 154 of file configreader.h.

typedef std::map<irc::string,char*> operclass_t
 

A Set of oper classes.

Definition at line 204 of file configreader.h.

typedef std::map<irc::string,char*> opertype_t
 

A set of oper types.

Definition at line 200 of file configreader.h.

typedef bool(* Validator)(ServerConfig *conf, const char *, const char *, ValueItem &)
 

A callback for validating a single value.

Definition at line 151 of file configreader.h.

typedef ValueContainer<bool*> ValueContainerBool
 

A specialization of ValueContainer to hold a pointer to a bool.

Definition at line 128 of file configreader.h.

typedef ValueContainer<char*> ValueContainerChar
 

A specialization of ValueContainer to hold a pointer to a char array.

Definition at line 138 of file configreader.h.

typedef ValueContainer<int*> ValueContainerInt
 

A specialization of ValueContainer to hold a pointer to an int.

Definition at line 143 of file configreader.h.

typedef ValueContainer<unsigned int*> ValueContainerUInt
 

A specialization of ValueContainer to hold a pointer to an unsigned int.

Definition at line 133 of file configreader.h.

typedef std::deque<ValueItem> ValueList
 

A set of ValueItems used by multi-value validator functions.

Definition at line 147 of file configreader.h.


Enumeration Type Documentation

enum ConfigDataType
 

Types of data in the core config.

Enumerator:
DT_NOTHING 
DT_INTEGER 
DT_CHARPTR 
DT_BOOLEAN 
DT_ALLOW_NEWLINE 

Definition at line 41 of file configreader.h.

00042 {
00043         DT_NOTHING       = 0,           /* No data */
00044         DT_INTEGER       = 1,           /* Integer */
00045         DT_CHARPTR       = 2,           /* Char pointer */
00046         DT_BOOLEAN       = 3,           /* Boolean */
00047         DT_ALLOW_NEWLINE = 128          /* New line characters allowed */
00048 };


Function Documentation

bool DoClass ServerConfig conf,
const char *  tag,
char **  entries,
ValueList values,
int *  types
 

Initialize an oper class.

Definition at line 68 of file users.cpp.

References ServerConfig::operclass, and strnewdup().

Referenced by ServerConfig::Read().

00069 {
00070         const char* ClassName = values[0].GetString();
00071         const char* CommandList = values[1].GetString();
00072 
00073         conf->operclass[ClassName] = strnewdup(CommandList);
00074         return true;
00075 }

bool DoneClassesAndTypes ServerConfig conf,
const char *  tag
 

Finish initializing the oper types and classes.

Definition at line 77 of file users.cpp.

Referenced by ServerConfig::Read().

00078 {
00079         return true;
00080 }

bool DoType ServerConfig conf,
const char *  tag,
char **  entries,
ValueList values,
int *  types
 

Initialize an oper type.

Definition at line 59 of file users.cpp.

References ServerConfig::opertypes, and strnewdup().

Referenced by ServerConfig::Read().

00060 {
00061         const char* TypeName = values[0].GetString();
00062         const char* Classes = values[1].GetString();
00063 
00064         conf->opertypes[TypeName] = strnewdup(Classes);
00065         return true;
00066 }

bool InitClasses ServerConfig conf,
const char *  tag
 

Initialize the oper classes.

Definition at line 44 of file users.cpp.

References ServerConfig::operclass.

Referenced by ServerConfig::Read().

00045 {
00046         if (conf->operclass.size())
00047         {
00048                 for (operclass_t::iterator n = conf->operclass.begin(); n != conf->operclass.end(); n++)
00049                 {
00050                         if (n->second)
00051                                 delete[] n->second;
00052                 }
00053         }
00054 
00055         conf->operclass.clear();
00056         return true;
00057 }

CoreExport bool InitializeDisabledCommands const char *  data,
InspIRCd ServerInstance
 

Initialize the disabled commands list.

Definition at line 199 of file configreader.cpp.

References CommandParser::cmdlist, and InspIRCd::Parser.

Referenced by cmd_rehash::Handle(), InspIRCd::InspIRCd(), ModuleSpanningTree::OnRehash(), and TreeSocket::RemoteRehash().

00200 {
00201         std::stringstream dcmds(data);
00202         std::string thiscmd;
00203 
00204         /* Enable everything first */
00205         for (command_table::iterator x = ServerInstance->Parser->cmdlist.begin(); x != ServerInstance->Parser->cmdlist.end(); x++)
00206                 x->second->Disable(false);
00207 
00208         /* Now disable all the ones which the user wants disabled */
00209         while (dcmds >> thiscmd)
00210         {
00211                 command_table::iterator cm = ServerInstance->Parser->cmdlist.find(thiscmd);
00212                 if (cm != ServerInstance->Parser->cmdlist.end())
00213                 {
00214                         cm->second->Disable(true);
00215                 }
00216         }
00217         return true;
00218 }

bool InitTypes ServerConfig conf,
const char *  tag
 

Initialize the oper types.

Definition at line 29 of file users.cpp.

References ServerConfig::opertypes.

Referenced by ServerConfig::Read().

00030 {
00031         if (conf->opertypes.size())
00032         {
00033                 for (opertype_t::iterator n = conf->opertypes.begin(); n != conf->opertypes.end(); n++)
00034                 {
00035                         if (n->second)
00036                                 delete[] n->second;
00037                 }
00038         }
00039 
00040         conf->opertypes.clear();
00041         return true;
00042 }