]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: filters: Print the list of existing filters during HA startup
authorChristopher Faulet <cfaulet@qualys.com>
Mon, 7 Mar 2016 11:46:38 +0000 (12:46 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 21 Apr 2016 04:58:08 +0000 (06:58 +0200)
This is done  in verbose/debug mode and when build options are reported.

include/proto/filters.h
include/types/filters.h
src/filters.c
src/haproxy.c

index f9b0fb0ec1b9269eef998ae5e347e959dc9719d9..28084f9a0625bb98de803985d912ec64b3ad3869 100644 (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. */
index 84469469a1156d621a8d61a27b3eccf4ade0dc72..0e4d99ab52751fc375eaa63e29f57ff05c7d6e09 100644 (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;
index 420ad8029a00710982b1efd094849299fb3bacc5..a8efaa1817dce1a19e90bf70e97f4e9e1c18b0ed 100644 (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
index 51af55abcd50e899489e2b42d83d844c823bdc37..0c223e5b8e27ab6d43f6d01bafe1b6d50c631a04 100644 (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"