path: root/include/libnftnl/chain.h
diff options
authorPhil Sutter <>2018-12-06 17:17:52 +0100
committerPablo Neira Ayuso <>2018-12-07 10:49:27 +0100
commit1a829ec0c3285baac712352c3a046a4f76013e70 (patch)
treeaacbefd74443dd07d82aaf095f99d23b999383d2 /include/libnftnl/chain.h
parente33798478176f97edf2649cd61444e0375fdc12b (diff)
chain: Add lookup functions for chain list and rules in chain
For now, these lookup functions simply iterate over the linked list until they find the right entry. In future, they may make use of more optimized data structures behind the curtains. Signed-off-by: Phil Sutter <> Signed-off-by: Pablo Neira Ayuso <>
Diffstat (limited to 'include/libnftnl/chain.h')
1 files changed, 2 insertions, 0 deletions
diff --git a/include/libnftnl/chain.h b/include/libnftnl/chain.h
index f04f610..64e10e9 100644
--- a/include/libnftnl/chain.h
+++ b/include/libnftnl/chain.h
@@ -76,6 +76,7 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *t);
int nftnl_rule_foreach(struct nftnl_chain *c,
int (*cb)(struct nftnl_rule *r, void *data),
void *data);
+struct nftnl_rule *nftnl_rule_lookup_byindex(struct nftnl_chain *c, uint32_t index);
struct nftnl_rule_iter;
@@ -89,6 +90,7 @@ struct nftnl_chain_list *nftnl_chain_list_alloc(void);
void nftnl_chain_list_free(struct nftnl_chain_list *list);
int nftnl_chain_list_is_empty(const struct nftnl_chain_list *list);
int nftnl_chain_list_foreach(struct nftnl_chain_list *chain_list, int (*cb)(struct nftnl_chain *t, void *data), void *data);
+struct nftnl_chain *nftnl_chain_list_lookup_byname(struct nftnl_chain_list *chain_list, const char *chain);
void nftnl_chain_list_add(struct nftnl_chain *r, struct nftnl_chain_list *list);
void nftnl_chain_list_add_tail(struct nftnl_chain *r, struct nftnl_chain_list *list);