From b7f4e250599d7ea0452711d388c161fd4ef61c60 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Tue, 13 Dec 2016 14:26:27 -0500 Subject: Adjust proto_tree_add_uint_format_value calls to use unit string Several calls to proto_tree_add_uint_format_value could be better served using BASE_UNIT_STRING with a "unit string" in hf_ field. There also a few cases where proto_tree_add_uint_format_value could just be proto_tree_add_uint. Added a few more "common" unit string values to unit_strings.[ch] Change-Id: Iaedff82c515269c9c31ab9100dff19f5563c932d Reviewed-on: https://code.wireshark.org/review/19242 Petri-Dish: Michael Mann Reviewed-by: Michael Mann --- epan/dissectors/file-jpeg.c | 12 ++--- epan/dissectors/packet-ansi_801.c | 20 ++++----- epan/dissectors/packet-aodv.c | 5 +-- epan/dissectors/packet-bat.c | 8 ++-- epan/dissectors/packet-batadv.c | 8 ++-- epan/dissectors/packet-bfd.c | 5 +-- epan/dissectors/packet-bootp.c | 9 ++-- epan/dissectors/packet-cattp.c | 7 +-- epan/dissectors/packet-cdp.c | 27 +++++------ epan/dissectors/packet-cip.c | 4 +- epan/dissectors/packet-cipmotion.c | 33 +++++--------- epan/dissectors/packet-dccp.c | 4 +- epan/dissectors/packet-dhcp-failover.c | 8 ++-- epan/dissectors/packet-dhcpv6.c | 5 +-- epan/dissectors/packet-dnp.c | 5 +-- epan/dissectors/packet-dsi.c | 13 +++--- epan/dissectors/packet-ecmp.c | 11 ++--- epan/dissectors/packet-ehdlc.c | 12 ++--- epan/dissectors/packet-esis.c | 36 +++++++-------- epan/dissectors/packet-fcswils.c | 19 +++----- epan/dissectors/packet-forces.c | 30 ++++++------- epan/dissectors/packet-geneve.c | 15 ++----- epan/dissectors/packet-gsm_a_dtap.c | 6 +-- epan/dissectors/packet-gsmtap.c | 7 ++- epan/dissectors/packet-gtpv2.c | 21 ++++----- epan/dissectors/packet-http.c | 10 ++--- epan/dissectors/packet-idp.c | 7 ++- epan/dissectors/packet-ieee80211-netmon.c | 7 ++- epan/dissectors/packet-ieee80211-radio.c | 30 ++++--------- epan/dissectors/packet-ieee80211-radiotap.c | 20 +++------ epan/dissectors/packet-ieee80211.c | 10 ++--- epan/dissectors/packet-igrp.c | 4 +- epan/dissectors/packet-ip.c | 5 +-- epan/dissectors/packet-ipx.c | 5 +-- epan/dissectors/packet-ipxwan.c | 40 +++++------------ epan/dissectors/packet-isakmp.c | 8 ++-- epan/dissectors/packet-isup.c | 13 +++--- epan/dissectors/packet-iwarp-ddp-rdmap.c | 10 ++--- epan/dissectors/packet-iwarp-mpa.c | 26 ++++------- epan/dissectors/packet-kerberos4.c | 3 +- epan/dissectors/packet-lat.c | 6 +-- epan/dissectors/packet-lmp.c | 13 +++--- epan/dissectors/packet-nbt.c | 22 ++++----- epan/dissectors/packet-nfs.c | 5 +-- epan/dissectors/packet-nlsp.c | 37 ++++++---------- epan/dissectors/packet-opensafety.c | 37 +++++----------- epan/dissectors/packet-ospf.c | 5 +-- epan/dissectors/packet-ppp.c | 6 +-- epan/dissectors/packet-ptp.c | 15 +++---- epan/dissectors/packet-q2931.c | 20 ++++----- epan/dissectors/packet-q931.c | 30 ++++++------- epan/dissectors/packet-q933.c | 22 +++++---- epan/dissectors/packet-rsvp.c | 69 ++++++++++------------------- epan/dissectors/packet-rtps.c | 22 ++++----- epan/dissectors/packet-scsi-ssc.c | 16 +++---- epan/dissectors/packet-scsi.c | 4 +- epan/dissectors/packet-sflow.c | 24 +++++----- epan/dissectors/packet-slimp3.c | 6 +-- epan/dissectors/packet-spice.c | 21 +++++---- epan/dissectors/packet-stt.c | 11 +++-- epan/dissectors/packet-tdmop.c | 2 +- epan/dissectors/packet-tds.c | 44 ++++++++---------- epan/dissectors/packet-trmac.c | 10 ++--- epan/dissectors/packet-ua3g.c | 2 +- epan/dissectors/packet-udp.c | 24 ++++------ epan/unit_strings.c | 12 +++++ epan/unit_strings.h | 11 +++++ 67 files changed, 415 insertions(+), 609 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/file-jpeg.c b/epan/dissectors/file-jpeg.c index 8f419d5a98..d492bebade 100644 --- a/epan/dissectors/file-jpeg.c +++ b/epan/dissectors/file-jpeg.c @@ -654,9 +654,7 @@ process_app1_segment(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, guint3 /* * Offset to IFD */ - val_32 = tvb_get_guint32(tvb, offset, encoding); - tiff_item = proto_tree_add_uint_format_value(subtree, hf_start_ifd_offset, tvb, offset, 4, val_32, "%u bytes", - val_32); + tiff_item = proto_tree_add_item_ret_uint(subtree, hf_start_ifd_offset, tvb, offset, 4, encoding, &val_32); offset += 4; /* * Check for a bogus val_32 value. @@ -697,9 +695,7 @@ process_app1_segment(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, guint3 /* * Offset to the next IFD */ - val_32 = tvb_get_guint32(tvb, offset, encoding); - tiff_item = proto_tree_add_uint_format_value(subtree, hf_next_ifd_offset, tvb, offset, 4, val_32, "%u bytes", - val_32); + tiff_item = proto_tree_add_item_ret_uint(subtree, hf_next_ifd_offset, tvb, offset, 4, encoding, &val_32); offset += 4; if (val_32 != 0 && val_32 + tiff_start < (guint32)offset) { @@ -1208,7 +1204,7 @@ proto_register_jfif(void) { &hf_start_ifd_offset, { "Start offset of IFD starting from the TIFF header start", IMG_JFIF ".start_ifd_offset", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL } @@ -1216,7 +1212,7 @@ proto_register_jfif(void) { &hf_next_ifd_offset, { "Offset to next IFD from start of TIFF header", IMG_JFIF ".next_ifd_offset", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL } diff --git a/epan/dissectors/packet-ansi_801.c b/epan/dissectors/packet-ansi_801.c index eda9fa7482..cbd28fe8a5 100644 --- a/epan/dissectors/packet-ansi_801.c +++ b/epan/dissectors/packet-ansi_801.c @@ -306,8 +306,11 @@ static const value_string regulatory_services_indicator_vals[] = { { 0, NULL }, }; -const true_false_string tfs_desired_pilot_phase_resolution = { "at least 1/8th PN chip resolution", "at least 1 PN chip resolution" }; -const true_false_string tfs_spherical_cartesian = { "Spherical", "Cartesian" }; +static const true_false_string tfs_desired_pilot_phase_resolution = { "at least 1/8th PN chip resolution", "at least 1 PN chip resolution" }; +static const true_false_string tfs_spherical_cartesian = { "Spherical", "Cartesian" }; + +static const unit_name_string units_time_of_almanac = { " (in units of 4096 seconds)", NULL }; +static const unit_name_string units_gps_week_number = { " (8 least significant bits)", NULL }; static void for_req_pseudo_meas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint len, guint32 offset) @@ -877,20 +880,15 @@ static void rev_req_gps_alm_correction(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint len, guint32 offset) { guint32 saved_offset; - guint8 oct; SHORT_DATA_CHECK(len, 2); saved_offset = offset; - oct = tvb_get_guint8(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_ansi_801_time_of_almanac, tvb, offset, 1, oct, - "%d (in units of 4096 seconds)", oct); + proto_tree_add_item(tree, hf_ansi_801_time_of_almanac, tvb, offset, 1, ENC_NA); offset++; - oct = tvb_get_guint8(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_ansi_801_gps_week_number, tvb, offset, 1, oct, - "%d (8 least significant bits)", oct); + proto_tree_add_item(tree, hf_ansi_801_gps_week_number, tvb, offset, 1, ENC_NA); offset++; @@ -2245,12 +2243,12 @@ proto_register_ansi_801(void) }, { &hf_ansi_801_time_of_almanac, { "Time of almanac", "ansi_801.time_of_almanac", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_time_of_almanac, 0x0, NULL, HFILL } }, { &hf_ansi_801_gps_week_number, { "GPS week number", "ansi_801.gps_week_number", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_gps_week_number, 0x0, NULL, HFILL } }, }; diff --git a/epan/dissectors/packet-aodv.c b/epan/dissectors/packet-aodv.c index 8d2576f19a..e204e741dd 100644 --- a/epan/dissectors/packet-aodv.c +++ b/epan/dissectors/packet-aodv.c @@ -159,8 +159,7 @@ again: proto_tree_add_item(ext_tree, hf_aodv_ext_type, tvb, offset, 1, ENC_BIG_ENDIAN); - len_item = proto_tree_add_uint_format_value(ext_tree, hf_aodv_ext_length, tvb, offset + 1, 1, - len, "%u bytes", len); + len_item = proto_tree_add_uint(ext_tree, hf_aodv_ext_length, tvb, offset + 1, 1, len); if (len == 0) { expert_add_info(pinfo, len_item, &ei_aodv_ext_length); return; /* we must not try to decode this */ @@ -879,7 +878,7 @@ proto_register_aodv(void) }, { &hf_aodv_ext_length, { "Extension Length", "aodv.ext_length", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, "Extension Data Length", HFILL} }, { &hf_aodv_ext_interval, diff --git a/epan/dissectors/packet-bat.c b/epan/dissectors/packet-bat.c index 02b424355b..d6d67f7eae 100644 --- a/epan/dissectors/packet-bat.c +++ b/epan/dissectors/packet-bat.c @@ -213,8 +213,8 @@ static void dissect_bat_gwflags(tvbuff_t *tvb, guint8 gwflags, int offset, proto up = ((upbits + 1) * down) / 8; gwflags_tree = proto_item_add_subtree(tgw, ett_bat_batman_gwflags); - proto_tree_add_uint_format_value(gwflags_tree, hf_bat_batman_gwflags_dl_speed, tvb, offset, 1, down, "%dkbit", down); - proto_tree_add_uint_format_value(gwflags_tree, hf_bat_batman_gwflags_ul_speed, tvb, offset, 1, up, "%dkbit", up); + proto_tree_add_uint(gwflags_tree, hf_bat_batman_gwflags_dl_speed, tvb, offset, 1, down); + proto_tree_add_uint(gwflags_tree, hf_bat_batman_gwflags_ul_speed, tvb, offset, 1, up); } @@ -704,12 +704,12 @@ void proto_register_bat(void) }, { &hf_bat_batman_gwflags_dl_speed, { "Download Speed", "bat.batman.gwflags.dl_speed", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_kbit, 0x0, NULL, HFILL } }, { &hf_bat_batman_gwflags_ul_speed, { "Upload Speed", "bat.batman.gwflags.ul_speed", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_kbit, 0x0, NULL, HFILL } }, { &hf_bat_batman_seqno, diff --git a/epan/dissectors/packet-batadv.c b/epan/dissectors/packet-batadv.c index ab28a7983a..0f960cf8a2 100644 --- a/epan/dissectors/packet-batadv.c +++ b/epan/dissectors/packet-batadv.c @@ -1027,8 +1027,8 @@ static void dissect_batadv_gwflags(tvbuff_t *tvb, guint8 gwflags, int offset, pr } gwflags_tree = proto_item_add_subtree(tgw, ett_batadv_batman_gwflags); - proto_tree_add_uint_format_value(gwflags_tree, hf_batadv_batman_gwflags_dl_speed, tvb, offset, 1, down, "%dkbit", down); - proto_tree_add_uint_format_value(gwflags_tree, hf_batadv_batman_gwflags_ul_speed, tvb, offset, 1, up, "%dkbit", up); + proto_tree_add_uint(gwflags_tree, hf_batadv_batman_gwflags_dl_speed, tvb, offset, 1, down); + proto_tree_add_uint(gwflags_tree, hf_batadv_batman_gwflags_ul_speed, tvb, offset, 1, up); } static int dissect_batadv_batman_v5(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) @@ -4234,12 +4234,12 @@ void proto_register_batadv(void) }, { &hf_batadv_batman_gwflags_dl_speed, { "Download Speed", "batadv.batman.gwflags.dl_speed", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_kbit, 0x0, NULL, HFILL } }, { &hf_batadv_batman_gwflags_ul_speed, { "Upload Speed", "batadv.batman.gwflags.ul_speed", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_kbit, 0x0, NULL, HFILL } }, { &hf_batadv_batman_tq, diff --git a/epan/dissectors/packet-bfd.c b/epan/dissectors/packet-bfd.c index 0de1c6a4ea..234d506f2b 100644 --- a/epan/dissectors/packet-bfd.c +++ b/epan/dissectors/packet-bfd.c @@ -480,8 +480,7 @@ dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d bfd_detect_time_multiplier, bfd_detect_time_multiplier * (bfd_desired_min_tx_interval/1000)); - proto_tree_add_uint_format_value(bfd_tree, hf_bfd_message_length, tvb, 3, 1, bfd_length, - "%u bytes", bfd_length); + proto_tree_add_uint(bfd_tree, hf_bfd_message_length, tvb, 3, 1, bfd_length); proto_tree_add_uint(bfd_tree, hf_bfd_my_discriminator, tvb, 4, 4, bfd_my_discriminator); @@ -713,7 +712,7 @@ proto_register_bfd(void) }, { &hf_bfd_message_length, { "Message Length", "bfd.message_length", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, "Length of the BFD Control packet, in bytes", HFILL } }, { &hf_bfd_my_discriminator, diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index 83aa784123..2de3feaf21 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -4649,8 +4649,7 @@ dissect_packetcable_mta_cap(proto_tree *v_tree, packet_info *pinfo, tvbuff_t *tv "Bogus length: %s", asc_val); return; } else { - proto_tree_add_uint_format_value(v_tree, hf_bootp_pkt_mta_cap_len, tvb, off, 2, - tlv_len, "%d", tlv_len); + proto_tree_add_uint(v_tree, hf_bootp_pkt_mta_cap_len, tvb, off, 2, tlv_len); off += 2; while (off - voff < len) { @@ -5152,8 +5151,7 @@ dissect_docsis_cm_cap(proto_tree *v_tree, tvbuff_t *tvb, int voff, int len, gboo tlv_type = tvb_get_guint8(tvb, off); /* Length */ tlv_len = tvb_get_guint8(tvb, off+1); - proto_tree_add_uint_format_value(v_tree, hf_bootp_docsis_cm_cap_len, tvb, off+1, 1, - tlv_len, "%d", tlv_len); + proto_tree_add_uint(v_tree, hf_bootp_docsis_cm_cap_len, tvb, off+1, 1, tlv_len); } else { @@ -5958,8 +5956,7 @@ dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U */ secs = tvb_get_letohs(tvb, 8); if (secs > 0 && secs <= 0xff) { - ti = proto_tree_add_uint_format_value(bp_tree, hf_bootp_secs, tvb, - 8, 2, secs, "%u", secs); + ti = proto_tree_add_uint(bp_tree, hf_bootp_secs, tvb, 8, 2, secs); expert_add_info_format(pinfo, ti, &ei_bootp_secs_le, "Seconds elapsed appears to be encoded as little-endian"); } else { proto_tree_add_item(bp_tree, hf_bootp_secs, tvb, diff --git a/epan/dissectors/packet-cattp.c b/epan/dissectors/packet-cattp.c index 9e293f4002..e79922e3b1 100644 --- a/epan/dissectors/packet-cattp.c +++ b/epan/dissectors/packet-cattp.c @@ -116,6 +116,8 @@ static const value_string cattp_reset_reason[] = { { 0, NULL } }; +static const unit_name_string units_pdu = { "PDU", "PDUs" }; + /* Forward declartion due to use of heuristic dissection preference. */ void proto_reg_handoff_cattp(void); void proto_register_cattp(void); @@ -181,8 +183,7 @@ dissect_cattp_eakpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *cattp_tree, guint8 eak_count; eak_count = (hlen - offset) >> 1; - eaki = proto_tree_add_uint_format_value(cattp_tree, hf_cattp_eaklen, tvb, offset, eak_count * 2, - eak_count, "%u PDUs", eak_count); + eaki = proto_tree_add_uint(cattp_tree, hf_cattp_eaklen, tvb, offset, eak_count * 2, eak_count); if (eak_count > 0) { proto_item *eak_tree; @@ -528,7 +529,7 @@ proto_register_cattp(void) { &hf_cattp_eaklen, { - "Extended Acknowledgement Numbers", "cattp.eaks", FT_UINT16, BASE_DEC, NULL, 0x0, + "Extended Acknowledgement Numbers", "cattp.eaks", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_pdu, 0x0, NULL, HFILL } } diff --git a/epan/dissectors/packet-cdp.c b/epan/dissectors/packet-cdp.c index d0014059e3..ed4719c631 100644 --- a/epan/dissectors/packet-cdp.c +++ b/epan/dissectors/packet-cdp.c @@ -268,6 +268,8 @@ static const value_string type_nrgyz_vals[] = { { 0, NULL } }; +static const unit_name_string units_mw = { "mW", NULL }; + static int dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { @@ -295,10 +297,7 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) proto_tree_add_item(cdp_tree, hf_cdp_version, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - proto_tree_add_uint_format_value(cdp_tree, hf_cdp_ttl, tvb, offset, 1, - tvb_get_guint8(tvb, offset), - "%u seconds", - tvb_get_guint8(tvb, offset)); + proto_tree_add_item(cdp_tree, hf_cdp_ttl, tvb, offset, 1, ENC_NA); offset += 1; /* Checksum display & verification code */ @@ -633,8 +632,7 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) tvb_get_ntohs(tvb, offset + 4)); proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN); - proto_tree_add_uint_format_value(tlv_tree, hf_cdp_power_consumption, tvb, offset + 4, 2, - tvb_get_ntohs(tvb, offset + 4), "%u mW", tvb_get_ntohs(tvb, offset + 4)); + proto_tree_add_item(tlv_tree, hf_cdp_power_consumption, tvb, offset + 4, 2, ENC_BIG_ENDIAN); } offset += length; break; @@ -753,15 +751,13 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) offset += 8; while(power_req_len) { if (power_req_len > 4) { - power_req = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(tlv_tree, hf_cdp_power_requested, tvb, offset, 4, power_req, "%u mW", power_req); + proto_tree_add_item_ret_uint(tlv_tree, hf_cdp_power_requested, tvb, offset, 4, ENC_BIG_ENDIAN, &power_req); proto_item_append_text(tlvi, "%u mW, ", power_req); power_req_len -= 4; offset += 4; } else { if (power_req_len == 4) { - power_req = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(tlv_tree, hf_cdp_power_requested, tvb, offset, 4, power_req, "%u mW", power_req); + proto_tree_add_item_ret_uint(tlv_tree, hf_cdp_power_requested, tvb, offset, 4, ENC_BIG_ENDIAN, &power_req); proto_item_append_text(tlvi, "%u mW", power_req); } offset += power_req_len; @@ -784,8 +780,7 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) offset += 8; while(power_avail_len) { if (power_avail_len >= 4) { - power_avail = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(tlv_tree, hf_cdp_power_available, tvb, offset, 4, power_avail, "%u mW", power_avail); + proto_tree_add_item_ret_uint(tlv_tree, hf_cdp_power_available, tvb, offset, 4, ENC_BIG_ENDIAN, &power_avail); proto_item_append_text(tlvi, "%u mW, ", power_avail); power_avail_len -= 4; offset += 4; @@ -1257,7 +1252,7 @@ proto_register_cdp(void) NULL, HFILL }}, { &hf_cdp_ttl, - { "TTL", "cdp.ttl", FT_UINT16, BASE_DEC, NULL, 0x0, + { "TTL", "cdp.ttl", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_second_seconds, 0x0, NULL, HFILL }}, { &hf_cdp_checksum, @@ -1374,7 +1369,7 @@ proto_register_cdp(void) { &hf_cdp_duplex, { "Duplex", "cdp.duplex", FT_BOOLEAN, BASE_NONE, TFS(&tfs_full_half), 0x0, NULL, HFILL }}, { &hf_cdp_data, { "Data", "cdp.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cdp_voice_vlan, { "Voice VLAN", "cdp.voice_vlan", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_cdp_power_consumption, { "Power Consumption", "cdp.power_consumption", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_cdp_power_consumption, { "Power Consumption", "cdp.power_consumption", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_mw, 0x0, NULL, HFILL }}, { &hf_cdp_mtu, { "MTU", "cdp.mtu", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cdp_trust_bitmap, { "Trust Bitmap", "cdp.trust_bitmap", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_cdp_untrusted_port_cos, { "Untrusted port CoS", "cdp.untrusted_port_cos", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, @@ -1384,8 +1379,8 @@ proto_register_cdp(void) { &hf_cdp_location, { "Location", "cdp.location", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cdp_request_id, { "Request-ID", "cdp.request_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cdp_management_id, { "Management-ID", "cdp.management_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_cdp_power_requested, { "Power Requested", "cdp.power_requested", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_cdp_power_available, { "Power Available", "cdp.power_available", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_cdp_power_requested, { "Power Requested", "cdp.power_requested", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_mw, 0x0, NULL, HFILL }}, + { &hf_cdp_power_available, { "Power Available", "cdp.power_available", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_mw, 0x0, NULL, HFILL }}, { &hf_cdp_encrypted_data, { "Encrypted Data", "cdp.encrypted_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cdp_seen_sequence, { "Seen Sequence?", "cdp.seen_sequence", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cdp_sequence_number, { "Sequence Number", "cdp.sequence_number", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-cip.c b/epan/dissectors/packet-cip.c index 5fc4692b4d..dc45845957 100644 --- a/epan/dissectors/packet-cip.c +++ b/epan/dissectors/packet-cip.c @@ -6008,7 +6008,7 @@ dissect_cip_cm_timeout(proto_tree *cmd_tree, tvbuff_t *tvb, int offset) /* Display the actual time out */ timeout = ( 1 << tick ) * timeout_tick; - proto_tree_add_uint_format_value(cmd_tree, hf_cip_cm_timeout, tvb, offset, 2, timeout, "%dms", timeout); + proto_tree_add_uint(cmd_tree, hf_cip_cm_timeout, tvb, offset, 2, timeout); } static void @@ -7872,7 +7872,7 @@ proto_register_cip(void) { &hf_cip_cm_priority, { "Priority", "cip.cm.priority", FT_UINT8, BASE_DEC, NULL, 0x10, NULL, HFILL }}, { &hf_cip_cm_tick_time, { "Tick time", "cip.cm.tick_time", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }}, { &hf_cip_cm_timeout_tick, { "Time-out ticks", "cip.cm.timeout_tick", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }}, - { &hf_cip_cm_timeout, { "Actual Time Out", "cip.cm.timeout", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, + { &hf_cip_cm_timeout, { "Actual Time Out", "cip.cm.timeout", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0, NULL, HFILL }}, { &hf_cip_cm_ot_connid, { "O->T Network Connection ID", "cip.cm.ot_connid", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_cip_cm_to_connid, { "T->O Network Connection ID", "cip.cm.to_connid", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_cip_cm_conn_serial_num, { "Connection Serial Number", "cip.cm.conn_serial_num", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-cipmotion.c b/epan/dissectors/packet-cipmotion.c index 780f942a29..2bd2d04ff2 100644 --- a/epan/dissectors/packet-cipmotion.c +++ b/epan/dissectors/packet-cipmotion.c @@ -1520,7 +1520,6 @@ static void dissect_var_inst_header(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint8* inst_number, guint32* cyc_size, guint32* cyc_blk_size, guint32* evnt_size, guint32* servc_size) { - guint8 temp_data; proto_tree *header_tree; /* Create the tree for the entire instance data header */ @@ -1536,34 +1535,26 @@ dissect_var_inst_header(tvbuff_t* tvb, proto_tree* tree, guint32 offset, guint8* * block uses since all blocks should pad up to 32-bits so to convert to bytes each is multiplied by 4 */ /* Read the instance block size field in bytes from the instance data header */ - temp_data = tvb_get_guint8(tvb, offset + 2); - proto_tree_add_uint_format_value(header_tree, hf_var_devce_instance_block_size, - tvb, offset + 2, 1, temp_data, "%d words", temp_data); + proto_tree_add_item(header_tree, hf_var_devce_instance_block_size, tvb, offset + 2, 1, ENC_NA); /* Read the cyclic block size field in bytes from the instance data header */ - temp_data = tvb_get_guint8(tvb, offset + 3); - proto_tree_add_uint_format_value(header_tree, hf_var_devce_cyclic_block_size, - tvb, offset + 3, 1, temp_data, "%d words", temp_data); + proto_tree_add_item(header_tree, hf_var_devce_cyclic_block_size, tvb, offset + 3, 1, ENC_NA); /* Read the cyclic command block size field in bytes from the instance data header */ *cyc_size = (tvb_get_guint8(tvb, offset + 4) * 4); - proto_tree_add_uint_format_value(header_tree, hf_var_devce_cyclic_data_block_size, - tvb, offset + 4, 1, (*cyc_size)/4, "%d words", (*cyc_size)/4); + proto_tree_add_item(header_tree, hf_var_devce_cyclic_data_block_size, tvb, offset + 4, 1, ENC_NA); /* Read the cyclic write block size field in bytes from the instance data header */ *cyc_blk_size = (tvb_get_guint8(tvb, offset + 5) * 4); - proto_tree_add_uint_format_value(header_tree, hf_var_devce_cyclic_rw_block_size, - tvb, offset + 5, 1, (*cyc_blk_size)/4, "%d words", (*cyc_blk_size)/4); + proto_tree_add_item(header_tree, hf_var_devce_cyclic_rw_block_size, tvb, offset + 5, 1, ENC_NA); /* Read the event block size in bytes from the instance data header */ *evnt_size = (tvb_get_guint8(tvb, offset + 6) * 4); - proto_tree_add_uint_format_value(header_tree, hf_var_devce_event_block_size, - tvb, offset + 6, 1, (*evnt_size)/4, "%d words", (*evnt_size)/4); + proto_tree_add_item(header_tree, hf_var_devce_event_block_size, tvb, offset + 6, 1, ENC_NA); /* Read the service block size in bytes from the instance data header */ *servc_size = (tvb_get_guint8(tvb, offset + 7) * 4); - proto_tree_add_uint_format_value(header_tree, hf_var_devce_service_block_size, - tvb, offset + 7, 1, (*servc_size)/4, "%d words", (*servc_size)/4); + proto_tree_add_item(header_tree, hf_var_devce_service_block_size, tvb, offset + 7, 1, ENC_NA); } /* @@ -2675,32 +2666,32 @@ proto_register_cipmotion(void) }, { &hf_var_devce_instance_block_size, { "Instance Block Size", "cipm.var_devce.header.instance_block_size", - FT_UINT8, BASE_DEC, NULL, 0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_word_words, 0, "Variable Device Header: Instance Block Size", HFILL} }, { &hf_var_devce_cyclic_block_size, { "Cyclic Block Size", "cipm.var_devce.header.cyclic_block_size", - FT_UINT8, BASE_DEC, NULL, 0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_word_words, 0, "Variable Device Header: Cyclic Block Size", HFILL} }, { &hf_var_devce_cyclic_data_block_size, { "Cyclic Data Block Size", "cipm.var_devce.header.cyclic_data_block_size", - FT_UINT8, BASE_DEC, NULL, 0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_word_words, 0, "Variable Device Header: Cyclic Data Block Size", HFILL} }, { &hf_var_devce_cyclic_rw_block_size, { "Cyclic Read/Write Block Size", "cipm.var_devce.header.cyclic_rw_block_size", - FT_UINT8, BASE_DEC, NULL, 0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_word_words, 0, "Variable Device Header: Cyclic Read/Write Block Size", HFILL} }, { &hf_var_devce_event_block_size, { "Event Block Size", "cipm.var_devce.header.event_block_size", - FT_UINT8, BASE_DEC, NULL, 0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_word_words, 0, "Variable Device Header: Event Block Size", HFILL} }, { &hf_var_devce_service_block_size, { "Service Block Size", "cipm.var_devce.header.service_block_size", - FT_UINT8, BASE_DEC, NULL, 0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_word_words, 0, "Variable Device Header: Service Block Size", HFILL} }, diff --git a/epan/dissectors/packet-dccp.c b/epan/dissectors/packet-dccp.c index 2850cba002..3c67c5f628 100644 --- a/epan/dissectors/packet-dccp.c +++ b/epan/dissectors/packet-dccp.c @@ -165,6 +165,8 @@ static const range_string dccp_feature_numbers_rvals[] = { {0, 0, NULL} }; +static const unit_name_string units_bytes_sec = { "bytes/sec", NULL }; + static int proto_dccp = -1; static int dccp_tap = -1; @@ -1245,7 +1247,7 @@ proto_register_dccp(void) { &hf_dccp_data_dropped, { "Data Dropped", "dccp.data_dropped", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_dccp_ccid3_loss_event_rate, { "CCID3 Loss Event Rate", "dccp.ccid3_loss_event_rate", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dccp_ccid3_loss_intervals, { "CCID3 Loss Intervals", "dccp.ccid3_loss_intervals", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_dccp_ccid3_receive_rate, { "CCID3 Receive Rate", "dccp.ccid3_receive_rate", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_ccid3_receive_rate, { "CCID3 Receive Rate", "dccp.ccid3_receive_rate", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_bytes_sec, 0x0, NULL, HFILL }}, { &hf_dccp_option_reserved, { "Reserved", "dccp.option_reserved", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_dccp_ccid_option_data, { "CCID option", "dccp.ccid_option_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_dccp_option_unknown, { "Unknown", "dccp.option_unknown", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-dhcp-failover.c b/epan/dissectors/packet-dhcp-failover.c index 7321dd92fa..3dcecda0f3 100644 --- a/epan/dissectors/packet-dhcp-failover.c +++ b/epan/dissectors/packet-dhcp-failover.c @@ -803,11 +803,9 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da proto_item_append_text(oi,", %u seconds", receive_timer); - proto_tree_add_uint_format_value(option_tree, + proto_tree_add_uint(option_tree, hf_dhcpfo_receive_timer, tvb, offset, - option_length, receive_timer, - "%u seconds", - receive_timer); + option_length, receive_timer); break; case DHCP_FO_PD_HASH_BUCKET_ASSIGNMENT: @@ -1079,7 +1077,7 @@ proto_register_dhcpfo(void) {&hf_dhcpfo_receive_timer, {"Receive timer", "dhcpfo.receivetimer", - FT_UINT32, BASE_DEC, NULL, 0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_second_seconds, 0, NULL, HFILL } }, diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c index 95a84386d2..15c638a5c6 100644 --- a/epan/dissectors/packet-dhcpv6.c +++ b/epan/dissectors/packet-dhcpv6.c @@ -1768,8 +1768,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, } temp_optlen = tvb_get_ntohs(tvb, off); - proto_tree_add_uint_format_value(subtree, hf_elapsed_time, tvb, off, - 2, temp_optlen*10, "%u ms", temp_optlen*10); + proto_tree_add_uint(subtree, hf_elapsed_time, tvb, off, 2, temp_optlen*10); break; case OPTION_RELAY_MSG: if (optlen == 0) { @@ -2402,7 +2401,7 @@ proto_register_dhcpv6(void) { &hf_option_preference, { "Pref-value", "dhcpv6.option_preference", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}}, { &hf_elapsed_time, - { "Elapsed time", "dhcpv6.elapsed_time", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}}, + { "Elapsed time", "dhcpv6.elapsed_time", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0, NULL, HFILL}}, { &hf_auth_protocol, { "Protocol", "dhcpv6.auth.protocol", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}}, { &hf_auth_algorithm, diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index 8b6b078af0..e29a9bef7e 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -2654,8 +2654,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, case AL_OBJ_TDELAYF: /* Time Delay - Fine (Obj:52, Var:02) */ - al_val_uint16 = tvb_get_letohs(tvb, data_pos); - proto_tree_add_uint_format_value(object_tree, hf_dnp3_al_time_delay, tvb, data_pos, 2, al_val_uint16, "%u ms", al_val_uint16); + proto_tree_add_item(object_tree, hf_dnp3_al_time_delay, tvb, data_pos, 2, ENC_LITTLE_ENDIAN); data_pos += 2; proto_item_set_len(point_item, data_pos - offset); @@ -4541,7 +4540,7 @@ proto_register_dnp3(void) { &hf_dnp3_al_count, { "Count", "dnp3.al.count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dnp3_al_on_time, { "On Time", "dnp3.al.on_time", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dnp3_al_off_time, { "Off Time", "dnp3.al.off_time", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_dnp3_al_time_delay, { "Time Delay", "dnp3.al.time_delay", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_dnp3_al_time_delay, { "Time Delay", "dnp3.al.time_delay", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_dnp3_al_file_string_offset, { "File String Offset", "dnp3.al.file_string_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dnp3_al_file_string_length, { "File String Length", "dnp3.al.file_string_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dnp3_al_file_name, { "File Name", "dnp3.al.file_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-dsi.c b/epan/dissectors/packet-dsi.c index d760125bbb..432fbe68bd 100644 --- a/epan/dissectors/packet-dsi.c +++ b/epan/dissectors/packet-dsi.c @@ -228,7 +228,6 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da guint16 dsi_requestid; gint32 dsi_code; guint32 dsi_length; - guint32 dsi_reserved; struct aspinfo aspinfo; @@ -240,7 +239,6 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da dsi_requestid = tvb_get_ntohs(tvb, 2); dsi_code = tvb_get_ntohl(tvb, 4); dsi_length = tvb_get_ntohl(tvb, 8); - dsi_reserved = tvb_get_ntohl(tvb, 12); col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s (%u)", val_to_str(dsi_flags, flag_vals, @@ -271,11 +269,10 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da 4, 4, dsi_code); break; } - proto_tree_add_uint_format_value(dsi_tree, hf_dsi_length, tvb, - 8, 4, dsi_length, - "%u bytes", dsi_length); - proto_tree_add_uint(dsi_tree, hf_dsi_reserved, tvb, - 12, 4, dsi_reserved); + proto_tree_add_item(dsi_tree, hf_dsi_length, tvb, + 8, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(dsi_tree, hf_dsi_reserved, tvb, + 12, 4, ENC_BIG_ENDIAN); } switch (dsi_command) { @@ -389,7 +386,7 @@ proto_register_dsi(void) { &hf_dsi_length, { "Length", "dsi.length", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, "Total length of the data that follows the DSI header.", HFILL }}, { &hf_dsi_reserved, diff --git a/epan/dissectors/packet-ecmp.c b/epan/dissectors/packet-ecmp.c index adcdbfe158..f4a907ee1c 100644 --- a/epan/dissectors/packet-ecmp.c +++ b/epan/dissectors/packet-ecmp.c @@ -1029,7 +1029,7 @@ static int get_response_size(int offset, tvbuff_t *tvb, proto_tree* ecmp_tree) /*display chunks and max response size in response subtree*/ proto_tree_add_item(ecmp_response_size_tree, hf_ecmp_chunking, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_tree_add_uint_format_value(ecmp_response_size_tree, hf_ecmp_max_response_size, tvb, offset, 2, max_response_size, "%d bytes", max_response_size); + proto_tree_add_item(ecmp_response_size_tree, hf_ecmp_max_response_size, tvb, offset, 2, ENC_BIG_ENDIAN); offset+= 2; return offset; @@ -2182,11 +2182,8 @@ static int add_cyclic_setup_attributes(packet_info* pinfo, int offset, guint16 l case 7: /* rx timeout */ { - guint32 val; - /* tout */ - val = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(cyclic_setup_attrib_item, hf_ecmp_rx_timeout, tvb, offset, 4, val, "%dus", val); + proto_tree_add_item(cyclic_setup_attrib_item, hf_ecmp_rx_timeout, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; /* action */ @@ -3223,7 +3220,7 @@ void proto_register_ecmp (void) { "Chunks allowed","ecmp.chunking", FT_UINT16, BASE_DEC, NULL,0xF000, "ECMP number of chunks allowed", HFILL}}, { &hf_ecmp_max_response_size, - { "Maximum Response Size","ecmp.response_size", FT_UINT16, BASE_DEC, NULL,0x0FFF, NULL, HFILL}}, + { "Maximum Response Size","ecmp.response_size", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0FFF, NULL, HFILL}}, { &hf_ecmp_category, { "Device", "ecmp.category", FT_UINT8, BASE_DEC, VALS(category), 0x0, "ECMP Category (drive or option module)", HFILL }}, @@ -3480,7 +3477,7 @@ void proto_register_ecmp (void) { &hf_ecmp_file_length, { "File length", "ecmp.file_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ecmp_mec_offset, { "mec_offset", "ecmp.mec_offset", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ecmp_sample_period, { "Sample period", "ecmp.sample_period", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_ecmp_rx_timeout, { "RX Timeout", "ecmp.rx_timeout", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ecmp_rx_timeout, { "RX Timeout", "ecmp.rx_timeout", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0, NULL, HFILL }}, { &hf_ecmp_rx_action, { "Action", "ecmp.rx_action", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ecmp_rx_event_destination, { "Event Destination", "ecmp.rx_event_destination", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ecmp_rx_event, { "Event", "ecmp.rx_event", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-ehdlc.c b/epan/dissectors/packet-ehdlc.c index a96e63c1db..e166a8b1c3 100644 --- a/epan/dissectors/packet-ehdlc.c +++ b/epan/dissectors/packet-ehdlc.c @@ -243,12 +243,12 @@ dissect_ehdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(ehdlc_tree, hf_ehdlc_ctei, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint_format_value(ehdlc_tree, hf_ehdlc_c_r, - tvb, offset, 1, c_r, "%d", c_r); - proto_tree_add_uint_format_value(ehdlc_tree, hf_ehdlc_sapi, - tvb, offset, 1, sapi, "%d", sapi); - proto_tree_add_uint_format_value(ehdlc_tree, hf_ehdlc_tei, - tvb, offset, 1, tei, "%d", tei); + proto_tree_add_uint(ehdlc_tree, hf_ehdlc_c_r, + tvb, offset, 1, c_r); + proto_tree_add_uint(ehdlc_tree, hf_ehdlc_sapi, + tvb, offset, 1, sapi); + proto_tree_add_uint(ehdlc_tree, hf_ehdlc_tei, + tvb, offset, 1, tei); proto_tree_add_item(ehdlc_tree, hf_ehdlc_data_len, tvb, offset, 2, ENC_BIG_ENDIAN); } diff --git a/epan/dissectors/packet-esis.c b/epan/dissectors/packet-esis.c index 6403822d4a..ea8d6ad692 100644 --- a/epan/dissectors/packet-esis.c +++ b/epan/dissectors/packet-esis.c @@ -138,23 +138,19 @@ static void esis_dissect_esh_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo) { proto_tree *esis_area_tree; int offset = 0; - int no_sa = 0; - int sal = 0; + guint no_sa, sal; proto_item *ti; offset += ESIS_HDR_FIXED_LENGTH; - no_sa = tvb_get_guint8(tvb, offset); - len -= 1; - - ti = proto_tree_add_uint( tree, hf_esis_number_of_source_addresses, tvb, offset, 1, no_sa); + ti = proto_tree_add_item_ret_uint( tree, hf_esis_number_of_source_addresses, tvb, offset, 1, ENC_NA, &no_sa); + len--; offset++; esis_area_tree = proto_item_add_subtree( ti, ett_esis_area_addr ); while ( no_sa-- > 0 ) { - sal = (int) tvb_get_guint8(tvb, offset); - proto_tree_add_uint_format_value(esis_area_tree, hf_esis_sal, tvb, offset, 1, sal, "%2u Octets", sal); + proto_tree_add_item_ret_uint(esis_area_tree, hf_esis_sal, tvb, offset, 1, ENC_NA, &sal); offset++; proto_tree_add_string(esis_area_tree, hf_esis_sa, tvb, offset, sal, print_nsap_net(tvb, offset, sal ) ); offset += sal; @@ -176,7 +172,7 @@ esis_dissect_ish_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree, packet_info * netl = (int) tvb_get_guint8(tvb, offset); network_tree = proto_tree_add_subtree( tree, tvb, offset, netl + 1, ett_esis_network, NULL, "### Network Entity Title Section ###"); - proto_tree_add_uint_format_value(network_tree, hf_esis_netl, tvb, offset++, 1, netl, "%2u Octets", netl); + proto_tree_add_uint(network_tree, hf_esis_netl, tvb, offset++, 1, netl); proto_tree_add_string(network_tree, hf_esis_net, tvb, offset, netl, print_nsap_net( tvb, offset, netl ) ); offset += netl; len -= ( netl + 1 ); @@ -196,7 +192,7 @@ esis_dissect_redirect_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree, packet_i tmpl = (int) tvb_get_guint8(tvb, offset); dest_tree = proto_tree_add_subtree( tree, tvb, offset, tmpl + 1, ett_esis_dest_addr, NULL, "### Destination Address Section ###" ); - proto_tree_add_uint_format_value(dest_tree, hf_esis_dal, tvb, offset++, 1, tmpl, "%2u Octets", tmpl); + proto_tree_add_uint(dest_tree, hf_esis_dal, tvb, offset++, 1, tmpl); proto_tree_add_string( dest_tree, hf_esis_da, tvb, offset, tmpl, print_nsap_net( tvb, offset, tmpl ) ); offset += tmpl; @@ -205,7 +201,7 @@ esis_dissect_redirect_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree, packet_i subnet_tree = proto_tree_add_subtree( tree, tvb, offset, tmpl + 1, ett_esis_subnetwork, NULL, "### Subnetwork Address Section ###"); - proto_tree_add_uint_format_value(subnet_tree, hf_esis_bsnpal, tvb, offset++, 1, tmpl, "%2u Octets", tmpl); + proto_tree_add_uint(subnet_tree, hf_esis_bsnpal, tvb, offset++, 1, tmpl); proto_tree_add_item(subnet_tree, hf_esis_bsnpa, tvb, offset, tmpl, ENC_NA); offset += tmpl; len -= ( tmpl + 1 ); @@ -220,7 +216,7 @@ esis_dissect_redirect_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree, packet_i else { network_tree = proto_tree_add_subtree( tree, tvb, offset, 1, ett_esis_network, NULL, "### Network Entity Title Section ###" ); - proto_tree_add_uint_format_value(network_tree, hf_esis_netl, tvb, offset++, 1, tmpl, "%2u Octets", tmpl ); + proto_tree_add_uint(network_tree, hf_esis_netl, tvb, offset++, 1, tmpl); proto_tree_add_string( network_tree, hf_esis_net, tvb, offset, tmpl, print_nsap_net( tvb, offset, tmpl ) ); offset += tmpl; @@ -251,7 +247,7 @@ dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ proto_item *ti, *type_item; proto_tree *esis_tree = NULL; guint8 variable_len, type; - guint16 holdtime, checksum; + guint16 checksum; col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESIS"); col_clear(pinfo->cinfo, COL_INFO); @@ -281,9 +277,7 @@ dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ type_item = proto_tree_add_item( esis_tree, hf_esis_type, tvb, 4, 1, ENC_BIG_ENDIAN); type = tvb_get_guint8(tvb, 4) & OSI_PDU_TYPE_MASK; - holdtime = tvb_get_ntohs(tvb, 5); - proto_tree_add_uint_format_value(esis_tree, hf_esis_holdtime, tvb, 5, 2, - holdtime, "%u seconds", holdtime); + proto_tree_add_item(esis_tree, hf_esis_holdtime, tvb, 5, 2, ENC_BIG_ENDIAN); checksum = tvb_get_ntohs(tvb, 7); if (checksum == 0) { @@ -364,7 +358,7 @@ proto_register_esis(void) { { "PDU Type", "esis.type", FT_UINT8, BASE_DEC, VALS(esis_vals), OSI_PDU_TYPE_MASK, NULL, HFILL }}, { &hf_esis_holdtime, - { "Holding Time", "esis.htime", FT_UINT16, BASE_DEC, NULL, 0x0, "s", HFILL }}, + { "Holding Time", "esis.htime", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_second_seconds, 0x0, NULL, HFILL }}, { &hf_esis_checksum, { "Checksum", "esis.chksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, @@ -374,11 +368,11 @@ proto_register_esis(void) { /* Generated from convert_proto_tree_add_text.pl */ { &hf_esis_number_of_source_addresses, { "Number of Source Addresses (SA, Format: NSAP)", "esis.number_of_source_addresses", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_esis_sal, { "SAL", "esis.sal", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_esis_sal, { "SAL", "esis.sal", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, { &hf_esis_sa, { "SA", "esis.sa", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_esis_netl, { "NETL", "esis.netl", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_esis_dal, { "DAL", "esis.dal", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_esis_bsnpal, { "BSNPAL", "esis.bsnpal", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_esis_netl, { "NETL", "esis.netl", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, + { &hf_esis_dal, { "DAL", "esis.dal", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, + { &hf_esis_bsnpal, { "BSNPAL", "esis.bsnpal", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, { &hf_esis_net, { "NET", "esis.net", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_esis_da, { "DA", "esis.da", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_esis_bsnpa, { "BSNPA", "esis.bsnpa", FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c index 8befc40de5..22212d2117 100644 --- a/epan/dissectors/packet-fcswils.c +++ b/epan/dissectors/packet-fcswils.c @@ -730,8 +730,6 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g /* We skip the initial 4 bytes as we don't care about the opcode */ int offset = 4; const gchar *flags; - guint32 r_a_tov; - guint32 e_d_tov; guint16 isl_flwctrl_mode; guint8 clsf_svcparm[6], cls1_svcparm[2], cls2_svcparm[2], cls3_svcparm[2]; @@ -740,13 +738,9 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g proto_tree_add_item(elp_tree, hf_swils_elp_rev, tvb, offset++, 1, ENC_BIG_ENDIAN); proto_tree_add_item(elp_tree, hf_swils_elp_flags, tvb, offset, 2, ENC_NA); offset += 3; - r_a_tov = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(elp_tree, hf_swils_elp_r_a_tov, tvb, offset, 4, - r_a_tov, "%d msecs", r_a_tov); + proto_tree_add_item(elp_tree, hf_swils_elp_r_a_tov, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - e_d_tov = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(elp_tree, hf_swils_elp_e_d_tov, tvb, offset, 4, - e_d_tov, "%d msecs", e_d_tov); + proto_tree_add_item(elp_tree, hf_swils_elp_e_d_tov, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(elp_tree, hf_swils_elp_req_epn, tvb, offset, 8, ENC_NA); offset += 8; @@ -1009,8 +1003,7 @@ static void dissect_swils_fspf_lsrechdr(tvbuff_t *tvb, proto_tree *tree, int offset) { proto_tree_add_item(tree, hf_swils_lsrh_lsr_type, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint_format_value(tree, hf_swils_lsrh_lsr_age, tvb, offset+2, 2, - tvb_get_ntohs(tvb, offset+2), "%d secs", tvb_get_ntohs(tvb, offset+2)); + proto_tree_add_item(tree, hf_swils_lsrh_lsr_age, tvb, offset+2, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_swils_lsrh_options, tvb, offset+4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_swils_lsrh_lsid, tvb, offset+11, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_swils_lsrh_adv_domid, tvb, offset+15, 1, ENC_BIG_ENDIAN); @@ -1831,12 +1824,12 @@ proto_register_fcswils(void) { &hf_swils_elp_r_a_tov, {"R_A_TOV", "swils.elp.ratov", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL}}, { &hf_swils_elp_e_d_tov, {"E_D_TOV", "swils.elp.edtov", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL}}, { &hf_swils_elp_req_epn, @@ -2461,7 +2454,7 @@ proto_register_fcswils(void) /* Generated from convert_proto_tree_add_text.pl */ { &hf_swils_requested_domain_id, { "Requested Domain ID", "swils.requested_domain_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_swils_granted_domain_id, { "Granted Domain ID", "swils.granted_domain_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_swils_lsrh_lsr_age, { "LSR Age", "swils.lsr.age", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_lsrh_lsr_age, { "LSR Age", "swils.lsr.age", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_seconds, 0x0, NULL, HFILL }}, { &hf_swils_lsrh_options, { "Options", "swils.lsr.options", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_swils_lsrh_checksum, { "Checksum", "swils.lsr.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_swils_lsrh_lsr_length, { "LSR Length", "swils.lsr.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-forces.c b/epan/dissectors/packet-forces.c index 745e90d09f..1c95bdd505 100644 --- a/epan/dissectors/packet-forces.c +++ b/epan/dissectors/packet-forces.c @@ -371,9 +371,8 @@ dissect_operation_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint expert_add_info_format(pinfo, ti, &ei_forces_lfbselect_tlv_type_operation_type, "Bogus: ForCES Operation TLV (Type:0x%04x) is not supported", type); - length = tvb_get_ntohs(tvb, offset+2); - proto_tree_add_uint_format_value(oper_tree, hf_forces_lfbselect_tlv_type_operation_length, - tvb, offset+2, 2, length, "%u Bytes", length); + proto_tree_add_item_ret_uint(oper_tree, hf_forces_lfbselect_tlv_type_operation_length, + tvb, offset+2, 2, ENC_BIG_ENDIAN, &length); dissect_path_data_tlv(tvb, pinfo, oper_tree, offset+TLV_TL_LENGTH); if (length == 0) @@ -421,8 +420,7 @@ dissect_redirecttlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint of proto_tree_add_item(meta_data_tree, hf_forces_redirect_tlv_meta_data_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); length_meta = tvb_get_ntohs(tvb, offset+2); - proto_tree_add_uint_format_value(meta_data_tree, hf_forces_redirect_tlv_meta_data_tlv_length, tvb, offset+2, 2, - length_meta, "%u Bytes", length_meta); + proto_tree_add_uint(meta_data_tree, hf_forces_redirect_tlv_meta_data_tlv_length, tvb, offset+2, 2, length_meta); proto_item_set_len(ti, length_meta); start_offset = offset; @@ -434,8 +432,8 @@ dissect_redirecttlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint of proto_tree_add_item(meta_data_ilv_tree, hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv_id, tvb, offset+8, 4, ENC_BIG_ENDIAN); length_ilv = tvb_get_ntohl(tvb, offset+12); - proto_tree_add_uint_format_value(meta_data_ilv_tree, hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv_length, - tvb, offset+12, 4, length_ilv, "%u Bytes", length_ilv); + proto_tree_add_uint(meta_data_ilv_tree, hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv_length, + tvb, offset+12, 4, length_ilv); offset += 8; if (length_ilv > 0) { proto_tree_add_item(meta_data_ilv_tree, hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv, @@ -457,8 +455,8 @@ dissect_redirecttlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint of proto_tree_add_item(redirect_data_tree, hf_forces_redirect_tlv_redirect_data_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); length_redirect = tvb_get_ntohs(tvb, offset+2); - proto_tree_add_uint_format_value(redirect_data_tree, hf_forces_redirect_tlv_redirect_data_tlv_length, - tvb, offset+2, 2, length_redirect, "%u Bytes", length_redirect); + proto_tree_add_uint(redirect_data_tree, hf_forces_redirect_tlv_redirect_data_tlv_length, + tvb, offset+2, 2, length_redirect); if (tvb_reported_length_remaining(tvb, offset) < length_redirect) { @@ -549,8 +547,8 @@ dissect_forces(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offs tlv_item = proto_tree_add_item(forces_tlv_tree, hf_forces_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); length_count = tvb_get_ntohs(tvb, offset+2) * 4; proto_item_set_len(ti, length_count); - ti = proto_tree_add_uint_format_value(forces_tlv_tree, hf_forces_tlv_length, - tvb, offset+2, 2, length_count, "%u Bytes", length_count); + ti = proto_tree_add_uint(forces_tlv_tree, hf_forces_tlv_length, + tvb, offset+2, 2, length_count); if (tvb_reported_length_remaining(tvb, offset) < length_count) expert_add_info_format(pinfo, ti, &ei_forces_tlv_length, "Bogus: Main TLV length (%u bytes) is wrong", length_count); @@ -659,7 +657,7 @@ proto_register_forces(void) }, { &hf_forces_tlv_length, { "Length", "forces.tlv.length", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL } }, /*flags*/ { &hf_forces_flags, @@ -710,7 +708,7 @@ proto_register_forces(void) }, { &hf_forces_lfbselect_tlv_type_operation_length, { "Length", "forces.lfbselect.tlv.type.operation.length", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL } }, { &hf_forces_lfbselect_tlv_type_operation_path_type, { "Type", "forces.lfbselect.tlv.type.operation.path.type", @@ -751,7 +749,7 @@ proto_register_forces(void) }, { &hf_forces_redirect_tlv_meta_data_tlv_length, { "Length", "forces.redirect.tlv.meta.data.tlv.length", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL } }, { &hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv, { "Meta Data ILV", "forces.redirect.tlv.meta.data.tlv.meta.data.ilv", @@ -763,7 +761,7 @@ proto_register_forces(void) }, { &hf_forces_redirect_tlv_meta_data_tlv_meta_data_ilv_length, { "Length", "forces.redirect.tlv.meta.data.tlv.meta.data.ilv.length", - FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL } }, { &hf_forces_redirect_tlv_redirect_data_tlv_type, { "Type", "forces.redirect.tlv.redirect.data.tlv.type", @@ -771,7 +769,7 @@ proto_register_forces(void) }, { &hf_forces_redirect_tlv_redirect_data_tlv_length, { "Length", "forces.redirect.tlv.redirect.data.tlv.length", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL } }, { &hf_forces_asresult_association_setup_result, { "Association Setup Result", "forces.teardown.reason", diff --git a/epan/dissectors/packet-geneve.c b/epan/dissectors/packet-geneve.c index 0b76ff2ce6..1b27c89b6a 100644 --- a/epan/dissectors/packet-geneve.c +++ b/epan/dissectors/packet-geneve.c @@ -60,7 +60,6 @@ void proto_reg_handoff_geneve(void); static int proto_geneve = -1; static int hf_geneve_version = -1; -static int hf_geneve_opt_len = -1; static int hf_geneve_flags = -1; static int hf_geneve_flag_oam = -1; static int hf_geneve_flag_critical = -1; @@ -177,8 +176,7 @@ dissect_unknown_option(tvbuff_t *tvb, proto_tree *opts_tree, int offset, PROTO_ITEM_SET_HIDDEN(flag_item); } - proto_tree_add_uint_format_value(opt_tree, hf_geneve_option_length, tvb, - offset, 1, len, "%u bytes", len); + proto_tree_add_uint(opt_tree, hf_geneve_option_length, tvb, offset, 1, len); offset += 1; proto_tree_add_item(opt_tree, hf_geneve_opt_unknown_data, tvb, offset, @@ -258,8 +256,8 @@ dissect_geneve(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ /* Option length. */ opts_len = (ver_opt & HDR_OPTS_LEN_MASK) * 4; - proto_tree_add_uint_format_value(geneve_tree, hf_geneve_opt_len, tvb, - offset, 1, opts_len, "%u bytes", opts_len); + proto_tree_add_uint(geneve_tree, hf_geneve_option_length, tvb, + offset, 1, opts_len); offset += 1; /* Flags. */ @@ -330,11 +328,6 @@ proto_register_geneve(void) FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL } }, - { &hf_geneve_opt_len, - { "Options Length", "geneve.options_length", - FT_UINT8, BASE_DEC, NULL, 0x0, - NULL, HFILL } - }, { &hf_geneve_flags, { "Flags", "geneve.flags", FT_UINT8, BASE_HEX, NULL, 0x00, @@ -402,7 +395,7 @@ proto_register_geneve(void) }, { &hf_geneve_option_length, { "Length", "geneve.option.length", - FT_UINT8, BASE_DEC, NULL, 0x00, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x00, NULL, HFILL } }, { &hf_geneve_opt_unknown, diff --git a/epan/dissectors/packet-gsm_a_dtap.c b/epan/dissectors/packet-gsm_a_dtap.c index edbc7ee6b7..4f53081239 100644 --- a/epan/dissectors/packet-gsm_a_dtap.c +++ b/epan/dissectors/packet-gsm_a_dtap.c @@ -3637,7 +3637,6 @@ de_tp_ue_test_loop_mode(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 curr_offset; guchar oct; guint8 lb_setup_length,i,j; - guint16 value; proto_tree* subtree; curr_offset = offset; @@ -3655,8 +3654,7 @@ de_tp_ue_test_loop_mode(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, for (i=0,j=0; (ihas_frequency = TRUE; phdr->frequency = channel; - proto_tree_add_uint_format_value(wlan_tree, hf_netmon_802_11_frequency, - tvb, offset, 4, channel, - "%u Mhz", channel); + proto_tree_add_uint(wlan_tree, hf_netmon_802_11_frequency, + tvb, offset, 4, channel); calc_channel = ieee80211_mhz_to_chan(channel); if (calc_channel != -1) { phdr->has_channel = TRUE; @@ -363,7 +362,7 @@ proto_register_netmon_802_11(void) { &hf_netmon_802_11_channel, { "Channel", "netmon_802_11.channel", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_netmon_802_11_frequency, { "Center frequency", "netmon_802_11.frequency", FT_UINT32, - BASE_DEC, NULL, 0x0, NULL, HFILL } }, + BASE_DEC|BASE_UNIT_STRING, &units_mhz, 0x0, NULL, HFILL } }, { &hf_netmon_802_11_rssi, { "RSSI", "netmon_802_11.rssi", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_netmon_802_11_datarate, { "Data rate", "netmon_802_11.datarate", FT_UINT32, diff --git a/epan/dissectors/packet-ieee80211-radio.c b/epan/dissectors/packet-ieee80211-radio.c index b6dd93783d..c5205db1b4 100644 --- a/epan/dissectors/packet-ieee80211-radio.c +++ b/epan/dissectors/packet-ieee80211-radio.c @@ -688,10 +688,7 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, if (phdr->has_signal_percent) { col_add_fstr(pinfo->cinfo, COL_RSSI, "%u%%", phdr->signal_percent); - proto_tree_add_uint_format_value(radio_tree, hf_wlan_radio_signal_percent, tvb, 0, 0, - phdr->signal_percent, - "%u%%", - phdr->signal_percent); + proto_tree_add_uint(radio_tree, hf_wlan_radio_signal_percent, tvb, 0, 0, phdr->signal_percent); } if (phdr->has_signal_dbm) { @@ -703,10 +700,7 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, } if (phdr->has_noise_percent) { - proto_tree_add_uint_format_value(radio_tree, hf_wlan_radio_noise_percent, tvb, 0, 0, - phdr->noise_percent, - "%u%%", - phdr->noise_percent); + proto_tree_add_uint(radio_tree, hf_wlan_radio_noise_percent, tvb, 0, 0, phdr->noise_percent); } if (phdr->has_noise_dbm) { @@ -923,10 +917,7 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, } if (duration) { - proto_item *item = proto_tree_add_uint_format_value(radio_tree, hf_wlan_radio_duration, tvb, 0, 0, - duration, - "%d us", - duration); + proto_item *item = proto_tree_add_uint(radio_tree, hf_wlan_radio_duration, tvb, 0, 0, duration); PROTO_ITEM_SET_GENERATED(item); if (assumed_short_preamble) @@ -942,10 +933,7 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, if (preamble) { proto_tree *d_tree = proto_item_add_subtree(item, ett_wlan_radio_duration); - proto_item *p_item = proto_tree_add_uint_format_value(d_tree, hf_wlan_radio_preamble, tvb, 0, 0, - preamble, - "%d us", - preamble); + proto_item *p_item = proto_tree_add_uint(d_tree, hf_wlan_radio_preamble, tvb, 0, 0, preamble); PROTO_ITEM_SET_GENERATED(p_item); } } @@ -1101,7 +1089,7 @@ static hf_register_info hf_wlan_radio[] = { "802.11 channel number that this frame was sent/received on", HFILL }}, {&hf_wlan_radio_frequency, - {"Frequency", "wlan_radio.frequency", FT_UINT16, BASE_DEC, NULL, 0, + {"Frequency", "wlan_radio.frequency", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_mhz, 0, "Center frequency of the 802.11 channel that this frame was sent/received on", HFILL }}, {&hf_wlan_radio_short_preamble, @@ -1109,7 +1097,7 @@ static hf_register_info hf_wlan_radio[] = { NULL, HFILL }}, {&hf_wlan_radio_signal_percent, - {"Signal strength (percentage)", "wlan_radio.signal_percentage", FT_UINT32, BASE_DEC, NULL, 0, + {"Signal strength (percentage)", "wlan_radio.signal_percentage", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_percent, 0, "Signal strength, as percentage of maximum RSSI", HFILL }}, {&hf_wlan_radio_signal_dbm, @@ -1117,7 +1105,7 @@ static hf_register_info hf_wlan_radio[] = { NULL, HFILL }}, {&hf_wlan_radio_noise_percent, - {"Noise level (percentage)", "wlan_radio.noise_percentage", FT_UINT32, BASE_DEC, NULL, 0, + {"Noise level (percentage)", "wlan_radio.noise_percentage", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_percent, 0, NULL, HFILL }}, {&hf_wlan_radio_noise_dbm, @@ -1141,12 +1129,12 @@ static hf_register_info hf_wlan_radio[] = { NULL, HFILL }}, {&hf_wlan_radio_duration, - {"Duration", "wlan_radio.duration", FT_UINT32, BASE_DEC, NULL, 0, + {"Duration", "wlan_radio.duration", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0, "Total duration of the frame in microseconds, including any preamble or plcp header. " "Calculated from the frame length, modulation and other phy data.", HFILL }}, {&hf_wlan_radio_preamble, - {"Preamble", "wlan_radio.preamble", FT_UINT32, BASE_DEC, NULL, 0, + {"Preamble", "wlan_radio.preamble", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0, "Duration of the PLCP or preamble in microseconds, calculated from PHY data", HFILL }}, }; diff --git a/epan/dissectors/packet-ieee80211-radiotap.c b/epan/dissectors/packet-ieee80211-radiotap.c index 8131a71257..cd4ffa9ef5 100644 --- a/epan/dissectors/packet-ieee80211-radiotap.c +++ b/epan/dissectors/packet-ieee80211-radiotap.c @@ -1233,24 +1233,16 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u case IEEE80211_RADIOTAP_DB_ANTSIGNAL: db = tvb_get_guint8(tvb, offset); col_add_fstr(pinfo->cinfo, COL_RSSI, "%u dB", db); - if (tree) { - proto_tree_add_uint_format_value(radiotap_tree, + proto_tree_add_uint(radiotap_tree, hf_radiotap_db_antsignal, - tvb, offset, 1, db, - "%u dB", - db); - } + tvb, offset, 1, db); break; case IEEE80211_RADIOTAP_DB_ANTNOISE: db = tvb_get_guint8(tvb, offset); - if (tree) { - proto_tree_add_uint_format_value(radiotap_tree, + proto_tree_add_uint(radiotap_tree, hf_radiotap_db_antnoise, - tvb, offset, 1, db, - "%u dB", - db); - } + tvb, offset, 1, db); break; case IEEE80211_RADIOTAP_RX_FLAGS: { @@ -2326,12 +2318,12 @@ void proto_register_radiotap(void) {&hf_radiotap_db_antsignal, {"SSI Signal", "radiotap.db_antsignal", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_decibals, 0x0, "RF signal power at the antenna from a fixed, arbitrary value in decibels", HFILL}}, {&hf_radiotap_dbm_antnoise, {"SSI Noise", "radiotap.dbm_antnoise", - FT_INT32, BASE_DEC, NULL, 0x0, + FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_decibals, 0x0, "RF noise power at the antenna from a fixed, arbitrary value" " in decibels per one milliwatt", HFILL}}, diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index f83929328b..48619db830 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -9902,8 +9902,8 @@ dissect_vendor_ie_wpawme(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, in cwmax= (1 << ecwmax) - 1; proto_tree_add_item(ecw_tree, hf_ieee80211_wfa_ie_wme_acp_ecw_max, tvb, offset, 1, ENC_NA); proto_tree_add_item(ecw_tree, hf_ieee80211_wfa_ie_wme_acp_ecw_min, tvb, offset, 1, ENC_NA); - proto_tree_add_uint_format_value(ecw_tree, hf_ieee80211_wfa_ie_wme_acp_cw_max, tvb, offset, 1, cwmax, "%u", cwmax); - proto_tree_add_uint_format_value(ecw_tree, hf_ieee80211_wfa_ie_wme_acp_cw_min, tvb, offset, 1, cwmin, "%u", cwmin); + proto_tree_add_uint(ecw_tree, hf_ieee80211_wfa_ie_wme_acp_cw_max, tvb, offset, 1, cwmax); + proto_tree_add_uint(ecw_tree, hf_ieee80211_wfa_ie_wme_acp_cw_min, tvb, offset, 1, cwmin); proto_item_append_text(ac_item, ", ECWmin/max %u/%u (CWmin/max %u/%u)", ecwmin, ecwmax, cwmin, cwmax); offset += 1; @@ -13654,7 +13654,7 @@ ieee80211_tag_tim(packet_info *pinfo, proto_tree *tree, for (j = 0; j < 8; j++) { if (byte & (1 << j)) { aid = 8*n1 + 8*i + j; - proto_tree_add_uint_format_value(tree, hf_ieee80211_tim_aid, tvb, offset + i, 1, aid, "%d", aid); + proto_tree_add_uint(tree, hf_ieee80211_tim_aid, tvb, offset + i, 1, aid); } } } @@ -17340,8 +17340,8 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo, for (f = 0; f < 64; f++) { if (bmap & (G_GUINT64_CONSTANT(1) << f)) continue; - proto_tree_add_uint_format_value(ba_bitmap_tree, hf_ieee80211_block_ack_bitmap_missing_frame, - tvb, offset + (f/8), 1, ssn + f, "%u", ssn + f); + proto_tree_add_uint(ba_bitmap_tree, hf_ieee80211_block_ack_bitmap_missing_frame, + tvb, offset + (f/8), 1, ssn + f); } offset += 8; proto_tree_add_item(ba_sub_tree, hf_ieee80211_block_ack_RBUFCAP, tvb, offset, 1, ENC_LITTLE_ENDIAN); diff --git a/epan/dissectors/packet-igrp.c b/epan/dissectors/packet-igrp.c index 0c2ab10f11..e1bcb32eed 100644 --- a/epan/dissectors/packet-igrp.c +++ b/epan/dissectors/packet-igrp.c @@ -186,7 +186,7 @@ static void dissect_vektor_igrp (tvbuff_t *tvb, proto_tree *igrp_vektor_tree, gu proto_tree_add_ipv4(igrp_vektor_tree, hf_igrp_network, tvb, 0, 3, addr.addr_word); proto_tree_add_item(igrp_vektor_tree, hf_igrp_delay, tvb, 3, 3, ENC_BIG_ENDIAN); proto_tree_add_item(igrp_vektor_tree, hf_igrp_bandwidth, tvb, 6, 3, ENC_BIG_ENDIAN); - proto_tree_add_uint_format_value(igrp_vektor_tree, hf_igrp_mtu, tvb, 9, 2, tvb_get_ntohs(tvb,9), "%d bytes", tvb_get_ntohs(tvb,9)); + proto_tree_add_item(igrp_vektor_tree, hf_igrp_mtu, tvb, 9, 2, ENC_BIG_ENDIAN); proto_tree_add_item(igrp_vektor_tree, hf_igrp_reliability, tvb, 11, 1, ENC_BIG_ENDIAN); proto_tree_add_item(igrp_vektor_tree, hf_igrp_load, tvb, 12, 1, ENC_BIG_ENDIAN); proto_tree_add_item(igrp_vektor_tree, hf_igrp_hop_count, tvb, 13, 1, ENC_BIG_ENDIAN); @@ -221,7 +221,7 @@ void proto_register_igrp(void) { &hf_igrp_network, { "Network", "igrp.network", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_igrp_delay, { "Delay", "igrp.delay", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_igrp_bandwidth, { "Bandwidth", "igrp.bandwidth", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_igrp_mtu, { "MTU", "igrp.mtu", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_igrp_mtu, { "MTU", "igrp.mtu", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_igrp_reliability, { "Reliability", "igrp.reliability", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_igrp_load, { "Load", "igrp.load", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_igrp_hop_count, { "Hop count", "igrp.hop_count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index 8f9aecefbe..8961c96e89 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -1528,9 +1528,8 @@ dissect_ipopt_qs(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset, proto_tree_add_item(field_tree, hf_ip_opt_qs_rate, tvb, offset + 2, 1, ENC_NA); proto_tree_add_item(field_tree, hf_ip_opt_qs_ttl, tvb, offset + 3, 1, ENC_NA); ttl_diff = (iph->ip_ttl - tvb_get_guint8(tvb, offset + 3) % 256); - ti = proto_tree_add_uint_format_value(field_tree, hf_ip_opt_qs_ttl_diff, - tvb, offset + 3, 1, ttl_diff, - "%u", ttl_diff); + ti = proto_tree_add_uint(field_tree, hf_ip_opt_qs_ttl_diff, + tvb, offset + 3, 1, ttl_diff); PROTO_ITEM_SET_GENERATED(ti); proto_item_append_text(tf, ", %s, QS TTL %u, QS TTL diff %u", val_to_str_ext(rate, &qs_rate_vals_ext, "Unknown (%u)"), diff --git a/epan/dissectors/packet-ipx.c b/epan/dissectors/packet-ipx.c index 0865dd76f7..2d4e1df616 100644 --- a/epan/dissectors/packet-ipx.c +++ b/epan/dissectors/packet-ipx.c @@ -346,8 +346,7 @@ dissect_ipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) PROTO_ITEM_SET_HIDDEN(hidden_item); proto_tree_add_checksum(ipx_tree, tvb, 0, hf_ipx_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); - proto_tree_add_uint_format_value(ipx_tree, hf_ipx_len, tvb, 2, 2, ipxh->ipx_length, - "%d bytes", ipxh->ipx_length); + proto_tree_add_uint(ipx_tree, hf_ipx_len, tvb, 2, 2, ipxh->ipx_length); ipx_hops = tvb_get_guint8(tvb, 4); proto_tree_add_uint_format(ipx_tree, hf_ipx_hops, tvb, 4, 1, ipx_hops, "Transport Control: %d hops", ipx_hops); @@ -1314,7 +1313,7 @@ proto_register_ipx(void) "Source or Destination IPX Address \"network.node\"", HFILL }}, { &hf_ipx_len, - { "Length", "ipx.len", FT_UINT16, BASE_DEC, NULL, 0x0, + { "Length", "ipx.len", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_ipx_hops, diff --git a/epan/dissectors/packet-ipxwan.c b/epan/dissectors/packet-ipxwan.c index c432069608..8222264c73 100644 --- a/epan/dissectors/packet-ipxwan.c +++ b/epan/dissectors/packet-ipxwan.c @@ -133,10 +133,6 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ guint8 option_number; proto_tree *option_tree; guint16 option_data_len; - guint16 wan_link_delay; - guint32 delay; - guint32 throughput; - guint32 delta_time; guint8 compression_type; col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPX WAN"); @@ -205,13 +201,9 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, "Bogus length: %u, should be 54", option_data_len); } else { - wan_link_delay = tvb_get_ntohs(tvb, - offset); - proto_tree_add_uint_format_value(option_tree, + proto_tree_add_item(option_tree, hf_ipxwan_wan_link_delay, tvb, - offset, 2, wan_link_delay, - "%ums", - wan_link_delay); + offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(option_tree, hf_ipxwan_common_network_number, tvb, offset+2, 4, ENC_NA); @@ -226,17 +218,12 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, "Bogus length: %u, should be 8", option_data_len); } else { - delay = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(option_tree, + proto_tree_add_item(option_tree, hf_ipxwan_delay, tvb, - offset, 4, delay, - "%uus", delay); - throughput = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(option_tree, + offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(option_tree, hf_ipxwan_throughput, tvb, - offset, 4, throughput, - "%uus", - throughput); + offset, 4, ENC_BIG_ENDIAN); } break; @@ -248,12 +235,9 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ proto_tree_add_item(option_tree, hf_ipxwan_request_size, tvb, offset, 4, ENC_BIG_ENDIAN); - delta_time = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(option_tree, + proto_tree_add_item(option_tree, hf_ipxwan_delta_time, tvb, - offset, 4, delta_time, - "%uus", - delta_time); + offset, 4, ENC_BIG_ENDIAN); } break; @@ -371,7 +355,7 @@ proto_register_ipxwan(void) { &hf_ipxwan_wan_link_delay, { "WAN Link Delay", "ipxwan.rip_sap_info_exchange.wan_link_delay", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_ipxwan_common_network_number, { "Common Network Number", "ipxwan.rip_sap_info_exchange.common_network_number", @@ -383,11 +367,11 @@ proto_register_ipxwan(void) { &hf_ipxwan_delay, { "Delay", "ipxwan.nlsp_information.delay", - FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0, NULL, HFILL }}, { &hf_ipxwan_throughput, { "Throughput", "ipxwan.nlsp_information.throughput", - FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0, NULL, HFILL }}, { &hf_ipxwan_request_size, { "Request Size", "ipxwan.nlsp_raw_throughput_data.request_size", @@ -395,7 +379,7 @@ proto_register_ipxwan(void) { &hf_ipxwan_delta_time, { "Delta Time", "ipxwan.nlsp_raw_throughput_data.delta_time", - FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0, NULL, HFILL }}, { &hf_ipxwan_extended_node_id, { "Extended Node ID", "ipxwan.extended_node_id", diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c index 7810d87728..c9cbc19940 100644 --- a/epan/dissectors/packet-isakmp.c +++ b/epan/dissectors/packet-isakmp.c @@ -3543,7 +3543,7 @@ dissect_life_duration(tvbuff_t *tvb, proto_tree *tree, proto_item *ti, int hf_ui guint8 val; val = tvb_get_guint8(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_uint32, tvb, offset, len, val, "%u", val); + proto_tree_add_uint(tree, hf_uint32, tvb, offset, len, val); proto_item_append_text(ti, ": %u", val); break; } @@ -3551,7 +3551,7 @@ dissect_life_duration(tvbuff_t *tvb, proto_tree *tree, proto_item *ti, int hf_ui guint16 val; val = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_uint32, tvb, offset, len, val, "%u", val); + proto_tree_add_uint(tree, hf_uint32, tvb, offset, len, val); proto_item_append_text(ti, ": %u", val); break; } @@ -3559,7 +3559,7 @@ dissect_life_duration(tvbuff_t *tvb, proto_tree *tree, proto_item *ti, int hf_ui guint32 val; val = tvb_get_ntoh24(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_uint32, tvb, offset, len, val, "%u", val); + proto_tree_add_uint(tree, hf_uint32, tvb, offset, len, val); proto_item_append_text(ti, ": %u", val); break; } @@ -3567,7 +3567,7 @@ dissect_life_duration(tvbuff_t *tvb, proto_tree *tree, proto_item *ti, int hf_ui guint32 val; val = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_uint32, tvb, offset, len, val, "%u", val); + proto_tree_add_uint(tree, hf_uint32, tvb, offset, len, val); proto_item_append_text(ti, ": %u", val); break; } diff --git a/epan/dissectors/packet-isup.c b/epan/dissectors/packet-isup.c index cf860bc3a6..82b26dd899 100644 --- a/epan/dissectors/packet-isup.c +++ b/epan/dissectors/packet-isup.c @@ -4711,7 +4711,7 @@ dissect_bat_ase_Encapsulated_Application_Information(tvbuff_t *parameter_tvb, pa guint content_len, length_indicator; guint duration; guint diagnostic; - guint32 bncid, Local_BCU_ID; + guint32 bncid; element_no = 0; @@ -4931,9 +4931,7 @@ dissect_bat_ase_Encapsulated_Application_Information(tvbuff_t *parameter_tvb, pa offset += tempdata; } /* end if */ - Local_BCU_ID = tvb_get_letohl(parameter_tvb, offset); - proto_tree_add_uint_format_value(bat_ase_element_tree, hf_Local_BCU_ID , parameter_tvb, offset, 4, - Local_BCU_ID , "0x%08x", Local_BCU_ID); + proto_tree_add_item(bat_ase_element_tree, hf_Local_BCU_ID, parameter_tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; break; case SIGNAL : @@ -5744,10 +5742,9 @@ dissect_isup_user_service_information_prime_parameter(tvbuff_t *parameter_tvb, p static void dissect_isup_propagation_delay_counter_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) { - guint16 info; + guint32 info; - info = tvb_get_ntohs(parameter_tvb, 0); - proto_tree_add_uint_format_value(parameter_tree, hf_isup_propagation_delay_counter, parameter_tvb, 0, PROPAGATION_DELAY_COUNT_LENGTH, info, "%u ms", info); + proto_tree_add_item_ret_uint(parameter_tree, hf_isup_propagation_delay_counter, parameter_tvb, 0, PROPAGATION_DELAY_COUNT_LENGTH, ENC_BIG_ENDIAN, &info); proto_item_set_text(parameter_item, "Propagation delay counter = %u ms", info); } /* ------------------------------------------------------------------ @@ -11973,7 +11970,7 @@ proto_register_isup(void) { &hf_isup_call_history_info, { "Call history info", "isup.call_history_info", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_isup_network_specific_facility, { "Network specific facility (refer to 3.36/Q.763 for detailed decoding)", "isup.network_specific_facility", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_user_service_information_prime, { "User service information prime (-> Q.931 Bearer capability information IE)", "isup.user_service_information_prime", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_isup_propagation_delay_counter, { "Propagation delay counter", "isup.propagation_delay_counter", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_isup_propagation_delay_counter, { "Propagation delay counter", "isup.propagation_delay_counter", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_isup_remote_operations, { "Remote operations", "isup.remote_operations", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_feature_code, { "Feature Code", "isup.feature_code", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_isup_user_teleservice_information, { "User teleservice information (-> Q.931 High Layer Compatibility IE)", "isup.user_teleservice_information", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-iwarp-ddp-rdmap.c b/epan/dissectors/packet-iwarp-ddp-rdmap.c index 6f1d90362c..4d8e1ce79b 100644 --- a/epan/dissectors/packet-iwarp-ddp-rdmap.c +++ b/epan/dissectors/packet-iwarp-ddp-rdmap.c @@ -328,8 +328,6 @@ dissect_iwarp_rdmap(tvbuff_t *tvb, proto_tree *rdma_tree, guint32 offset, guint8 layer, etype, hdrct; - guint32 rdmardsz; - if (rdma_tree) { if (rdma_msg_opcode == RDMA_READ_REQUEST) { @@ -345,11 +343,9 @@ dissect_iwarp_rdmap(tvbuff_t *tvb, proto_tree *rdma_tree, guint32 offset, offset, RDMA_SINKTO_LEN, ENC_BIG_ENDIAN); offset += RDMA_SINKTO_LEN; - rdmardsz = (guint32) tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(rdma_header_tree, + proto_tree_add_item(rdma_header_tree, hf_iwarp_rdma_rdmardsz, tvb, offset, - RDMA_RDMARDSZ_LEN, rdmardsz, "%u bytes", - rdmardsz); + RDMA_RDMARDSZ_LEN, ENC_BIG_ENDIAN); offset += RDMA_RDMARDSZ_LEN; proto_tree_add_item(rdma_header_tree, hf_iwarp_rdma_srcstag, tvb, @@ -846,7 +842,7 @@ proto_register_iwarp_ddp_rdmap(void) NULL, HFILL} }, { &hf_iwarp_rdma_rdmardsz, { "RDMA Read Message Size", "iwarp_rdma.rdmardsz", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL} }, { &hf_iwarp_rdma_srcstag, { "Data Source STag", "iwarp_rdma.srcstag", diff --git a/epan/dissectors/packet-iwarp-mpa.c b/epan/dissectors/packet-iwarp-mpa.c index aa82e8cf17..26db219dab 100644 --- a/epan/dissectors/packet-iwarp-mpa.c +++ b/epan/dissectors/packet-iwarp-mpa.c @@ -520,10 +520,9 @@ dissect_mpa_req_rep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, return FALSE; } - proto_tree_add_uint_format_value(mpa_header_tree, + proto_tree_add_uint(mpa_header_tree, hf_mpa_pd_length, tvb, offset, - MPA_REQ_REP_PDLENGTH_LEN, pd_length, "%u bytes", - pd_length); + MPA_REQ_REP_PDLENGTH_LEN, pd_length); offset += MPA_REQ_REP_PDLENGTH_LEN; if (pd_length) { @@ -609,7 +608,6 @@ dissect_fpdu_markers(tvbuff_t *tvb, proto_tree *tree, mpa_state_t *state, { proto_tree *mpa_marker_tree; proto_item *mpa_marker_item; - guint16 fpduptr; guint32 offset, i; mpa_marker_item = proto_tree_add_item(tree, hf_mpa_marker, tvb, @@ -621,11 +619,9 @@ dissect_fpdu_markers(tvbuff_t *tvb, proto_tree *tree, mpa_state_t *state, for (i=0; iminfo[endpoint].valid && num_of_m > 0) { @@ -770,7 +763,6 @@ dissect_mpa_fpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dissect_fpdu_crc(tvb, mpa_header_tree, state, offset, ulpdu_length+pad_length+MPA_ULPDU_LENGTH_LEN); } - } return ulpdu_length; } @@ -909,7 +901,7 @@ void proto_register_mpa(void) NULL, HFILL } }, { &hf_mpa_pd_length, { "Private data length", "iwarp_mpa.pdlength", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL } }, { &hf_mpa_private_data, { "Private data", "iwarp_mpa.privatedata", @@ -917,7 +909,7 @@ void proto_register_mpa(void) NULL, HFILL } }, { &hf_mpa_ulpdu_length, { "ULPDU length", "iwarp_mpa.ulpdulength", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL } }, { &hf_mpa_pad, { "Padding", "iwarp_mpa.pad", @@ -937,7 +929,7 @@ void proto_register_mpa(void) "Marker: Reserved", HFILL } }, { &hf_mpa_marker_fpduptr, { "FPDU back pointer", "iwarp_mpa.marker_fpduptr", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, "Marker: FPDU Pointer", HFILL } } }; diff --git a/epan/dissectors/packet-kerberos4.c b/epan/dissectors/packet-kerberos4.c index fae0108330..ce1c8fadc2 100644 --- a/epan/dissectors/packet-kerberos4.c +++ b/epan/dissectors/packet-kerberos4.c @@ -184,8 +184,7 @@ dissect_krb4_kdc_reply(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset++; /* length2 */ - length=little_endian?tvb_get_letohs(tvb, offset):tvb_get_ntohs(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_krb4_length, tvb, offset, 2, length, "%d", length); + proto_tree_add_item_ret_uint(tree, hf_krb4_length, tvb, offset, 2, little_endian?ENC_LITTLE_ENDIAN:ENC_BIG_ENDIAN, &length); offset+=2; /* encrypted blob */ diff --git a/epan/dissectors/packet-lat.c b/epan/dissectors/packet-lat.c index a7da6857fb..953276e8a8 100644 --- a/epan/dissectors/packet-lat.c +++ b/epan/dissectors/packet-lat.c @@ -470,9 +470,7 @@ dissect_lat_start(tvbuff_t *tvb, int offset, proto_tree *tree) proto_tree_add_uint_format_value(tree, hf_lat_server_circuit_timer, tvb, offset, 1, timer, "%u milliseconds", timer*10); offset += 1; - timer = tvb_get_guint8(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_lat_keep_alive_timer, tvb, - offset, 1, timer, "%u seconds", timer); + proto_tree_add_item(tree, hf_lat_keep_alive_timer, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; proto_tree_add_item(tree, hf_lat_facility_number, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; @@ -1588,7 +1586,7 @@ proto_register_lat(void) { &hf_lat_keep_alive_timer, { "Keep-alive timer", "lat.keep_alive_timer", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, HFILL}}, + BASE_DEC|BASE_UNIT_STRING, &units_second_seconds, 0x0, NULL, HFILL}}, { &hf_lat_facility_number, { "Facility number", "lat.facility_number", FT_UINT16, diff --git a/epan/dissectors/packet-lmp.c b/epan/dissectors/packet-lmp.c index 5c90e636c4..1d3aee5b4d 100644 --- a/epan/dissectors/packet-lmp.c +++ b/epan/dissectors/packet-lmp.c @@ -1027,8 +1027,7 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) proto_tree_add_bitmask(lmp_object_tree, tvb, offset2, hf_lmp_filter[LMPF_VAL_BEGIN_VERIFY_FLAGS], lmp_subtree[LMP_TREE_BEGIN_VERIFY_FLAGS], verify_flags, ENC_BIG_ENDIAN); - proto_tree_add_uint_format_value(lmp_object_tree, hf_lmp_verify_interval, tvb, offset2+2, 2, - tvb_get_ntohs(tvb, offset2+2), "%d ms", tvb_get_ntohs(tvb, offset2+2)); + proto_tree_add_item(lmp_object_tree, hf_lmp_verify_interval, tvb, offset2+2, 2, ENC_BIG_ENDIAN); proto_tree_add_item(lmp_object_tree, hf_lmp_number_of_data_links, tvb, offset2+4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(lmp_object_tree, hf_lmp_filter[LMPF_VAL_BEGIN_VERIFY_ENCTYPE], @@ -1055,9 +1054,7 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) proto_item_append_text(ti, ": VerifyDeadInterval: %d, TransportResponse: 0x%0x", tvb_get_ntohs(tvb, offset2), tvb_get_ntohs(tvb, offset2+2)); - proto_tree_add_uint_format_value(lmp_object_tree, hf_lmp_verifydeadinterval, tvb, offset2, 2, - tvb_get_ntohs(tvb, offset2), "%d ms", - tvb_get_ntohs(tvb, offset2)); + proto_tree_add_item(lmp_object_tree, hf_lmp_verifydeadinterval, tvb, offset2, 2, ENC_BIG_ENDIAN); proto_tree_add_item(lmp_object_tree, hf_lmp_verify_transport_response, tvb, offset2+2, 2, ENC_BIG_ENDIAN); break; @@ -2574,16 +2571,16 @@ proto_register_lmp(void) /* Generated from convert_proto_tree_add_text.pl */ { &hf_lmp_version, { "LMP Version", "lmp.version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_lmp_header_flags, { "Flags", "lmp.header_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - { &hf_lmp_header_length, { "Length", "lmp.header_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_lmp_header_length, { "Length", "lmp.header_length", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_lmp_negotiable, { "Negotiable", "lmp.negotiable", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }}, { &hf_lmp_object_length, { "Length", "lmp.object_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_lmp_object_class, { "Object Class", "lmp.object_class", FT_UINT8, BASE_DEC, VALS(lmp_class_vals), 0x0, NULL, HFILL }}, - { &hf_lmp_verify_interval, { "Verify Interval", "lmp.verify_interval", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_lmp_verify_interval, { "Verify Interval", "lmp.verify_interval", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_lmp_number_of_data_links, { "Number of Data Links", "lmp.number_of_data_links", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_lmp_verify_transport_mechanism, { "Verify Transport Mechanism", "lmp.verify_transport_mechanism", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_lmp_transmission_rate, { "Transmission Rate", "lmp.transmission_rate", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_lmp_wavelength, { "Wavelength", "lmp.wavelength", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_lmp_verifydeadinterval, { "VerifyDeadInterval", "lmp.verifydeadinterval", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_lmp_verifydeadinterval, { "VerifyDeadInterval", "lmp.verifydeadinterval", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_lmp_verify_transport_response, { "Verify Transport Response", "lmp.verify_transport_response", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_lmp_data_link_local_id_ipv6, { "Data-Link Local ID - IPv6", "lmp.data_link.local_ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_lmp_data_link_remote_id_ipv6, { "Data-Link Remote ID - IPv6", "lmp.data_link.remote_ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-nbt.c b/epan/dissectors/packet-nbt.c index d4df6f8a76..3ddc935e2b 100644 --- a/epan/dissectors/packet-nbt.c +++ b/epan/dissectors/packet-nbt.c @@ -1244,20 +1244,14 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U case NBDS_DIRECT_UNIQUE: case NBDS_DIRECT_GROUP: case NBDS_BROADCAST: - if (tree) { - header.dgm_length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint_format_value(nbdgm_tree, hf_nbdgm_datagram_length, - tvb, offset, 2, header.dgm_length, - "%u bytes", header.dgm_length); - } + header.dgm_length = tvb_get_ntohs(tvb, offset); + proto_tree_add_item(nbdgm_tree, hf_nbdgm_datagram_length, + tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - if (tree) { - header.pkt_offset = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint_format_value(nbdgm_tree, hf_nbdgm_packet_offset, - tvb, offset, 2, header.pkt_offset, - "%u bytes", header.pkt_offset); - } + header.pkt_offset = tvb_get_ntohs(tvb, offset); + proto_tree_add_item(nbdgm_tree, hf_nbdgm_packet_offset, + tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; name = (char *)wmem_alloc(wmem_packet_scope(), MAX_NAME_LEN); @@ -1969,11 +1963,11 @@ proto_register_nbt(void) NULL, HFILL }}, { &hf_nbdgm_datagram_length, { "Datagram length", "nbdgm.dgram_len", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_nbdgm_packet_offset, { "Packet offset", "nbdgm.pkt_offset", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_nbdgm_error_code, { "Error code", "nbdgm.error_code", diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index 010db6e967..923eec68e1 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -1750,9 +1750,8 @@ dissect_fhandle_data_NETAPP_GX_v3(tvbuff_t* tvb, packet_info *pinfo _U_, proto_t /* = utility = */ utility = tvb_get_guint8(tvb, offset); - tf = proto_tree_add_uint_format_value(tree, hf_nfs3_gxfh_utlfield, tvb, - offset, 1, utility, - "0x%02x", utility); + tf = proto_tree_add_uint(tree, hf_nfs3_gxfh_utlfield, tvb, + offset, 1, utility); field_tree = proto_item_add_subtree(tf, ett_nfs3_gxfh_utlfield); if (utility & NFS3GX_FH_TREE_MASK) { diff --git a/epan/dissectors/packet-nlsp.c b/epan/dissectors/packet-nlsp.c index 37a2ea3fef..e05bb25811 100644 --- a/epan/dissectors/packet-nlsp.c +++ b/epan/dissectors/packet-nlsp.c @@ -442,7 +442,6 @@ nlsp_dissect_nlsp_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { guint16 packet_length; int len; - guint16 holding_timer; if (hello_type == NLSP_TYPE_WAN_HELLO) { proto_tree_add_item(tree, hf_nlsp_hello_state, tvb, @@ -462,9 +461,7 @@ nlsp_dissect_nlsp_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 6; - holding_timer = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_nlsp_hello_holding_timer, - tvb, offset, 2, holding_timer, "%us", holding_timer); + proto_tree_add_item(tree, hf_nlsp_hello_holding_timer, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; packet_length = tvb_get_ntohs(tvb, offset); @@ -680,8 +677,7 @@ dissect_lsp_link_info_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, i "Short link info entry"); return; } - proto_tree_add_uint_format_value(tree, hf_nlsp_link_info_delay, tvb, offset, 4, - tvb_get_ntohl(tvb, offset), "%uus", tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_link_info_delay, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; length -= 4; @@ -690,8 +686,7 @@ dissect_lsp_link_info_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, i "Short link info entry"); return; } - proto_tree_add_uint_format_value(tree, hf_nlsp_link_info_throughput, tvb, offset, 4, - tvb_get_ntohl(tvb, offset), "%u bits/s", tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_link_info_throughput, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; length -= 4; @@ -824,8 +819,7 @@ dissect_lsp_ext_routes_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, return; } - proto_tree_add_uint_format_value(tree, hf_nlsp_ext_routes_rip_delay, tvb, offset, 2, - tvb_get_ntohs(tvb, offset), "%u ticks", tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_ext_routes_rip_delay, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; length -= 2; } @@ -918,8 +912,7 @@ nlsp_dissect_nlsp_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 2; remaining_lifetime = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_nlsp_remaining_lifetime, tvb, offset, 2, - remaining_lifetime, "%us", remaining_lifetime); + proto_tree_add_uint(tree, hf_nlsp_remaining_lifetime, tvb, offset, 2, remaining_lifetime); offset += 2; col_append_fstr(pinfo->cinfo, COL_INFO, ", LSP ID: %s", @@ -1022,8 +1015,7 @@ dissect_csnp_lsp_entries(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, in proto_tree_add_item(subtree, hf_nlsp_csnp_lsp_sequence_number, tvb, offset+10, 4, ENC_BIG_ENDIAN); - proto_tree_add_uint_format_value(subtree, hf_nlsp_csnp_remaining_lifetime, tvb, offset, 2, - tvb_get_ntohs(tvb, offset), "%us", tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(subtree, hf_nlsp_csnp_remaining_lifetime, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_checksum(subtree, tvb, offset+14, hf_nlsp_csnp_lsp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); @@ -1058,8 +1050,7 @@ dissect_psnp_lsp_entries(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, in proto_tree_add_item(subtree, hf_nlsp_psnp_lsp_sequence_number, tvb, offset+10, 4, ENC_BIG_ENDIAN); - proto_tree_add_uint_format_value(subtree, hf_nlsp_psnp_remaining_lifetime, tvb, offset, 2, - tvb_get_ntohs(tvb, offset), "%us", tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(subtree, hf_nlsp_psnp_remaining_lifetime, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_checksum(subtree, tvb, offset+14, hf_nlsp_psnp_lsp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); @@ -1389,7 +1380,7 @@ proto_register_nlsp(void) { &hf_nlsp_hello_holding_timer, { "Holding Timer", "nlsp.hello.holding_timer", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_seconds, 0x0, NULL, HFILL } }, @@ -1541,12 +1532,12 @@ proto_register_nlsp(void) }, { &hf_nlsp_link_info_delay, { "Delay", "nlsp.link_info.delay", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0, NULL, HFILL } }, { &hf_nlsp_link_info_throughput, { "Throughput", "nlsp.link_info.throughput", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_bit_sec, 0x0, NULL, HFILL } }, { &hf_nlsp_link_info_media_type, @@ -1596,12 +1587,12 @@ proto_register_nlsp(void) }, { &hf_nlsp_ext_routes_rip_delay, { "RIP delay", "nlsp.ext_routes.rip_delay", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_tick_ticks, 0x0, NULL, HFILL } }, { &hf_nlsp_remaining_lifetime, { "Remaining Lifetime", "nlsp.remaining_lifetime", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_seconds, 0x0, NULL, HFILL } }, { &hf_nlsp_lsp_id_system_id, @@ -1641,7 +1632,7 @@ proto_register_nlsp(void) }, { &hf_nlsp_csnp_remaining_lifetime, { "Remaining Lifetime", "nlsp.csnp.remaining_lifetime", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_seconds, 0x0, NULL, HFILL } }, { &hf_nlsp_csnp_lsp_checksum, @@ -1671,7 +1662,7 @@ proto_register_nlsp(void) }, { &hf_nlsp_psnp_remaining_lifetime, { "Remaining Lifetime", "nlsp.psnp.remaining_lifetime", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_seconds, 0x0, NULL, HFILL } }, { &hf_nlsp_psnp_lsp_checksum, diff --git a/epan/dissectors/packet-opensafety.c b/epan/dissectors/packet-opensafety.c index 6921c61acd..36a293ae5e 100644 --- a/epan/dissectors/packet-opensafety.c +++ b/epan/dissectors/packet-opensafety.c @@ -334,11 +334,11 @@ opensafety_packet_node(tvbuff_t * message_tvb, packet_info *pinfo, proto_tree *t if ( sdn > 0 ) { - psf_item = proto_tree_add_uint_format_value(psf_tree, hf_oss_msg_network, message_tvb, - posSdnInFrame, 2, sdn, "0x%04X", sdn); + psf_item = proto_tree_add_uint(psf_tree, hf_oss_msg_network, message_tvb, + posSdnInFrame, 2, sdn); } else if ( sdn <= 0 ) { - psf_item = proto_tree_add_uint_format_value(psf_tree, hf_oss_msg_network, message_tvb, - posSdnInFrame, 2, sdn * -1, "0x%04X", sdn * -1); + psf_item = proto_tree_add_uint(psf_tree, hf_oss_msg_network, message_tvb, + posSdnInFrame, 2, sdn * -1); expert_add_info(pinfo, psf_item, &ei_scmudid_unknown ); } PROTO_ITEM_SET_GENERATED(psf_item); @@ -958,9 +958,7 @@ static void dissect_opensafety_ssdo_payload ( packet_info *pinfo, tvbuff_t *new_ &opensafety_sod_idx_names_ext, "Unknown") ); PROTO_ITEM_SET_GENERATED(item); - entry = tvb_get_letohl ( new_tvb, 0 ); - proto_tree_add_uint_format_value ( sod_tree, hf_oss_sod_par_timestamp, new_tvb, 0, - 4, entry, "0x%08X", entry ); + proto_tree_add_item( sod_tree, hf_oss_sod_par_timestamp, new_tvb, 0, 4, ENC_LITTLE_ENDIAN ); /* This is to avoid a compiler loop optimization warning */ nCRCs = dataLength / 4; @@ -1025,9 +1023,7 @@ static void dissect_opensafety_ssdo_payload ( packet_info *pinfo, tvbuff_t *new_ if ( ssdoIndex == OPENSAFETY_SOD_DVI && ssdoSubIndex == 0x06 ) { - entry = tvb_get_letohl ( new_tvb, ctr + 5 ); - proto_tree_add_uint_format_value ( sod_tree, hf_oss_sod_par_timestamp, new_tvb, ctr + 5, - 4, entry, "0x%08X", entry ); + proto_tree_add_item( sod_tree, hf_oss_sod_par_timestamp, new_tvb, ctr + 5, 4, ENC_LITTLE_ENDIAN ); /* This is to avoid a compiler loop optimization warning */ nCRCs = sodLength / 4; @@ -1038,9 +1034,7 @@ static void dissect_opensafety_ssdo_payload ( packet_info *pinfo, tvbuff_t *new_ (ctr + 5 + ( n * 4 ) ), 4, entry, "[#%d] 0x%08X", n, entry ); } } else if ( ssdoIndex == OPENSAFETY_SOD_DVI && ssdoSubIndex == 0x07 ) { - entry = tvb_get_letohl ( new_tvb, ctr + 5 ); - proto_tree_add_uint_format_value ( sod_tree, hf_oss_sod_par_timestamp, new_tvb, ctr + 5, - 4, entry, "0x%08X", entry ); + proto_tree_add_item( sod_tree, hf_oss_sod_par_timestamp, new_tvb, ctr + 5, 4, ENC_LITTLE_ENDIAN ); } else if ( ( dispSSDOIndex == OPENSAFETY_SOD_RXMAP || dispSSDOIndex == OPENSAFETY_SOD_TXMAP ) && ssdoSubIndex != 0x0 ) { proto_tree_add_uint(sod_tree, hf_oss_ssdo_sodentry_size, new_tvb, ctr + 1, 4, sodLength ); item = proto_tree_add_item(sod_tree, hf_oss_ssdo_sodmapping, new_tvb, ctr + 5, sodLength, ENC_NA ); @@ -1048,8 +1042,7 @@ static void dissect_opensafety_ssdo_payload ( packet_info *pinfo, tvbuff_t *new_ proto_tree_add_item(ext_tree, hf_oss_ssdo_sodmapping_bits, new_tvb, ctr + 5, 1, ENC_NA); - entry = tvb_get_letohl ( new_tvb, ctr + 7 ); - proto_tree_add_item(ext_tree, hf_oss_ssdo_sod_index, new_tvb, ctr + 7, 2, entry); + proto_tree_add_item(ext_tree, hf_oss_ssdo_sod_index, new_tvb, ctr + 7, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(ext_tree, hf_oss_ssdo_sod_subindex, new_tvb, ctr + 6, 1, ENC_NA); } else { @@ -1330,9 +1323,7 @@ dissect_opensafety_ssdo_message(tvbuff_t *message_tvb, packet_info *pinfo, proto if ( ssdoIndex == OPENSAFETY_SOD_DVI && ssdoSubIndex == 0x06 ) { - entry = tvb_get_letohl ( message_tvb, payloadOffset ); - proto_tree_add_uint_format_value ( ssdo_tree, hf_oss_sod_par_timestamp, message_tvb, payloadOffset, - 4, entry, "0x%08X", entry ); + proto_tree_add_item( ssdo_tree, hf_oss_sod_par_timestamp, message_tvb, payloadOffset, 4, ENC_LITTLE_ENDIAN ); for ( n = 4; n < payloadSize; n+=4 ) { entry = tvb_get_letohl ( message_tvb, payloadOffset + n ); @@ -1340,9 +1331,7 @@ dissect_opensafety_ssdo_message(tvbuff_t *message_tvb, packet_info *pinfo, proto 4, entry, "[#%d] 0x%08X", ( n / 4 ), entry ); } } else if ( ssdoIndex == OPENSAFETY_SOD_DVI && ssdoSubIndex == 0x07 ) { - entry = tvb_get_letohl ( message_tvb, payloadOffset ); - proto_tree_add_uint_format_value ( ssdo_tree, hf_oss_sod_par_timestamp, message_tvb, payloadOffset, - 4, entry, "0x%08X", entry ); + proto_tree_add_item ( ssdo_tree, hf_oss_sod_par_timestamp, message_tvb, payloadOffset, 4, ENC_LITTLE_ENDIAN ); } else proto_tree_add_item(ssdo_tree, hf_oss_ssdo_payload, message_tvb, payloadOffset, payloadSize, ENC_NA ); } @@ -1389,7 +1378,6 @@ dissect_opensafety_snmt_message(tvbuff_t *message_tvb, packet_info *pinfo, proto opensafety_packet_info *packet, proto_item * opensafety_item ) { proto_tree *snmt_tree; - guint32 entry = 0; guint16 addr, taddr, sdn; guint8 db0, byte, errcode; guint dataLength; @@ -1570,9 +1558,8 @@ dissect_opensafety_snmt_message(tvbuff_t *message_tvb, packet_info *pinfo, proto { if ( (db0 ^ OPENSAFETY_MSG_SNMT_EXT_SN_SET_TO_OP) == 0 ) { - entry = tvb_get_letohl ( message_tvb, packet->frame.subframe1 + OSS_FRAME_POS_DATA + 1 ); - proto_tree_add_uint_format_value ( snmt_tree, hf_oss_sod_par_timestamp, message_tvb, - OSS_FRAME_POS_DATA + packet->frame.subframe1 + 1, 4, entry, "0x%08X", entry ); + proto_tree_add_item ( snmt_tree, hf_oss_sod_par_timestamp, message_tvb, + OSS_FRAME_POS_DATA + packet->frame.subframe1 + 1, 4, ENC_LITTLE_ENDIAN ); } else if ( ( db0 ^ OPENSAFETY_MSG_SNMT_EXT_ASSIGN_ADDITIONAL_SADR) == 0 ) { diff --git a/epan/dissectors/packet-ospf.c b/epan/dissectors/packet-ospf.c index 4d5e8520bf..35e5da5a03 100644 --- a/epan/dissectors/packet-ospf.c +++ b/epan/dissectors/packet-ospf.c @@ -1516,8 +1516,7 @@ dissect_ospf_lls_data_block(tvbuff_t *tvb, packet_info *pinfo, int offset, proto /* TODO: verify checksum */ proto_tree_add_checksum(ospf_lls_data_block_tree, tvb, offset, hf_ospf_lls_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); - proto_tree_add_uint_format_value(ospf_lls_data_block_tree, hf_ospf_lls_data_length, tvb, offset + 2, 2, - ospf_lls_len, "%d bytes", ospf_lls_len); + proto_tree_add_uint(ospf_lls_data_block_tree, hf_ospf_lls_data_length, tvb, offset + 2, 2, ospf_lls_len); offset += 4; DISSECTOR_ASSERT((version == OSPF_VERSION_2) || (version == OSPF_VERSION_3)); @@ -3766,7 +3765,7 @@ proto_register_ospf(void) { &hf_ospf_v3_lls_request_from, { "Request From", "ospf.v3.lls.request_from", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_ospf_v3_lls_full_state_for, { "Full State For", "ospf.v3.lls.full_state_for", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_ospf_lls_checksum, { "Checksum", "ospf.lls.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - { &hf_ospf_lls_data_length, { "LLS Data Length", "ospf.lls.data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ospf_lls_data_length, { "LLS Data Length", "ospf.lls.data_length", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_ospf_db_interface_mtu, { "Interface MTU", "ospf.db.interface_mtu", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ospf_db_dd_sequence, { "DD Sequence", "ospf.db.dd_sequence", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ospf_link_state_id, { "Link State ID", "ospf.link_state_id", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c index 16188fc705..0f3cb483f0 100644 --- a/epan/dissectors/packet-ppp.c +++ b/epan/dissectors/packet-ppp.c @@ -3791,12 +3791,10 @@ dissect_bap_link_type_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_) { proto_tree *field_tree; - guint16 link_speed; field_tree = proto_tree_add_subtree(tree, tvb, offset, length, *optp->subtree_index, NULL, optp->name); - link_speed = tvb_get_ntohs(tvb, offset + 2); - proto_tree_add_uint_format_value(field_tree, hf_bacp_link_speed, tvb, offset + 2, 2, link_speed, "%u kbps", link_speed); + proto_tree_add_item(field_tree, hf_bacp_link_speed, tvb, offset + 2, 2, ENC_BIG_ENDIAN); proto_tree_add_item(field_tree, hf_bacp_link_type, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } @@ -7079,7 +7077,7 @@ proto_register_bacp(void) static hf_register_info hf[] = { /* Generated from convert_proto_tree_add_text.pl */ { &hf_bacp_magic_number, { "Magic number", "bacp.magic_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - { &hf_bacp_link_speed, { "Link Speed", "bacp.link_speed", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_bacp_link_speed, { "Link Speed", "bacp.link_speed", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_kbps, 0x0, NULL, HFILL }}, { &hf_bacp_link_type, { "Link Type", "bacp.link_type", FT_UINT8, BASE_DEC, VALS(bap_link_type_vals), 0x0, NULL, HFILL }}, }; diff --git a/epan/dissectors/packet-ptp.c b/epan/dissectors/packet-ptp.c index 8e9bb12603..675291ce47 100644 --- a/epan/dissectors/packet-ptp.c +++ b/epan/dissectors/packet-ptp.c @@ -3102,7 +3102,6 @@ dissect_ptp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean ptp gint8 log_inter_message_period; gdouble period = 0.0f; gdouble rate = 0.0f; - guint32 duration_field; proto_item *ptp_tlv_period; proto_tree *ptp_tlv_period_tree; @@ -3150,10 +3149,8 @@ dissect_ptp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean ptp tlv_offset + PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET, PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_LEN, log_inter_message_period, "%lg packets/sec", rate); /* 16.1.4.1.5 durationField */ - duration_field = tvb_get_ntohl(tvb, tlv_offset + PTP_V2_SIG_TLV_DURATION_FIELD_OFFSET); - - proto_tree_add_uint_format_value(ptp_tlv_tree, hf_ptp_v2_sig_tlv_durationField, tvb, - tlv_offset + PTP_V2_SIG_TLV_DURATION_FIELD_OFFSET, PTP_V2_SIG_TLV_DURATION_FIELD_LEN, duration_field, "%u seconds", duration_field); + proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_durationField, tvb, + tlv_offset + PTP_V2_SIG_TLV_DURATION_FIELD_OFFSET, PTP_V2_SIG_TLV_DURATION_FIELD_LEN, ENC_BIG_ENDIAN); break; @@ -3181,10 +3178,8 @@ dissect_ptp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean ptp tlv_offset + PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_OFFSET, PTP_V2_SIG_TLV_LOG_INTER_MESSAGE_PERIOD_LEN, log_inter_message_period, "%lg packets/sec", rate); /* 16.1.4.2.5 durationField */ - duration_field = tvb_get_ntohl(tvb, tlv_offset + PTP_V2_SIG_TLV_DURATION_FIELD_OFFSET); - - proto_tree_add_uint_format_value(ptp_tlv_tree, hf_ptp_v2_sig_tlv_durationField, tvb, - tlv_offset + PTP_V2_SIG_TLV_DURATION_FIELD_OFFSET, PTP_V2_SIG_TLV_DURATION_FIELD_LEN, duration_field, "%u seconds", duration_field); + proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_durationField, tvb, + tlv_offset + PTP_V2_SIG_TLV_DURATION_FIELD_OFFSET, PTP_V2_SIG_TLV_DURATION_FIELD_LEN, ENC_BIG_ENDIAN); /* 16.1.4.2.6 renewalInvited */ proto_tree_add_item(ptp_tlv_tree, hf_ptp_v2_sig_tlv_renewalInvited, tvb, @@ -5450,7 +5445,7 @@ proto_register_ptp(void) }, { &hf_ptp_v2_sig_tlv_durationField, { "durationField", "ptp.v2.sig.tlv.durationField", - FT_UINT32, BASE_DEC, NULL, 0x00, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_second_seconds, 0x00, NULL, HFILL } }, { &hf_ptp_v2_sig_tlv_renewalInvited, diff --git a/epan/dissectors/packet-q2931.c b/epan/dissectors/packet-q2931.c index c5b5bfb1a1..f09d73e58e 100644 --- a/epan/dissectors/packet-q2931.c +++ b/epan/dissectors/packet-q2931.c @@ -636,6 +636,8 @@ static const value_string q2931_atm_td_subfield_vals[] = { { 0x0, NULL } }; +static const unit_name_string units_cells_s = { " cell/s", " cells/s" }; + static void dissect_q2931_atm_cell_rate_ie(tvbuff_t *tvb, packet_info* pinfo, int offset, int len, proto_tree *tree) @@ -664,9 +666,9 @@ dissect_q2931_atm_cell_rate_ie(tvbuff_t *tvb, packet_info* pinfo, int offset, in case Q2931_ATM_CR_BW_MAXB_CLP_0_1: if (len < 4) return; + value = tvb_get_ntoh24(tvb, offset + 1); - proto_tree_add_uint_format_value(tree, hf_q2931_atm_identifier_value, tvb, offset+3, 3, value, - "%u cell%s/s", value, plurality(value, "", "s")); + proto_tree_add_uint(tree, hf_q2931_atm_identifier_value, tvb, offset+3, 3, value); offset += 4; len -= 4; break; @@ -950,8 +952,7 @@ l2_done: break; case Q2931_UIL3_USER_SPEC: - proto_tree_add_uint_format_value(tree, hf_q2931_bband_low_layer_info_default_packet_size, tvb, offset, 1, - 1 << (octet & 0x0F), "%u octets", 1 << (octet & 0x0F)); + proto_tree_add_uint(tree, hf_q2931_bband_low_layer_info_default_packet_size, tvb, offset, 1, 1 << (octet & 0x0F)); /*offset += 1;*/ /*len -= 1;*/ break; @@ -1480,8 +1481,7 @@ dissect_q2931_e2e_transit_delay_ie(tvbuff_t *tvb, packet_info* pinfo, int offset switch (identifier) { case 0x01: /* Cumulative transit delay identifier */ - proto_tree_add_uint_format_value(tree, hf_q2931_e2e_transit_delay_cumulative, tvb, offset, 2, - value, "%u ms", value); + proto_tree_add_uint(tree, hf_q2931_e2e_transit_delay_cumulative, tvb, offset, 2, value); break; case 0x03: /* Maximum transit delay identifier */ @@ -2099,7 +2099,7 @@ proto_register_q2931(void) }, { &hf_q2931_aal1_partially_filled_cells_method, { "Partially filled cells method", "q2931.aal1.partially_filled_cells_method", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL } }, { &hf_q2931_aal1_forward_max_cpcs_sdu_size, @@ -2179,7 +2179,7 @@ proto_register_q2931(void) }, { &hf_q2931_bband_low_layer_info_default_packet_size, { "Default packet size", "q2931.bband_low_layer_info.default_packet_size", - FT_UINT8, BASE_DEC, NULL, 0x0F, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0F, NULL, HFILL } }, { &hf_q2931_bband_low_layer_info_packet_window_size, @@ -2354,7 +2354,7 @@ proto_register_q2931(void) }, { &hf_q2931_e2e_transit_delay_cumulative, { "Cumulative transit delay", "q2931.e2e_transit_delay.cumulative", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL } }, { &hf_q2931_e2e_transit_delay_maximum_end_to_end, @@ -2509,7 +2509,7 @@ proto_register_q2931(void) }, { &hf_q2931_atm_identifier_value, { "Value", "q2931.atm_identifier_value", - FT_UINT24, BASE_DEC, NULL, 0x0, + FT_UINT24, BASE_DEC|BASE_UNIT_STRING, &units_cells_s, 0x0, NULL, HFILL } }, { &hf_q2931_aal_parameter_identifier, diff --git a/epan/dissectors/packet-q931.c b/epan/dissectors/packet-q931.c index bbcf0841e2..e4e2a0e212 100644 --- a/epan/dissectors/packet-q931.c +++ b/epan/dissectors/packet-q931.c @@ -628,11 +628,9 @@ dissect_q931_segmented_message_ie(tvbuff_t *tvb, packet_info *pinfo, int offset, octet = tvb_get_guint8(tvb, offset); if (octet & 0x80) { - proto_tree_add_uint_format_value(tree, hf_q931_first_segment, tvb, offset, 1, - octet & 0x7F, "%u segments remaining", octet & 0x7F); + proto_tree_add_item(tree, hf_q931_first_segment, tvb, offset, 1, ENC_NA); } else { - proto_tree_add_uint_format_value(tree, hf_q931_not_first_segment, tvb, offset, 1, - octet & 0x7F, "%u segments remaining", octet & 0x7F); + proto_tree_add_item(tree, hf_q931_not_first_segment, tvb, offset, 1, ENC_NA); } proto_tree_add_item(tree, hf_q931_segment_type, tvb, offset + 1, 1, ENC_BIG_ENDIAN); } @@ -1096,8 +1094,7 @@ l2_done: break; case Q931_UIL3_USER_SPEC: - proto_tree_add_uint_format_value(tree, hf_q931_bearer_capability_default_packet_size, tvb, offset, 1, - 1 << (octet & 0x0F), "%u octets", 1 << (octet & 0x0F)); + proto_tree_add_uint(tree, hf_q931_bearer_capability_default_packet_size, tvb, offset, 1, 1 << (octet & 0x0F)); /*offset += 1;*/ /*len -= 1;*/ break; @@ -1913,8 +1910,7 @@ dissect_q931_guint16_value(tvbuff_t *tvb, packet_info *pinfo, int offset, int le /*len -= 1;*/ value_len++; - proto_tree_add_uint_format_value(tree, hf_value, tvb, offset, value_len, value, - "%u ms", value); + proto_tree_add_uint(tree, hf_value, tvb, offset, value_len, value); return value_len; past_end: @@ -2421,7 +2417,7 @@ dissect_q931_user_user_ie(tvbuff_t *tvb, packet_info *pinfo, int offset, int len next_tvb = tvb_new_subset_length(tvb, offset, len); proto_tree_add_uint_format_value(tree, hf_q931_user_information_len, tvb, offset, len, len, "%d octets", len); if (!dissector_try_heuristic(q931_user_heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, NULL)) { - call_data_dissector(next_tvb, pinfo, tree); + call_data_dissector(next_tvb, pinfo, tree); } break; @@ -3417,12 +3413,12 @@ proto_register_q931(void) /* Generated from convert_proto_tree_add_text.pl */ { &hf_q931_first_segment, { "First segment", "q931.segment.first", - FT_UINT8, BASE_DEC, NULL, 0x7F, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_segment_remaining, 0x7F, NULL, HFILL } }, { &hf_q931_not_first_segment, { "Not first segment", "q931.segment.not_first", - FT_UINT8, BASE_DEC, NULL, 0x7F, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_segment_remaining, 0x7F, NULL, HFILL } }, { &hf_q931_bearer_capability_data, @@ -3492,7 +3488,7 @@ proto_register_q931(void) }, { &hf_q931_bearer_capability_default_packet_size, { "Default packet size", "q931.bearer_capability.default_packet_size", - FT_UINT8, BASE_DEC, NULL, 0x0F, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0F, NULL, HFILL } }, { &hf_q931_bearer_capability_packet_window_size, @@ -3717,7 +3713,7 @@ proto_register_q931(void) }, { &hf_q931_user_information_len, { "User information", "q931.user.len", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL } }, { &hf_q931_user_information_str, @@ -3887,22 +3883,22 @@ proto_register_q931(void) }, { &hf_q931_cumulative_transit_delay, { "Cumulative transit delay", "q931.cumulative_transit_delay", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL } }, { &hf_q931_requested_end_to_end_transit_delay, { "Requested end-to-end transit delay", "q931.requested_end_to_end_transit_delay", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL } }, { &hf_q931_maximum_end_to_end_transit_delay, { "Maximum end-to-end transit delay", "q931.maximum_end_to_end_transit_delay", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL } }, { &hf_q931_transit_delay, { "Transit delay", "q931.transit_delay", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL } }, { &hf_q931_display_information, diff --git a/epan/dissectors/packet-q933.c b/epan/dissectors/packet-q933.c index aae33a7ff4..d7a3f89350 100644 --- a/epan/dissectors/packet-q933.c +++ b/epan/dissectors/packet-q933.c @@ -369,11 +369,9 @@ dissect_q933_segmented_message_ie(tvbuff_t *tvb, packet_info *pinfo, int offset, octet = tvb_get_guint8(tvb, offset); if (octet & 0x80) { - proto_tree_add_uint_format_value(tree, hf_q933_first_segment, tvb, offset, 1, - octet & 0x7F, "%u segments remaining", octet & 0x7F); + proto_tree_add_item(tree, hf_q933_first_segment, tvb, offset, 1, ENC_NA); } else { - proto_tree_add_uint_format_value(tree, hf_q933_not_first_segment, tvb, offset, 1, - octet & 0x7F, "%u segments remaining", octet & 0x7F); + proto_tree_add_item(tree, hf_q933_not_first_segment, tvb, offset, 1, ENC_NA); } proto_tree_add_item(tree, hf_q933_segmented_message_type, tvb, offset + 1, 1, ENC_BIG_ENDIAN); } @@ -1432,7 +1430,7 @@ dissect_q933_guint16_value(tvbuff_t *tvb, packet_info *pinfo, int offset, int le /*len -= 1;*/ value_len++; - proto_tree_add_uint_format_value(tree, hf, tvb, offset, value_len, value, "%u ms", value); + proto_tree_add_uint(tree, hf, tvb, offset, value_len, value); return value_len; past_end: @@ -2137,8 +2135,8 @@ proto_register_q933(void) NULL, HFILL }}, /* Generated from convert_proto_tree_add_text.pl */ - { &hf_q933_first_segment, { "First segment", "q933.first_segment", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_q933_not_first_segment, { "Not first segment", "q933.not_first_segment", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_q933_first_segment, { "First segment", "q933.first_segment", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_segment_remaining, 0x7F, NULL, HFILL }}, + { &hf_q933_not_first_segment, { "Not first segment", "q933.not_first_segment", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_segment_remaining, 0x7F, NULL, HFILL }}, { &hf_q933_segmented_message_type, { "Segmented message type", "q933.segmented_message_type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_q933_out_band_negotiation, { "Out-band negotiation", "q933.out_band_negotiation", FT_BOOLEAN, 8, TFS(&tfs_possible_not_possible), 0x40, NULL, HFILL }}, { &hf_q933_layer_1, { "Layer 1", "q933.layer_1", FT_BOOLEAN, 8, TFS(&tfs_asynchronous_synchronous), 0x40, NULL, HFILL }}, @@ -2158,7 +2156,7 @@ proto_register_q933(void) { &hf_q933_mode, { "Mode", "q933.mode", FT_UINT8, BASE_HEX, VALS(q933_mode_vals), 0x60, NULL, HFILL }}, { &hf_q933_default_packet_size_0F, { "Default packet size", "q933.default_packet_size", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }}, { &hf_q933_packet_window_size, { "Packet window size", "q933.packet_window_size", FT_UINT8, BASE_DEC, NULL, 0x7F, NULL, HFILL }}, - { &hf_q933_default_packet_size, { "Default packet size", "q933.default_packet_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_q933_default_packet_size, { "Default packet size", "q933.default_packet_size", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }}, { &hf_q933_additional_layer_3_protocol_information, { "Additional layer 3 protocol information", "q933.additional_layer_3_protocol_information", FT_UINT16, BASE_HEX, VALS(nlpid_vals), 0x0FF0, NULL, HFILL }}, { &hf_q933_recommendation, { "Recommendation", "q933.recommendation", FT_UINT8, BASE_HEX, VALS(q933_cause_recommendation_vals), 0x7F, NULL, HFILL }}, { &hf_q933_network_service, { "Network service", "q933.network_service", FT_BOOLEAN, 8, TFS(&tfs_user_provider), 0x80, NULL, HFILL }}, @@ -2209,10 +2207,10 @@ proto_register_q933(void) { &hf_q933_length, { "Length", "q933.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_q933_diagnostics, { "Diagnostics", "q933.diagnostics", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_q933_display_information, { "Display information", "q933.display_information", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_q933_cumulative_transit_delay, { "Cumulative transit delay", "q933.cumulative_transit_delay", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_q933_requested_end_to_end_transit_delay, { "Requested end-to-end transit delay", "q933.requested_end_to_end_transit_delay", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_q933_max_end_to_end_transit_delay, { "Maximum end-to-end transit delay", "q933.max_end_to_end_transit_delay", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_q933_transit_delay, { "Transit Delay", "q933.transit_delay", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_q933_cumulative_transit_delay, { "Cumulative transit delay", "q933.cumulative_transit_delay", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, + { &hf_q933_requested_end_to_end_transit_delay, { "Requested end-to-end transit delay", "q933.requested_end_to_end_transit_delay", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, + { &hf_q933_max_end_to_end_transit_delay, { "Maximum end-to-end transit delay", "q933.max_end_to_end_transit_delay", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, + { &hf_q933_transit_delay, { "Transit Delay", "q933.transit_delay", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_q933_request, { "Request", "q933.request", FT_BOOLEAN, 8, TFS(&tfs_no_request_request_indicated), 0x04, NULL, HFILL }}, }; diff --git a/epan/dissectors/packet-rsvp.c b/epan/dissectors/packet-rsvp.c index 007e4aca2a..364d1fe210 100644 --- a/epan/dissectors/packet-rsvp.c +++ b/epan/dissectors/packet-rsvp.c @@ -1841,6 +1841,8 @@ static const true_false_string tfs_loose_strict_hop = { "Loose Hop", "Strict Hop static const true_false_string tfs_can_cannot = { "Can", "Cannot" }; static const true_false_string tfs_gen_uni_direction = { "U: 1 - Upstream label/port ID", "U: 0 - Downstream label/port ID" }; +static const unit_name_string units_word_not_including_header = { " word, not including header", " words, not including header" }; + static int hf_rsvp_filter[RSVPF_MAX] = { -1 }; /* RSVP Conversation related Hash functions */ @@ -3552,9 +3554,7 @@ dissect_rsvp_tspec(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_object_t proto_tree_add_uint_format_value(rsvp_object_tree, hf_rsvp_ctype, tvb, offset+3, 1, type, "2 - Integrated Services"); proto_tree_add_item(rsvp_object_tree, hf_rsvp_tspec_message_format_version, tvb, offset2, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint_format_value(rsvp_object_tree, hf_rsvp_data_length, tvb, offset2+2, 2, - tvb_get_ntohs(tvb, offset2+2), "%u words, not including header", - tvb_get_ntohs(tvb, offset2+2)); + proto_tree_add_item(rsvp_object_tree, hf_rsvp_data_length, tvb, offset2+2, 2, ENC_BIG_ENDIAN); mylen -= 4; offset2 += 4; @@ -3562,18 +3562,13 @@ dissect_rsvp_tspec(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_object_t proto_item_set_text(ti, "SENDER TSPEC: IntServ, "); while (mylen > 0) { - guint8 service_num; guint8 param_id; guint param_len, raw_len; guint param_len_processed; guint length; - service_num = tvb_get_guint8(tvb, offset2); proto_tree_add_item(rsvp_object_tree, hf_rsvp_tspec_service_header, tvb, offset2, 1, ENC_BIG_ENDIAN); - length = tvb_get_ntohs(tvb, offset2+2); - proto_tree_add_uint_format(rsvp_object_tree, hf_rsvp_data_length, tvb, offset2+2, 2, - length, "Length of service %u data: %u words, not including header", - service_num, length); + proto_tree_add_item_ret_uint(rsvp_object_tree, hf_rsvp_data_length, tvb, offset2+2, 2, ENC_BIG_ENDIAN, &length); mylen -= 4; offset2 += 4; @@ -3592,8 +3587,7 @@ dissect_rsvp_tspec(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_object_t tspec_tree = proto_item_add_subtree(ti2, TREE(TT_TSPEC_SUBTREE)); proto_tree_add_item(tspec_tree, hf_rsvp_parameter_flags, tvb, offset2+1, 1, ENC_NA); - proto_tree_add_uint_format_value(tspec_tree, hf_rsvp_parameter_length, tvb, offset2+2, 2, - raw_len, "%u words, not including header", raw_len); + proto_tree_add_uint(tspec_tree, hf_rsvp_parameter_length, tvb, offset2+2, 2, raw_len); proto_tree_add_item(tspec_tree, hf_rsvp_tspec_token_bucket_rate, tvb, offset2+4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tspec_tree, hf_rsvp_tspec_token_bucket_size, tvb, offset2+8, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tspec_tree, hf_rsvp_tspec_peak_data_rate, tvb, offset2+12, 4, ENC_BIG_ENDIAN); @@ -3615,8 +3609,7 @@ dissect_rsvp_tspec(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_object_t tspec_tree = proto_item_add_subtree(ti2, TREE(TT_TSPEC_SUBTREE)); proto_tree_add_item(tspec_tree, hf_rsvp_parameter_flags, tvb, offset2+1, 1, ENC_NA); - proto_tree_add_uint_format_value(tspec_tree, hf_rsvp_parameter_length, tvb, offset2+2, 2, - raw_len, "%u words, not including header", raw_len); + proto_tree_add_uint(tspec_tree, hf_rsvp_parameter_length, tvb, offset2+2, 2, raw_len); proto_tree_add_item(tspec_tree, hf_rsvp_maximum_packet_size, tvb, offset2+4, 4, ENC_BIG_ENDIAN); proto_item_append_text(ti, "Null Service. M=%u", tvb_get_ntohl(tvb, offset2+4)); @@ -3630,8 +3623,7 @@ dissect_rsvp_tspec(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_object_t tspec_tree = proto_item_add_subtree(ti2, TREE(TT_TSPEC_SUBTREE)); proto_tree_add_item(tspec_tree, hf_rsvp_parameter_flags, tvb, offset2+1, 1, ENC_NA); - proto_tree_add_uint_format_value(tspec_tree, hf_rsvp_parameter_length, tvb, offset2+2, 2, - raw_len, "%u words, not including header", raw_len); + proto_tree_add_uint(tspec_tree, hf_rsvp_parameter_length, tvb, offset2+2, 2, raw_len); proto_tree_add_item(tspec_tree, hf_rsvp_tspec_hint, tvb, offset2+4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tspec_tree, hf_rsvp_compression_factor, tvb, offset2+4, 4, ENC_BIG_ENDIAN); proto_item_append_text(ti, "Compression Hint. Hint=%u, Factor=%u", @@ -3776,9 +3768,7 @@ dissect_rsvp_flowspec(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_objec return; } proto_tree_add_item(rsvp_object_tree, hf_rsvp_flowspec_message_format_version, tvb, offset2, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint_format_value(rsvp_object_tree, hf_rsvp_data_length, tvb, offset2+2, 2, - tvb_get_ntohs(tvb, offset2+2), "%u words, not including header", - tvb_get_ntohs(tvb, offset2+2)); + proto_tree_add_item(rsvp_object_tree, hf_rsvp_data_length, tvb, offset2+2, 2, ENC_BIG_ENDIAN); proto_item_set_text(ti, "FLOWSPEC: "); @@ -3798,10 +3788,7 @@ dissect_rsvp_flowspec(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_objec } service_num = tvb_get_guint8(tvb, offset2); proto_tree_add_item(rsvp_object_tree, hf_rsvp_flowspec_service_header, tvb, offset2, 1, ENC_BIG_ENDIAN); - length = tvb_get_ntohs(tvb, offset2+2); - proto_tree_add_uint_format(rsvp_object_tree, hf_rsvp_data_length, tvb, offset2+2, 2, - length, "Length of service %u data: %u words, not including header", - service_num, length); + proto_tree_add_item_ret_uint(rsvp_object_tree, hf_rsvp_data_length, tvb, offset2+2, 2, ENC_BIG_ENDIAN, &length); mylen -= 4; offset2 += 4; @@ -3824,8 +3811,7 @@ dissect_rsvp_flowspec(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_objec flowspec_tree = proto_item_add_subtree(ti2, TREE(TT_FLOWSPEC_SUBTREE)); proto_tree_add_item(flowspec_tree, hf_rsvp_parameter_flags, tvb, offset2+1, 1, ENC_NA); - proto_tree_add_uint_format_value(flowspec_tree, hf_rsvp_parameter_length, tvb, offset2+2, 2, - raw_len, "%u words, not including header", raw_len); + proto_tree_add_uint(flowspec_tree, hf_rsvp_parameter_length, tvb, offset2+2, 2, raw_len); proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_token_bucket_rate, tvb, offset2+4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_token_bucket_size, tvb, offset2+8, 4, ENC_BIG_ENDIAN); proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_peak_data_rate, tvb, offset2+12, 4, ENC_BIG_ENDIAN); @@ -3847,8 +3833,7 @@ dissect_rsvp_flowspec(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_objec flowspec_tree = proto_item_add_subtree(ti2, TREE(TT_FLOWSPEC_SUBTREE)); proto_tree_add_item(flowspec_tree, hf_rsvp_parameter_flags, tvb, offset2+1, 1, ENC_NA); - proto_tree_add_uint_format_value(flowspec_tree, hf_rsvp_parameter_length, tvb, offset2+2, 2, - raw_len, "%u words, not including header", raw_len); + proto_tree_add_uint(flowspec_tree, hf_rsvp_parameter_length, tvb, offset2+2, 2, raw_len); proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_rate, tvb, offset2+4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(flowspec_tree, hf_rsvp_flowspec_slack_term, tvb, offset2+8, 4, ENC_BIG_ENDIAN); @@ -3865,8 +3850,7 @@ dissect_rsvp_flowspec(proto_item *ti, packet_info* pinfo, proto_tree *rsvp_objec flowspec_tree = proto_item_add_subtree(ti2, TREE(TT_FLOWSPEC_SUBTREE)); proto_tree_add_item(flowspec_tree, hf_rsvp_parameter_flags, tvb, offset2+1, 1, ENC_NA); - proto_tree_add_uint_format_value(flowspec_tree, hf_rsvp_parameter_length, tvb, offset2+2, 2, - raw_len, "%u words, not including header", raw_len); + proto_tree_add_uint(flowspec_tree, hf_rsvp_parameter_length, tvb, offset2+2, 2, raw_len); proto_tree_add_item(flowspec_tree, hf_rsvp_maximum_packet_size, tvb, offset2+4, 4, ENC_BIG_ENDIAN); proto_item_append_text(ti, "Null Service. M=%u", tvb_get_ntohl(tvb, offset2+4)); @@ -3998,9 +3982,7 @@ dissect_rsvp_adspec(proto_item *ti _U_, packet_info* pinfo, proto_tree *rsvp_obj mylen = obj_length - 4; proto_tree_add_item(rsvp_object_tree, hf_rsvp_adspec_message_format_version, tvb, offset2, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint_format_value(rsvp_object_tree, hf_rsvp_data_length, tvb, offset2+2, 2, - tvb_get_ntohs(tvb, offset2+2), "%u words, not including header", - tvb_get_ntohs(tvb, offset2+2)); + proto_tree_add_item(rsvp_object_tree, hf_rsvp_data_length, tvb, offset2+2, 2, ENC_BIG_ENDIAN); mylen -= 4; offset2 += 4; while (mylen > 0) { @@ -4016,9 +3998,7 @@ dissect_rsvp_adspec(proto_item *ti _U_, packet_info* pinfo, proto_tree *rsvp_obj proto_tree_add_item(adspec_tree, hf_rsvp_adspec_service_header, tvb, offset2, 1, ENC_BIG_ENDIAN); proto_tree_add_item(adspec_tree, hf_rsvp_hf_rsvp_adspec_break_bit, tvb, offset2+1, 1, ENC_NA); - proto_tree_add_uint_format_value(adspec_tree, hf_rsvp_data_length, tvb, offset2+2, 2, - length, "%u words, not including header", - length); + proto_tree_add_uint(adspec_tree, hf_rsvp_data_length, tvb, offset2+2, 2, length); mylen -= 4; offset2 += 4; i = length*4; @@ -6507,13 +6487,10 @@ dissect_rsvp_restart_cap(proto_tree *ti, proto_tree *rsvp_object_tree, switch(type) { case 1: proto_tree_add_uint(rsvp_object_tree, hf_rsvp_ctype, tvb, offset+3, 1, type); - restart = tvb_get_ntohl(tvb, offset2); - proto_tree_add_uint_format_value(rsvp_object_tree, hf_rsvp_restart_cap_restart_time, tvb, offset2, 4, - restart, "%d ms", restart); - recovery = tvb_get_ntohl(tvb, offset2+4); - proto_tree_add_uint_format_value(rsvp_object_tree, hf_rsvp_restart_cap_recovery_time, tvb, offset2+4, 4, - recovery, "%d ms", - recovery); + proto_tree_add_item_ret_uint(rsvp_object_tree, hf_rsvp_restart_cap_restart_time, tvb, offset2, 4, + ENC_BIG_ENDIAN, &restart); + proto_tree_add_item_ret_uint(rsvp_object_tree, hf_rsvp_restart_cap_recovery_time, tvb, offset2+4, 4, + ENC_BIG_ENDIAN, &recovery); proto_item_append_text(ti, "Restart Time: %d ms. Recovery Time: %d ms.", restart, recovery); break; @@ -7712,7 +7689,7 @@ proto_register_rsvp(void) {&hf_rsvp_parameter_length, { "Parameter length", "rsvp.parameter_length", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_word_not_including_header, 0x0, NULL, HFILL } }, @@ -9267,7 +9244,7 @@ proto_register_rsvp(void) { &hf_rsvp_data_length, { "Data length", "rsvp.data_length", - FT_UINT16, BASE_DEC, NULL, 0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_word_not_including_header, 0, NULL, HFILL } }, @@ -9492,8 +9469,8 @@ proto_register_rsvp(void) { &hf_rsvp_gen_uni_data, { "Data", "rsvp.gen_uni.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_rsvp_gen_uni_logical_port_id, { "Logical Port ID", "rsvp.gen_uni.logical_port_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_rsvp_gen_uni_service_level, { "Service Level", "rsvp.gen_uni.service_level", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_rsvp_restart_cap_restart_time, { "Restart Time", "rsvp.restart_cap.restart_time", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_rsvp_restart_cap_recovery_time, { "Recovery Time", "rsvp.restart_cap.recovery_time", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_rsvp_restart_cap_restart_time, { "Restart Time", "rsvp.restart_cap.restart_time", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, + { &hf_rsvp_restart_cap_recovery_time, { "Recovery Time", "rsvp.restart_cap.recovery_time", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_rsvp_detour_plr_id, { "PLR ID", "rsvp.detour.plr_id", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_rsvp_detour_avoid_node_id, { "Avoid Node ID", "rsvp.detour.avoid_node_id", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_rsvp_message_checksum, { "Message Checksum", "rsvp.message_checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, @@ -9508,7 +9485,7 @@ proto_register_rsvp(void) { &hf_rsvp_wavelength_grid, { "Grid", "rsvp.wavelength.grid", FT_UINT8, BASE_DEC, VALS(lambda_grid_vals), 0xE0, NULL, HFILL }}, { &hf_rsvp_wavelength_channel_spacing, { "Channel Spacing", "rsvp.wavelength.channel_spacing", FT_UINT8, BASE_DEC, NULL, 0x1E, NULL, HFILL }}, { &hf_rsvp_wavelength_n, { "n", "rsvp.wavelength.n", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_rsvp_wavelength_wavelength, { "Wavelength", "rsvp.wavelength.wavelength", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_rsvp_wavelength_wavelength, { "Wavelength", "rsvp.wavelength.wavelength", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_nanometers, 0x0, NULL, HFILL }}, { &hf_rsvp_sonet_s, { "S", "rsvp.sonet.s", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_rsvp_sonet_u, { "U", "rsvp.sonet.u", FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL }}, { &hf_rsvp_sonet_k, { "K", "rsvp.sonet.k", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }}, diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c index e134f57565..7c116d5f10 100644 --- a/epan/dissectors/packet-rtps.c +++ b/epan/dissectors/packet-rtps.c @@ -155,7 +155,7 @@ static int hf_rtps_persistence = -1; static int hf_rtps_info_ts_timestamp = -1; static int hf_rtps_locator_kind = -1; static int hf_rtps_locator_port = -1; -static int hf_rtps_logical_port = -1; +/* static int hf_rtps_logical_port = -1; */ static int hf_rtps_locator_public_address_port = -1; static int hf_rtps_locator_ipv4 = -1; static int hf_rtps_locator_ipv6 = -1; @@ -264,9 +264,9 @@ static int hf_rtps_source_participant_guid = -1; static int hf_rtps_message_identity_source_guid = -1; static int hf_rtps_pgm_message_class_id = -1; static int hf_rtps_pgm_data_holder_class_id = -1; -static int hf_rtps_pgm_data_holder_stringseq_size = -1; -static int hf_rtps_pgm_data_holder_stringseq_name = -1; -static int hf_rtps_pgm_data_holder_long_long = -1; +/* static int hf_rtps_pgm_data_holder_stringseq_size = -1; */ +/* static int hf_rtps_pgm_data_holder_stringseq_name = -1; */ +/* static int hf_rtps_pgm_data_holder_long_long = -1; */ static int hf_rtps_param_ntpt_sec = -1; static int hf_rtps_param_ntpt_fraction = -1; @@ -3452,15 +3452,13 @@ gint rtps_util_add_seq_octets(proto_tree *tree, packet_info *pinfo, tvbuff_t *tv guint32 seq_length; proto_item *ti; - seq_length = tvb_get_guint32(tvb, offset, encoding); - - ti = proto_tree_add_uint_format_value(tree, hf_rtps_sequence_size, tvb, offset, 4, seq_length, "%d octets", seq_length); + ti = proto_tree_add_item_ret_uint(tree, hf_rtps_sequence_size, tvb, offset, 4, encoding, &seq_length); offset += 4; /* param length -1 means not specified */ if (param_length != -1 && param_length < 4 + (int)seq_length) { expert_add_info_format(pinfo, ti, &ei_rtps_parameter_value_invalid, "ERROR: Parameter value too small"); - return offset + seq_length;; + return offset + seq_length; } proto_tree_add_item(tree, hf_id, tvb, offset, seq_length, ENC_NA); @@ -10171,13 +10169,13 @@ void proto_register_rtps(void) { FT_INT32, BASE_DEC, NULL, 0, NULL, HFILL } }, - +#if 0 { &hf_rtps_logical_port, { "RTPS Logical Port", "rtps.locator.port", FT_INT32, BASE_DEC, NULL, 0, NULL, HFILL } }, - +#endif { &hf_rtps_locator_public_address_port, { "Public Address Port", "rtps.locator.public_address_port", FT_INT32, BASE_DEC, NULL, 0, @@ -10973,7 +10971,7 @@ void proto_register_rtps(void) { { &hf_rtps_sequence_size, { "sequenceSize", "rtps.sequence_size", - FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0, NULL, HFILL } }, { &hf_rtps_guid, { @@ -11495,6 +11493,7 @@ void proto_register_rtps(void) { { "Class Id", "rtps.pgm.data_holder.class_id", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, +#if 0 { &hf_rtps_pgm_data_holder_stringseq_size, { "Size", "rtps.pgm.data_holder.string_seq_size", FT_INT32, BASE_DEC, NULL, 0, NULL, HFILL } @@ -11507,6 +11506,7 @@ void proto_register_rtps(void) { { "Long long", "rtps.pgm.data_holder.long_long", FT_INT64, BASE_DEC, NULL, 0, NULL, HFILL } }, +#endif { &hf_rtps_param_topic_query_publication_enable, { "Enable", "rtps.param.topic_query_publication_enable", FT_BOOLEAN, 8, TFS(&tfs_true_false), 0, NULL, HFILL } diff --git a/epan/dissectors/packet-scsi-ssc.c b/epan/dissectors/packet-scsi-ssc.c index c31dcbdf12..72fbd9556e 100644 --- a/epan/dissectors/packet-scsi-ssc.c +++ b/epan/dissectors/packet-scsi-ssc.c @@ -494,13 +494,9 @@ dissect_ssc_readblocklimits (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * } else if (!iscdb) { granularity = tvb_get_guint8 (tvb, offset); - proto_tree_add_uint_format_value(tree, hf_scsi_ssc_readblocklimits_granularity, tvb, offset, 1, - 1 << granularity, "%u %s", 1 << granularity, - plurality(1 << granularity, "byte", "bytes")); - proto_tree_add_uint_format_value(tree, hf_scsi_ssc_readblocklimits_max_block_length_limit, tvb, offset+1, 3, - tvb_get_ntoh24 (tvb, offset+1), "%u bytes", tvb_get_ntoh24 (tvb, offset+1)); - proto_tree_add_uint_format_value(tree, hf_scsi_ssc_readblocklimits_min_block_length_limit, tvb, offset+4, 2, - tvb_get_ntohs (tvb, offset+4), "%u bytes", tvb_get_ntohs (tvb, offset+4)); + proto_tree_add_uint(tree, hf_scsi_ssc_readblocklimits_granularity, tvb, offset, 1, 1 << granularity); + proto_tree_add_item(tree, hf_scsi_ssc_readblocklimits_max_block_length_limit, tvb, offset+1, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_ssc_readblocklimits_min_block_length_limit, tvb, offset+4, 2, ENC_BIG_ENDIAN); } } @@ -1348,9 +1344,9 @@ proto_register_scsi_ssc(void) {"Capacity Proportion Value", "scsi_ssc.cpv", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}}, /* Generated from convert_proto_tree_add_text.pl */ - { &hf_scsi_ssc_readblocklimits_granularity, { "Granularity", "scsi_ssc.readblocklimits.granularity", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_ssc_readblocklimits_max_block_length_limit, { "Maximum Block Length Limit", "scsi_ssc.readblocklimits.max_block_length_limit", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_ssc_readblocklimits_min_block_length_limit, { "Minimum Block Length Limit", "scsi_ssc.readblocklimits.min_block_length_limit", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readblocklimits_granularity, { "Granularity", "scsi_ssc.readblocklimits.granularity", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readblocklimits_max_block_length_limit, { "Maximum Block Length Limit", "scsi_ssc.readblocklimits.max_block_length_limit", FT_UINT24, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc_readblocklimits_min_block_length_limit, { "Minimum Block Length Limit", "scsi_ssc.readblocklimits.min_block_length_limit", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_scsi_ssc_erase6_immed, { "IMMED", "scsi_ssc.erase6.immed", FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL }}, { &hf_scsi_ssc_erase6_long, { "LONG", "scsi_ssc.erase6.long", FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }}, { &hf_scsi_ssc_space16_parameter_len, { "Parameter Len", "scsi_ssc.space16.parameter_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c index 36a7401348..0a582cb511 100644 --- a/epan/dissectors/packet-scsi.c +++ b/epan/dissectors/packet-scsi.c @@ -964,6 +964,8 @@ static const value_string scsi_naa_designator_type_val[] = { {0, NULL}, }; +static const unit_name_string units_100_milliseconds = { "100ms", NULL }; + #define SCSI_NUM_PROCEDURES 256 typedef struct scsistat_tap_data { @@ -7429,7 +7431,7 @@ proto_register_scsi(void) { &hf_scsi_ssc2_modepage_active_partition, { "Active Partition", "scsi.ssc2.modepage.active_partition", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_ssc2_modepage_write_object_buffer_full_ratio, { "Write Object Buffer Full Ratio", "scsi.ssc2.modepage.write_object_buffer_full_ratio", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_ssc2_modepage_read_object_buffer_empty_ratio, { "Read Object Buffer Empty Ratio", "scsi.ssc2.modepage.read_object_buffer_empty_ratio", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_ssc2_modepage_write_delay_time, { "Write Delay time", "scsi.ssc2.modepage.write_delay_time", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_ssc2_modepage_write_delay_time, { "Write Delay time", "scsi.ssc2.modepage.write_delay_time", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_100_milliseconds, 0x0, NULL, HFILL }}, { &hf_scsi_ssc2_modepage_obr, { "OBR", "scsi.ssc2.modepage.obr", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }}, { &hf_scsi_ssc2_modepage_gap_size, { "Gap Size", "scsi.ssc2.modepage.gap_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_ssc2_modepage_eod_defined, { "EOD Defined", "scsi.ssc2.modepage.eod_defined", FT_UINT8, BASE_DEC, NULL, 0xE0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-sflow.c b/epan/dissectors/packet-sflow.c index 2292d34ce7..19633ab941 100644 --- a/epan/dissectors/packet-sflow.c +++ b/epan/dissectors/packet-sflow.c @@ -629,6 +629,8 @@ static expert_field ei_sflow_invalid_address_type = EI_INIT; static dissector_table_t header_subdissector_table; +static const unit_name_string units_total_packets = { " total packet", " total packets" }; + void proto_reg_handoff_sflow_245(void); /* dissect a sampled header - layer 2 protocols */ @@ -1436,7 +1438,7 @@ dissect_sflow_5_extended_80211_aggregation(tvbuff_t *tvb _U_, proto_tree *tree _ static gint dissect_sflow_24_flow_sample(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, proto_item *parent) { - guint32 sequence_number, sampling_rate, sample_pool, output; + guint32 sequence_number, sampling_rate, output; proto_tree *extended_data_tree; proto_item *ti; @@ -1451,10 +1453,8 @@ dissect_sflow_24_flow_sample(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_uint_format_value(tree, hf_sflow_flow_sample_sampling_rate, tvb, offset + 8, 4, sampling_rate, "1 out of %u packets", sampling_rate); - sample_pool = tvb_get_ntohl(tvb, offset + 12); - proto_tree_add_uint_format_value(tree, hf_sflow_flow_sample_sample_pool, tvb, offset + 12, 4, - sample_pool, "%u total packets", - sample_pool); + + proto_tree_add_item(tree, hf_sflow_flow_sample_sample_pool, tvb, offset + 12, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_sflow_flow_sample_dropped_packets, tvb, offset + 16, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_sflow_flow_sample_input_interface, tvb, offset + 20, 4, ENC_BIG_ENDIAN); output = tvb_get_ntohl(tvb, offset + 24); @@ -1953,7 +1953,7 @@ static void dissect_sflow_5_flow_sample(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, proto_item *parent) { - guint32 sequence_number, sampling_rate, sample_pool, + guint32 sequence_number, sampling_rate, output, records, i; sequence_number = tvb_get_ntohl(tvb, offset); @@ -1968,9 +1968,7 @@ dissect_sflow_5_flow_sample(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_uint_format_value(tree, hf_sflow_flow_sample_sampling_rate, tvb, offset, 4, sampling_rate, "1 out of %u packets", sampling_rate); offset += 4; - sample_pool = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_sflow_flow_sample_sample_pool, tvb, offset, 4, - sample_pool, "%u total packets", sample_pool); + proto_tree_add_item(tree, hf_sflow_flow_sample_sample_pool, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_sflow_flow_sample_dropped_packets, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; @@ -2005,7 +2003,7 @@ static void dissect_sflow_5_expanded_flow_sample(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, proto_item *parent) { - guint32 sequence_number, sampling_rate, sample_pool, records, i; + guint32 sequence_number, sampling_rate, records, i; sequence_number = tvb_get_ntohl(tvb, offset); proto_tree_add_item(tree, hf_sflow_flow_sample_sequence_number, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -2019,9 +2017,7 @@ dissect_sflow_5_expanded_flow_sample(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_uint_format_value(tree, hf_sflow_flow_sample_sampling_rate, tvb, offset, 4, sampling_rate, "1 out of %u packets", sampling_rate); offset += 4; - sample_pool = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_sflow_flow_sample_sample_pool, tvb, offset, 4, - sample_pool, "%u total packets", sample_pool); + proto_tree_add_item(tree, hf_sflow_flow_sample_sample_pool, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_sflow_flow_sample_dropped_packets, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; @@ -3321,7 +3317,7 @@ proto_register_sflow(void) { }, { &hf_sflow_flow_sample_sample_pool, { "Sample pool", "sflow.flow_sample.sample_pool", - FT_UINT32, BASE_DEC, NULL, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_total_packets, 0x0, NULL, HFILL } }, { &hf_sflow_flow_sample_dropped_packets, diff --git a/epan/dissectors/packet-slimp3.c b/epan/dissectors/packet-slimp3.c index 43f7ff4558..3fbb6bdf84 100644 --- a/epan/dissectors/packet-slimp3.c +++ b/epan/dissectors/packet-slimp3.c @@ -358,9 +358,7 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ case 0: in_str = FALSE; lcd_strlen = 0; - value = tvb_get_guint8(tvb, offset + i1 + 1); - proto_tree_add_uint_format_value(slimp3_tree, hf_slimp3_display_delay, tvb, offset + i1, 2, - value, "%u ms", value); + proto_tree_add_item(slimp3_tree, hf_slimp3_display_delay, tvb, offset + i1, 2, ENC_NA); i1 += 2; break; case 3: @@ -686,7 +684,7 @@ proto_register_slimp3(void) NULL, HFILL }}, /* Generated from convert_proto_tree_add_text.pl */ - { &hf_slimp3_display_delay, { "Delay", "slimp3.display_delay", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_slimp3_display_delay, { "Delay", "slimp3.display_delay", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_slimp3_display_string, { "String", "slimp3.display_string", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_slimp3_display_command, { "Command", "slimp3.display_command", FT_UINT8, BASE_DEC, VALS(slimp3_display_commands), 0x0, NULL, HFILL }}, { &hf_slimp3_display_unknown, { "Unknown", "slimp3.display_unknown", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-spice.c b/epan/dissectors/packet-spice.c index 0441bd8ffe..7aaf66065f 100644 --- a/epan/dissectors/packet-spice.c +++ b/epan/dissectors/packet-spice.c @@ -969,7 +969,7 @@ dissect_ImageQuic(tvbuff_t *tvb, proto_tree *tree, guint32 offset) ImageQuic_tree = proto_tree_add_subtree(tree, tvb, offset, QuicSize + 4, ett_imageQuic, NULL, "QUIC Image"); - proto_tree_add_uint_format_value(ImageQuic_tree, hf_spice_quic_image_size, tvb, offset, 4, QuicSize, "%u bytes", QuicSize); + proto_tree_add_uint(ImageQuic_tree, hf_spice_quic_image_size, tvb, offset, 4, QuicSize); offset += 4; proto_tree_add_item(ImageQuic_tree, hf_spice_quic_magic, tvb, offset, 4, ENC_ASCII|ENC_NA); offset += 4; @@ -1066,7 +1066,7 @@ dissect_ImageLZ_JPEG(tvbuff_t *tvb, proto_tree *tree, guint32 offset) const guint32 LZ_JPEGSize = tvb_get_letohl(tvb, offset); LZ_JPEG_tree = proto_tree_add_subtree(tree, tvb, offset, LZ_JPEGSize + 4, ett_LZ_JPEG, NULL, "LZ_JPEG Image"); - proto_tree_add_uint_format_value(LZ_JPEG_tree, hf_spice_lz_jpeg_image_size, tvb, offset, 4, LZ_JPEGSize, "%u bytes", LZ_JPEGSize); + proto_tree_add_uint(LZ_JPEG_tree, hf_spice_lz_jpeg_image_size, tvb, offset, 4, LZ_JPEGSize); offset += 4; offset += dissect_ImageLZ_common_header(tvb, LZ_JPEG_tree, offset); @@ -1083,7 +1083,7 @@ dissect_ImageGLZ_RGB(tvbuff_t *tvb, proto_tree *tree, guint32 offset, const guin if (size == 0) { /* if no size was passed to us, need to fetch it. Otherwise, we already have it from the callee */ GLZ_RGBSize = tvb_get_letohl(tvb, offset); GLZ_RGB_tree = proto_tree_add_subtree(tree, tvb, offset, GLZ_RGBSize + 4, ett_GLZ_RGB, NULL, "GLZ_RGB Image"); - proto_tree_add_uint_format_value(GLZ_RGB_tree, hf_spice_glz_rgb_image_size, tvb, offset, 4, GLZ_RGBSize, "%u bytes", GLZ_RGBSize); + proto_tree_add_uint(GLZ_RGB_tree, hf_spice_glz_rgb_image_size, tvb, offset, 4, GLZ_RGBSize); offset += 4; } else { GLZ_RGBSize = size; @@ -1102,7 +1102,7 @@ dissect_ImageLZ_RGB(tvbuff_t *tvb, proto_tree *tree, guint32 offset) const guint32 LZ_RGBSize = tvb_get_letohl(tvb, offset); LZ_RGB_tree = proto_tree_add_subtree(tree, tvb, offset, LZ_RGBSize + 4, ett_LZ_RGB, NULL, "LZ_RGB Image"); - proto_tree_add_uint_format_value(LZ_RGB_tree, hf_spice_lz_rgb_image_size, tvb, offset, 4, LZ_RGBSize, "%u bytes", LZ_RGBSize); + proto_tree_add_uint(LZ_RGB_tree, hf_spice_lz_rgb_image_size, tvb, offset, 4, LZ_RGBSize); offset += 4; dissect_ImageLZ_common(tvb, LZ_RGB_tree, offset, TRUE, LZ_RGBSize); @@ -1126,8 +1126,7 @@ dissect_ImageLZ_PLT(tvbuff_t *tvb, proto_tree *tree, guint32 offset) proto_tree_add_uint_format_value(LZ_PLT_tree, hf_spice_lz_plt_image_size, tvb, offset, 4, LZ_PLTSize, "%u bytes (2 extra bytes?)", LZ_PLTSize); offset += 4; - pal_size = tvb_get_letohl(tvb, offset); - proto_tree_add_uint_format_value(LZ_PLT_tree, hf_spice_palette_offset, tvb, offset, 4, pal_size, "%u bytes", pal_size); /* TODO: not sure it's correct */ + proto_tree_add_item_ret_uint(LZ_PLT_tree, hf_spice_palette_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN, &pal_size); /* TODO: not sure it's correct */ offset += 4; dissect_ImageLZ_common_header(tvb, LZ_PLT_tree, offset); @@ -4434,7 +4433,7 @@ proto_register_spice(void) { &hf_spice_pixmap_pixels, { "Pixmap pixels", "spice.pixmap_pixels", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_spice_palette, { "Palette", "spice.palette", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_spice_cursor_data, { "Cursor data", "spice.cursor_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_spice_quic_image_size, { "QUIC image size", "spice.quic_image_size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_spice_quic_image_size, { "QUIC image size", "spice.quic_image_size", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_spice_quic_magic, { "QUIC magic", "spice.quic_magic", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_spice_quic_compressed_image_data, { "QUIC compressed image data", "spice.quic_compressed_image_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_spice_lz_magic, { "LZ magic", "spice.lz_magic", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, @@ -4442,13 +4441,13 @@ proto_register_spice(void) { &hf_spice_topdown_flag, { "Topdown flag", "spice.topdown_flag", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_spice_unknown_bytes, { "Unknown bytes", "spice.unknown_bytes", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, #if 0 - { &hf_spice_lz_jpeg_image_size, { "LZ JPEG image size", "spice.lz_jpeg_image_size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_spice_lz_jpeg_image_size, { "LZ JPEG image size", "spice.lz_jpeg_image_size", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, #endif - { &hf_spice_glz_rgb_image_size, { "GLZ RGB image size", "spice.glz_rgb_image_size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_spice_lz_rgb_image_size, { "LZ RGB image size", "spice.lz_rgb_image_size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_spice_glz_rgb_image_size, { "GLZ RGB image size", "spice.glz_rgb_image_size", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, + { &hf_spice_lz_rgb_image_size, { "LZ RGB image size", "spice.lz_rgb_image_size", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_spice_lz_plt_flag, { "LZ_PLT Flag", "spice.lz_plt_flag", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_spice_lz_plt_image_size, { "LZ PLT image size", "spice.lz_plt_image_size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_spice_palette_offset, { "palette offset", "spice.palette_offset", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_spice_palette_offset, { "palette offset", "spice.palette_offset", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_spice_lz_plt_data, { "LZ_PLT data", "spice.lz_plt_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_spice_zlib_stream, { "ZLIB stream", "spice.zlib_stream", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_spice_image_from_cache, { "Image from Cache", "spice.image_from_cache", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-stt.c b/epan/dissectors/packet-stt.c index 1c5f13851f..cdd2ef5414 100644 --- a/epan/dissectors/packet-stt.c +++ b/epan/dissectors/packet-stt.c @@ -310,11 +310,10 @@ dissect_tcp_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *stt_tree) proto_item_set_text(tcp_item, "TCP Data"); data_offset = hi_nibble(tvb_get_guint8(tvb, offset)) * 4; - data_offset_item = proto_tree_add_uint_format_value(tcp_tree, - hf_stt_tcp_data_offset, - tvb, offset, 1, - data_offset, - "%u bytes", data_offset); + data_offset_item = proto_tree_add_uint(tcp_tree, + hf_stt_tcp_data_offset, + tvb, offset, 1, + data_offset); if (data_offset != STT_TCP_HDR_LEN) { expert_add_info(pinfo, data_offset_item, &ei_stt_data_offset_bad); } @@ -604,7 +603,7 @@ proto_register_stt(void) }, { &hf_stt_tcp_data_offset, { "Data Offset", "stt.tcp.data_offset", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL, }, }, diff --git a/epan/dissectors/packet-tdmop.c b/epan/dissectors/packet-tdmop.c index 3dadcb2a06..92cf9d5092 100644 --- a/epan/dissectors/packet-tdmop.c +++ b/epan/dissectors/packet-tdmop.c @@ -158,7 +158,7 @@ static int dissect_tdmop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo { mask = tvb_get_letohl(tvb,offset); mask = ((mask >> 16) & 0xFFFF)|((mask & 0xFFFF) << 16); - proto_tree_add_uint_format_value(currentblock, hf_tdmop_Compression_mask, tvb, offset, 4, mask, "%08X", mask); + proto_tree_add_uint(currentblock, hf_tdmop_Compression_mask, tvb, offset, 4, mask); offset+=4; } for (i=0; i<32; i++) diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c index 90c5980122..b7797243ce 100644 --- a/epan/dissectors/packet-tds.c +++ b/epan/dissectors/packet-tds.c @@ -1148,6 +1148,8 @@ static const value_string prelogin_encryption_options[] = { {0, NULL} }; +static const unit_name_string units_characters = { " character", " characters" }; + #define TDS_MAX_COLUMNS 256 /* @@ -2748,8 +2750,8 @@ static int dissect_tds_error_token(tvbuff_t *tvb, guint offset, proto_tree *tree, tds_conv_info_t *tds_info) { guint cur = offset; - guint16 msg_len; - guint8 srvr_len, proc_len; + guint32 msg_len; + guint32 srvr_len, proc_len; int encoding = tds_little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN; proto_tree_add_item(tree, hf_tds_error_length, tvb, cur, 2, ENC_LITTLE_ENDIAN); @@ -2762,17 +2764,14 @@ dissect_tds_error_token(tvbuff_t *tvb, guint offset, proto_tree *tree, tds_conv_ proto_tree_add_item(tree, hf_tds_error_class, tvb, cur, 1, ENC_NA); cur +=1; - msg_len = tvb_get_guint16(tvb, cur, encoding); - proto_tree_add_uint_format_value(tree, hf_tds_error_msgtext_length, tvb, cur, 2, msg_len, "%u characters", msg_len); + proto_tree_add_item_ret_uint(tree, hf_tds_error_msgtext_length, tvb, cur, 2, encoding, &msg_len); cur +=2; msg_len *= 2; proto_tree_add_item(tree, hf_tds_error_msgtext, tvb, cur, msg_len, ENC_UTF_16|ENC_LITTLE_ENDIAN); cur += msg_len; - srvr_len = tvb_get_guint8(tvb, cur); - - proto_tree_add_uint_format_value(tree, hf_tds_error_servername_length, tvb, cur, 1, srvr_len, "%u characters", srvr_len); + proto_tree_add_item_ret_uint(tree, hf_tds_error_servername_length, tvb, cur, 1, ENC_NA, &srvr_len); cur +=1; if(srvr_len) { srvr_len *=2; @@ -2780,9 +2779,7 @@ dissect_tds_error_token(tvbuff_t *tvb, guint offset, proto_tree *tree, tds_conv_ cur += srvr_len; } - proc_len = tvb_get_guint8(tvb, cur); - - proto_tree_add_uint_format_value(tree, hf_tds_error_procname_length, tvb, cur, 1, proc_len, "%u characters", proc_len); + proto_tree_add_item_ret_uint(tree, hf_tds_error_procname_length, tvb, cur, 1, ENC_NA, &proc_len); cur +=1; if(proc_len) { proc_len *=2; @@ -2805,8 +2802,8 @@ static int dissect_tds_info_token(tvbuff_t *tvb, guint offset, proto_tree *tree, tds_conv_info_t *tds_info) { guint cur = offset; - guint16 msg_len; - guint8 srvr_len, proc_len; + guint32 msg_len; + guint32 srvr_len, proc_len; int encoding = tds_little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN; proto_tree_add_item(tree, hf_tds_info_length, tvb, cur, 2, ENC_LITTLE_ENDIAN); @@ -2819,17 +2816,14 @@ dissect_tds_info_token(tvbuff_t *tvb, guint offset, proto_tree *tree, tds_conv_i proto_tree_add_item(tree, hf_tds_info_class, tvb, cur, 1, ENC_NA); cur +=1; - msg_len = tvb_get_guint16(tvb, cur, encoding); - proto_tree_add_uint_format_value(tree, hf_tds_info_msgtext_length, tvb, cur, 2, msg_len, "%u characters", msg_len); + proto_tree_add_item_ret_uint(tree, hf_tds_info_msgtext_length, tvb, cur, 2, encoding, &msg_len); cur +=2; msg_len *= 2; proto_tree_add_item(tree, hf_tds_info_msgtext, tvb, cur, msg_len, ENC_UTF_16|ENC_LITTLE_ENDIAN); cur += msg_len; - srvr_len = tvb_get_guint8(tvb, cur); - - proto_tree_add_uint_format_value(tree, hf_tds_info_servername_length, tvb, cur, 1, srvr_len, "%u characters", srvr_len); + proto_tree_add_item_ret_uint(tree, hf_tds_info_servername_length, tvb, cur, 1, ENC_NA, &srvr_len); cur +=1; if(srvr_len) { srvr_len *=2; @@ -2837,9 +2831,7 @@ dissect_tds_info_token(tvbuff_t *tvb, guint offset, proto_tree *tree, tds_conv_i cur += srvr_len; } - proc_len = tvb_get_guint8(tvb, cur); - - proto_tree_add_uint_format_value(tree, hf_tds_info_procname_length, tvb, cur, 1, proc_len, "%u characters", proc_len); + proto_tree_add_item_ret_uint(tree, hf_tds_info_procname_length, tvb, cur, 1, ENC_NA, &proc_len); cur +=1; if(proc_len) { proc_len *=2; @@ -4645,7 +4637,7 @@ proto_register_tds(void) }, { &hf_tds_error_msgtext_length, { "Error message length", "tds.error.msgtext_length", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_characters, 0x0, NULL, HFILL } }, { &hf_tds_error_msgtext, @@ -4655,7 +4647,7 @@ proto_register_tds(void) }, { &hf_tds_error_servername_length, { "Server name length", "tds.error.servername_length", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_characters, 0x0, NULL, HFILL } }, { &hf_tds_error_servername, @@ -4665,7 +4657,7 @@ proto_register_tds(void) }, { &hf_tds_error_procname_length, { "Process name length", "tds.error.procname_length", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_characters, 0x0, NULL, HFILL } }, { &hf_tds_error_procname, @@ -4741,7 +4733,7 @@ proto_register_tds(void) }, { &hf_tds_info_msgtext_length, { "Error message length", "tds.info.msgtext_length", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_characters, 0x0, NULL, HFILL } }, { &hf_tds_info_msgtext, @@ -4751,7 +4743,7 @@ proto_register_tds(void) }, { &hf_tds_info_servername_length, { "Server name length", "tds.info.servername_length", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_characters, 0x0, NULL, HFILL } }, { &hf_tds_info_servername, @@ -4761,7 +4753,7 @@ proto_register_tds(void) }, { &hf_tds_info_procname_length, { "Process name length", "tds.info.procname_length", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_characters, 0x0, NULL, HFILL } }, { &hf_tds_info_procname, diff --git a/epan/dissectors/packet-trmac.c b/epan/dissectors/packet-trmac.c index 2b44ee97c5..6f2653c504 100644 --- a/epan/dissectors/packet-trmac.c +++ b/epan/dissectors/packet-trmac.c @@ -245,8 +245,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) } error_report_timer_value = 10 * tvb_get_ntohs(tvb, svoff+2); - proto_tree_add_uint_format_value(sv_tree, hf_trmac_error_report_timer_value, tvb, svoff+2, sv_length-2, - error_report_timer_value, "%u ms", error_report_timer_value ); + proto_tree_add_uint(sv_tree, hf_trmac_error_report_timer_value, tvb, svoff+2, sv_length-2, error_report_timer_value); proto_item_append_text(sv_item, ": %u ms", error_report_timer_value ); break; @@ -497,8 +496,7 @@ dissect_trmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U mac_tree = proto_item_add_subtree(ti, ett_tr_mac); proto_tree_add_uint(mac_tree, hf_trmac_mv, tvb, 3, 1, mv_val); - proto_tree_add_uint_format_value(mac_tree, hf_trmac_length, tvb, 0, 2, mv_length, - "%d bytes", mv_length); + proto_tree_add_uint(mac_tree, hf_trmac_length, tvb, 0, 2, mv_length); proto_tree_add_uint(mac_tree, hf_trmac_srcclass, tvb, 2, 1, tvb_get_guint8(tvb, 2) & 0x0f); proto_tree_add_uint(mac_tree, hf_trmac_dstclass, tvb, 2, 1, tvb_get_guint8(tvb, 2) >> 4 ); @@ -527,7 +525,7 @@ proto_register_trmac(void) NULL, HFILL }}, { &hf_trmac_length, - { "Total Length", "trmac.length", FT_UINT8, BASE_DEC, NULL, 0x0, + { "Total Length", "trmac.length", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0, NULL, HFILL }}, { &hf_trmac_srcclass, @@ -611,7 +609,7 @@ proto_register_trmac(void) NULL, HFILL }}, { &hf_trmac_error_report_timer_value, - { "Error Report Timer Value", "trmac.error_report_timer_value", FT_UINT16, BASE_DEC, NULL, 0x0, + { "Error Report Timer Value", "trmac.error_report_timer_value", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_trmac_authorized_function_classes, diff --git a/epan/dissectors/packet-ua3g.c b/epan/dissectors/packet-ua3g.c index c8acf15cbd..979566ec08 100644 --- a/epan/dissectors/packet-ua3g.c +++ b/epan/dissectors/packet-ua3g.c @@ -4296,7 +4296,7 @@ proto_register_ua3g(void) { &hf_ua3g_ringing_cadence_on_off, { "On / Off", "ua3g.ringing_cadence.on_off", FT_BOOLEAN, 8, TFS(&tfs_on_off), 0x80, NULL, HFILL }}, { &hf_ua3g_ringing_cadence_length, { "Length (ms)", "ua3g.ringing_cadence.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ua3g_feedback_level, { "Level (dB)", "ua3g.command.feedback.level", FT_INT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_ua3g_feedback_duration, { "Duration (ms)", "ua3g.command.feedback.duration", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_ua3g_feedback_duration, { "Duration", "ua3g.command.feedback.duration", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, NULL, HFILL }}, { &hf_ua3g_r_w_peripheral_address, { "Address", "ua3g.r_w_peripheral.address", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ua3g_r_w_peripheral_content, { "Content", "ua3g.r_w_peripheral.content", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ua3g_icon_cmd_icon_number, { "Icon Number", "ua3g.icon_cmd.icon_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c index c559488390..c1dedf0553 100644 --- a/epan/dissectors/packet-udp.c +++ b/epan/dissectors/packet-udp.c @@ -1082,24 +1082,16 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) process_tree = proto_tree_add_subtree(udp_tree, tvb, offset, 0, ett_udp_process_info, &ti, "Process Information"); PROTO_ITEM_SET_GENERATED(ti); if (udpd->fwd && udpd->fwd->command) { - proto_tree_add_uint_format_value(process_tree, hfi_udp_proc_dst_uid.id, tvb, 0, 0, - udpd->fwd->process_uid, "%u", udpd->fwd->process_uid); - proto_tree_add_uint_format_value(process_tree, hfi_udp_proc_dst_pid.id, tvb, 0, 0, - udpd->fwd->process_pid, "%u", udpd->fwd->process_pid); - proto_tree_add_string_format_value(process_tree, hfi_udp_proc_dst_uname.id, tvb, 0, 0, - udpd->fwd->username, "%s", udpd->fwd->username); - proto_tree_add_string_format_value(process_tree, hfi_udp_proc_dst_cmd.id, tvb, 0, 0, - udpd->fwd->command, "%s", udpd->fwd->command); + proto_tree_add_uint(process_tree, &hfi_udp_proc_dst_uid, tvb, 0, 0, udpd->fwd->process_uid); + proto_tree_add_uint(process_tree, &hfi_udp_proc_dst_pid, tvb, 0, 0, udpd->fwd->process_pid); + proto_tree_add_string(process_tree, &hfi_udp_proc_dst_uname, tvb, 0, 0, udpd->fwd->username); + proto_tree_add_string(process_tree, &hfi_udp_proc_dst_cmd, tvb, 0, 0, udpd->fwd->command); } if (udpd->rev->command) { - proto_tree_add_uint_format_value(process_tree, hfi_udp_proc_src_uid.id, tvb, 0, 0, - udpd->rev->process_uid, "%u", udpd->rev->process_uid); - proto_tree_add_uint_format_value(process_tree, hfi_udp_proc_src_pid.id, tvb, 0, 0, - udpd->rev->process_pid, "%u", udpd->rev->process_pid); - proto_tree_add_string_format_value(process_tree, hfi_udp_proc_src_uname.id, tvb, 0, 0, - udpd->rev->username, "%s", udpd->rev->username); - proto_tree_add_string_format_value(process_tree, hfi_udp_proc_src_cmd.id, tvb, 0, 0, - udpd->rev->command, "%s", udpd->rev->command); + proto_tree_add_uint(process_tree, &hfi_udp_proc_src_uid, tvb, 0, 0, udpd->rev->process_uid); + proto_tree_add_uint(process_tree, &hfi_udp_proc_src_pid, tvb, 0, 0, udpd->rev->process_pid); + proto_tree_add_string(process_tree, &hfi_udp_proc_src_uname, tvb, 0, 0, udpd->rev->username); + proto_tree_add_string(process_tree, &hfi_udp_proc_src_cmd, tvb, 0, 0, udpd->rev->command); } } diff --git a/epan/unit_strings.c b/epan/unit_strings.c index 03dd077923..cfcfeb9bce 100644 --- a/epan/unit_strings.c +++ b/epan/unit_strings.c @@ -22,6 +22,7 @@ #include "config.h" +#include #include #include "unit_strings.h" @@ -49,16 +50,27 @@ char* unit_name_string_get_value64(guint64 value, unit_name_string* units) const unit_name_string units_foot_feet = { " foot", " feet" }; const unit_name_string units_bit_bits = { " bit", " bits" }; const unit_name_string units_byte_bytes = { " byte", " bytes" }; +const unit_name_string units_octet_octets = { " octet", " octets" }; const unit_name_string units_word_words = { " word", " words" }; +const unit_name_string units_tick_ticks = { " tick", " ticks" }; const unit_name_string units_second_seconds = { " second", " seconds" }; const unit_name_string units_seconds = { "s", NULL }; const unit_name_string units_millisecond_milliseconds = { " millisecond", " milliseconds" }; const unit_name_string units_milliseconds = { "ms", NULL }; +const unit_name_string units_microseconds = { UTF8_MICRO_SIGN "s", NULL }; const unit_name_string units_nanosecond_nanoseconds = { " nanosecond", " nanoseconds" }; +const unit_name_string units_nanometers = { "nm", NULL }; const unit_name_string units_degree_degrees = { " degree", " degrees" }; +const unit_name_string units_decibals = { "dB", NULL }; +const unit_name_string units_percent = { "%", NULL }; +const unit_name_string units_mhz = { "MHz", NULL }; const unit_name_string units_ghz = { "GHz", NULL }; const unit_name_string units_hz = { "Hz", NULL }; const unit_name_string units_hz_s = { "Hz/s", NULL }; +const unit_name_string units_kbit = { "kbit", NULL }; +const unit_name_string units_kbps = { "Kbps", NULL }; +const unit_name_string units_bit_sec = { "bits/s", NULL }; +const unit_name_string units_segment_remaining = { " segment remaining", " segments remaining" }; /* diff --git a/epan/unit_strings.h b/epan/unit_strings.h index f6ca847bd8..c703f12c6c 100644 --- a/epan/unit_strings.h +++ b/epan/unit_strings.h @@ -49,16 +49,27 @@ WS_DLL_PUBLIC char* unit_name_string_get_value64(guint64 value, unit_name_string WS_DLL_PUBLIC const unit_name_string units_foot_feet; WS_DLL_PUBLIC const unit_name_string units_bit_bits; WS_DLL_PUBLIC const unit_name_string units_byte_bytes; +WS_DLL_PUBLIC const unit_name_string units_octet_octets; WS_DLL_PUBLIC const unit_name_string units_word_words; +WS_DLL_PUBLIC const unit_name_string units_tick_ticks; WS_DLL_PUBLIC const unit_name_string units_second_seconds; // full unit name "second[s?]" WS_DLL_PUBLIC const unit_name_string units_seconds; //only seconds abbreviation "s" WS_DLL_PUBLIC const unit_name_string units_millisecond_milliseconds; // full unit name "millisecond[s?]" WS_DLL_PUBLIC const unit_name_string units_milliseconds; //only seconds abbreviation "ms" +WS_DLL_PUBLIC const unit_name_string units_microseconds; //only seconds abbreviation "us" WS_DLL_PUBLIC const unit_name_string units_nanosecond_nanoseconds; // full unit name "nanosecond[s?]" +WS_DLL_PUBLIC const unit_name_string units_nanometers; WS_DLL_PUBLIC const unit_name_string units_degree_degrees; +WS_DLL_PUBLIC const unit_name_string units_decibals; +WS_DLL_PUBLIC const unit_name_string units_percent; WS_DLL_PUBLIC const unit_name_string units_ghz; +WS_DLL_PUBLIC const unit_name_string units_mhz; WS_DLL_PUBLIC const unit_name_string units_hz; WS_DLL_PUBLIC const unit_name_string units_hz_s; +WS_DLL_PUBLIC const unit_name_string units_kbit; +WS_DLL_PUBLIC const unit_name_string units_kbps; +WS_DLL_PUBLIC const unit_name_string units_bit_sec; +WS_DLL_PUBLIC const unit_name_string units_segment_remaining; #ifdef __cplusplus } -- cgit v1.2.3