diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-04-13 16:30:44 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-05-18 01:02:49 +0200 |
commit | 00b82dd6c9ad4765ebc2f59e395a6749acc0738a (patch) | |
tree | 494683b4a8f8f46191bda3fe4d4999cd63259fd4 /include/libmnl/libmnl.h | |
parent | 5373fe81ca557a8f846fd6c0b68ee389808cfc3b (diff) | |
download | libmnl-00b82dd6c9ad4765ebc2f59e395a6749acc0738a.tar.gz libmnl-00b82dd6c9ad4765ebc2f59e395a6749acc0738a.zip |
parse: add mnl_attr_for_each_payload
This function allows you to parse the payload of the Netlink message.
Thus, you can skip the headers and go down to the part of the message
you want to parse.
This patch has updated the LIBVERSION and it also bumps the version
to 1.0.3, in case that someone wants to package some snapshot, not to
mess with the new symbol we have added.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/libmnl/libmnl.h')
-rw-r--r-- | include/libmnl/libmnl.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/libmnl/libmnl.h b/include/libmnl/libmnl.h index 1e170a9..a647fd9 100644 --- a/include/libmnl/libmnl.h +++ b/include/libmnl/libmnl.h @@ -156,11 +156,17 @@ extern struct nlattr *mnl_attr_next(const struct nlattr *attr); mnl_attr_ok((attr), (char *)mnl_attr_get_payload(nest) + mnl_attr_get_payload_len(nest) - (char *)(attr)); \ (attr) = mnl_attr_next(attr)) +#define mnl_attr_for_each_payload(payload, payload_size) \ + for ((attr) = (payload); \ + mnl_attr_ok((attr), (char *)(payload) + payload_size - (char *)(attr)); \ + (attr) = mnl_attr_next(attr)) + /* TLV callback-based attribute parsers */ typedef int (*mnl_attr_cb_t)(const struct nlattr *attr, void *data); extern int mnl_attr_parse(const struct nlmsghdr *nlh, unsigned int offset, mnl_attr_cb_t cb, void *data); extern int mnl_attr_parse_nested(const struct nlattr *attr, mnl_attr_cb_t cb, void *data); +extern int mnl_attr_parse_payload(const void *payload, size_t payload_len, mnl_attr_cb_t cb, void *data); /* * callback API |