]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/configreader.h
Add fixes to stop people changing the SID of a live server - certain configuration...
[user/henk/code/inspircd.git] / include / configreader.h
index 3759e909f9855463ee8d5762511ffc2206fdac33..3120d3d59b69fb5267b9f3fc7eb5ef7a90b8ce50 100644 (file)
@@ -49,7 +49,8 @@ enum ConfigDataType
        DT_IPADDRESS     = 6,           /* IP address (v4, v6) */
        DT_CHANNEL       = 7,           /* Channel name */
        DT_ALLOW_WILD    = 64,          /* Allow wildcards/CIDR in DT_IPADDRESS */
-       DT_ALLOW_NEWLINE = 128          /* New line characters allowed in DT_CHARPTR */
+       DT_ALLOW_NEWLINE = 128,         /* New line characters allowed in DT_CHARPTR */
+       DT_BOOTONLY      = 256          /* Can only be set on startup, not on rehash */
 };
 
 /** Holds a config value, either string, integer or boolean.
@@ -68,10 +69,8 @@ class ValueItem
        /** Initialize with a bool */
        ValueItem(bool value);
        /** Initialize with a char pointer */
-       ValueItem(char* value);
+       ValueItem(const char* value);
        /** Change value to a char pointer */
-       void Set(char* value);
-       /** Change value to a const char pointer */
        void Set(const char* val);
        /** Change value to an int */
        void Set(int value);
@@ -166,15 +165,15 @@ typedef bool (*MultiNotify)(ServerConfig* conf, const char*);
 struct InitialConfig
 {
        /** Tag name */
-       char* tag;
+       const char* tag;
        /** Value name */
-       char* value;
+       const char* value;
        /** Default, if not defined */
-       char* default_value;
+       const char* default_value;
        /** Value containers */
        ValueContainerBase* val;
        /** Data types */
-       ConfigDataType datatype;
+       int datatype;
        /** Validation function */
        Validator validation_function;
 };
@@ -187,9 +186,9 @@ struct MultiConfig
        /** Tag name */
        const char*     tag;
        /** One or more items within tag */
-       char*           items[18];
+       const char*     items[18];
        /** One or more defaults for items within tags */
-       char*           items_default[18];
+       const char* items_default[18];
        /** One or more data types */
        int             datatype[18];
        /** Initialization function */
@@ -232,18 +231,26 @@ class CoreExport ServerConfig : public Extensible
         * configutation, appending errors to errorstream
         * and setting error if an error has occured.
         */
-       bool ParseLine(ConfigDataHash &target, std::string &line, long &linenumber, std::ostringstream &errorstream, int pass, std::istream* scan_for_includes_only);
-  
-       /** Process an include directive
-        */
-       bool DoInclude(ConfigDataHash &target, const std::string &file, std::ostringstream &errorstream, int pass, std::istream* scan_for_includes_only);
+       bool ParseLine(ConfigDataHash &target, std::string &line, long &linenumber, std::ostringstream &errorstream);
 
        /** Check that there is only one of each configuration item
         */
-       bool CheckOnce(char* tag);
+       bool CheckOnce(const char* tag);
 
  public:
 
+       /** Process an include executable directive
+        */
+       bool DoPipe(ConfigDataHash &target, const std::string &file, std::ostringstream &errorstream);
+
+       /** Process an include file directive
+        */
+       bool DoInclude(ConfigDataHash &target, const std::string &file, std::ostringstream &errorstream);
+
+       User* RehashUser;
+
+       std::string RehashParameter;
+
        std::ostringstream errstr;
 
        ConfigDataHash newconfig;
@@ -263,7 +270,7 @@ class CoreExport ServerConfig : public Extensible
 
        InspIRCd* GetInstance();
 
-       void DoDownloads();
+       int DoDownloads();
          
        /** This holds all the information in the config file,
         * it's indexed by tag name to a vector of key/values.
@@ -429,10 +436,6 @@ class CoreExport ServerConfig : public Extensible
         */
        bool AllowHalfop;
 
-       /** If this value is true, users are allowed to devoice themselves.
-        */
-       bool AllowDevoiceSelf;
-
        /** If this is set to true, then mode lists (e.g
         * MODE #chan b) are hidden from unprivileged
         * users.
@@ -635,6 +638,11 @@ class CoreExport ServerConfig : public Extensible
         */
        char sid[MAXBUF];
 
+       /** True if we have been told to run the testsuite from the commandline,
+        * rather than entering the mainloop.
+        */
+       bool TestSuite;
+
        /** Construct a new ServerConfig
         */
        ServerConfig(InspIRCd* Instance);
@@ -659,7 +667,7 @@ class CoreExport ServerConfig : public Extensible
         * and initialize this class. All other methods
         * should be used only by the core.
         */
-       void Read(bool bail, User* user, int pass);
+       void Read(bool bail, User* user);
 
        /** Read a file into a file_cache object
         */
@@ -676,12 +684,12 @@ class CoreExport ServerConfig : public Extensible
        /** 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.
         */
-       bool LoadConf(ConfigDataHash &target, const char* filename, std::ostringstream &errorstream, int pass, std::istream* scan_for_includs_only);
+       bool LoadConf(ConfigDataHash &target, FILE* &conf, const char* filename, std::ostringstream &errorstream);
 
        /** 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.
         */
-       bool LoadConf(ConfigDataHash &target, const std::string &filename, std::ostringstream &errorstream, int pass, std::istream* scan_for_includs_only = NULL);
+       bool LoadConf(ConfigDataHash &target, FILE* &conf, const std::string &filename, std::ostringstream &errorstream);
        
        /* Both these return true if the value existed or false otherwise */