aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Mayer <jmayer@loplof.de>2018-06-04 08:57:35 +0200
committerJörg Mayer <jmayer@loplof.de>2018-06-04 20:33:36 +0000
commitb9e8b7cb24eb5ed490e954d4869f7fe2dce59c41 (patch)
tree071b029a1a42c6091e6025e96851f623a3c6e091
parent70e49e8e1306cb7663c9f02c4cce02434f3d5ff6 (diff)
When using the NEW_PROTO_TREE_API, the proto_tree_add... functions are
"redefined" to handle the same way as before. In dissectors using the new API, add all currently used proto_tree_add_xxx functions to the list of functions that take care of NEW_PROTO_TREE_API changes. Modify the dissectors that worked around the missing change. Change-Id: Ib6d6ec2c225d96c98c2a8f507648d7ad4bfb6c68 Reviewed-on: https://code.wireshark.org/review/28002 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
-rw-r--r--epan/dissectors/file-gif.c4
-rw-r--r--epan/dissectors/packet-bitcoin.c6
-rw-r--r--epan/dissectors/packet-dbus.c20
-rw-r--r--epan/dissectors/packet-fcdns.c6
-rw-r--r--epan/dissectors/packet-gadu-gadu.c8
-rw-r--r--epan/dissectors/packet-json.c6
-rw-r--r--epan/dissectors/packet-netlink-generic.c19
-rw-r--r--epan/dissectors/packet-netlink-netfilter.c4
-rw-r--r--epan/dissectors/packet-netlink-route.c8
-rw-r--r--epan/dissectors/packet-netlink-sock_diag.c2
-rw-r--r--epan/dissectors/packet-netlink.c6
-rw-r--r--epan/dissectors/packet-nflog.c2
-rw-r--r--epan/dissectors/packet-udp.c10
-rw-r--r--epan/dissectors/packet-yami.c4
-rw-r--r--epan/proto.h57
15 files changed, 106 insertions, 56 deletions
diff --git a/epan/dissectors/file-gif.c b/epan/dissectors/file-gif.c
index e5c855a57e..6f33d95720 100644
--- a/epan/dissectors/file-gif.c
+++ b/epan/dissectors/file-gif.c
@@ -337,7 +337,7 @@ dissect_gif(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
gif_tree = proto_item_add_subtree(ti, ett_gif);
/* GIF signature */
- proto_tree_add_item_ret_string(gif_tree, hfi_version.id,
+ proto_tree_add_item_ret_string(gif_tree, &hfi_version,
tvb, offset, 6, ENC_ASCII|ENC_NA, wmem_packet_scope(), &ver_str);
proto_item_append_text(ti, ", Version: %s", ver_str);
col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", ver_str);
@@ -395,7 +395,7 @@ dissect_gif(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
peek = tvb_get_guint8(tvb, offset);
if (peek) {
/* Only display if different from 0 */
- proto_tree_add_uint_format(gif_tree, hfi_pixel_aspect_ratio.id,
+ proto_tree_add_uint_format(gif_tree, &hfi_pixel_aspect_ratio,
tvb, offset, 1, peek,
"%u, yields an aspect ratio of (15 + %u) / 64 = %.2f",
peek, peek, (float)(15 + peek) / 64.0);
diff --git a/epan/dissectors/packet-bitcoin.c b/epan/dissectors/packet-bitcoin.c
index ed9eb33427..36c912147c 100644
--- a/epan/dissectors/packet-bitcoin.c
+++ b/epan/dissectors/packet-bitcoin.c
@@ -1092,7 +1092,7 @@ dissect_bitcoin_msg_tx_common(tvbuff_t *tvb, guint32 offset, packet_info *pinfo,
if (msgnum == 0) {
rti = proto_tree_add_item(tree, &hfi_bitcoin_msg_tx, tvb, offset, -1, ENC_NA);
} else {
- rti = proto_tree_add_none_format(tree, hfi_bitcoin_msg_tx.id, tvb, offset, -1, "Tx message [ %4d ]", msgnum);
+ rti = proto_tree_add_none_format(tree, &hfi_bitcoin_msg_tx, tvb, offset, -1, "Tx message [ %4d ]", msgnum);
}
tree = proto_item_add_subtree(rti, ett_bitcoin_msg);
@@ -1540,9 +1540,9 @@ static int dissect_bitcoin_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree
/* add basic protocol data */
proto_tree_add_item(tree, &hfi_bitcoin_magic, tvb, 0, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item_ret_string(tree, hfi_bitcoin_command.id, tvb, 4, 12, ENC_ASCII|ENC_NA, wmem_packet_scope(), &command);
+ proto_tree_add_item_ret_string(tree, &hfi_bitcoin_command, tvb, 4, 12, ENC_ASCII|ENC_NA, wmem_packet_scope(), &command);
proto_tree_add_item(tree, &hfi_bitcoin_length, tvb, 16, 4, ENC_LITTLE_ENDIAN);
- proto_tree_add_checksum(tree, tvb, 20, hfi_bitcoin_checksum.id, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
+ proto_tree_add_checksum(tree, tvb, 20, &hfi_bitcoin_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
offset = 24;
diff --git a/epan/dissectors/packet-dbus.c b/epan/dissectors/packet-dbus.c
index aebb5cb28b..1819418508 100644
--- a/epan/dissectors/packet-dbus.c
+++ b/epan/dissectors/packet-dbus.c
@@ -232,7 +232,7 @@ dissect_dbus_sig(tvbuff_t *tvb, dbus_info_t *dinfo, proto_tree *tree, int offset
val = tvb_get_guint8(tvb, offset);
offset += 1;
- proto_tree_add_uint_format(tree, hfi_dbus_value_uint.id, tvb, org_offset, offset - org_offset, val, "BYTE: %u", val);
+ proto_tree_add_uint_format(tree, &hfi_dbus_value_uint, tvb, org_offset, offset - org_offset, val, "BYTE: %u", val);
ret->uint = val;
return offset;
}
@@ -244,7 +244,7 @@ dissect_dbus_sig(tvbuff_t *tvb, dbus_info_t *dinfo, proto_tree *tree, int offset
val = dinfo->get32(tvb, offset);
offset += 4;
- ti = proto_tree_add_boolean_format(tree, hfi_dbus_value_bool.id, tvb, org_offset, offset - org_offset, val, "BOOLEAN: %s", val ? "True" : "False");
+ ti = proto_tree_add_boolean_format(tree, &hfi_dbus_value_bool, tvb, org_offset, offset - org_offset, val, "BOOLEAN: %s", val ? "True" : "False");
if (val != 0 && val != 1) {
expert_add_info_format(dinfo->pinfo, ti, &ei_dbus_value_bool_invalid, "Invalid boolean value (must be 0 or 1 is: %u)", val);
return -1;
@@ -260,7 +260,7 @@ dissect_dbus_sig(tvbuff_t *tvb, dbus_info_t *dinfo, proto_tree *tree, int offset
val = (gint16 )dinfo->get16(tvb, offset);
offset += 2;
- proto_tree_add_uint_format(tree, hfi_dbus_value_int.id, tvb, org_offset, offset - org_offset, val, "INT16: %d", val);
+ proto_tree_add_uint_format(tree, &hfi_dbus_value_int, tvb, org_offset, offset - org_offset, val, "INT16: %d", val);
/* XXX ret */
return offset;
}
@@ -272,7 +272,7 @@ dissect_dbus_sig(tvbuff_t *tvb, dbus_info_t *dinfo, proto_tree *tree, int offset
val = dinfo->get16(tvb, offset);
offset += 2;
- proto_tree_add_uint_format(tree, hfi_dbus_value_uint.id, tvb, org_offset, offset - org_offset, val, "UINT16: %u", val);
+ proto_tree_add_uint_format(tree, &hfi_dbus_value_uint, tvb, org_offset, offset - org_offset, val, "UINT16: %u", val);
ret->uint = val;
return offset;
}
@@ -284,7 +284,7 @@ dissect_dbus_sig(tvbuff_t *tvb, dbus_info_t *dinfo, proto_tree *tree, int offset
val = (gint32) dinfo->get32(tvb, offset);
offset += 4;
- proto_tree_add_int_format(tree, hfi_dbus_value_int.id, tvb, org_offset, offset - org_offset, val, "INT32: %d", val);
+ proto_tree_add_int_format(tree, &hfi_dbus_value_int, tvb, org_offset, offset - org_offset, val, "INT32: %d", val);
/* XXX ret */
return offset;
}
@@ -296,7 +296,7 @@ dissect_dbus_sig(tvbuff_t *tvb, dbus_info_t *dinfo, proto_tree *tree, int offset
val = dinfo->get32(tvb, offset);
offset += 4;
- proto_tree_add_uint_format(tree, hfi_dbus_value_uint.id, tvb, org_offset, offset - org_offset, val, "UINT32: %u", val);
+ proto_tree_add_uint_format(tree, &hfi_dbus_value_uint, tvb, org_offset, offset - org_offset, val, "UINT32: %u", val);
ret->uint = val;
return offset;
}
@@ -312,7 +312,7 @@ dissect_dbus_sig(tvbuff_t *tvb, dbus_info_t *dinfo, proto_tree *tree, int offset
val = dinfo->getdouble(tvb, offset);
offset += 8;
- proto_tree_add_double(tree, hfi_dbus_value_double.id, tvb, org_offset, offset - org_offset, val);
+ proto_tree_add_double(tree, &hfi_dbus_value_double, tvb, org_offset, offset - org_offset, val);
/* XXX ret */
return offset;
}
@@ -330,13 +330,13 @@ dissect_dbus_sig(tvbuff_t *tvb, dbus_info_t *dinfo, proto_tree *tree, int offset
offset += (len + 1 /* NUL-byte */);
if (sig == 's') {
- ti = proto_tree_add_string_format(tree, hfi_dbus_value_str.id, tvb, org_offset, offset - org_offset, val, "STRING: %s", val);
+ ti = proto_tree_add_string_format(tree, &hfi_dbus_value_str, tvb, org_offset, offset - org_offset, val, "STRING: %s", val);
if (!g_utf8_validate(val, -1, NULL)) {
expert_add_info(dinfo->pinfo, ti, &ei_dbus_value_str_invalid);
return -1;
}
} else {
- ti = proto_tree_add_string_format(tree, hfi_dbus_value_str.id, tvb, org_offset, offset - org_offset, val, "OBJECT_PATH: %s", val);
+ ti = proto_tree_add_string_format(tree, &hfi_dbus_value_str, tvb, org_offset, offset - org_offset, val, "OBJECT_PATH: %s", val);
if (!dbus_validate_object_path(val)) {
expert_add_info(dinfo->pinfo, ti, &ei_dbus_invalid_object_path);
return -1;
@@ -357,7 +357,7 @@ dissect_dbus_sig(tvbuff_t *tvb, dbus_info_t *dinfo, proto_tree *tree, int offset
val = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, len, ENC_ASCII);
offset += (len + 1);
- ti = proto_tree_add_string_format(tree, hfi_dbus_value_str.id, tvb, org_offset, offset - org_offset, val, "SIGNATURE: %s", val);
+ ti = proto_tree_add_string_format(tree, &hfi_dbus_value_str, tvb, org_offset, offset - org_offset, val, "SIGNATURE: %s", val);
if (!dbus_validate_signature(val)) {
expert_add_info(dinfo->pinfo, ti, &ei_dbus_invalid_signature);
return -1;
diff --git a/epan/dissectors/packet-fcdns.c b/epan/dissectors/packet-fcdns.c
index 3b508541bf..f3fa5d04f8 100644
--- a/epan/dissectors/packet-fcdns.c
+++ b/epan/dissectors/packet-fcdns.c
@@ -581,7 +581,7 @@ dissect_cos_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, const hea
NULL
};
- proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hfinfo->id,
+ proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hfinfo,
ett_cos_flags, flags, ENC_BIG_ENDIAN, BMT_NO_FALSE|BMT_NO_TFS);
}
@@ -603,7 +603,7 @@ dissect_fc4features_and_type (proto_tree *parent_tree, tvbuff_t *tvb, int offset
type = tvb_get_guint8(tvb, offset+1);
if(type==FC_TYPE_SCSI){
- proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hfi_fcdns_fc4features.id,
+ proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, &hfi_fcdns_fc4features,
ett_fc4features, flags, ENC_NA, BMT_NO_FALSE|BMT_NO_TFS);
} else {
proto_tree_add_item(parent_tree, &hfi_fcdns_fc4features, tvb, offset, 1, ENC_NA);
@@ -623,7 +623,7 @@ dissect_fc4features (proto_tree *parent_tree, tvbuff_t *tvb, int offset)
NULL
};
- proto_tree_add_bitmask(parent_tree, tvb, offset, hfi_fcdns_fc4features_i.id,
+ proto_tree_add_bitmask(parent_tree, tvb, offset, &hfi_fcdns_fc4features_i,
ett_fc4features, flags, ENC_NA);
}
diff --git a/epan/dissectors/packet-gadu-gadu.c b/epan/dissectors/packet-gadu-gadu.c
index 717d924f88..b8be47a5e4 100644
--- a/epan/dissectors/packet-gadu-gadu.c
+++ b/epan/dissectors/packet-gadu-gadu.c
@@ -682,7 +682,7 @@ dissect_gadu_gadu_login(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
/* hash is 32-bit number written in LE */
_tvb_memcpy_reverse(tvb, hash, offset, 4);
- proto_tree_add_bytes_format_value(tree, hfi_gadu_gadu_login_hash.id, tvb, offset, 4, hash, "0x%.8x", tvb_get_letohl(tvb, offset));
+ proto_tree_add_bytes_format_value(tree, &hfi_gadu_gadu_login_hash, tvb, offset, 4, hash, "0x%.8x", tvb_get_letohl(tvb, offset));
offset += 4;
proto_tree_add_item(tree, &hfi_gadu_gadu_login_status, tvb, offset, 4, ENC_LITTLE_ENDIAN);
@@ -715,7 +715,7 @@ dissect_gadu_gadu_login_hash(tvbuff_t *tvb, proto_tree *tree, int offset)
case GG_LOGIN_HASH_GG32:
/* hash is 32-bit number written in LE */
_tvb_memcpy_reverse(tvb, hash, offset, 4);
- proto_tree_add_bytes_format_value(tree, hfi_gadu_gadu_login_hash.id, tvb, offset, 4, hash, "0x%.8x", tvb_get_letohl(tvb, offset));
+ proto_tree_add_bytes_format_value(tree, &hfi_gadu_gadu_login_hash, tvb, offset, 4, hash, "0x%.8x", tvb_get_letohl(tvb, offset));
for (i = 4; i < 64; i++) {
if (tvb_get_guint8(tvb, offset+i)) {
proto_tree_add_item(tree, &hfi_gadu_gadu_data, tvb, offset + 4, 64-4, ENC_NA);
@@ -1428,14 +1428,14 @@ dissect_gadu_gadu_userlist_xml_compressed(tvbuff_t *tvb, packet_info *pinfo, pro
return offset;
if ((uncomp_tvb = tvb_child_uncompress(tvb, tvb, offset, remain))) {
- proto_tree_add_bytes_format_value(tree, hfi_gadu_gadu_userlist.id, tvb, offset, remain, NULL, "[Decompression succeeded]");
+ proto_tree_add_bytes_format_value(tree, &hfi_gadu_gadu_userlist, tvb, offset, remain, NULL, "[Decompression succeeded]");
add_new_data_source(pinfo, uncomp_tvb, "Uncompressed userlist");
/* XXX add DTD (pinfo->match_string) */
call_dissector_only(xml_handle, uncomp_tvb, pinfo, tree, NULL);
} else
- proto_tree_add_bytes_format_value(tree, hfi_gadu_gadu_userlist.id, tvb, offset, remain, NULL, "[Error: Decompression failed] (or no zlib)");
+ proto_tree_add_bytes_format_value(tree, &hfi_gadu_gadu_userlist, tvb, offset, remain, NULL, "[Error: Decompression failed] (or no zlib)");
offset += remain;
diff --git a/epan/dissectors/packet-json.c b/epan/dissectors/packet-json.c
index c3f413ad7e..c9c88eac0d 100644
--- a/epan/dissectors/packet-json.c
+++ b/epan/dissectors/packet-json.c
@@ -275,7 +275,7 @@ static void before_object(void *tvbparse_data, const void *wanted_data _U_, tvbp
gint idx = GPOINTER_TO_INT(wmem_stack_peek(data->array_idx));
if (JSON_INSIDE_ARRAY(idx)) {
- ti_compact = proto_tree_add_none_format(tree_compact, hfi_json_object_compact.id, tok->tvb, tok->offset, tok->len, "%d:", idx);
+ ti_compact = proto_tree_add_none_format(tree_compact, &hfi_json_object_compact, tok->tvb, tok->offset, tok->len, "%d:", idx);
subtree_compact = proto_item_add_subtree(ti_compact, ett_json_object_compact);
json_array_index_increment(data);
} else {
@@ -330,7 +330,7 @@ static void before_member(void *tvbparse_data, const void *wanted_data _U_, tvbp
if (key_tok && key_tok->id == JSON_TOKEN_STRING) {
char *key_str = json_string_unescape(key_tok);
- ti_compact = proto_tree_add_none_format(tree_compact, hfi_json_member_compact.id, tok->tvb, tok->offset, tok->len, "%s:", key_str);
+ ti_compact = proto_tree_add_none_format(tree_compact, &hfi_json_member_compact, tok->tvb, tok->offset, tok->len, "%s:", key_str);
} else {
ti_compact = proto_tree_add_item(tree_compact, &hfi_json_member_compact, tok->tvb, tok->offset, tok->len, ENC_NA);
}
@@ -605,7 +605,7 @@ static void after_value(void *tvbparse_data, const void *wanted_data _U_, tvbpar
}
if (JSON_INSIDE_ARRAY(idx)) {
- proto_tree_add_none_format(tree_compact, hfi_json_array_item_compact.id, tok->tvb, tok->offset, tok->len, "%d: %s", idx, val_str);
+ proto_tree_add_none_format(tree_compact, &hfi_json_array_item_compact, tok->tvb, tok->offset, tok->len, "%d: %s", idx, val_str);
json_array_index_increment(data);
} else {
proto_item *parent_item = proto_tree_get_parent(tree_compact);
diff --git a/epan/dissectors/packet-netlink-generic.c b/epan/dissectors/packet-netlink-generic.c
index 34ac1f9e56..ec07ec5d8e 100644
--- a/epan/dissectors/packet-netlink-generic.c
+++ b/epan/dissectors/packet-netlink-generic.c
@@ -194,7 +194,7 @@ dissect_genl_ctrl_ops_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla
break;
case WS_CTRL_ATTR_OP_ID:
if (len == 4) {
- proto_tree_add_item_ret_uint(tree, hfi_genl_ctrl_op_id.id, tvb, offset, 4, info->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_op_id, tvb, offset, 4, info->encoding, &value);
proto_item_append_text(tree, ": %u", value);
proto_item_append_text(ptree, ", id=%u", value);
offset += 4;
@@ -204,7 +204,8 @@ dissect_genl_ctrl_ops_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla
if (len == 4) {
guint64 op_flags;
/* XXX it would be nice if the flag names are appended to the tree */
- proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hfi_genl_ctrl_op_flags.id, ett_genl_ctrl_op_flags, genl_ctrl_op_flags_fields, info->encoding, BMT_NO_FALSE, &op_flags);
+ proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, &hfi_genl_ctrl_op_flags,
+ ett_genl_ctrl_op_flags, genl_ctrl_op_flags_fields, info->encoding, BMT_NO_FALSE, &op_flags);
proto_item_append_text(tree, ": 0x%08x", (guint32)op_flags);
proto_item_append_text(ptree, ", flags=0x%08x", (guint32)op_flags);
offset += 4;
@@ -237,14 +238,14 @@ dissect_genl_ctrl_groups_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int
case WS_CTRL_ATTR_MCAST_GRP_UNSPEC:
break;
case WS_CTRL_ATTR_MCAST_GRP_NAME:
- proto_tree_add_item_ret_string(tree, hfi_genl_ctrl_group_name.id, tvb, offset, len, ENC_ASCII, wmem_packet_scope(), &strval);
+ proto_tree_add_item_ret_string(tree, &hfi_genl_ctrl_group_name, tvb, offset, len, ENC_ASCII, wmem_packet_scope(), &strval);
proto_item_append_text(tree, ": %s", strval);
proto_item_append_text(ptree, ", name=%s", strval);
offset += len;
break;
case WS_CTRL_ATTR_MCAST_GRP_ID:
if (len == 4) {
- proto_tree_add_item_ret_uint(tree, hfi_genl_ctrl_group_id.id, tvb, offset, 4, info->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_group_id, tvb, offset, 4, info->encoding, &value);
proto_item_append_text(tree, ": %u", value);
proto_item_append_text(ptree, ", id=%u", value);
offset += 4;
@@ -296,34 +297,34 @@ dissect_genl_ctrl_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_typ
break;
case WS_CTRL_ATTR_FAMILY_ID:
if (len == 2) {
- proto_tree_add_item_ret_uint(tree, hfi_genl_ctrl_family_id.id, tvb, offset, 2, info->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_family_id, tvb, offset, 2, info->encoding, &value);
proto_item_append_text(tree, ": %#x", value);
info->family_id = value;
offset += 2;
}
break;
case WS_CTRL_ATTR_FAMILY_NAME:
- proto_tree_add_item_ret_string(tree, hfi_genl_ctrl_family_name.id, tvb, offset, len, ENC_ASCII, wmem_packet_scope(), &info->family_name);
+ proto_tree_add_item_ret_string(tree, &hfi_genl_ctrl_family_name, tvb, offset, len, ENC_ASCII, wmem_packet_scope(), &info->family_name);
proto_item_append_text(tree, ": %s", info->family_name);
offset += len;
break;
case WS_CTRL_ATTR_VERSION:
if (len == 4) {
- proto_tree_add_item_ret_uint(tree, hfi_genl_ctrl_version.id, tvb, offset, 4, info->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_version, tvb, offset, 4, info->encoding, &value);
proto_item_append_text(tree, ": %u", value);
offset += 4;
}
break;
case WS_CTRL_ATTR_HDRSIZE:
if (len == 4) {
- proto_tree_add_item_ret_uint(tree, hfi_genl_ctrl_hdrsize.id, tvb, offset, 4, info->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_hdrsize, tvb, offset, 4, info->encoding, &value);
proto_item_append_text(tree, ": %u", value);
offset += 4;
}
break;
case WS_CTRL_ATTR_MAXATTR:
if (len == 4) {
- proto_tree_add_item_ret_uint(tree, hfi_genl_ctrl_maxattr.id, tvb, offset, 4, info->encoding, &value);
+ proto_tree_add_item_ret_uint(tree, &hfi_genl_ctrl_maxattr, tvb, offset, 4, info->encoding, &value);
proto_item_append_text(tree, ": %u", value);
offset += 4;
}
diff --git a/epan/dissectors/packet-netlink-netfilter.c b/epan/dissectors/packet-netlink-netfilter.c
index e16f0d2fe9..4635c02e5e 100644
--- a/epan/dissectors/packet-netlink-netfilter.c
+++ b/epan/dissectors/packet-netlink-netfilter.c
@@ -768,7 +768,7 @@ dissect_nfct_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, in
switch (type) {
case WS_CTA_STATUS:
- proto_tree_add_bitmask(tree, tvb, offset, hfi_nfct_attr_status.id,
+ proto_tree_add_bitmask(tree, tvb, offset, &hfi_nfct_attr_status,
ett_nfct_status_attr, hfi_nfct_attr_status_flags, ENC_BIG_ENDIAN);
return 1;
@@ -976,7 +976,7 @@ dissect_nfexp_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, i
return 1;
case WS_CTA_EXPECT_FLAGS:
- proto_tree_add_bitmask(tree, tvb, offset, hfi_nfexp_attr_flags.id,
+ proto_tree_add_bitmask(tree, tvb, offset, &hfi_nfexp_attr_flags,
ett_nfexp_flags_attr, hfi_nfexp_attr_flags_bitfield, ENC_BIG_ENDIAN);
return 1;
diff --git a/epan/dissectors/packet-netlink-route.c b/epan/dissectors/packet-netlink-route.c
index 4d27531560..1f2ba5afbd 100644
--- a/epan/dissectors/packet-netlink-route.c
+++ b/epan/dissectors/packet-netlink-route.c
@@ -750,7 +750,7 @@ dissect_netlink_route_ifla_attrs(tvbuff_t *tvb, struct netlink_route_info *info,
proto_tree* subtree;
switch (type) {
case WS_IFLA_IFNAME:
- proto_tree_add_item_ret_string(tree, hfi_netlink_route_ifla_ifname.id, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
+ proto_tree_add_item_ret_string(tree, &hfi_netlink_route_ifla_ifname, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
proto_item_append_text(tree, ": %s", str);
return 1;
case WS_IFLA_MTU:
@@ -762,7 +762,7 @@ dissect_netlink_route_ifla_attrs(tvbuff_t *tvb, struct netlink_route_info *info,
proto_tree_add_item(tree, &hfi_netlink_route_ifla_txqlen, tvb, offset, len, info->encoding);
return 1;
case WS_IFLA_OPERSTATE:
- proto_tree_add_item_ret_uint(tree, hfi_netlink_route_ifla_operstate.id, tvb, offset, len, info->encoding, &gint);
+ proto_tree_add_item_ret_uint(tree, &hfi_netlink_route_ifla_operstate, tvb, offset, len, info->encoding, &gint);
return 1;
case WS_IFLA_PROMISCUITY:
proto_item_append_text(tree, ": %u", tvb_get_letohl(tvb, offset));
@@ -811,7 +811,7 @@ dissect_netlink_route_ifla_attrs(tvbuff_t *tvb, struct netlink_route_info *info,
subtree = proto_tree_add_subtree(tree, tvb, offset, len, ett_netlink_route_attr_linkstats, NULL, "Statistics");
return dissect_netlink_route_ifla_linkstats(tvb, info, subtree, offset, 8);
case WS_IFLA_QDISC:
- proto_tree_add_item_ret_string(tree, hfi_netlink_route_ifla_qdisc.id, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
+ proto_tree_add_item_ret_string(tree, &hfi_netlink_route_ifla_qdisc, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
proto_item_append_text(tree, ": %s", str);
return 1;
case WS_IFLA_MAP:
@@ -943,7 +943,7 @@ dissect_netlink_route_ifa_attrs(tvbuff_t *tvb, struct netlink_route_info *info _
switch (type) {
case WS_IFA_LABEL:
- proto_tree_add_item_ret_string(tree, hfi_netlink_route_ifa_label.id, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
+ proto_tree_add_item_ret_string(tree, &hfi_netlink_route_ifa_label, tvb, offset, len, ENC_ASCII | ENC_NA, wmem_packet_scope(), &str);
proto_item_append_text(tree, ": %s", str);
return 1;
diff --git a/epan/dissectors/packet-netlink-sock_diag.c b/epan/dissectors/packet-netlink-sock_diag.c
index 483eb21896..a3f223a1b0 100644
--- a/epan/dissectors/packet-netlink-sock_diag.c
+++ b/epan/dissectors/packet-netlink-sock_diag.c
@@ -311,7 +311,7 @@ sock_diag_proto_tree_add_cookie(proto_tree *tree, netlink_sock_diag_info_t *info
/* XXX support for INET_DIAG_NOCOOKIE (~0) */
- proto_tree_add_uint64(tree, hfi_netlink_sock_diag_cookie.id, tvb, offset, 8, cookie);
+ proto_tree_add_uint64(tree, &hfi_netlink_sock_diag_cookie, tvb, offset, 8, cookie);
}
static const value_string netlink_sock_diag_shutdown_flags_vals[] = {
diff --git a/epan/dissectors/packet-netlink.c b/epan/dissectors/packet-netlink.c
index 4b9b60ae5e..29b5850aac 100644
--- a/epan/dissectors/packet-netlink.c
+++ b/epan/dissectors/packet-netlink.c
@@ -384,12 +384,12 @@ dissect_netlink_header(tvbuff_t *tvb, proto_tree *tree, int offset, int encoding
if ((hdr_flags & WS_NLM_F_REQUEST) && (hdr_flags & 0x0f00)) {
/* XXX detect based on the protocol family and message type
* whether this is a GET, NEW or regular request. */
- proto_tree_add_bitmask(fh_hdr, tvb, offset, hfi_netlink_hdr_flags.id,
+ proto_tree_add_bitmask(fh_hdr, tvb, offset, &hfi_netlink_hdr_flags,
ett_netlink_hdr_flags, netlink_header_get_flags, encoding);
- proto_tree_add_bitmask(fh_hdr, tvb, offset, hfi_netlink_hdr_flags.id,
+ proto_tree_add_bitmask(fh_hdr, tvb, offset, &hfi_netlink_hdr_flags,
ett_netlink_hdr_flags, netlink_header_new_flags, encoding);
} else {
- proto_tree_add_bitmask(fh_hdr, tvb, offset, hfi_netlink_hdr_flags.id,
+ proto_tree_add_bitmask(fh_hdr, tvb, offset, &hfi_netlink_hdr_flags,
ett_netlink_hdr_flags, netlink_header_standard_flags, encoding);
}
diff --git a/epan/dissectors/packet-nflog.c b/epan/dissectors/packet-nflog.c
index 5777e732d7..4968407099 100644
--- a/epan/dissectors/packet-nflog.c
+++ b/epan/dissectors/packet-nflog.c
@@ -184,7 +184,7 @@ dissect_nflog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
if (nflog_tree) {
gboolean handled = FALSE;
- ti = proto_tree_add_bytes_format(nflog_tree, hfi_nflog_tlv.id,
+ ti = proto_tree_add_bytes_format(nflog_tree, &hfi_nflog_tlv,
tvb, offset, tlv_len, NULL,
"TLV Type: %s (%u), Length: %u",
val_to_str_const(tlv_type, nflog_tlv_vals, "Unknown"),
diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c
index a827304e5a..5600565fc5 100644
--- a/epan/dissectors/packet-udp.c
+++ b/epan/dissectors/packet-udp.c
@@ -991,10 +991,10 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto)
if (udph->uh_sum == 0) {
/* No checksum supplied in the packet. */
if (((ip_proto == IP_PROTO_UDP) && (pinfo->src.type == AT_IPv4)) || pinfo->flags.in_error_pkt) {
- proto_tree_add_checksum(udp_tree, tvb, offset + 6, hfi_udp_checksum.id, hfi_udp_checksum_status.id, &ei_udp_checksum_bad,
+ proto_tree_add_checksum(udp_tree, tvb, offset + 6, &hfi_udp_checksum, hfi_udp_checksum_status.id, &ei_udp_checksum_bad,
pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT);
} else {
- item = proto_tree_add_uint_format_value(udp_tree, hfi_udp_checksum.id, tvb, offset + 6, 2, 0, "0 (Illegal)");
+ item = proto_tree_add_uint_format_value(udp_tree, &hfi_udp_checksum, tvb, offset + 6, 2, 0, "0 (Illegal)%s", "");
checksum_tree = proto_item_add_subtree(item, ett_udp_checksum);
expert_add_info(pinfo, item, &ei_udp_checksum_zero);
@@ -1045,7 +1045,7 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto)
SET_CKSUM_VEC_TVB(cksum_vec[3], tvb, offset, udph->uh_sum_cov);
computed_cksum = in_cksum(&cksum_vec[0], 4);
- item = proto_tree_add_checksum(udp_tree, tvb, offset+6, hfi_udp_checksum.id, hfi_udp_checksum_status.id, &ei_udp_checksum_bad,
+ item = proto_tree_add_checksum(udp_tree, tvb, offset + 6, &hfi_udp_checksum, hfi_udp_checksum_status.id, &ei_udp_checksum_bad,
pinfo, computed_cksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
checksum_tree = proto_item_add_subtree(item, ett_udp_checksum);
@@ -1061,10 +1061,10 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto)
PROTO_ITEM_SET_GENERATED(calc_item);
} else {
- proto_tree_add_checksum(udp_tree, tvb, offset + 6, hfi_udp_checksum.id, hfi_udp_checksum_status.id, &ei_udp_checksum_bad, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
+ proto_tree_add_checksum(udp_tree, tvb, offset + 6, &hfi_udp_checksum, hfi_udp_checksum_status.id, &ei_udp_checksum_bad, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
}
} else {
- proto_tree_add_checksum(udp_tree, tvb, offset + 6, hfi_udp_checksum.id, hfi_udp_checksum_status.id, &ei_udp_checksum_bad, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
+ proto_tree_add_checksum(udp_tree, tvb, offset + 6, &hfi_udp_checksum, hfi_udp_checksum_status.id, &ei_udp_checksum_bad, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
}
/* Skip over header */
diff --git a/epan/dissectors/packet-yami.c b/epan/dissectors/packet-yami.c
index d99409a665..c9a81169e3 100644
--- a/epan/dissectors/packet-yami.c
+++ b/epan/dissectors/packet-yami.c
@@ -221,7 +221,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *
proto_item_append_text(ti, ", Type: binary, Value: %s", repr);
offset += (val_len + 3) & ~3;
- proto_tree_add_bytes_format_value(yami_param, hfi_yami_param_value_bin.id, tvb, val_offset, offset - val_offset, val, "%s", repr);
+ proto_tree_add_bytes_format_value(yami_param, &hfi_yami_param_value_bin, tvb, val_offset, offset - val_offset, val, "%s", repr);
break;
}
@@ -385,7 +385,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *
proto_item_append_text(ti, "%s, ", repr);
offset += (val_len + 3) & ~3;
- proto_tree_add_bytes_format_value(yami_param, hfi_yami_param_value_bin.id, tvb, val_offset, offset - val_offset, val, "%s", repr);
+ proto_tree_add_bytes_format_value(yami_param, &hfi_yami_param_value_bin, tvb, val_offset, offset - val_offset, val, "%s", repr);
}
proto_item_append_text(ti, "}");
break;
diff --git a/epan/proto.h b/epan/proto.h
index 95c0fe8fcc..def572f222 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -3053,25 +3053,74 @@ proto_custom_set(proto_tree* tree, GSList *field_id,
#define proto_tree_add_boolean(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_boolean(tree, (hfinfo)->id, tvb, start, length, value)
+#define proto_tree_add_boolean_format(tree, hfinfo, tvb, start, length, value, format, ...) \
+ proto_tree_add_boolean_format(tree, (hfinfo)->id, tvb, start, length, value, format, __VA_ARGS__)
+
#define proto_tree_add_string(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_string(tree, (hfinfo)->id, tvb, start, length, value)
+#define proto_tree_add_string_format(tree, hfinfo, tvb, start, length, value, format, ...) \
+ proto_tree_add_string_format(tree, (hfinfo)->id, tvb, start, length, value, format, __VA_ARGS__)
+
+#define proto_tree_add_item_ret_string(tree, hfinfo, tvb, start, length, encoding, scope, retval) \
+ proto_tree_add_item_ret_string(tree, (hfinfo)->id, tvb, start, length, encoding, scope, retval)
+
#define proto_tree_add_time(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_time(tree, (hfinfo)->id, tvb, start, length, value)
#define proto_tree_add_int(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_int(tree, (hfinfo)->id, tvb, start, length, value)
+#define proto_tree_add_int_format(tree, hfinfo, tvb, start, length, value, format, ...) \
+ proto_tree_add_int_format(tree, (hfinfo)->id, tvb, start, length, value, format, __VA_ARGS__)
+
#define proto_tree_add_uint(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_uint(tree, (hfinfo)->id, tvb, start, length, value)
+#define proto_tree_add_uint_format(tree, hfinfo, tvb, start, length, value, format, ...) \
+ proto_tree_add_uint_format(tree, (hfinfo)->id, tvb, start, length, value, format, __VA_ARGS__)
+
+#define proto_tree_add_uint_format_value(tree, hfinfo, tvb, start, length, value, format, ...) \
+ proto_tree_add_uint_format_value(tree, (hfinfo)->id, tvb, start, length, value, format, __VA_ARGS__)
+
+#define proto_tree_add_item_ret_uint(tree, hfinfo, tvb, start, length, encoding, retval) \
+ proto_tree_add_item_ret_uint(tree, (hfinfo)->id, tvb, start, length, encoding, retval)
+
+#define proto_tree_add_uint64(tree, hfinfo, tvb, start, length, value) \
+ proto_tree_add_uint64(tree, (hfinfo)->id, tvb, start, length, value)
+
#define proto_tree_add_float(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_float(tree, (hfinfo)->id, tvb, start, length, value)
-#define proto_tree_add_float_format_value(tree, hfinfo, \
- tvb, start, length, value, format, ...) \
- proto_tree_add_float_format_value(tree, (hfinfo)->id, \
- tvb, start, length, value, format, __VA_ARGS__)
+#define proto_tree_add_float_format_value(tree, hfinfo, tvb, start, length, value, format, ...) \
+ proto_tree_add_float_format_value(tree, (hfinfo)->id, tvb, start, length, value, format, __VA_ARGS__)
+
+#define proto_tree_add_double(tree, hfinfo, tvb, start, length, value) \
+ proto_tree_add_double(tree, (hfinfo)->id, tvb, start, length, value)
+
+#define proto_tree_add_bytes_format(tree, hfinfo, tvb, start, length, format, ...) \
+ proto_tree_add_bytes_format(tree, (hfinfo)->id, tvb, start, length, format, __VA_ARGS__)
+
+#define proto_tree_add_bytes_format_value(tree, hfinfo, tvb, start, length, format, ...) \
+ proto_tree_add_bytes_format_value(tree, (hfinfo)->id, tvb, start, length, format, __VA_ARGS__)
+
+#define proto_tree_add_bitmask(tree, tvb, start, hfinfo, ett, fields, encoding) \
+ proto_tree_add_bitmask(tree, tvb, start, (hfinfo)->id, ett, fields, encoding)
+
+#define proto_tree_add_bitmask_with_flags(tree, tvb, start, hfinfo, ett, fields, encoding, flags) \
+ proto_tree_add_bitmask_with_flags(tree, tvb, start, (hfinfo)->id, ett, fields, encoding, flags)
+
+#define proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, start, hfinfo, ett, fields, encoding, flags, retval) \
+ proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, start, (hfinfo)->id, ett, fields, encoding, flags, retval)
+
+#define proto_tree_add_none_format(tree, hfinfo, tvb, start, length, format, ...) \
+ proto_tree_add_none_format(tree, (hfinfo)->id, tvb, start, length, format, __VA_ARGS__)
+
+#define proto_tree_add_checksum(tree, tvb, offset, hf_checksum, hf_checksum_status, \
+ bad_checksum_expert, pinfo, computed_checksum, encoding, flags) \
+ proto_tree_add_checksum(tree, tvb, offset, (hf_checksum)->id, hf_checksum_status, \
+ bad_checksum_expert, pinfo, computed_checksum, encoding, flags)
+
#endif
/** @} */