| 1 |
/* |
| 2 |
* Copyright (C) 2005 William Pitcock, et al. |
| 3 |
* Rights to this code are as documented in doc/LICENSE. |
| 4 |
* |
| 5 |
* Config reader. |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef CONFPROCESS_H |
| 9 |
#define CONFPROCESS_H |
| 10 |
|
| 11 |
#define CONF_NO_REHASH 0x1 |
| 12 |
|
| 13 |
struct Token |
| 14 |
{ |
| 15 |
const char *text; |
| 16 |
int value; |
| 17 |
}; |
| 18 |
|
| 19 |
struct ConfTable; |
| 20 |
|
| 21 |
E void init_confprocess(void); |
| 22 |
E struct ConfTable *find_top_conf(const char *name); |
| 23 |
E struct ConfTable *find_conf_item(const char *name, mowgli_list_t *conflist); |
| 24 |
E void add_top_conf(const char *name, int (*handler)(mowgli_config_file_entry_t *ce)); |
| 25 |
E void add_subblock_top_conf(const char *name, mowgli_list_t *list); |
| 26 |
E void add_conf_item(const char *name, mowgli_list_t *conflist, int (*handler)(mowgli_config_file_entry_t *ce)); |
| 27 |
E void add_uint_conf_item(const char *name, mowgli_list_t *conflist, unsigned int flags, unsigned int *var, unsigned int min, unsigned int max, unsigned int def); |
| 28 |
E void add_duration_conf_item(const char *name, mowgli_list_t *conflist, unsigned int flags, unsigned int *var, const char *defunit, unsigned int def); |
| 29 |
E void add_dupstr_conf_item(const char *name, mowgli_list_t *conflist, unsigned int flags, char **var, const char *def); |
| 30 |
E void add_bool_conf_item(const char *name, mowgli_list_t *conflist, unsigned int flags, bool *var, bool def); |
| 31 |
E void del_top_conf(const char *name); |
| 32 |
E void del_conf_item(const char *name, mowgli_list_t *conflist); |
| 33 |
E int subblock_handler(mowgli_config_file_entry_t *ce, mowgli_list_t *entries); |
| 34 |
E bool process_uint_configentry(mowgli_config_file_entry_t *ce, unsigned int *var, |
| 35 |
unsigned int min, unsigned int max); |
| 36 |
E bool process_duration_configentry(mowgli_config_file_entry_t *ce, unsigned int *var, |
| 37 |
const char *defunit); |
| 38 |
E void conf_report_warning(mowgli_config_file_entry_t *ce, const char *fmt, ...) PRINTFLIKE (2, 3); |
| 39 |
/* sort of a hack for servtree.c */ |
| 40 |
typedef int (*conf_handler_t)(mowgli_config_file_entry_t *); |
| 41 |
E conf_handler_t conftable_get_conf_handler(struct ConfTable *ct); |
| 42 |
|
| 43 |
E void conf_process(mowgli_config_file_t *cfp); |
| 44 |
|
| 45 |
E int token_to_value(struct Token token_table[], const char *token); |
| 46 |
/* special return values for token_to_value */ |
| 47 |
#define TOKEN_UNMATCHED -1 |
| 48 |
#define TOKEN_ERROR -2 |
| 49 |
|
| 50 |
E bool conf_need_rehash; |
| 51 |
|
| 52 |
#endif |
| 53 |
|
| 54 |
/* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs ts=8 sw=8 noexpandtab |
| 55 |
*/ |