X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fconfigreader.h;h=5c8a663070887c1ac3f0b204880d2e15fb625a14;hb=d54fd9b1e6b31f69332a9241b5f17330c0ad61e0;hp=63836056a077aee5de56b77fba6fb46f8265885c;hpb=19e361b2f1e3ed1a6ce5f95d11c3d37f626c428b;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/configreader.h b/include/configreader.h index 63836056a..5c8a66307 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -5,7 +5,7 @@ * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. * E-mail: * - * + * * * * Written by Craig Edwards, Craig McLure, and others. @@ -25,14 +25,20 @@ #include "inspircd.h" #include "globals.h" #include "modules.h" +#include "socketengine.h" +#include "socket.h" -typedef bool (*Validator)(const char*, const char*, void*); -typedef bool (*MultiValidator)(const char*, char**, void**, int*); -typedef bool (*MultiNotify)(const char*); +class ServerConfig; +class InspIRCd; + +typedef bool (*Validator)(ServerConfig* conf, const char*, const char*, void*); +typedef bool (*MultiValidator)(ServerConfig* conf, const char*, char**, void**, int*); +typedef bool (*MultiNotify)(ServerConfig* conf, const char*); enum ConfigDataType { DT_NOTHING, DT_INTEGER, DT_CHARPTR, DT_BOOLEAN }; -struct InitialConfig { +struct InitialConfig +{ char* tag; char* value; void* val; @@ -40,7 +46,8 @@ struct InitialConfig { Validator validation_function; }; -struct MultiConfig { +struct MultiConfig +{ const char* tag; char* items[12]; int datatype[12]; @@ -54,9 +61,11 @@ struct MultiConfig { * and storage of the configuration data needed to run the ircd, such as * the servername, connect classes, /ADMIN data, MOTDs and filenames etc. */ -class ServerConfig : public classbase +class ServerConfig : public Extensible { private: + InspIRCd* ServerInstance; + /** This variable holds the names of all * files included from the main one. This * is used to make sure that no files are @@ -77,6 +86,8 @@ class ServerConfig : public classbase bool CheckOnce(char* tag, bool bail, userrec* user); public: + + InspIRCd* GetInstance(); /** This holds all the information in the config file, * it's indexed by tag name to a vector of key/values. @@ -214,18 +225,18 @@ class ServerConfig : public classbase * handling code, used to read data into a user's * recvQ. */ - int NetBufferSize; + int NetBufferSize; /** The value to be used for listen() backlogs * as default. */ - int MaxConn; + int MaxConn; /** The soft limit value assigned to the irc server. * The IRC server will not allow more than this * number of local users. */ - unsigned int SoftLimit; + unsigned int SoftLimit; /** Maximum number of targets for a multi target command * such as PRIVMSG or KICK @@ -235,20 +246,20 @@ class ServerConfig : public classbase /** The maximum number of /WHO results allowed * in any single /WHO command. */ - int MaxWhoResults; + int MaxWhoResults; /** True if the DEBUG loglevel is selected. */ - int debugging; + int debugging; /** The loglevel in use by the IRC server */ - int LogLevel; + int LogLevel; /** How many seconds to wait before exiting * the program when /DIE is correctly issued. */ - int DieDelay; + int DieDelay; /** True if we're going to hide netsplits as *.net *.split for non-opers */ @@ -271,7 +282,7 @@ class ServerConfig : public classbase /** A list of IP addresses the server is listening * on. */ - char addrs[MAXBUF][255]; + char addrs[MAXBUF][255]; /** The MOTD file, cached in a file_cache type. */ @@ -299,6 +310,10 @@ class ServerConfig : public classbase */ int ports[255]; + /** A list of the file descriptors for the listening client ports + */ + ListenSocket* openSockfd[255]; + /** Boolean sets of which modules implement which functions */ char implement_lists[255][255]; @@ -338,10 +353,22 @@ class ServerConfig : public classbase */ std::map maxbans; - ServerConfig(); + /** If set to true, no user DNS lookups are to be performed + */ + bool NoUserDns; + + /** If set to true, provide syntax hints for unknown commands + */ + bool SyntaxHints; - /** Clears the include stack in preperation for - * a Read() call. + /** If set to true, users appear to quit then rejoin when their hosts change. + * This keeps clients synchronized properly. + */ + bool CycleHosts; + + ServerConfig(InspIRCd* Instance); + + /** Clears the include stack in preperation for a Read() call. */ void ClearStack(); @@ -351,6 +378,10 @@ class ServerConfig : public classbase */ void Read(bool bail, userrec* user); + /** Read a file into a file_cache object + */ + bool ReadFile(file_cache &F, const char* fname); + /** Load 'filename' into 'target', with the new config parser everything is parsed into * tag/key/value at load-time rather than at read-value time. */ @@ -382,6 +413,14 @@ class ServerConfig : public classbase Module* GetIOHook(int port); bool AddIOHook(int port, Module* iomod); bool DelIOHook(int port); + + static std::string GetFullProgDir(char** argv, int argc); + static bool DirValid(const char* dirandfile); + static char* CleanFilename(char* name); + static bool FileExists(const char* file); + }; +bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance); + #endif