diff options
author | Phil Sutter <phil@nwl.cc> | 2020-07-29 14:33:33 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2020-12-21 18:33:21 +0100 |
commit | 87cce1cc4e1edfa03e56a2f9c72ee3cb3485f52b (patch) | |
tree | fdb705dfbf4842246a8a15b1a4f0ab5c037782ce /iptables/nft-chain.h | |
parent | 9189d1898f2f6c10689e1147e97f3a382d272e41 (diff) |
nft: Introduce struct nft_chain
Preparing for ordered output of user-defined chains, introduce a local
datatype wrapping nftnl_chain. In order to maintain the chain name hash
table, introduce nft_chain_list as well and use it instead of
nftnl_chain_list.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/nft-chain.h')
-rw-r--r-- | iptables/nft-chain.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/iptables/nft-chain.h b/iptables/nft-chain.h new file mode 100644 index 00000000..137f4b7f --- /dev/null +++ b/iptables/nft-chain.h @@ -0,0 +1,29 @@ +#ifndef _NFT_CHAIN_H_ +#define _NFT_CHAIN_H_ + +#include <libnftnl/chain.h> +#include <libiptc/linux_list.h> + +struct nft_handle; + +struct nft_chain { + struct list_head head; + struct hlist_node hnode; + struct nftnl_chain *nftnl; +}; + +#define CHAIN_NAME_HSIZE 512 + +struct nft_chain_list { + struct list_head list; + struct hlist_head names[CHAIN_NAME_HSIZE]; +}; + +struct nft_chain *nft_chain_alloc(struct nftnl_chain *nftnl); +void nft_chain_free(struct nft_chain *c); + +struct nft_chain_list *nft_chain_list_alloc(void); +void nft_chain_list_free(struct nft_chain_list *list); +void nft_chain_list_del(struct nft_chain *c); + +#endif /* _NFT_CHAIN_H_ */ |