aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-netlink.h
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2017-04-04 13:13:59 +0200
committerMichael Mann <mmann78@netscape.net>2017-04-09 01:37:20 +0000
commit0add542dbfc6d0467d14ebb2abbde0ebd1427ce1 (patch)
tree940b0297be51e4935b9259b20b8bb5169afc7ec0 /epan/dissectors/packet-netlink.h
parent802479d23798c6d180fad50e95555b49b3d337cb (diff)
netlink: add helper for dissecting an array of attributes
From https://wiki.linuxfoundation.org/networking/generic_netlink_howto "Arrays can be represented by using a single nested attribute as a container with several of the same attribute type inside each representing a spot in the array." This patch adds a helper function to dissect such a type (it will be used by Generic Netlink for CTRL_ATTR_OPS and CTRL_ATTR_MCAST_GROUPS). Change-Id: I60537712f7fb0f9d4fb8850c6c8eef590635f49f Reviewed-on: https://code.wireshark.org/review/20903 Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-netlink.h')
-rw-r--r--epan/dissectors/packet-netlink.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/epan/dissectors/packet-netlink.h b/epan/dissectors/packet-netlink.h
index ce0a8259a5..e02cd685fe 100644
--- a/epan/dissectors/packet-netlink.h
+++ b/epan/dissectors/packet-netlink.h
@@ -109,6 +109,14 @@ typedef int netlink_attributes_cb_t(tvbuff_t *, void *data, proto_tree *, int nl
int dissect_netlink_attributes(tvbuff_t *tvb, header_field_info *hfi_type, int ett, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int offset, int length, netlink_attributes_cb_t cb);
+/*
+ * Similar to dissect_netlink_attributes, but used to parse nested attributes
+ * that model an array of attributes. The first level (tree ett_array) contains
+ * array elements and its type field is the array index. The next level (tree
+ * ett_attrib) contains attributes (where hfi_type applies).
+ */
+int dissect_netlink_attributes_array(tvbuff_t *tvb, header_field_info *hfi_type, int ett_array, int ett_attrib, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int offset, int length, netlink_attributes_cb_t cb);
+
#define NLA_F_NESTED 0x8000
#define NLA_F_NET_BYTEORDER 0x4000
#define NLA_TYPE_MASK 0x3fff