1 #ifndef _NFT_CMD_H_ 2 #define _NFT_CMD_H_ 3 4 #include <libiptc/linux_list.h> 5 #include <stdbool.h> 6 #include "nft.h" 7 8 struct nftnl_rule; 9 10 struct nft_cmd { 11 struct list_head head; 12 int command; 13 const char *table; 14 const char *chain; 15 const char *jumpto; 16 int rulenum; 17 bool verbose; 18 unsigned int format; 19 struct { 20 struct nftnl_rule *rule; 21 struct nftnl_set *set; 22 } obj; 23 const char *policy; 24 struct xt_counters counters; 25 const char *rename; 26 int counters_save; 27 }; 28 29 struct nft_cmd *nft_cmd_new(struct nft_handle *h, int command, 30 const char *table, const char *chain, 31 struct iptables_command_state *state, 32 int rulenum, bool verbose); 33 void nft_cmd_free(struct nft_cmd *cmd); 34 35 int nft_cmd_rule_append(struct nft_handle *h, const char *chain, 36 const char *table, struct iptables_command_state *state, 37 void *ref, bool verbose); 38 int nft_cmd_rule_insert(struct nft_handle *h, const char *chain, 39 const char *table, struct iptables_command_state *state, 40 int rulenum, bool verbose); 41 int nft_cmd_rule_delete(struct nft_handle *h, const char *chain, 42 const char *table, struct iptables_command_state *state, 43 bool verbose); 44 int nft_cmd_rule_delete_num(struct nft_handle *h, const char *chain, 45 const char *table, int rulenum, bool verbose); 46 int nft_cmd_rule_flush(struct nft_handle *h, const char *chain, 47 const char *table, bool verbose); 48 int nft_cmd_zero_counters(struct nft_handle *h, const char *chain, 49 const char *table, bool verbose); 50 int nft_cmd_chain_user_add(struct nft_handle *h, const char *chain, 51 const char *table); 52 int nft_cmd_chain_user_del(struct nft_handle *h, const char *chain, 53 const char *table, bool verbose); 54 int nft_cmd_chain_zero_counters(struct nft_handle *h, const char *chain, 55 const char *table, bool verbose); 56 int nft_cmd_rule_list(struct nft_handle *h, const char *chain, 57 const char *table, int rulenum, unsigned int format); 58 int nft_cmd_rule_check(struct nft_handle *h, const char *chain, 59 const char *table, void *data, bool verbose); 60 int nft_cmd_chain_set(struct nft_handle *h, const char *table, 61 const char *chain, const char *policy, 62 const struct xt_counters *counters); 63 int nft_cmd_chain_user_rename(struct nft_handle *h,const char *chain, 64 const char *table, const char *newname); 65 int nft_cmd_rule_replace(struct nft_handle *h, const char *chain, 66 const char *table, void *data, int rulenum, 67 bool verbose); 68 int nft_cmd_table_flush(struct nft_handle *h, const char *table, bool verbose); 69 int nft_cmd_chain_restore(struct nft_handle *h, const char *chain, 70 const char *table); 71 int nft_cmd_rule_zero_counters(struct nft_handle *h, const char *chain, 72 const char *table, int rulenum); 73 int nft_cmd_rule_list_save(struct nft_handle *h, const char *chain, 74 const char *table, int rulenum, int counters); 75 int ebt_cmd_user_chain_policy(struct nft_handle *h, const char *table, 76 const char *chain, const char *policy); 77 void nft_cmd_table_new(struct nft_handle *h, const char *table); 78 79 #endif /* _NFT_CMD_H_ */ 80