aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ptp.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-12-13 14:26:27 -0500
committerMichael Mann <mmann78@netscape.net>2016-12-13 22:56:50 +0000
commitb7f4e250599d7ea0452711d388c161fd4ef61c60 (patch)
tree0eb636cef1c72912cef640148b680d8ddabbed2d /epan/dissectors/packet-ptp.c
parenta869ec6f55160622a90bc437517dee91d57f85d5 (diff)
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 <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-ptp.c')
-rw-r--r--epan/dissectors/packet-ptp.c15
1 files changed, 5 insertions, 10 deletions
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,