diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2010-12-17 10:28:38 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2010-12-17 10:28:38 +0100 |
commit | eadc7a04ea1fbb71987aeb8d1b7aaa6135cfbf5f (patch) | |
tree | e1bb941acc45ace4922d117ef07ff1e84e663af1 /include/libmnl/libmnl.h | |
parent | 017e8a8ff29a66cc19efa12b96813f7848b85a94 (diff) | |
download | libmnl-eadc7a04ea1fbb71987aeb8d1b7aaa6135cfbf5f.tar.gz libmnl-eadc7a04ea1fbb71987aeb8d1b7aaa6135cfbf5f.zip |
attr: add put function that allows to check buffer size
This patch adds a set of function that allows to check the
size of the buffer. This is useful for attribute batching.
This is strongly based on a patch from Jozsef.
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/libmnl/libmnl.h')
-rw-r--r-- | include/libmnl/libmnl.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/libmnl/libmnl.h b/include/libmnl/libmnl.h index 5b8d78c..1237b6d 100644 --- a/include/libmnl/libmnl.h +++ b/include/libmnl/libmnl.h @@ -93,8 +93,18 @@ extern void mnl_attr_put_u64(struct nlmsghdr *nlh, uint16_t type, uint64_t data) extern void mnl_attr_put_str(struct nlmsghdr *nlh, uint16_t type, const char *data); extern void mnl_attr_put_strz(struct nlmsghdr *nlh, uint16_t type, const char *data); +/* TLV attribute putters with buffer boundary checkings */ +extern bool mnl_attr_put_check(struct nlmsghdr *nlh, size_t buflen, uint16_t type, size_t len, const void *data); +extern bool mnl_attr_put_u8_check(struct nlmsghdr *nlh, size_t buflen, uint16_t type, uint8_t data); +extern bool mnl_attr_put_u16_check(struct nlmsghdr *nlh, size_t buflen, uint16_t type, uint16_t data); +extern bool mnl_attr_put_u32_check(struct nlmsghdr *nlh, size_t buflen, uint16_t type, uint32_t data); +extern bool mnl_attr_put_u64_check(struct nlmsghdr *nlh, size_t buflen, uint16_t type, uint64_t data); +extern bool mnl_attr_put_str_check(struct nlmsghdr *nlh, size_t buflen, uint16_t type, const char *data); +extern bool mnl_attr_put_strz_check(struct nlmsghdr *nlh, size_t buflen, uint16_t type, const char *data); + /* TLV attribute nesting */ extern struct nlattr *mnl_attr_nest_start(struct nlmsghdr *nlh, uint16_t type); +extern struct nlattr *mnl_attr_nest_start_check(struct nlmsghdr *nlh, size_t buflen, uint16_t type); extern void mnl_attr_nest_end(struct nlmsghdr *nlh, struct nlattr *start); extern void mnl_attr_nest_cancel(struct nlmsghdr *nlh, struct nlattr *start); |