diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-04-13 11:05:15 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-02-16 19:30:21 +0100 |
commit | d13b60c9ddb48e651b92f13579e236c530658176 (patch) | |
tree | 45c70b3dde3131a7abbd1aadbafecedb0d38bb60 /iptables/nft-shared.h | |
parent | 50b056ce99517939cc4c0f5e278d32a252b71ee6 (diff) |
nft: xtables-restore: add generic parsing infrastructure
This allows us to reuse the xtables-restore parser code in the
translation infrastructure.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/nft-shared.h')
-rw-r--r-- | iptables/nft-shared.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/iptables/nft-shared.h b/iptables/nft-shared.h index 03784ccc..56d75f82 100644 --- a/iptables/nft-shared.h +++ b/iptables/nft-shared.h @@ -232,4 +232,39 @@ void do_parse(struct nft_handle *h, int argc, char *argv[], struct nft_xt_cmd_parse *p, struct iptables_command_state *cs, struct xtables_args *args); +struct nft_xt_restore_parse { + FILE *in; + int testing; + const char *tablename; +}; + +struct nftnl_chain_list; + +struct nft_xt_restore_cb { + void (*table_new)(struct nft_handle *h, const char *table); + struct nftnl_chain_list *(*chain_list)(struct nft_handle *h); + int (*chains_purge)(struct nft_handle *h, const char *table, + struct nftnl_chain_list *clist); + void (*chain_del)(struct nftnl_chain_list *clist, const char *curtable, + const char *chain); + int (*chain_set)(struct nft_handle *h, const char *table, + const char *chain, const char *policy, + const struct xt_counters *counters); + int (*chain_user_add)(struct nft_handle *h, const char *chain, + const char *table); + + int (*rule_flush)(struct nft_handle *h, const char *chain, const char *table); + + int (*do_command)(struct nft_handle *h, int argc, char *argv[], + char **table, bool restore); + + int (*commit)(struct nft_handle *h); + int (*abort)(struct nft_handle *h); +}; + +void xtables_restore_parse(struct nft_handle *h, + struct nft_xt_restore_parse *p, + struct nft_xt_restore_cb *cb, + int argc, char *argv[]); + #endif |