ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/confparse.h
Revision: 1.3
Committed: Tue Aug 28 17:08:06 2007 UTC (19 years ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.2: +30 -20 lines
Log Message:
- changed name
- updated the example config to the new system
- added more documentation
- enhanced documentation generators
- added a link to the pdf to the website
- added an RSS feed generator
- transitioned hooks to c++ callbacks
- did various merges with upstream along the way
- added const where appropriate
- removed the old block allocator
- fixed most memory leaks
- transitioned some dictionaries to std::map
- transitioned some lists to std::vector
- made some free functions members where appropriate
- renamed string to dynstr and added a static string ststr
- use NOW instead of time (NULL) if possible
- completely reworked database backends, crypto handlers and protocol handlers
  to use an object factory
- removed the old module system. ermyth does not do any dynamic loading anymore
- fixed most of the build system
- reworked how protocol commands work

File Contents

# User Rev Content
1 pippijn 1.1 /*
2 pippijn 1.3 * Copyright © 2005 William Pitcock, et al.
3 pippijn 1.2 * Rights to this code are as documented in doc/pod/license.pod.
4 pippijn 1.1 *
5     * Data structures for flags to bitmask processing routines.
6     *
7 pippijn 1.3 * $Id: confparse.h,v 1.2 2007-07-21 01:29:07 pippijn Exp $
8 pippijn 1.1 */
9    
10     #ifndef CONFPARSE_H
11     #define CONFPARSE_H
12    
13 pippijn 1.3 #include <ermyth/callback.h>
14    
15     struct config_file_t : zero_initialised
16 pippijn 1.1 {
17     char *cf_filename;
18     config_entry_t *cf_entries;
19     config_file_t *cf_next;
20     };
21    
22 pippijn 1.3 struct config_entry_t : zero_initialised
23 pippijn 1.1 {
24     config_file_t *ce_fileptr;
25    
26     int ce_varlinenum;
27     char *ce_varname;
28     char *ce_vardata;
29     int ce_vardatanum;
30     int ce_fileposstart;
31     int ce_fileposend;
32    
33     int ce_sectlinenum;
34     config_entry_t *ce_entries;
35    
36     config_entry_t *ce_prevlevel;
37    
38     config_entry_t *ce_next;
39     };
40    
41     struct Token
42     {
43 pippijn 1.3 char const * const text;
44     int const value;
45 pippijn 1.1 };
46    
47 pippijn 1.3 class ConfTable : public zero_initialised
48 pippijn 1.1 {
49 pippijn 1.3 struct callbacks
50     {
51     functor::callback0<> ready;
52     };
53    
54     public:
55     char const * const name;
56     int const rehashable;
57 pippijn 1.1 int (*handler) (config_entry_t *);
58     char *str_val;
59     int *int_val;
60 pippijn 1.3
61     static callbacks callback;
62    
63     ConfTable (char const * const blockname, int const can_rehash, int (*handlerfunc) (config_entry_t *))
64     : name (blockname), rehashable (can_rehash), handler (handlerfunc)
65     {
66     }
67 pippijn 1.1 };
68    
69     extern void init_newconf (void);
70 pippijn 1.3 extern struct ConfTable *find_top_conf (char const * const name);
71     extern struct ConfTable *find_conf_item (char const * const name, list_t *conflist);
72     extern void add_top_conf (char const * const name, int (*handler) (config_entry_t *ce));
73     extern void add_conf_item (char const * const name, list_t *conflist, int (*handler) (config_entry_t *ce));
74     extern void del_top_conf (char const * const name);
75     extern void del_conf_item (char const * const name, list_t *conflist);
76 pippijn 1.1 extern int subblock_handler (config_entry_t *ce, list_t *entries);
77    
78     #endif