diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-02-25 22:30:12 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-02-27 10:35:07 +0100 |
commit | 53c0ff324598ce2926236c32b2b4c858a0b3831a (patch) | |
tree | 1f8d2ce3804d0abf4fdc253bf3d78abc34b3fcd4 /include/libnftnl/expr.h | |
parent | 7756d31990cd47673a21cacf6fd6d33227d6270e (diff) |
src: add nft_*_attr_{set|get}_data interface
This patch adds two functions that allows you to validate the size
of the attribute. This new functions provide a replacement for
nft_rule_attr_set and nft_rule_attr_get.
The data_len parameter was already passed to the {_set|_get} funcion
in expressions. For consistency, add nft_rule_expr_{set|get}_data
alias.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/libnftnl/expr.h')
-rw-r--r-- | include/libnftnl/expr.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/libnftnl/expr.h b/include/libnftnl/expr.h index 6ec05a6..2cfb4dc 100644 --- a/include/libnftnl/expr.h +++ b/include/libnftnl/expr.h @@ -21,6 +21,7 @@ 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, uint32_t data_len); +#define nft_rule_expr_set_data nft_rule_expr_set void nft_rule_expr_set_u8(struct nft_rule_expr *expr, uint16_t type, uint8_t data); void nft_rule_expr_set_u16(struct nft_rule_expr *expr, uint16_t type, uint16_t data); void nft_rule_expr_set_u32(struct nft_rule_expr *expr, uint16_t type, uint32_t data); @@ -28,6 +29,7 @@ void nft_rule_expr_set_u64(struct nft_rule_expr *expr, uint16_t type, uint64_t d void nft_rule_expr_set_str(struct nft_rule_expr *expr, uint16_t type, const char *str); const void *nft_rule_expr_get(const struct nft_rule_expr *expr, uint16_t type, uint32_t *data_len); +#define nft_rule_expr_get_data nft_rule_expr_get uint8_t nft_rule_expr_get_u8(const struct nft_rule_expr *expr, uint16_t type); uint16_t nft_rule_expr_get_u16(const struct nft_rule_expr *expr, uint16_t type); uint32_t nft_rule_expr_get_u32(const struct nft_rule_expr *expr, uint16_t type); |