Use proto_tree_add_item() for a number of time values.

Change-Id: I862a7870d335f8b0b57d13e2981a8bb1a02b2726
Reviewed-on: https://code.wireshark.org/review/28563
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-07-01 20:32:52 -07:00
parent e9dc611e4f
commit a796138283
24 changed files with 78 additions and 234 deletions

View File

@ -91,7 +91,6 @@ static int dissect_cmp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pa
tvbuff_t *next_tvb;
guint32 pdu_len;
guint8 pdu_type;
nstime_t ts;
proto_item *item=NULL;
proto_item *ti=NULL;
proto_tree *tree=NULL;
@ -139,9 +138,7 @@ static int dissect_cmp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pa
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans_poll_ref, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
ts.secs = tvb_get_ntohl(tvb, 4);
ts.nsecs = 0;
proto_tree_add_time(tcptrans_tree, hf_cmp_tcptrans_ttcb, tvb, offset, 4, &ts);
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans_ttcb, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
break;
case CMP_TYPE_POLLREQ:
@ -154,9 +151,7 @@ static int dissect_cmp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pa
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans_next_poll_ref, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
ts.secs = tvb_get_ntohl(tvb, 4);
ts.nsecs = 0;
proto_tree_add_time(tcptrans_tree, hf_cmp_tcptrans_ttcb, tvb, offset, 4, &ts);
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans_ttcb, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
next_tvb = tvb_new_subset_length_caplen(tvb, offset, tvb_reported_length_remaining(tvb, offset), pdu_len);

View File

@ -3557,10 +3557,7 @@ static int dissect_aim_snac_ssi_time_and_items_num(tvbuff_t *tvb, packet_info *p
int offset = 0;
/* get timestamp */
nstime_t tmptime;
tmptime.secs = tvb_get_ntohl(tvb, offset);
tmptime.nsecs = 0;
proto_tree_add_time(tree, hf_aim_fnac_subtype_ssi_last_change_time, tvb, offset, 4, &tmptime);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_last_change_time, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
/* get number of SSI items */
@ -3575,7 +3572,6 @@ static int dissect_aim_snac_ssi_list(tvbuff_t *tvb, packet_info *pinfo, proto_tr
int offset = 0;
proto_tree *ssi_entry = NULL;
guint16 num_items, i;
nstime_t tmptime;
gint ssi_entry_size;
/* SSI Version */
@ -3593,9 +3589,7 @@ static int dissect_aim_snac_ssi_list(tvbuff_t *tvb, packet_info *pinfo, proto_tr
ett_aim_ssi, NULL, "SSI Entry %u", i);
offset = dissect_ssi_item(tvb, pinfo, offset, ssi_entry);
}
tmptime.secs = tvb_get_ntohl(tvb, offset);
tmptime.nsecs = 0;
proto_tree_add_time(tree, hf_aim_fnac_subtype_ssi_last_change_time, tvb, offset, 4, &tmptime);
proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_last_change_time, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
return offset;
}

View File

