From e0f0f01c249ce659947fb8ca592da3c7062b7fa6 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Mon, 17 Jun 2013 00:39:38 +0200 Subject: src: add nft_*_attr_is_set Signed-off-by: Pablo Neira Ayuso --- include/libnftables/chain.h | 2 ++ include/libnftables/expr.h | 1 + include/libnftables/rule.h | 2 ++ include/libnftables/set.h | 6 ++++++ include/libnftables/table.h | 2 ++ 5 files changed, 13 insertions(+) (limited to 'include') diff --git a/include/libnftables/chain.h b/include/libnftables/chain.h index 313c26a..29f7bc7 100644 --- a/include/libnftables/chain.h +++ b/include/libnftables/chain.h @@ -2,6 +2,7 @@ #define _CHAIN_H_ #include +#include #ifdef __cplusplus extern "C" { @@ -26,6 +27,7 @@ enum { NFT_CHAIN_ATTR_TYPE, }; +bool nft_chain_attr_is_set(struct nft_chain *c, uint16_t attr); void nft_chain_attr_unset(struct nft_chain *c, uint16_t attr); void nft_chain_attr_set(struct nft_chain *t, uint16_t attr, const void *data); void nft_chain_attr_set_u32(struct nft_chain *t, uint16_t attr, uint32_t data); diff --git a/include/libnftables/expr.h b/include/libnftables/expr.h index bd3fd6e..1ab5590 100644 --- a/include/libnftables/expr.h +++ b/include/libnftables/expr.h @@ -15,6 +15,7 @@ enum { struct nft_rule_expr *nft_rule_expr_alloc(const char *name); void nft_rule_expr_free(struct nft_rule_expr *expr); +bool nft_rule_expr_is_set(const struct nft_rule_expr *expr, uint16_t type); void nft_rule_expr_set(struct nft_rule_expr *expr, uint16_t type, const void *data, size_t data_len); void nft_rule_expr_set_u8(struct nft_rule_expr *expr, uint16_t type, uint8_t data); void nft_rule_expr_set_u32(struct nft_rule_expr *expr, uint16_t type, uint32_t data); diff --git a/include/libnftables/rule.h b/include/libnftables/rule.h index ce8bd1f..242ea07 100644 --- a/include/libnftables/rule.h +++ b/include/libnftables/rule.h @@ -2,6 +2,7 @@ #define _RULE_H_ #include +#include #ifdef __cplusplus extern "C" { @@ -24,6 +25,7 @@ enum { }; void nft_rule_attr_unset(struct nft_rule *r, uint16_t attr); +bool nft_rule_attr_is_set(struct nft_rule *r, uint16_t attr); void nft_rule_attr_set(struct nft_rule *r, uint16_t attr, const void *data); void nft_rule_attr_set_u32(struct nft_rule *r, uint16_t attr, uint32_t val); void nft_rule_attr_set_u64(struct nft_rule *r, uint16_t attr, uint64_t val); diff --git a/include/libnftables/set.h b/include/libnftables/set.h index f337f60..bcd4db7 100644 --- a/include/libnftables/set.h +++ b/include/libnftables/set.h @@ -1,6 +1,9 @@ #ifndef _NFT_SET_H_ #define _NFT_SET_H_ +#include +#include + enum { NFT_SET_ATTR_TABLE, NFT_SET_ATTR_NAME, @@ -16,6 +19,7 @@ struct nft_set; struct nft_set *nft_set_alloc(void); void nft_set_free(struct nft_set *s); +bool nft_set_attr_is_set(struct nft_set *s, uint16_t attr); void nft_set_attr_unset(struct nft_set *s, uint16_t attr); void nft_set_attr_set(struct nft_set *s, uint16_t attr, const void *data); void nft_set_attr_set_u32(struct nft_set *s, uint16_t attr, uint32_t val); @@ -73,6 +77,8 @@ void *nft_set_elem_attr_get(struct nft_set_elem *s, uint16_t attr, size_t *data_ const char *nft_set_elem_attr_get_str(struct nft_set_elem *s, uint16_t attr); uint32_t nft_set_elem_attr_get_u32(struct nft_set_elem *s, uint16_t attr); +bool nft_set_elem_attr_is_set(struct nft_set_elem *s, uint16_t attr); + struct nlmsghdr *nft_set_elem_nlmsg_build_hdr(char *buf, uint16_t cmd, uint16_t family, uint16_t type, uint32_t seq); void nft_set_elems_nlmsg_build_payload(struct nlmsghdr *nlh, struct nft_set *s); void nft_set_elem_nlmsg_build_payload(struct nlmsghdr *nlh, struct nft_set_elem *e); diff --git a/include/libnftables/table.h b/include/libnftables/table.h index 8a4778f..9445879 100644 --- a/include/libnftables/table.h +++ b/include/libnftables/table.h @@ -2,6 +2,7 @@ #define _TABLE_H_ #include +#include #ifdef __cplusplus extern "C" { @@ -18,6 +19,7 @@ enum { NFT_TABLE_ATTR_FLAGS, }; +bool nft_table_attr_is_set(struct nft_table *t, uint16_t attr); void nft_table_attr_unset(struct nft_table *t, uint16_t attr); void nft_table_attr_set(struct nft_table *t, uint16_t attr, const void *data); const void *nft_table_attr_get(struct nft_table *t, uint16_t attr); -- cgit v1.2.3