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 (16 years, 9 months 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

# Content
1 /*
2 * Copyright © 2005 William Pitcock, et al.
3 * Rights to this code are as documented in doc/pod/license.pod.
4 *
5 * Data structures for flags to bitmask processing routines.
6 *
7 * $Id: confparse.h,v 1.2 2007-07-21 01:29:07 pippijn Exp $
8 */
9
10 #ifndef CONFPARSE_H
11 #define CONFPARSE_H
12
13 #include <ermyth/callback.h>
14
15 struct config_file_t : zero_initialised
16 {
17 char *cf_filename;
18 config_entry_t *cf_entries;
19 config_file_t *cf_next;
20 };
21
22 struct config_entry_t : zero_initialised
23 {
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 char const * const text;
44 int const value;
45 };
46
47 class ConfTable : public zero_initialised
48 {
49 struct callbacks
50 {
51 functor::callback0<> ready;
52 };
53
54 public:
55 char const * const name;
56 int const rehashable;
57 int (*handler) (config_entry_t *);
58 char *str_val;
59 int *int_val;
60
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 };
68
69 extern void init_newconf (void);
70 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 extern int subblock_handler (config_entry_t *ce, list_t *entries);
77
78 #endif