]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/configreader.h
Add stuff so that modules can hook users by altering a pointer in the User class...
[user/henk/code/inspircd.git] / include / configreader.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #ifndef INSPIRCD_CONFIGREADER
15 #define INSPIRCD_CONFIGREADER
16
17 /* handy defines */
18
19 /** Determines if a channel op is exempt from given mode m,
20  * in config of server instance s. 
21  */
22 #define CHANOPS_EXEMPT(s, m) (s->Config->ExemptChanOps[(unsigned char)m])
23
24 #include <sstream>
25 #include <string>
26 #include <vector>
27 #include <map>
28 #include "inspircd.h"
29 #include "globals.h"
30 #include "modules.h"
31 #include "socketengine.h"
32 #include "socket.h"
33
34 /* Required forward definitions */
35 class ServerConfig;
36 class InspIRCd;
37 class BufferedSocket;
38
39 /** Types of data in the core config
40  */
41 enum ConfigDataType
42 {
43         DT_NOTHING       = 0,           /* No data */
44         DT_INTEGER       = 1,           /* Integer */
45         DT_CHARPTR       = 2,           /* Char pointer */
46         DT_BOOLEAN       = 3,           /* Boolean */
47         DT_HOSTNAME      = 4,           /* Hostname syntax */
48         DT_NOSPACES      = 5,           /* No spaces */
49         DT_IPADDRESS     = 6,           /* IP address (v4, v6) */
50         DT_CHANNEL       = 7,           /* Channel name */
51         DT_ALLOW_WILD    = 64,          /* Allow wildcards/CIDR in DT_IPADDRESS */
52         DT_ALLOW_NEWLINE = 128,         /* New line characters allowed in DT_CHARPTR */
53         DT_BOOTONLY      = 256          /* Can only be set on startup, not on rehash */
54 };
55
56 /** Holds a config value, either string, integer or boolean.
57  * Callback functions receive one or more of these, either on
58  * their own as a reference, or in a reference to a deque of them.
59  * The callback function can then alter the values of the ValueItem
60  * classes to validate the settings.
61  */
62 class ValueItem
63 {
64         /** Actual data */
65         std::string v;
66  public:
67         /** Initialize with an int */
68         ValueItem(int value);
69         /** Initialize with a bool */
70         ValueItem(bool value);
71         /** Initialize with a char pointer */
72         ValueItem(const char* value);
73         /** Change value to a char pointer */
74         void Set(const char* val);
75         /** Change value to an int */
76         void Set(int value);
77         /** Get value as an int */
78         int GetInteger();
79         /** Get value as a string */
80         char* GetString();
81         /** Get value as a bool */
82         bool GetBool();
83 };
84
85 /** The base class of the container 'ValueContainer'
86  * used internally by the core to hold core values.
87  */
88 class ValueContainerBase
89 {
90  public:
91         /** Constructor */
92         ValueContainerBase() { }
93         /** Destructor */
94         virtual ~ValueContainerBase() { }
95 };
96
97 /** ValueContainer is used to contain pointers to different
98  * core values such as the server name, maximum number of
99  * clients etc.
100  * It is specialized to hold a data type, then pointed at
101  * a value in the ServerConfig class. When the value has been
102  * read and validated, the Set method is called to write the
103  * value safely in a type-safe manner.
104  */
105 template<typename T> class ValueContainer : public ValueContainerBase
106 {
107         /** Contained item */
108         T val;
109  public:
110
111         /** Initialize with nothing */
112         ValueContainer()
113         {
114                 val = NULL;
115         }
116
117         /** Initialize with a value of type T */
118         ValueContainer(T Val)
119         {
120                 val = Val;
121         }
122
123         /** Change value to type T of size s */
124         void Set(T newval, size_t s)
125         {
126                 memcpy(val, newval, s);
127         }
128 };
129
130 /** A specialization of ValueContainer to hold a pointer to a bool
131  */
132 typedef ValueContainer<bool*> ValueContainerBool;
133
134 /** A specialization of ValueContainer to hold a pointer to
135  * an unsigned int
136  */
137 typedef ValueContainer<unsigned int*> ValueContainerUInt;
138
139 /** A specialization of ValueContainer to hold a pointer to
140  * a char array.
141  */
142 typedef ValueContainer<char*> ValueContainerChar;
143
144 /** A specialization of ValueContainer to hold a pointer to
145  * an int
146  */
147 typedef ValueContainer<int*> ValueContainerInt;
148
149 /** A set of ValueItems used by multi-value validator functions
150  */
151 typedef std::deque<ValueItem> ValueList;
152
153 /** A callback for validating a single value
154  */
155 typedef bool (*Validator)(ServerConfig* conf, const char*, const char*, ValueItem&);
156 /** A callback for validating multiple value entries
157  */
158 typedef bool (*MultiValidator)(ServerConfig* conf, const char*, char**, ValueList&, int*);
159 /** A callback indicating the end of a group of entries
160  */
161 typedef bool (*MultiNotify)(ServerConfig* conf, const char*);
162
163 /** Holds a core configuration item and its callbacks
164  */
165 struct InitialConfig
166 {
167         /** Tag name */
168         const char* tag;
169         /** Value name */
170         const char* value;
171         /** Default, if not defined */
172         const char* default_value;
173         /** Value containers */
174         ValueContainerBase* val;
175         /** Data types */
176         int datatype;
177         /** Validation function */
178         Validator validation_function;
179 };
180
181 /** Holds a core configuration item and its callbacks
182  * where there may be more than one item
183  */
184 struct MultiConfig
185 {
186         /** Tag name */
187         const char*     tag;
188         /** One or more items within tag */
189         const char*     items[18];
190         /** One or more defaults for items within tags */
191         const char* items_default[18];
192         /** One or more data types */
193         int             datatype[18];
194         /** Initialization function */
195         MultiNotify     init_function;
196         /** Validation function */
197         MultiValidator  validation_function;
198         /** Completion function */
199         MultiNotify     finish_function;
200 };
201
202 /** A set of oper types
203  */
204 typedef std::map<irc::string,char*> opertype_t;
205
206 struct operclass_data
207 {
208         char* commandlist;
209         char* cmodelist;
210         char* umodelist;
211 };
212
213 /** A Set of oper classes
214  */
215 typedef std::map<irc::string, operclass_data> operclass_t;
216
217
218 /** This class holds the bulk of the runtime configuration for the ircd.
219  * It allows for reading new config values, accessing configuration files,
220  * and storage of the configuration data needed to run the ircd, such as
221  * the servername, connect classes, /ADMIN data, MOTDs and filenames etc.
222  */
223 class CoreExport ServerConfig : public Extensible
224 {
225   private:
226         /** Creator/owner pointer
227          */
228         InspIRCd* ServerInstance;
229
230         /** This variable holds the names of all
231          * files included from the main one. This
232          * is used to make sure that no files are
233          * recursively included.
234          */
235         std::vector<std::string> include_stack;
236
237         /** This private method processes one line of
238          * configutation, appending errors to errorstream
239          * and setting error if an error has occured.
240          */
241         bool ParseLine(ConfigDataHash &target, std::string &line, long &linenumber, std::ostringstream &errorstream);
242
243         /** Check that there is only one of each configuration item
244          */
245         bool CheckOnce(const char* tag);
246
247  public:
248
249         /** Process an include executable directive
250          */
251         bool DoPipe(ConfigDataHash &target, const std::string &file, std::ostringstream &errorstream);
252
253         /** Process an include file directive
254          */
255         bool DoInclude(ConfigDataHash &target, const std::string &file, std::ostringstream &errorstream);
256
257         User* RehashUser;
258
259         std::string RehashParameter;
260
261         std::ostringstream errstr;
262
263         ConfigDataHash newconfig;
264
265         std::map<std::string, std::istream*> IncludedFiles;
266
267         std::map<std::string, bool> CompletedFiles;
268
269         size_t TotalDownloaded;
270         size_t FileErrors;
271
272         /** Used to indicate who we announce invites to on a channel */
273         enum InviteAnnounceState { INVITE_ANNOUNCE_NONE, INVITE_ANNOUNCE_ALL, INVITE_ANNOUNCE_OPS, INVITE_ANNOUNCE_DYNAMIC };
274
275         /** Pointer to function that validates dns server addresses (can be changed depending on platform) */
276         Validator DNSServerValidator;
277
278         InspIRCd* GetInstance();
279
280         int DoDownloads();
281           
282         /** This holds all the information in the config file,
283          * it's indexed by tag name to a vector of key/values.
284          */
285         ConfigDataHash config_data;
286
287         /** Max number of WhoWas entries per user.
288          */
289         int WhoWasGroupSize;
290
291         /** Max number of cumulative user-entries in WhoWas.
292          *  When max reached and added to, push out oldest entry FIFO style.
293          */
294         int WhoWasMaxGroups;
295
296         /** Max seconds a user is kept in WhoWas before being pruned.
297          */
298         int WhoWasMaxKeep;
299
300         /** Holds the server name of the local server
301          * as defined by the administrator.
302          */
303         char ServerName[MAXBUF];
304
305         /** Notice to give to users when they are Xlined
306          */
307         char MoronBanner[MAXBUF];
308         
309         /* Holds the network name the local server
310          * belongs to. This is an arbitary field defined
311          * by the administrator.
312          */
313         char Network[MAXBUF];
314
315         /** Holds the description of the local server
316          * as defined by the administrator.
317          */
318         char ServerDesc[MAXBUF];
319
320         /** Holds the admin's name, for output in
321          * the /ADMIN command.
322          */
323         char AdminName[MAXBUF];
324
325         /** Holds the email address of the admin,
326          * for output in the /ADMIN command.
327          */
328         char AdminEmail[MAXBUF];
329
330         /** Holds the admin's nickname, for output
331          * in the /ADMIN command
332          */
333         char AdminNick[MAXBUF];
334
335         /** The admin-configured /DIE password
336          */
337         char diepass[MAXBUF];
338
339         /** The admin-configured /RESTART password
340          */
341         char restartpass[MAXBUF];
342
343         /** The hash method for *BOTH* the die and restart passwords.
344          */
345         char powerhash[MAXBUF];
346
347         /** The pathname and filename of the message of the
348          * day file, as defined by the administrator.
349          */
350         char motd[MAXBUF];
351
352         /** The pathname and filename of the rules file,
353          * as defined by the administrator.
354          */
355         char rules[MAXBUF];
356
357         /** The quit prefix in use, or an empty string
358          */
359         char PrefixQuit[MAXBUF];
360
361         /** The quit suffix in use, or an empty string
362          */
363         char SuffixQuit[MAXBUF];
364
365         /** The fixed quit message in use, or an empty string
366          */
367         char FixedQuit[MAXBUF];
368
369         /** The part prefix in use, or an empty string
370          */
371         char PrefixPart[MAXBUF];
372
373         /** The part suffix in use, or an empty string
374          */
375         char SuffixPart[MAXBUF];
376
377         /** The fixed part message in use, or an empty string
378          */
379         char FixedPart[MAXBUF];
380
381         /** The last string found within a <die> tag, or
382          * an empty string.
383          */
384         char DieValue[MAXBUF];
385
386         /** The DNS server to use for DNS queries
387          */
388         char DNSServer[MAXBUF];
389
390         /** This variable contains a space-seperated list
391          * of commands which are disabled by the
392          * administrator of the server for non-opers.
393          */
394         char DisabledCommands[MAXBUF];
395
396         /** The full path to the modules directory.
397          * This is either set at compile time, or
398          * overridden in the configuration file via
399          * the <options> tag.
400          */
401         char ModPath[1024];
402
403         /** The full pathname to the executable, as
404          * given in argv[0] when the program starts.
405          */
406         char MyExecutable[1024];
407
408         /** The file handle of the logfile. If this
409          * value is NULL, the log file is not open,
410          * probably due to a permissions error on
411          * startup (this should not happen in normal
412          * operation!).
413          */
414         FILE *log_file;
415
416         /** If this value is true, the owner of the
417          * server specified -nofork on the command
418          * line, causing the daemon to stay in the
419          * foreground.
420          */
421         bool nofork;
422         
423         /** If this value if true then all log
424          * messages will be output, regardless of
425          * the level given in the config file.
426          * This is set with the -debug commandline
427          * option.
428          */
429         bool forcedebug;
430         
431         /** If this is true then log output will be
432          * written to the logfile. This is the default.
433          * If you put -nolog on the commandline then
434          * the logfile will not be written.
435          * This is meant to be used in conjunction with
436          * -debug for debugging without filling up the
437          * hard disk.
438          */
439         bool writelog;
440
441         /** If this value is true, halfops have been
442          * enabled in the configuration file.
443          */
444         bool AllowHalfop;
445
446         /** If this is set to true, then mode lists (e.g
447          * MODE #chan b) are hidden from unprivileged
448          * users.
449          */
450         bool HideModeLists[256];
451
452         /** If this is set to true, then channel operators
453          * are exempt from this channel mode. Used for +Sc etc.
454          */
455         bool ExemptChanOps[256];
456
457         /** The number of seconds the DNS subsystem
458          * will wait before timing out any request.
459          */
460         int dns_timeout;
461
462         /** The size of the read() buffer in the user
463          * handling code, used to read data into a user's
464          * recvQ.
465          */
466         int NetBufferSize;
467
468         /** The value to be used for listen() backlogs
469          * as default.
470          */
471         int MaxConn;
472
473         /** The soft limit value assigned to the irc server.
474          * The IRC server will not allow more than this
475          * number of local users.
476          */
477         unsigned int SoftLimit;
478
479         /** Maximum number of targets for a multi target command
480          * such as PRIVMSG or KICK
481          */
482         unsigned int MaxTargets;
483
484         /** The maximum number of /WHO results allowed
485          * in any single /WHO command.
486          */
487         int MaxWhoResults;
488
489         /** True if the DEBUG loglevel is selected.
490          */
491         int debugging;
492
493         /** The loglevel in use by the IRC server
494          */
495         int LogLevel;
496
497         /** How many seconds to wait before exiting
498          * the program when /DIE is correctly issued.
499          */
500         int DieDelay;
501
502         /** True if we're going to hide netsplits as *.net *.split for non-opers
503          */
504         bool HideSplits;
505
506         /** True if we're going to hide ban reasons for non-opers (e.g. G-Lines,
507          * K-Lines, Z-Lines)
508          */
509         bool HideBans;
510
511         /** Announce invites to the channel with a server notice
512          */
513         InviteAnnounceState AnnounceInvites;
514
515         /** If this is enabled then operators will
516          * see invisible (+i) channels in /whois.
517          */
518         bool OperSpyWhois;
519
520         /** Set to a non-empty string to obfuscate the server name of users in WHOIS
521          */
522         char HideWhoisServer[MAXBUF];
523
524         /** Set to a non empty string to obfuscate nicknames prepended to a KILL.
525          */
526         char HideKillsServer[MAXBUF];
527
528         /** The MOTD file, cached in a file_cache type.
529          */
530         file_cache MOTD;
531
532         /** The RULES file, cached in a file_cache type.
533          */
534         file_cache RULES;
535
536         /** The full pathname and filename of the PID
537          * file as defined in the configuration.
538          */
539         char PID[1024];
540
541         /** The connect classes in use by the IRC server.
542          */
543         ClassVector Classes;
544
545         /** A list of the classes for listening client ports
546          */
547         std::vector<ListenSocket*> ports;
548
549         /** A list of ports claimed by IO Modules
550          */
551         std::map<int,Module*> IOHookModule;
552
553         std::map<BufferedSocket*, Module*> SocketIOHookModule;
554
555         /** The 005 tokens of this server (ISUPPORT)
556          * populated/repopulated upon loading or unloading
557          * modules.
558          */
559         std::string data005;
560
561         /** isupport strings
562          */
563         std::vector<std::string> isupport;
564
565         /** STATS characters in this list are available
566          * only to operators.
567          */
568         char UserStats[MAXBUF];
569         
570         /** The path and filename of the ircd.log file
571          */
572         std::string logpath;
573
574         /** Default channel modes
575          */
576         char DefaultModes[MAXBUF];
577
578         /** Custom version string, which if defined can replace the system info in VERSION.
579          */
580         char CustomVersion[MAXBUF];
581
582         /** List of u-lined servers
583          */
584         std::map<irc::string, bool> ulines;
585
586         /** Max banlist sizes for channels (the std::string is a glob)
587          */
588         std::map<std::string, int> maxbans;
589
590         /** Directory where the inspircd binary resides
591          */
592         std::string MyDir;
593
594         /** If set to true, no user DNS lookups are to be performed
595          */
596         bool NoUserDns;
597
598         /** If set to true, provide syntax hints for unknown commands
599          */
600         bool SyntaxHints;
601
602         /** If set to true, users appear to quit then rejoin when their hosts change.
603          * This keeps clients synchronized properly.
604          */
605         bool CycleHosts;
606
607         /** If set to true, prefixed channel NOTICEs and PRIVMSGs will have the prefix
608          *  added to the outgoing text for undernet style msg prefixing.
609          */
610         bool UndernetMsgPrefix;
611
612         /** If set to true, the full nick!user@host will be shown in the TOPIC command
613          * for who set the topic last. If false, only the nick is shown.
614          */
615         bool FullHostInTopic;
616
617         /** All oper type definitions from the config file
618          */
619         opertype_t opertypes;
620
621         /** All oper class definitions from the config file
622          */
623         operclass_t operclass;
624
625         /** Saved argv from startup
626          */
627         char** argv;
628
629         /** Saved argc from startup
630          */
631         int argc;
632
633         /** Max channels per user
634          */
635         unsigned int MaxChans;
636
637         /** Oper max channels per user
638          */
639         unsigned int OperMaxChans;
640
641         /** TS6-like server ID.
642          * NOTE: 000...999 are usable for InspIRCd servers. This
643          * makes code simpler. 0AA, 1BB etc with letters are reserved
644          * for services use.
645          */
646         char sid[MAXBUF];
647
648         /** True if we have been told to run the testsuite from the commandline,
649          * rather than entering the mainloop.
650          */
651         bool TestSuite;
652
653         /** Construct a new ServerConfig
654          */
655         ServerConfig(InspIRCd* Instance);
656
657         /** Clears the include stack in preperation for a Read() call.
658          */
659         void ClearStack();
660
661         /** Get server ID as string with required leading zeroes
662          */
663         std::string GetSID();
664
665         /** Update the 005 vector
666          */
667         void Update005();
668
669         /** Send the 005 numerics (ISUPPORT) to a user
670          */
671         void Send005(User* user);
672
673         /** Read the entire configuration into memory
674          * and initialize this class. All other methods
675          * should be used only by the core.
676          */
677         void Read(bool bail, User* user);
678
679         /** Read a file into a file_cache object
680          */
681         bool ReadFile(file_cache &F, const char* fname);
682
683         /** Report a configuration error given in errormessage.
684          * @param bail If this is set to true, the error is sent to the console, and the program exits
685          * @param user If this is set to a non-null value, and bail is false, the errors are spooled to
686          * this user as SNOTICEs.
687          * If the parameter is NULL, the messages are spooled to all opers.
688          */
689         void ReportConfigError(const std::string &errormessage, bool bail, User* user);
690
691         /** Load 'filename' into 'target', with the new config parser everything is parsed into
692          * tag/key/value at load-time rather than at read-value time.
693          */
694         bool LoadConf(ConfigDataHash &target, FILE* &conf, const char* filename, std::ostringstream &errorstream);
695
696         /** Load 'filename' into 'target', with the new config parser everything is parsed into
697          * tag/key/value at load-time rather than at read-value time.
698          */
699         bool LoadConf(ConfigDataHash &target, FILE* &conf, const std::string &filename, std::ostringstream &errorstream);
700         
701         /* Both these return true if the value existed or false otherwise */
702         
703         /** Writes 'length' chars into 'result' as a string
704          */
705         bool ConfValue(ConfigDataHash &target, const char* tag, const char* var, int index, char* result, int length, bool allow_linefeeds = false);
706         /** Writes 'length' chars into 'result' as a string
707          */
708         bool ConfValue(ConfigDataHash &target, const char* tag, const char* var, const char* default_value, int index, char* result, int length, bool allow_linefeeds = false);
709
710         /** Writes 'length' chars into 'result' as a string
711          */
712         bool ConfValue(ConfigDataHash &target, const std::string &tag, const std::string &var, int index, std::string &result, bool allow_linefeeds = false);
713         /** Writes 'length' chars into 'result' as a string
714          */
715         bool ConfValue(ConfigDataHash &target, const std::string &tag, const std::string &var, const std::string &default_value, int index, std::string &result, bool allow_linefeeds = false);
716         
717         /** Tries to convert the value to an integer and write it to 'result'
718          */
719         bool ConfValueInteger(ConfigDataHash &target, const char* tag, const char* var, int index, int &result);
720         /** Tries to convert the value to an integer and write it to 'result'
721          */
722         bool ConfValueInteger(ConfigDataHash &target, const char* tag, const char* var, const char* default_value, int index, int &result);
723         /** Tries to convert the value to an integer and write it to 'result'
724          */
725         bool ConfValueInteger(ConfigDataHash &target, const std::string &tag, const std::string &var, int index, int &result);
726         /** Tries to convert the value to an integer and write it to 'result'
727          */
728         bool ConfValueInteger(ConfigDataHash &target, const std::string &tag, const std::string &var, const std::string &default_value, int index, int &result);
729         
730         /** Returns true if the value exists and has a true value, false otherwise
731          */
732         bool ConfValueBool(ConfigDataHash &target, const char* tag, const char* var, int index);
733         /** Returns true if the value exists and has a true value, false otherwise
734          */
735         bool ConfValueBool(ConfigDataHash &target, const char* tag, const char* var, const char* default_value, int index);
736         /** Returns true if the value exists and has a true value, false otherwise
737          */
738         bool ConfValueBool(ConfigDataHash &target, const std::string &tag, const std::string &var, int index);
739         /** Returns true if the value exists and has a true value, false otherwise
740          */
741         bool ConfValueBool(ConfigDataHash &target, const std::string &tag, const std::string &var, const std::string &default_value, int index);
742         
743         /** Returns the number of occurences of tag in the config file
744          */
745         int ConfValueEnum(ConfigDataHash &target, const char* tag);
746         /** Returns the number of occurences of tag in the config file
747          */
748         int ConfValueEnum(ConfigDataHash &target, const std::string &tag);
749         
750         /** Returns the numbers of vars inside the index'th 'tag in the config file
751          */
752         int ConfVarEnum(ConfigDataHash &target, const char* tag, int index);
753         /** Returns the numbers of vars inside the index'th 'tag in the config file
754          */
755         int ConfVarEnum(ConfigDataHash &target, const std::string &tag, int index);
756
757         void ValidateHostname(const char* p, const std::string &tag, const std::string &val);
758
759         void ValidateIP(const char* p, const std::string &tag, const std::string &val, bool wild);
760
761         void ValidateNoSpaces(const char* p, const std::string &tag, const std::string &val);
762         
763         /** Get a pointer to the module which has hooked the given port.
764          * @parameter port Port number
765          * @return Returns a pointer to the hooking module, or NULL
766          */
767         Module* GetIOHook(int port);
768
769         /** Hook a module to a client port, so that it can receive notifications
770          * of low-level port activity.
771          * @param port The port number
772          * @param Module the module to hook to the port
773          * @return True if the hook was successful.
774          */
775         bool AddIOHook(int port, Module* iomod);
776
777         /** Delete a module hook from a client port.
778          * @param port The port to detatch from
779          * @return True if successful
780          */
781         bool DelIOHook(int port);
782         
783         /** Get a pointer to the module which has hooked the given BufferedSocket class.
784          * @parameter port Port number
785          * @return Returns a pointer to the hooking module, or NULL
786          */
787         Module* GetIOHook(BufferedSocket* is);
788
789         /** Hook a module to an BufferedSocket class, so that it can receive notifications
790          * of low-level socket activity.
791          * @param iomod The module to hook to the socket
792          * @param is The BufferedSocket to attach to
793          * @return True if the hook was successful.
794          */
795         bool AddIOHook(Module* iomod, BufferedSocket* is);
796
797         /** Delete a module hook from an BufferedSocket.
798          * @param is The BufferedSocket to detatch from.
799          * @return True if the unhook was successful
800          */
801         bool DelIOHook(BufferedSocket* is);
802
803         /** Returns the fully qualified path to the inspircd directory
804          * @return The full program directory
805          */
806         std::string GetFullProgDir();
807
808         /** Returns true if a directory is valid (within the modules directory).
809          * @param dirandfile The directory and filename to check
810          * @return True if the directory is valid
811          */
812         static bool DirValid(const char* dirandfile);
813
814         /** Clean a filename, stripping the directories (and drives) from string.
815          * @param name Directory to tidy
816          * @return The cleaned filename
817          */
818         static char* CleanFilename(char* name);
819
820         /** Check if a file exists.
821          * @param file The full path to a file
822          * @return True if the file exists and is readable.
823          */
824         static bool FileExists(const char* file);
825         
826 };
827
828 /** Initialize the disabled commands list
829  */
830 CoreExport bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance);
831
832 /** Initialize the oper types
833  */
834 bool InitTypes(ServerConfig* conf, const char* tag);
835
836 /** Initialize the oper classes
837  */
838 bool InitClasses(ServerConfig* conf, const char* tag);
839
840 /** Initialize an oper type 
841  */
842 bool DoType(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
843
844 /** Initialize an oper class
845  */
846 bool DoClass(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
847
848 /** Finish initializing the oper types and classes
849  */
850 bool DoneClassesAndTypes(ServerConfig* conf, const char* tag);
851
852
853
854 /** Initialize x line
855  */
856 bool InitXLine(ServerConfig* conf, const char* tag);
857  
858 /** Add a config-defined zline
859  */
860 bool DoZLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
861
862 /** Add a config-defined qline
863  */
864 bool DoQLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
865
866 /** Add a config-defined kline
867  */
868 bool DoKLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
869
870 /** Add a config-defined eline
871  */
872 bool DoELine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
873
874
875
876
877 #endif
878