@ -152,11 +152,7 @@ static dissector_table_t aruba_erm_subdissector_table;
static int
dissect_aruba_erm_pcap(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *aruba_erm_tree, gint offset)
{
nstime_t ts;
ts.secs = tvb_get_ntohl(tvb, 0);
ts.nsecs = tvb_get_ntohl(tvb,4)*1000;
proto_tree_add_time(aruba_erm_tree, hf_aruba_erm_time, tvb, offset, 8,&ts);
proto_tree_add_item(aruba_erm_tree, hf_aruba_erm_time, tvb, offset, 8, ENC_TIME_TIMEVAL|ENC_BIG_ENDIAN);
offset +=8;
proto_tree_add_item(aruba_erm_tree, hf_aruba_erm_incl_len, tvb, 8, 4, ENC_BIG_ENDIAN);

View File

@ -94,7 +94,6 @@ dissect_ayiya(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
if (tree) {
proto_item *ti;
nstime_t tv;
ti = proto_tree_add_protocol_format( tree, proto_ayiya, tvb,
offset, ayiya_len, "AYIYA" );
ayiya_tree = proto_item_add_subtree(ti, ett_ayiya);
@ -109,9 +108,7 @@ dissect_ayiya(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
3, 1, next_header,
"%s (0x%02x)",
ipprotostr(next_header), next_header);
tv.secs = tvb_get_ntohl(tvb, 4);
tv.nsecs = 0;
proto_tree_add_time(ayiya_tree, hf_epoch, tvb, 4, 4, &tv);
proto_tree_add_item(ayiya_tree, hf_epoch, tvb, 4, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
proto_tree_add_item(ayiya_tree, hf_identity, tvb, 8, idlen, ENC_NA);
proto_tree_add_item(ayiya_tree, hf_signature, tvb, 8+idlen, siglen, ENC_NA);
}

View File

@ -1505,7 +1505,6 @@ static int dissect_cmp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pa
tvbuff_t *next_tvb;
guint32 pdu_len;
guint8 pdu_type;
nstime_t ts;
proto_item *item=NULL;
proto_item *ti=NULL;
proto_tree *tree=NULL;
@ -1553,9 +1552,7 @@ static int dissect_cmp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pa
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans_poll_ref, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
ts.secs = tvb_get_ntohl(tvb, 4);
ts.nsecs = 0;
proto_tree_add_time(tcptrans_tree, hf_cmp_tcptrans_ttcb, tvb, offset, 4, &ts);
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans_ttcb, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
break;
case CMP_TYPE_POLLREQ:
@ -1568,9 +1565,7 @@ static int dissect_cmp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pa
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans_next_poll_ref, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
ts.secs = tvb_get_ntohl(tvb, 4);
ts.nsecs = 0;
proto_tree_add_time(tcptrans_tree, hf_cmp_tcptrans_ttcb, tvb, offset, 4, &ts);
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans_ttcb, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
next_tvb = tvb_new_subset_length_caplen(tvb, offset, tvb_reported_length_remaining(tvb, offset), pdu_len);
@ -2350,7 +2345,7 @@ void proto_register_cmp(void) {
NULL, HFILL }},
/*--- End of included file: packet-cmp-hfarr.c ---*/
#line 307 "./asn1/cmp/packet-cmp-template.c"
#line 302 "./asn1/cmp/packet-cmp-template.c"
};
/* List of subtrees */
@ -2408,7 +2403,7 @@ void proto_register_cmp(void) {
&ett_cmp_PollRepContent_item,
/*--- End of included file: packet-cmp-ettarr.c ---*/
#line 313 "./asn1/cmp/packet-cmp-template.c"
#line 308 "./asn1/cmp/packet-cmp-template.c"
};
module_t *cmp_module;
@ -2495,7 +2490,7 @@ void proto_reg_handoff_cmp(void) {
/*--- End of included file: packet-cmp-dis-tab.c ---*/
#line 378 "./asn1/cmp/packet-cmp-template.c"
#line 373 "./asn1/cmp/packet-cmp-template.c"
inited = TRUE;
}

View File

@ -103,10 +103,7 @@ static expert_field ei_dcc_len = EI_INIT;
offset += (int)sizeof(DCC_TGTS);
#define D_DATE() { \
nstime_t ts; \
ts.nsecs = 0; \
ts.secs = tvb_get_ntohl(tvb,offset); \
proto_tree_add_time(dcc_optree, hf_dcc_date, tvb, offset, 4, &ts); \
proto_tree_add_item(dcc_optree, hf_dcc_date, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN); \
offset += 4; \
}

View File

