MINOR: filters: Print the list of existing filters during HA startup

This is done  in verbose/debug mode and when build options are reported.
This commit is contained in:
Christopher Faulet 2016-03-07 12:46:38 +01:00 committed by Willy Tarreau
parent d50b4ac0d4
commit b3f4e14932
4 changed files with 23 additions and 5 deletions

View File

@ -126,6 +126,7 @@ int flt_xfer_data(struct stream *s, struct channel *chn, unsigned int an_bit);
void flt_register_keywords(struct flt_kw_list *kwl);
struct flt_kw *flt_find_kw(const char *kw);
void flt_dump_kws(char **out);
void list_filters(FILE *out);
/* Helper function that returns the "global" state of filters attached to a
* stream. */

View File

@ -33,10 +33,7 @@ struct filter;
/* Descriptor for a "filter" keyword. The ->parse() function returns 0 in case
* of success, or a combination of ERR_* flags if an error is encountered. The
* function pointer can be NULL if not implemented. The function also has an
* access to the current "server" config line. The ->skip value tells the parser
* how many words have to be skipped after the keyword. If the function needs to
* parse more keywords, it needs to update cur_arg.
* function pointer can be NULL if not implemented.
*/
struct flt_kw {
const char *kw;

View File

@ -150,6 +150,21 @@ flt_dump_kws(char **out)
}
}
/*
* Lists the known filters on <out>
*/
void
list_filters(FILE *out)
{
char *filters, *p, *f;
fprintf(out, "Available filters :\n");
flt_dump_kws(&filters);
for (p = filters; (f = strtok_r(p,"\n",&p));)
fprintf(out, "\t%s\n", f);
free(filters);
}
/*
* Parses the "filter" keyword. All keywords must be handled by filters
* themselves

View File

@ -412,6 +412,8 @@ void display_build_opts()
list_pollers(stdout);
putchar('\n');
list_filters(stdout);
putchar('\n');
}
/*
@ -1126,8 +1128,11 @@ void init(int argc, char **argv)
/* Note: we could disable any poller by name here */
if (global.mode & (MODE_VERBOSE|MODE_DEBUG))
if (global.mode & (MODE_VERBOSE|MODE_DEBUG)) {
list_pollers(stderr);
fprintf(stderr, "\n");
list_filters(stderr);
}
if (!init_pollers()) {
Alert("No polling mechanism available.\n"