diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-02-08 03:16:35 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-02-08 03:16:35 +0000 |
commit | 045037dc715d9308bea85c370f5e86cf8b407ceb (patch) | |
tree | 4ecae69d4b5fd905cf5cea1de97c5d37d13f8ea0 /epan | |
parent | b87a80f196bd712627c042fb834881c27d291326 (diff) |
Add NTP times using proto_tree_add_item().
svn path=/trunk/; revision=35876
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-mikey.c | 15 | ||||
-rw-r--r-- | epan/dissectors/packet-mip.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-mip6.c | 46 | ||||
-rw-r--r-- | epan/dissectors/packet-mpls-echo.c | 17 |
4 files changed, 33 insertions, 61 deletions
diff --git a/epan/dissectors/packet-mikey.c b/epan/dissectors/packet-mikey.c index c54d0b638a..005f6b0071 100644 --- a/epan/dissectors/packet-mikey.c +++ b/epan/dissectors/packet-mikey.c @@ -46,7 +46,6 @@ #include <epan/prefs.h> #include <epan/asn1.h> #include <epan/dissectors/packet-x509af.h> -#include "packet-ntp.h" #ifdef HAVE_LIBGCRYPT #include <gcrypt.h> @@ -858,18 +857,10 @@ dissect_payload_t(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, pro switch (ts_type) { case T_NTP: - case T_NTP_UTC: { - const gchar *buff; - - tvb_ensure_bytes_exist(tvb, offset+2, 8); - buff = ntp_fmt_ts(tvb_get_ptr(tvb, offset+2, 8)); - - if (tree) - proto_tree_add_string_format(tree, hf_mikey[POS_TS_NTP], tvb, offset+2, 8, (const char*)buff, "NTP timestamp: %s", buff); - + case T_NTP_UTC: + proto_tree_add_item(tree, hf_mikey[POS_TS_NTP], tvb, offset+2, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN); len = 10; break; - } case T_COUNTER: len = 6; break; @@ -1520,7 +1511,7 @@ proto_register_mikey(void) NULL, HFILL }}, { &hf_mikey[POS_TS_NTP], { "NTP timestamp", "mikey.t.ntp", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }}, { &hf_mikey[POS_PAYLOAD_STR], diff --git a/epan/dissectors/packet-mip.c b/epan/dissectors/packet-mip.c index 0cc5a0990f..93a4b144a1 100644 --- a/epan/dissectors/packet-mip.c +++ b/epan/dissectors/packet-mip.c @@ -37,7 +37,6 @@ #include <epan/packet.h> #include <epan/sminmpec.h> -#include "packet-ntp.h" /* Initialize the protocol and registered fields */ static int proto_mip = -1; @@ -663,7 +662,6 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 type; guint16 flags; gint offset=0; - const guint8 *reftime; tvbuff_t *next_tvb; /* Make entries in Protocol column and Info column on summary display */ @@ -719,11 +717,7 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 4; /* Identifier - assumed to be an NTP time here */ - reftime = tvb_get_ptr(tvb, offset, 8); - proto_tree_add_bytes_format(mip_tree, hf_mip_ident, tvb, offset, 8, - reftime, - "Identification: %s", - ntp_fmt_ts(reftime)); + proto_tree_add_item(mip_tree, hf_mip_ident, tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN); offset += 8; } /* if tree */ @@ -761,11 +755,7 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 4; /* Identifier - assumed to be an NTP time here */ - reftime = tvb_get_ptr(tvb, offset, 8); - proto_tree_add_bytes_format(mip_tree, hf_mip_ident, tvb, offset, 8, - reftime, - "Identification: %s", - ntp_fmt_ts(reftime)); + proto_tree_add_item(mip_tree, hf_mip_ident, tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN); offset += 8; } /* if tree */ break; @@ -973,7 +963,7 @@ void proto_register_mip(void) }, { &hf_mip_ident, { "Identification", "mip.ident", - FT_BYTES, BASE_NONE, NULL, 0, + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, "MN Identification.", HFILL } }, { &hf_mip_ext_type, diff --git a/epan/dissectors/packet-mip6.c b/epan/dissectors/packet-mip6.c index 1fd4d014d5..53c6539651 100644 --- a/epan/dissectors/packet-mip6.c +++ b/epan/dissectors/packet-mip6.c @@ -40,7 +40,6 @@ #include <epan/ip_opts.h> #include <epan/expert.h> #include <epan/sminmpec.h> -#include "packet-ntp.h" /* Mobility Header types */ typedef enum { @@ -135,7 +134,7 @@ typedef enum { MIP6_MNLLAII = 42, /* 42 Mobile Node Link-local Address Interface Identifier Option [RFC5949] */ MIP6_TB = 43, /* 43 Transient Binding [RFC-ietf-mipshop-transient-bce-pmipv6-07] */ MIP6_FS = 44, /* 44 Flow Summary Mobility Option [RFC-ietf-mext-flow-binding-11] */ - MIP6_FI = 45, /* 45 Flow Identification Mobility Option [RFC-ietf-mext-flow-binding-11]] */ + MIP6_FI = 45, /* 45 Flow Identification Mobility Option [RFC-ietf-mext-flow-binding-11]] */ } optTypes; @@ -185,7 +184,7 @@ static const true_false_string pmip6_bu_t_flag_value = { "No TLV-header format" }; -/* Binding Acknowledgement status values +/* Binding Acknowledgement status values * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml */ static const value_string mip6_ba_status_value[] = { @@ -196,7 +195,7 @@ static const value_string mip6_ba_status_value[] = { { 4, "MCOA NOTCOMPLETE" }, /* [RFC5648] */ { 5, "MCOA RETURNHOME WO/NDP" }, /* [RFC5648] */ { 6, "PBU_ACCEPTED_TB_IGNORED_SETTINGSMISMATCH" }, /* [RFC-ietf-mipshop-transient-bce-pmipv6-07] */ - /* 7-127 Unassigned */ + /* 7-127 Unassigned */ { 128, "Reason unspecified" }, { 129, "Administratively prohibited" }, @@ -463,7 +462,7 @@ static const value_string mip6_mobility_options[] = { { MIP6_MNLLAII, "Mobile Node Link-local Address Interface Identifier Option"}, /* RFC5949 */ { MIP6_TB, "Transient Binding"}, /* [RFC-ietf-mipshop-transient-bce-pmipv6-07] */ { MIP6_FS, "Flow Summary"}, /* [RFC-ietf-mext-flow-binding-11] */ - { MIP6_FI, "Flow Identification"}, /* [RFC-ietf-mext-flow-binding-11]] */ + { MIP6_FI, "Flow Identification"}, /* [RFC-ietf-mext-flow-binding-11]] */ { 0, NULL } }; @@ -1252,21 +1251,21 @@ dissect_pmip6_bri(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo) proto_tree_add_item(field_tree, hf_pmip6_bri_brtype, tvb, PMIP6_BRI_BRTYPE_OFF, PMIP6_BRI_BRTYPE_LEN, FALSE); - + proto_tree_add_item(field_tree, hf_pmip6_bri_rtrigger, tvb, PMIP6_BRI_RTRIGGER_OFF, PMIP6_BRI_RTRIGGER_LEN, FALSE); - + proto_tree_add_item(field_tree, hf_pmip6_bri_seqnr, tvb, PMIP6_BRI_SEQNR_OFF, PMIP6_BRI_SEQNR_LEN, FALSE); - + proto_tree_add_item(field_tree, hf_pmip6_bri_ip_flag, tvb, - PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, FALSE); + PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, FALSE); proto_tree_add_item(field_tree, hf_pmip6_bri_ia_flag, tvb, - PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, FALSE); + PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, FALSE); proto_tree_add_item(field_tree, hf_pmip6_bri_ig_flag, tvb, - PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, FALSE); + PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, FALSE); proto_tree_add_item(field_tree, hf_pmip6_bri_res, tvb, PMIP6_BRI_RES_OFF, PMIP6_BRI_RES_LEN, FALSE); @@ -1284,18 +1283,18 @@ dissect_pmip6_bri(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo) proto_tree_add_item(field_tree, hf_pmip6_bri_brtype, tvb, PMIP6_BRI_BRTYPE_OFF, PMIP6_BRI_BRTYPE_LEN, FALSE); - + proto_tree_add_item(field_tree, hf_pmip6_bri_status, tvb, PMIP6_BRI_STATUS_OFF, PMIP6_BRI_STATUS_LEN, FALSE); - + proto_tree_add_item(field_tree, hf_pmip6_bri_seqnr, tvb, PMIP6_BRI_SEQNR_OFF, PMIP6_BRI_SEQNR_LEN, FALSE); - + proto_tree_add_item(field_tree, hf_pmip6_bri_ap_flag, tvb, - PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, FALSE); + PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, FALSE); proto_tree_add_item(field_tree, hf_pmip6_bri_ag_flag, tvb, - PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, FALSE); + PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, FALSE); proto_tree_add_item(field_tree, hf_pmip6_bri_res, tvb, PMIP6_BRI_RES_OFF, PMIP6_BRI_RES_LEN, FALSE); @@ -1539,7 +1538,7 @@ static void dissect_pmip6_opt_lla(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, int proto_tree *field_tree; if (opt_tree){ - ti = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s", optp->name); + ti = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s", optp->name); field_tree = proto_item_add_subtree(ti, *optp->subtree_index); proto_tree_add_item(field_tree, hf_pmip6_opt_lila_lla, tvb, offset + 2, 16, FALSE); @@ -1549,13 +1548,10 @@ static void dissect_pmip6_opt_lla(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, int /* 27 Timestamp */ static void dissect_pmip6_opt_ts(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, int offset, - guint optlen, packet_info *pinfo _U_, proto_tree *opt_tree) + guint optlen _U_, packet_info *pinfo _U_, proto_tree *opt_tree) { - const guint8 *reftime; - - reftime = tvb_get_ptr(tvb, offset + 2, optlen); - proto_tree_add_bytes_format(opt_tree, hf_pmip6_timestamp, tvb, offset , 10, - reftime, "Timestamp: %s", ntp_fmt_ts(reftime)); + proto_tree_add_item(opt_tree, hf_pmip6_timestamp, tvb, offset+2, 8, + ENC_TIME_NTP|ENC_BIG_ENDIAN); } /* 28 Restart Counter [RFC5847] */ @@ -2385,7 +2381,7 @@ proto_register_mip6(void) NULL, HFILL }}, { &hf_pmip6_timestamp, { "Timestamp", "mip6.timestamp", - FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL }}, { &hf_pmip6_opt_lila_lla, { "Link-local Address", "mip6.lila_lla", FT_IPv6, BASE_NONE, NULL, 0x0, "", HFILL }}, @@ -2423,7 +2419,7 @@ proto_register_mip6(void) NULL, HFILL }}, { &hf_pmip6_bri_brtype, { "B.R. Type", "mip6.bri_br.type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_pmip6_bri_rtrigger, { "R. Trigger", "mip6.bri_r.trigger", FT_UINT8, BASE_DEC, VALS(pmip6_bri_rtrigger), 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-mpls-echo.c b/epan/dissectors/packet-mpls-echo.c index 3129f3457d..e9203e6b81 100644 --- a/epan/dissectors/packet-mpls-echo.c +++ b/epan/dissectors/packet-mpls-echo.c @@ -32,7 +32,6 @@ #include <epan/packet.h> #include <epan/prefs.h> #include <epan/sminmpec.h> -#include "packet-ntp.h" #include "packet-ldp.h" #include "packet-mpls.h" @@ -974,7 +973,6 @@ dissect_mpls_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *ti = NULL; proto_tree *mpls_echo_tree = NULL, *mpls_echo_gflags = NULL; guint8 msgtype; - const guint8 *ts_sent, *ts_rec; /* If version != 1 we assume it's not an mpls ping packet */ if (tvb_length(tvb) < 5) { @@ -1046,13 +1044,10 @@ dissect_mpls_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hf_mpls_echo_sequence, tvb, offset + 12, 4, FALSE); if(MSGTYPE_MPLS_ECHO(msgtype)){ - /* Using NTP routine to calculate the timestamp */ - ts_sent = tvb_get_ptr(tvb, 16, 8); - proto_tree_add_bytes_format(mpls_echo_tree, hf_mpls_echo_ts_sent, tvb, - offset + 16, 8, ts_sent, "Timestamp Sent: %s", ntp_fmt_ts(ts_sent)); - ts_rec = tvb_get_ptr(tvb, 24, 8); - proto_tree_add_bytes_format(mpls_echo_tree, hf_mpls_echo_ts_rec, tvb, - offset + 24, 8, ts_rec, "Timestamp Received: %s", ntp_fmt_ts(ts_rec)); + proto_tree_add_item(mpls_echo_tree, hf_mpls_echo_ts_sent, tvb, + offset + 16, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_tree, hf_mpls_echo_ts_rec, tvb, + offset + 24, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN); } } @@ -1128,11 +1123,11 @@ proto_register_mpls_echo(void) }, { &hf_mpls_echo_ts_sent, { "Timestamp Sent", "mpls_echo.timestamp_sent", - FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO Timestamp Sent", HFILL} + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, "MPLS ECHO Timestamp Sent", HFILL} }, { &hf_mpls_echo_ts_rec, { "Timestamp Received", "mpls_echo.timestamp_rec", - FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO Timestamp Received", HFILL} + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, "MPLS ECHO Timestamp Received", HFILL} }, { &hf_mpls_echo_tlv_type, { "Type", "mpls_echo.tlv.type", |