@ -2746,7 +2746,6 @@ dissect_epl_payload(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, gin
static gint
dissect_epl_soc(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, gint offset)
{
nstime_t nettime;
guint8 flags;
static const int * soc_flags[] = {
&hf_epl_soc_mc,
@ -2767,12 +2766,11 @@ dissect_epl_soc(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, gint of
((EPL_SOC_MC_MASK & flags) >> 7), ((EPL_SOC_PS_MASK & flags) >> 6));
}
nettime.secs = tvb_get_letohl(tvb, offset);
nettime.nsecs = tvb_get_letohl(tvb, offset+4);
proto_tree_add_time(epl_tree, hf_epl_soc_nettime, tvb, offset, 8, &nettime);
proto_tree_add_item(epl_tree, hf_epl_soc_nettime, tvb, offset, 8, ENC_TIME_TIMESPEC|ENC_LITTLE_ENDIAN);
offset += 8;
proto_tree_add_item(epl_tree, hf_epl_soc_relativetime, tvb, offset+8, 8, ENC_LITTLE_ENDIAN);
offset += 16;
proto_tree_add_item(epl_tree, hf_epl_soc_relativetime, tvb, offset, 8, ENC_TIME_TIMESPEC|ENC_LITTLE_ENDIAN);
offset += 8;
return offset;
}

View File

@ -254,7 +254,6 @@ glusterfs_rpc_dissect_gf_iatt(proto_tree *tree, tvbuff_t *tvb, int hfindex,
{
proto_item *iatt_item;
proto_tree *iatt_tree;
nstime_t timestamp;
int start_offset = offset;
iatt_item = proto_tree_add_item(tree, hfindex, tvb, offset, -1,
@ -284,25 +283,19 @@ glusterfs_rpc_dissect_gf_iatt(proto_tree *tree, tvbuff_t *tvb, int hfindex,
offset = dissect_rpc_uint64(tvb, iatt_tree, hf_glusterfs_ia_blocks,
offset);
timestamp.secs = tvb_get_ntohl(tvb, offset);
timestamp.nsecs = tvb_get_ntohl(tvb, offset + 4);
if (tree)
proto_tree_add_time(iatt_tree, hf_glusterfs_ia_atime, tvb,
offset, 8, &timestamp);
proto_tree_add_item(iatt_tree, hf_glusterfs_ia_atime, tvb,
offset, 8, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
offset += 8;
timestamp.secs = tvb_get_ntohl(tvb, offset);
timestamp.nsecs = tvb_get_ntohl(tvb, offset + 4);
if (tree)
proto_tree_add_time(iatt_tree, hf_glusterfs_ia_mtime, tvb,
offset, 8, &timestamp);
proto_tree_add_item(iatt_tree, hf_glusterfs_ia_mtime, tvb,
offset, 8, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
offset += 8;
timestamp.secs = tvb_get_ntohl(tvb, offset);
timestamp.nsecs = tvb_get_ntohl(tvb, offset + 4);
if (tree)
proto_tree_add_time(iatt_tree, hf_glusterfs_ia_ctime, tvb,
offset, 8, &timestamp);
proto_tree_add_item(iatt_tree, hf_glusterfs_ia_ctime, tvb,
offset, 8, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
offset += 8;
proto_item_set_len (iatt_item, offset - start_offset);

View File

@ -2827,11 +2827,8 @@ dissect_hie_time_correction(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *i
static int
dissect_hie_global_time(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
{
nstime_t ts;
proto_tree *subtree = ieee802154_create_hie_tree(tvb, tree, hf_ieee802154_hie_global_time, ett_ieee802154_hie_global_time);
ts.secs = tvb_get_letohl(tvb, 2);
ts.nsecs = 0;
proto_tree_add_time(subtree, hf_ieee802154_hie_global_time_value, tvb, 2, 4, &ts);
proto_tree_add_item(subtree, hf_ieee802154_hie_global_time_value, tvb, 2, 4, ENC_TIME_SECS|ENC_LITTLE_ENDIAN);
return 2 + 4;
}

View File

@ -101,7 +101,6 @@ dissect_krb4_string(packet_info *pinfo _U_, int hf_index, proto_tree *tree, tvbu
static int
dissect_krb4_kdc_request(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, const guint encoding, int version)
{
nstime_t time_sec;
guint8 lifetime;
if(version==TRANSARC_SPECIAL_VERSION){
@ -119,9 +118,7 @@ dissect_krb4_kdc_request(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, in
offset=dissect_krb4_string(pinfo, hf_krb4_realm, tree, tvb, offset);
/* Time sec */
time_sec.secs=tvb_get_guint32(tvb, offset, encoding);
time_sec.nsecs=0;
proto_tree_add_time(tree, hf_krb4_time_sec, tvb, offset, 4, &time_sec);
proto_tree_add_item(tree, hf_krb4_time_sec, tvb, offset, 4, ENC_TIME_SECS|encoding);
offset+=4;
/* lifetime */
@ -142,7 +139,6 @@ dissect_krb4_kdc_request(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, in
static int
dissect_krb4_kdc_reply(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, const guint encoding)
{
nstime_t time_sec;
guint32 length;
/* Name */
@ -155,18 +151,14 @@ dissect_krb4_kdc_reply(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
offset=dissect_krb4_string(pinfo, hf_krb4_realm, tree, tvb, offset);
/* Time sec */
time_sec.secs=tvb_get_guint32(tvb, offset, encoding);
time_sec.nsecs=0;
proto_tree_add_time(tree, hf_krb4_time_sec, tvb, offset, 4, &time_sec);
proto_tree_add_item(tree, hf_krb4_time_sec, tvb, offset, 4, ENC_TIME_SECS|encoding);
offset+=4;
/*XXX unknown byte here */
offset++;
/* exp date */
time_sec.secs=tvb_get_guint32(tvb, offset, encoding);
time_sec.nsecs=0;
proto_tree_add_time(tree, hf_krb4_exp_date, tvb, offset, 4, &time_sec);
proto_tree_add_item(tree, hf_krb4_exp_date, tvb, offset, 4, ENC_TIME_SECS|encoding);
offset+=4;
/* kvno */
@ -189,7 +181,6 @@ static int
dissect_krb4_appl_request(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, const guint encoding)
{
guint8 tlen, rlen;
nstime_t time_sec;
guint8 lifetime;
/* kvno */
@ -218,9 +209,7 @@ dissect_krb4_appl_request(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, i
offset+=rlen;
/* request time */
time_sec.secs=tvb_get_guint32(tvb, offset, encoding);
time_sec.nsecs=0;
proto_tree_add_time(tree, hf_krb4_req_date, tvb, offset, 4, &time_sec);
proto_tree_add_item(tree, hf_krb4_req_date, tvb, offset, 4, ENC_TIME_SECS|encoding);
offset+=4;
/* lifetime */

View File

@ -285,13 +285,8 @@ mpls_pm_dissect_timestamp(tvbuff_t *tvb, proto_tree *pm_tree,
offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case MPLS_PM_TSF_PTP:
{
nstime_t ts;
ts.secs = tvb_get_ntohl(tvb, offset);
ts.nsecs = tvb_get_ntohl(tvb, offset + 4);
proto_tree_add_time(pm_tree, hf_mpls_pm_timestamp1_q_ptp,
tvb, offset, 8, &ts);
}
proto_tree_add_item(pm_tree, hf_mpls_pm_timestamp1_q_ptp, tvb,
offset, 8, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
break;
default:
proto_tree_add_item(pm_tree, hf_mpls_pm_timestamp1_unk, tvb,
@ -315,13 +310,8 @@ mpls_pm_dissect_timestamp(tvbuff_t *tvb, proto_tree *pm_tree,
offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case MPLS_PM_TSF_PTP:
{
nstime_t ts;
ts.secs = tvb_get_ntohl(tvb, offset);
ts.nsecs = tvb_get_ntohl(tvb, offset + 4);
proto_tree_add_time(pm_tree, hf_mpls_pm_timestamp2_q_ptp,
tvb, offset, 8, &ts);
}
proto_tree_add_item(pm_tree, hf_mpls_pm_timestamp2_q_ptp, tvb,
offset, 8, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
break;
default:
proto_tree_add_item(pm_tree, hf_mpls_pm_timestamp2_unk, tvb,
@ -372,13 +362,8 @@ mpls_pm_dissect_timestamp(tvbuff_t *tvb, proto_tree *pm_tree,
offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case MPLS_PM_TSF_PTP:
{
nstime_t ts;
ts.secs = tvb_get_ntohl(tvb, offset);
ts.nsecs = tvb_get_ntohl(tvb, offset + 4);
proto_tree_add_time(pm_tree, hf_mpls_pm_timestamp1_r_ptp,
tvb, offset, 8, &ts);
}
proto_tree_add_item(pm_tree, hf_mpls_pm_timestamp1_r_ptp, tvb,
offset, 8, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
break;
default:
proto_tree_add_item(pm_tree, hf_mpls_pm_timestamp1_unk, tvb,
@ -402,13 +387,8 @@ mpls_pm_dissect_timestamp(tvbuff_t *tvb, proto_tree *pm_tree,
offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case MPLS_PM_TSF_PTP:
{
nstime_t ts;
ts.secs = tvb_get_ntohl(tvb, offset);
ts.nsecs = tvb_get_ntohl(tvb, offset + 4);
proto_tree_add_time(pm_tree, hf_mpls_pm_timestamp2_r_ptp,
tvb, offset, 8, &ts);
}
proto_tree_add_item(pm_tree, hf_mpls_pm_timestamp2_r_ptp, tvb,
offset, 8, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
break;
default:
proto_tree_add_item(pm_tree, hf_mpls_pm_timestamp2_unk, tvb,
@ -432,13 +412,8 @@ mpls_pm_dissect_timestamp(tvbuff_t *tvb, proto_tree *pm_tree,
offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case MPLS_PM_TSF_PTP:
{
nstime_t ts;
ts.secs = tvb_get_ntohl(tvb, offset);
ts.nsecs = tvb_get_ntohl(tvb, offset + 4);
proto_tree_add_time(pm_tree, hf_mpls_pm_timestamp3_r_ptp,
tvb, offset, 8, &ts);
}
proto_tree_add_item(pm_tree, hf_mpls_pm_timestamp3_r_ptp, tvb,
offset, 8, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
break;
default:
proto_tree_add_item(pm_tree, hf_mpls_pm_timestamp3_unk, tvb,
@ -462,13 +437,8 @@ mpls_pm_dissect_timestamp(tvbuff_t *tvb, proto_tree *pm_tree,
offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case MPLS_PM_TSF_PTP:
{
nstime_t ts;
ts.secs = tvb_get_ntohl(tvb, offset);
ts.nsecs = tvb_get_ntohl(tvb, offset + 4);
proto_tree_add_time(pm_tree, hf_mpls_pm_timestamp4_r_ptp,
tvb, offset, 8, &ts);
}
proto_tree_add_item(pm_tree, hf_mpls_pm_timestamp4_r_ptp, tvb,
offset, 8, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
break;
default:
proto_tree_add_item(pm_tree, hf_mpls_pm_timestamp4_unk, tvb,
@ -627,13 +597,8 @@ dissect_mpls_pm_loss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case MPLS_PM_TSF_PTP:
{
nstime_t ts;
ts.secs = tvb_get_ntohl(tvb, offset);
ts.nsecs = tvb_get_ntohl(tvb, offset + 4);
proto_tree_add_time(pm_tree, hf_mpls_pm_origin_timestamp_ptp, tvb,
offset, 8, &ts);
}
proto_tree_add_item(pm_tree, hf_mpls_pm_origin_timestamp_ptp, tvb,
offset, 8, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
break;
default:
proto_tree_add_item(pm_tree, hf_mpls_pm_origin_timestamp_unk, tvb,

View File

@ -2382,7 +2382,6 @@ dissect_file_stats(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *pa
proto_item* item;
proto_tree* tree;
int old_offset=offset;
nstime_t ns;
tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1,
ett_ndmp_file_stats, &item, "Stats:");
@ -2399,21 +2398,15 @@ dissect_file_stats(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *pa
offset += 4;
/* mtime */
ns.secs=tvb_get_ntohl(tvb, offset);
ns.nsecs=0;
proto_tree_add_time(tree, hf_ndmp_file_mtime, tvb, offset, 4, &ns);
proto_tree_add_item(tree, hf_ndmp_file_mtime, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
/* atime */
ns.secs=tvb_get_ntohl(tvb, offset);
ns.nsecs=0;
proto_tree_add_time(tree, hf_ndmp_file_atime, tvb, offset, 4, &ns);
proto_tree_add_item(tree, hf_ndmp_file_atime, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
/* ctime */
ns.secs=tvb_get_ntohl(tvb, offset);
ns.nsecs=0;
proto_tree_add_time(tree, hf_ndmp_file_ctime, tvb, offset, 4, &ns);
proto_tree_add_item(tree, hf_ndmp_file_ctime, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
/* owner */
@ -2700,8 +2693,6 @@ static int
dissect_data_get_state_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, guint32 seq)
{
nstime_t ns;
/* invalids */
offset = dissect_state_invalids(tvb, offset, pinfo, tree);
@ -2729,9 +2720,7 @@ dissect_data_get_state_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
offset);
/* est time remain */
ns.secs=tvb_get_ntohl(tvb, offset);
ns.nsecs=0;
proto_tree_add_time(tree, hf_ndmp_data_est_time_remain, tvb, offset, 4, &ns);
proto_tree_add_item(tree, hf_ndmp_data_est_time_remain, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
/* ndmp addr */

View File

@ -1307,11 +1307,7 @@ dissect_nfq_attrs(tvbuff_t *tvb, void *data, proto_tree *tree, int nla_type, int
case WS_NFQA_TIMESTAMP:
if (len == 16) {
nstime_t ts;
ts.secs = (time_t)tvb_get_ntoh64(tvb, offset);
ts.nsecs = (int)tvb_get_ntoh64(tvb, offset + 8) * 1000;
proto_tree_add_time(tree, &hfi_nfq_timestamp, tvb, offset, 16, &ts);
proto_tree_add_item(tree, &hfi_nfq_timestamp, tvb, offset, 16, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
offset += 16;
}
break;

View File

@ -262,13 +262,9 @@ dissect_nflog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
case WS_NFULA_TIMESTAMP:
if (value_len == 16) {
nstime_t ts;
ts.secs = (time_t)tvb_get_ntoh64(tvb, offset + 4);
/* XXX - add an "expert info" warning if this is >= 10^9? */
ts.nsecs = (int)tvb_get_ntoh64(tvb, offset + 12);
proto_tree_add_time(tlv_tree, &hfi_nflog_tlv_timestamp,
tvb, offset + 4, value_len, &ts);
/* XXX - add an "expert info" warning if the nanoseconds are >= 10^9? */
proto_tree_add_item(tlv_tree, &hfi_nflog_tlv_timestamp,
tvb, offset + 4, value_len, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
handled = TRUE;
}
break;

View File

@ -458,15 +458,11 @@ decode_value_string_attribute(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
static void
decode_time_attribute(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, int* hfValue, int offset, int length)
{
nstime_t ns;
if (length < 8) {
expert_add_info(pinfo, item, &ei_opsi_short_attribute);
return;
}
ns.secs = tvb_get_ntohl(tvb, offset+4);
ns.nsecs = 0;
proto_tree_add_time(tree, *hfValue, tvb, offset+4, 4, &ns);
proto_tree_add_item(tree, *hfValue, tvb, offset+4, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
}
/****************************************************************************/

View File

@ -776,7 +776,6 @@ static int dissect_p_mul (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
gint i, tot_no_missing = 0, no_missing = 0, offset = 0;
address src, dst;
wmem_strbuf_t *message_id_list = NULL;
nstime_t ts;
gboolean fletcher = FALSE;
col_set_str (pinfo->cinfo, COL_PROTOCOL, "P_MUL");
@ -962,9 +961,7 @@ static int dissect_p_mul (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
pdu_type == Extra_Address_PDU || pdu_type == FEC_Address_PDU ||
pdu_type == Extra_FEC_Address_PDU) {
/* Expiry Time */
ts.secs = tvb_get_ntohl (tvb, offset);
ts.nsecs = 0;
proto_tree_add_time (p_mul_tree, hf_expiry_time, tvb, offset, 4, &ts);
proto_tree_add_item (p_mul_tree, hf_expiry_time, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
}

View File

@ -820,7 +820,6 @@ dissect_rpcap_packet (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree,
{
proto_tree *tree;
proto_item *ti;
nstime_t ts;
tvbuff_t *new_tvb;
guint caplen, len, frame_no;
gint reported_length_remaining;
@ -828,9 +827,7 @@ dissect_rpcap_packet (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree,
ti = proto_tree_add_item (parent_tree, hf_packet, tvb, offset, 20, ENC_NA);
tree = proto_item_add_subtree (ti, ett_packet);
ts.secs = tvb_get_ntohl (tvb, offset);
ts.nsecs = tvb_get_ntohl (tvb, offset + 4) * 1000;
proto_tree_add_time(tree, hf_timestamp, tvb, offset, 8, &ts);
proto_tree_add_item(tree, hf_timestamp, tvb, offset, 8, ENC_TIME_TIMEVAL|ENC_BIG_ENDIAN);
offset += 8;
caplen = tvb_get_ntohl (tvb, offset);

View File

@ -119,7 +119,6 @@ dissect_rtacser_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *rtacser_tree, *cl_tree;
int offset = 0, len;
guint event_type;
nstime_t tv;
gboolean cts, dcd, dsr, rts, dtr, ring, mbok;
tvbuff_t *payload_tvb;
@ -134,9 +133,7 @@ dissect_rtacser_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Time-stamp is stored as 2 x 32-bit unsigned integers, the left and right-hand side of the decimal point respectively */
/* The format mirrors the timeval struct - absolute Epoch time (seconds since 1/1/1970) with an added microsecond component */
tv.secs = tvb_get_ntohl(tvb, offset);
tv.nsecs = tvb_get_ntohl(tvb, offset+4)*1000;
proto_tree_add_time(rtacser_tree, hf_rtacser_timestamp, tvb, offset, 8, &tv);
proto_tree_add_item(rtacser_tree, hf_rtacser_timestamp, tvb, offset, 8, ENC_TIME_TIMEVAL|ENC_BIG_ENDIAN);
offset += 8;
/* Set INFO column with RTAC Serial Event Type */

View File

@ -131,15 +131,8 @@ dissect_rx_response_encrypted(tvbuff_t *tvb, proto_tree *parent_tree, int offset
tree = proto_item_add_subtree(item, ett_rx_encrypted);
/* epoch : 4 bytes */
{
nstime_t ts;
ts.secs = tvb_get_ntohl(tvb, offset);
ts.nsecs = 0;
proto_tree_add_time(tree, hf_rx_epoch, tvb,
offset, 4, &ts);
offset += 4;
}
proto_tree_add_item(tree, hf_rx_epoch, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
/* cid : 4 bytes */
proto_tree_add_item(tree, hf_rx_cid, tvb, offset, 4, ENC_BIG_ENDIAN);

View File

@ -106,7 +106,6 @@ dissect_sebek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
proto_tree *sebek_tree;
proto_item *ti;
int offset = 0;
nstime_t ts;
int sebek_ver = 0;
int sebek_type = 0;
int cmd_len = 0;
@ -162,9 +161,7 @@ dissect_sebek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
proto_tree_add_item(sebek_tree, hf_sebek_counter, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
ts.secs = tvb_get_ntohl(tvb, offset);
ts.nsecs = tvb_get_ntohl(tvb, offset+4);
proto_tree_add_time(sebek_tree, hf_sebek_time, tvb, offset, 8, &ts);
proto_tree_add_item(sebek_tree, hf_sebek_time, tvb, offset, 8, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
offset += 8;
proto_tree_add_item(sebek_tree, hf_sebek_pid, tvb, offset, 4, ENC_BIG_ENDIAN);
@ -199,9 +196,7 @@ dissect_sebek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
proto_tree_add_item(sebek_tree, hf_sebek_counter, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
ts.secs = tvb_get_ntohl(tvb, offset);
ts.nsecs = tvb_get_ntohl(tvb, offset+4);
proto_tree_add_time(sebek_tree, hf_sebek_time, tvb, offset, 8, &ts);
proto_tree_add_item(sebek_tree, hf_sebek_time, tvb, offset, 8, ENC_TIME_TIMESPEC|ENC_BIG_ENDIAN);
offset += 8;
proto_tree_add_item(sebek_tree, hf_sebek_ppid, tvb, offset, 4, ENC_BIG_ENDIAN);

View File

@ -370,13 +370,10 @@ static int
dissect_authblk_v2(tvbuff_t *tvb, int offset, proto_tree *tree)
{
guint16 length;
nstime_t ts;
proto_tree_add_item(tree, hf_srvloc_authblkv2_bsd, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_srvloc_authblkv2_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
ts.nsecs = 0;
ts.secs = tvb_get_ntohl(tvb, offset + 4);
proto_tree_add_time(tree, hf_srvloc_authblkv2_timestamp, tvb, offset+4, 4, &ts);
proto_tree_add_item(tree, hf_srvloc_authblkv2_timestamp, tvb, offset+4, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
length = tvb_get_ntohs(tvb, offset + 8);
proto_tree_add_uint(tree, hf_srvloc_authblkv2_slpspilen, tvb, offset + 8, 2, length);
offset += 10;
@ -793,7 +790,6 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
guint32 count;
guint32 next_ext_off; /* three bytes, v2 only */
guint16 lang_tag_len;
nstime_t ts;
proto_item *expert_item;
guint16 expert_status;
@ -1229,10 +1225,8 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
expert_add_info_format(pinfo, expert_item, &ei_srvloc_error_v2, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)"));
}
offset += 2;
ts.nsecs = 0;
ts.secs = tvb_get_ntohl(tvb, offset);
proto_tree_add_time(srvloc_tree, hf_srvloc_daadvert_timestamp, tvb, offset, 4,
&ts);
proto_tree_add_item(srvloc_tree, hf_srvloc_daadvert_timestamp, tvb, offset, 4,
ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
length = tvb_get_ntohs(tvb, offset);
proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_urllen, tvb, offset, 2, length);

View File

@ -6710,7 +6710,6 @@ ssl_dissect_hnd_hello_common(ssl_common_dissect_t *hf, tvbuff_t *tvb,
SslSession *session, SslDecryptSession *ssl,
gboolean from_server, gboolean is_hrr)
{
nstime_t gmt_unix_time;
guint8 sessid_length;
proto_tree *rnd_tree;
proto_tree *ti_rnd;
@ -6743,10 +6742,8 @@ ssl_dissect_hnd_hello_common(ssl_common_dissect_t *hf, tvbuff_t *tvb,
rnd_tree = proto_item_add_subtree(ti_rnd, hf->ett.hs_random);
/* show the time */
gmt_unix_time.secs = tvb_get_ntohl(tvb, offset);
gmt_unix_time.nsecs = 0;
proto_tree_add_time(rnd_tree, hf->hf.hs_random_time,
tvb, offset, 4, &gmt_unix_time);
proto_tree_add_item(rnd_tree, hf->hf.hs_random_time,
tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
/* show the random bytes */

View File

@ -79,14 +79,11 @@ dissect_who(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
proto_item *who_ti;
guint8 *server_name;
double loadav_5 = 0.0, loadav_10 = 0.0, loadav_15 = 0.0;
nstime_t ts;
/* Summary information */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "WHO");
col_clear(pinfo->cinfo, COL_INFO);
ts.nsecs = 0;
who_ti = proto_tree_add_item(tree, proto_who, tvb, offset, -1, ENC_NA);
who_tree = proto_item_add_subtree(who_ti, ett_who);
@ -100,16 +97,14 @@ dissect_who(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
offset += 2;
if (tree) {
ts.secs = tvb_get_ntohl(tvb, offset);
proto_tree_add_time(who_tree, hf_who_sendtime, tvb, offset, 4,
&ts);
proto_tree_add_item(who_tree, hf_who_sendtime, tvb, offset, 4,
ENC_TIME_SECS|ENC_BIG_ENDIAN);
}
offset += 4;
if (tree) {
ts.secs = tvb_get_ntohl(tvb, offset);
proto_tree_add_time(who_tree, hf_who_recvtime, tvb, offset, 4,
&ts);
proto_tree_add_item(who_tree, hf_who_recvtime, tvb, offset, 4,
ENC_TIME_SECS|ENC_BIG_ENDIAN);
}
offset += 4;
@ -137,9 +132,8 @@ dissect_who(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
server_name, loadav_5, loadav_10, loadav_15);
if (tree) {
ts.secs = tvb_get_ntohl(tvb, offset);
proto_tree_add_time(who_tree, hf_who_boottime, tvb, offset, 4,
&ts);
proto_tree_add_item(who_tree, hf_who_boottime, tvb, offset, 4,
ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset += 4;
dissect_whoent(tvb, offset, who_tree);
@ -161,12 +155,9 @@ dissect_whoent(tvbuff_t *tvb, int offset, proto_tree *tree)
int line_offset = offset;
guint8 *out_line;
guint8 *out_name;
nstime_t ts;
int whoent_num = 0;
guint32 idle_secs; /* say that out loud... */
ts.nsecs = 0;
while (tvb_reported_length_remaining(tvb, line_offset) > 0
&& whoent_num < MAX_NUM_WHOENTS) {
whoent_ti = proto_tree_add_item(tree, hf_who_whoent, tvb,
@ -183,9 +174,8 @@ dissect_whoent(tvbuff_t *tvb, int offset, proto_tree *tree)
8, out_name);
line_offset += 8;
ts.secs = tvb_get_ntohl(tvb, line_offset);
proto_tree_add_time(whoent_tree, hf_who_timeon, tvb,
line_offset, 4, &ts);
proto_tree_add_item(whoent_tree, hf_who_timeon, tvb,
line_offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
line_offset += 4;
idle_secs = tvb_get_ntohl(tvb, line_offset);

View File

@ -461,7 +461,6 @@ static void
dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint count)
{
char pdu_msg_type;
nstime_t timeValue;
int client_size = 0;
guint value = 0;
int size = 0;
@ -496,10 +495,8 @@ dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint coun
proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_version,
tvb,offset,1,ENC_BIG_ENDIAN);
offset++;
timeValue.secs = tvb_get_ntohl (tvb, offset);
timeValue.nsecs = 0;
proto_tree_add_time (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_gmt, tvb,
offset, 4, &timeValue);
proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_gmt, tvb,
offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset+=4;
proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_random,
tvb,offset,12,ENC_NA);
@ -839,10 +836,8 @@ dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint coun
proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_version,
tvb,offset,1,ENC_BIG_ENDIAN);
offset++;
timeValue.secs = tvb_get_ntohl (tvb, offset);
timeValue.nsecs = 0;
proto_tree_add_time (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_gmt, tvb,
offset, 4, &timeValue);
proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_gmt, tvb,
offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset+=4;
proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_random,
tvb,offset,12,ENC_NA);
@ -941,18 +936,14 @@ dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint coun
case IDENTIFIER_X509 :
break;
}
timeValue.secs = tvb_get_ntohl (tvb, offset);
timeValue.nsecs = 0;
proto_tree_add_time (wtls_msg_type_item_sub_tree,
proto_tree_add_item (wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_valid_not_before,
tvb, offset, 4, &timeValue);
tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset+=4;
client_size+=4;
timeValue.secs = tvb_get_ntohl (tvb, offset);
timeValue.nsecs = 0;
proto_tree_add_time (wtls_msg_type_item_sub_tree,
proto_tree_add_item (wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_valid_not_after,
tvb, offset, 4, &timeValue);
tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
offset+=4;
client_size+=4;
value = tvb_get_guint8 (tvb, offset);