MINOR: acl: add a function to dump the list of known ACL keywords
New function acl_dump_kwd() dumps the registered ACL keywords and their sample-fetch equivalent to stdout. It's called by dump_registered_keywords() for keyword class "acl".
This commit is contained in:
parent
06d0e2e034
commit
6ff7d1b9a5
@ -146,6 +146,8 @@ void acl_unregister_keywords(struct acl_kw_list *kwl);
|
|||||||
*/
|
*/
|
||||||
int init_acl(void);
|
int init_acl(void);
|
||||||
|
|
||||||
|
void acl_dump_kwd(void);
|
||||||
|
|
||||||
void free_acl_cond(struct acl_cond *cond);
|
void free_acl_cond(struct acl_cond *cond);
|
||||||
|
|
||||||
#endif /* _HAPROXY_ACL_H */
|
#endif /* _HAPROXY_ACL_H */
|
||||||
|
18
src/acl.c
18
src/acl.c
@ -1308,6 +1308,24 @@ int init_acl()
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* dump known ACL keywords on stdout */
|
||||||
|
void acl_dump_kwd(void)
|
||||||
|
{
|
||||||
|
struct acl_kw_list *kwl;
|
||||||
|
const char *name;
|
||||||
|
int index;
|
||||||
|
|
||||||
|
list_for_each_entry(kwl, &acl_keywords.list, list) {
|
||||||
|
for (index = 0; kwl->kw[index].kw != NULL; index++) {
|
||||||
|
name = kwl->kw[index].fetch_kw;
|
||||||
|
if (!name)
|
||||||
|
name = kwl->kw[index].kw;
|
||||||
|
|
||||||
|
printf("%s = %s -m %s\n", kwl->kw[index].kw, name, pat_match_names[kwl->kw[index].match_type]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void free_acl_cond(struct acl_cond *cond)
|
void free_acl_cond(struct acl_cond *cond)
|
||||||
{
|
{
|
||||||
struct acl_term_suite *suite, *suiteb;
|
struct acl_term_suite *suite, *suiteb;
|
||||||
|
@ -1825,6 +1825,7 @@ static void dump_registered_keywords(void)
|
|||||||
if (strcmp(kwd_dump, "help") == 0) {
|
if (strcmp(kwd_dump, "help") == 0) {
|
||||||
printf("# List of supported keyword classes:\n");
|
printf("# List of supported keyword classes:\n");
|
||||||
printf("all: list all keywords\n");
|
printf("all: list all keywords\n");
|
||||||
|
printf("acl: ACL keywords\n");
|
||||||
printf("cfg: configuration keywords\n");
|
printf("cfg: configuration keywords\n");
|
||||||
printf("cli: CLI keywords\n");
|
printf("cli: CLI keywords\n");
|
||||||
printf("flt: filter names\n");
|
printf("flt: filter names\n");
|
||||||
@ -1835,6 +1836,11 @@ static void dump_registered_keywords(void)
|
|||||||
all = 1;
|
all = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (all || strcmp(kwd_dump, "acl") == 0) {
|
||||||
|
printf("# List of registered ACL keywords:\n");
|
||||||
|
acl_dump_kwd();
|
||||||
|
}
|
||||||
|
|
||||||
if (all || strcmp(kwd_dump, "cfg") == 0) {
|
if (all || strcmp(kwd_dump, "cfg") == 0) {
|
||||||
printf("# List of registered configuration keywords:\n");
|
printf("# List of registered configuration keywords:\n");
|
||||||
cfg_dump_registered_keywords();
|
cfg_dump_registered_keywords();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user