mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-16 09:09:21 -05:00
Any module which needs configuration keywords may now dynamically
register a keyword in a given section, and associate it with a
configuration parsing function using cfg_register_keywords() from
a constructor function. This makes the configuration parser more
modular because it is not required anymore to touch cfg_parse.c.
Example :
static int parse_global_blah(char **args, int section_type, struct proxy *curpx,
struct proxy *defpx, char *err, int errlen)
{
printf("parsing blah in global section\n");
return 0;
}
static int parse_listen_blah(char **args, int section_type, struct proxy *curpx,
struct proxy *defpx, char *err, int errlen)
{
printf("parsing blah in listen section\n");
if (*args[1]) {
snprintf(err, errlen, "missing arg for listen_blah!!!");
return -1;
}
return 0;
}
static struct cfg_kw_list cfg_kws = {{ },{
{ CFG_GLOBAL, "blah", parse_global_blah },
{ CFG_LISTEN, "blah", parse_listen_blah },
{ 0, NULL, NULL },
}};
__attribute__((constructor))
static void __module_init(void)
{
cfg_register_keywords(&cfg_kws);
}
|
||
|---|---|---|
| .. | ||
| appsession.h | ||
| base64.h | ||
| cfgparse.h | ||
| compat.h | ||
| config.h | ||
| debug.h | ||
| defaults.h | ||
| eb32tree.h | ||
| eb64tree.h | ||
| ebpttree.h | ||
| ebtree.h | ||
| epoll.h | ||
| errors.h | ||
| memory.h | ||
| mini-clist.h | ||
| rbtree.h | ||
| regex.h | ||
| sessionhash.h | ||
| standard.h | ||
| template.h | ||
| ticks.h | ||
| time.h | ||
| tools.h | ||
| uri_auth.h | ||
| version.h | ||