diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-06-13 21:15:05 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-06-17 00:38:51 +0200 |
commit | 283ea9e229fa362836992c61e4dcef4aef1a8564 (patch) | |
tree | 5fed00940921389ca34ca9a3ac08793769be9754 /include/libnftables | |
parent | faa855f4deaded25781a41af19ebfe82fa77bfc0 (diff) |
src: add nft_*_list_foreach
This patch adds a simplied iterator interface.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/libnftables')
-rw-r--r-- | include/libnftables/chain.h | 1 | ||||
-rw-r--r-- | include/libnftables/rule.h | 5 | ||||
-rw-r--r-- | include/libnftables/set.h | 3 | ||||
-rw-r--r-- | include/libnftables/table.h | 1 |
4 files changed, 10 insertions, 0 deletions
diff --git a/include/libnftables/chain.h b/include/libnftables/chain.h index 3645eaa..313c26a 100644 --- a/include/libnftables/chain.h +++ b/include/libnftables/chain.h @@ -63,6 +63,7 @@ struct nft_chain_list; struct nft_chain_list *nft_chain_list_alloc(void); void nft_chain_list_free(struct nft_chain_list *list); +int nft_chain_list_foreach(struct nft_chain_list *chain_list, int (*cb)(struct nft_chain *t, void *data), void *data); void nft_chain_list_add(struct nft_chain *r, struct nft_chain_list *list); void nft_chain_list_del(struct nft_chain *r); diff --git a/include/libnftables/rule.h b/include/libnftables/rule.h index 9989f19..ce8bd1f 100644 --- a/include/libnftables/rule.h +++ b/include/libnftables/rule.h @@ -56,6 +56,10 @@ int nft_rule_snprintf(char *buf, size_t size, struct nft_rule *t, uint32_t type, struct nlmsghdr *nft_rule_nlmsg_build_hdr(char *buf, uint16_t cmd, uint16_t family, uint16_t type, uint32_t seq); int nft_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nft_rule *t); +int nft_rule_expr_foreach(struct nft_rule *r, + int (*cb)(struct nft_rule_expr *e, void *data), + void *data); + struct nft_rule_expr_iter; struct nft_rule_expr_iter *nft_rule_expr_iter_create(struct nft_rule *r); @@ -67,6 +71,7 @@ struct nft_rule_list; struct nft_rule_list *nft_rule_list_alloc(void); void nft_rule_list_free(struct nft_rule_list *list); void nft_rule_list_add(struct nft_rule *r, struct nft_rule_list *list); +int nft_rule_list_foreach(struct nft_rule_list *rule_list, int (*cb)(struct nft_rule *t, void *data), void *data); struct nft_rule_list_iter; diff --git a/include/libnftables/set.h b/include/libnftables/set.h index d1f6d16..f337f60 100644 --- a/include/libnftables/set.h +++ b/include/libnftables/set.h @@ -37,6 +37,7 @@ struct nft_set_list; struct nft_set_list *nft_set_list_alloc(void); void nft_set_list_free(struct nft_set_list *list); void nft_set_list_add(struct nft_set *s, struct nft_set_list *list); +int nft_set_list_foreach(struct nft_set_list *set_list, int (*cb)(struct nft_set *t, void *data), void *data); struct nft_set_list_iter; struct nft_set_list_iter *nft_set_list_iter_create(struct nft_set_list *l); @@ -80,6 +81,8 @@ int nft_set_elem_nlmsg_parse(const struct nlmsghdr *nlh, struct nft_set_elem *s) int nft_set_elem_snprintf(char *buf, size_t size, struct nft_set_elem *s, uint32_t type, uint32_t flags); +int nft_set_elem_foreach(struct nft_set *s, int (*cb)(struct nft_set_elem *e, void *data), void *data); + struct nft_set_elems_iter; struct nft_set_elems_iter *nft_set_elems_iter_create(struct nft_set *s); struct nft_set_elem *nft_set_elems_iter_cur(struct nft_set_elems_iter *iter); diff --git a/include/libnftables/table.h b/include/libnftables/table.h index a999770..8a4778f 100644 --- a/include/libnftables/table.h +++ b/include/libnftables/table.h @@ -51,6 +51,7 @@ struct nft_table_list; struct nft_table_list *nft_table_list_alloc(void); void nft_table_list_free(struct nft_table_list *list); +int nft_table_list_foreach(struct nft_table_list *table_list, int (*cb)(struct nft_table *t, void *data), void *data); void nft_table_list_add(struct nft_table *r, struct nft_table_list *list); |