From 53c0ff324598ce2926236c32b2b4c858a0b3831a Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 25 Feb 2014 22:30:12 +0100 Subject: 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 --- include/libnftnl/set.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/libnftnl/set.h') diff --git a/include/libnftnl/set.h b/include/libnftnl/set.h index ba11315..fcb1a7e 100644 --- a/include/libnftnl/set.h +++ b/include/libnftnl/set.h @@ -29,10 +29,14 @@ void nft_set_free(struct nft_set *s); bool nft_set_attr_is_set(const 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_data(struct nft_set *s, uint16_t attr, const void *data, + uint32_t data_len); void nft_set_attr_set_u32(struct nft_set *s, uint16_t attr, uint32_t val); void nft_set_attr_set_str(struct nft_set *s, uint16_t attr, const char *str); const void *nft_set_attr_get(struct nft_set *s, uint16_t attr); +const void *nft_set_attr_get_data(struct nft_set *s, uint16_t attr, + uint32_t *data_len); const char *nft_set_attr_get_str(struct nft_set *s, uint16_t attr); uint32_t nft_set_attr_get_u32(struct nft_set *s, uint16_t attr); -- cgit v1.2.3