From 283ea9e229fa362836992c61e4dcef4aef1a8564 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 13 Jun 2013 21:15:05 +0200 Subject: src: add nft_*_list_foreach This patch adds a simplied iterator interface. Signed-off-by: Pablo Neira Ayuso --- include/libnftables/rule.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/libnftables/rule.h') 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; -- cgit v1.2.3