mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-15 07:54:33 +00:00
5b2c33683b
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); } |
||
---|---|---|
.. | ||
common | ||
import | ||
proto | ||
types |