| 1 |
pippijn |
1.1 |
/* |
| 2 |
|
|
* 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.2 |
* $Id: confparse.h,v 1.1 2007-07-19 08:24:50 pippijn Exp $ |
| 8 |
pippijn |
1.1 |
*/ |
| 9 |
|
|
|
| 10 |
|
|
#ifndef CONFPARSE_H |
| 11 |
|
|
#define CONFPARSE_H |
| 12 |
|
|
|
| 13 |
|
|
struct config_file_t |
| 14 |
|
|
{ |
| 15 |
|
|
char *cf_filename; |
| 16 |
|
|
config_entry_t *cf_entries; |
| 17 |
|
|
config_file_t *cf_next; |
| 18 |
|
|
}; |
| 19 |
|
|
|
| 20 |
|
|
struct config_entry_t |
| 21 |
|
|
{ |
| 22 |
|
|
config_file_t *ce_fileptr; |
| 23 |
|
|
|
| 24 |
|
|
int ce_varlinenum; |
| 25 |
|
|
char *ce_varname; |
| 26 |
|
|
char *ce_vardata; |
| 27 |
|
|
int ce_vardatanum; |
| 28 |
|
|
int ce_fileposstart; |
| 29 |
|
|
int ce_fileposend; |
| 30 |
|
|
|
| 31 |
|
|
int ce_sectlinenum; |
| 32 |
|
|
config_entry_t *ce_entries; |
| 33 |
|
|
|
| 34 |
|
|
config_entry_t *ce_prevlevel; |
| 35 |
|
|
|
| 36 |
|
|
config_entry_t *ce_next; |
| 37 |
|
|
}; |
| 38 |
|
|
|
| 39 |
|
|
struct Token |
| 40 |
|
|
{ |
| 41 |
|
|
const char *text; |
| 42 |
|
|
int value; |
| 43 |
|
|
}; |
| 44 |
|
|
|
| 45 |
|
|
struct ConfTable |
| 46 |
|
|
{ |
| 47 |
|
|
char *name; |
| 48 |
|
|
int rehashable; |
| 49 |
|
|
int (*handler) (config_entry_t *); |
| 50 |
|
|
char *str_val; |
| 51 |
|
|
int *int_val; |
| 52 |
|
|
}; |
| 53 |
|
|
|
| 54 |
|
|
extern void init_newconf (void); |
| 55 |
|
|
extern struct ConfTable *find_top_conf (char *name); |
| 56 |
|
|
extern struct ConfTable *find_conf_item (char *name, list_t *conflist); |
| 57 |
|
|
extern void add_top_conf (char *name, int (*handler) (config_entry_t *ce)); |
| 58 |
|
|
extern void add_conf_item (char *name, list_t *conflist, int (*handler) (config_entry_t *ce)); |
| 59 |
|
|
extern void del_top_conf (char *name); |
| 60 |
|
|
extern void del_conf_item (char *name, list_t *conflist); |
| 61 |
|
|
extern int subblock_handler (config_entry_t *ce, list_t *entries); |
| 62 |
|
|
|
| 63 |
|
|
extern int token_to_value (struct Token token_table[], char *token); |
| 64 |
|
|
/* special return values for token_to_value */ |
| 65 |
|
|
#define TOKEN_UNMATCHED -1 |
| 66 |
|
|
#define TOKEN_ERROR -2 |
| 67 |
|
|
|
| 68 |
|
|
#endif |