Add NTP times using proto_tree_add_item().

Replace a couple not-very-descriptive blurbs with NULL.

svn path=/trunk/; revision=35883
This commit is contained in:
Jeff Morriss 2011-02-09 02:27:41 +00:00
parent 87aaac83ce
commit a527fa4b49
3 changed files with 42 additions and 53 deletions

View File

@ -135,7 +135,6 @@
#include <epan/dissectors/packet-tcp.h>
#include <epan/dissectors/packet-udp.h>
#include <epan/expert.h>
#include <epan/dissectors/packet-ntp.h>
#if 0
@ -2352,7 +2351,6 @@ dissect_v9_v10_pdu_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pdutree,
int gen_str_offset = 0;
proto_item *ti;
const guint8 *reftime;
guint16 count;
struct v9_v10_template_entry *entries;
proto_tree *fwdstattree;
@ -3922,9 +3920,8 @@ dissect_v9_v10_pdu_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pdutree,
break;
case 268: /* maxFlowEndMicroseconds */
reftime = tvb_get_ptr(tvb, offset, 8);
ti = proto_tree_add_bytes_format_value(pdutree, hf_cflow_max_flow_end_microseconds,
tvb, offset, length, reftime, "%s", ntp_fmt_ts(reftime));
ti = proto_tree_add_item(pdutree, hf_cflow_max_flow_end_microseconds,
tvb, offset, length, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case 269: /* maxFlowEndMilliseconds */
@ -3935,15 +3932,13 @@ dissect_v9_v10_pdu_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pdutree,
break;
case 270: /* maxFlowEndNanoseconds */
reftime = tvb_get_ptr(tvb, offset, 8);
ti = proto_tree_add_bytes_format_value(pdutree, hf_cflow_max_flow_end_nanoseconds,
tvb, offset, length, reftime, "%s", ntp_fmt_ts(reftime));
ti = proto_tree_add_item(pdutree, hf_cflow_max_flow_end_nanoseconds,
tvb, offset, length, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case 271: /* minFlowStartMicroseconds */
reftime = tvb_get_ptr(tvb, offset, 8);
ti = proto_tree_add_bytes_format_value(pdutree, hf_cflow_min_flow_start_microseconds,
tvb, offset, length, reftime, "%s", ntp_fmt_ts(reftime));
ti = proto_tree_add_item(pdutree, hf_cflow_min_flow_start_microseconds,
tvb, offset, length, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case 272: /* minFlowStartMilliseconds */
@ -3954,9 +3949,8 @@ dissect_v9_v10_pdu_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pdutree,
break;
case 273: /* minFlowStartNanoseconds */
reftime = tvb_get_ptr(tvb, offset, 8);
ti = proto_tree_add_bytes_format_value(pdutree, hf_cflow_min_flow_start_nanoseconds,
tvb, offset, length, reftime, "%s", ntp_fmt_ts(reftime));
ti = proto_tree_add_item(pdutree, hf_cflow_min_flow_start_nanoseconds,
tvb, offset, length, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case 274: /* collectorCertificate */
@ -4079,15 +4073,13 @@ dissect_v9_v10_pdu_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pdutree,
break;
case 324: /* observationTimeMicroseconds */
reftime = tvb_get_ptr(tvb, offset, 8);
ti = proto_tree_add_bytes_format_value(pdutree, hf_cflow_observation_time_microseconds,
tvb, offset, length, reftime, "%s", ntp_fmt_ts(reftime));
ti = proto_tree_add_item(pdutree, hf_cflow_observation_time_microseconds,
tvb, offset, length, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case 325: /* observationTimeNanoseconds */
reftime = tvb_get_ptr(tvb, offset, 8);
ti = proto_tree_add_bytes_format_value(pdutree, hf_cflow_observation_time_nanoseconds,
tvb, offset, length, reftime, "%s", ntp_fmt_ts(reftime));
ti = proto_tree_add_item(pdutree, hf_cflow_observation_time_nanoseconds,
tvb, offset, length, ENC_TIME_NTP|ENC_BIG_ENDIAN);
break;
case 326: /* digestHashValue */
@ -6636,7 +6628,7 @@ proto_register_netflow(void)
},
{&hf_cflow_max_flow_end_microseconds,
{"Max Flow End Microseconds", "cflow.max_flow_end_microseconds",
FT_BYTES, BASE_NONE, NULL, 0x0,
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
NULL, HFILL}
},
{&hf_cflow_max_flow_end_milliseconds,
@ -6646,12 +6638,12 @@ proto_register_netflow(void)
},
{&hf_cflow_max_flow_end_nanoseconds,
{"Max Flow End Nanoseconds", "cflow.max_flow_end_nanoseconds",
FT_BYTES, BASE_NONE, NULL, 0x0,
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
NULL, HFILL}
},
{&hf_cflow_min_flow_start_microseconds,
{"Min Flow Start Microseconds", "cflow.min_flow_start_microseconds",
FT_BYTES, BASE_NONE, NULL, 0x0,
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
NULL, HFILL}
},
{&hf_cflow_min_flow_start_milliseconds,
@ -6661,7 +6653,7 @@ proto_register_netflow(void)
},
{&hf_cflow_min_flow_start_nanoseconds,
{"Min Flow Start Nanoseconds", "cflow.min_flow_start_nanoseconds",
FT_BYTES, BASE_NONE, NULL, 0x0,
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
NULL, HFILL}
},
{&hf_cflow_collector_certificate,
@ -6771,12 +6763,12 @@ proto_register_netflow(void)
},
{&hf_cflow_observation_time_microseconds,
{"Observation Time Microseconds", "cflow.observation_time_microseconds",
FT_BYTES, BASE_NONE, NULL, 0x0,
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
NULL, HFILL}
},
{&hf_cflow_observation_time_nanoseconds,
{"Observation Time Nanoseconds", "cflow.observation_time_nanoseconds",
FT_BYTES, BASE_NONE, NULL, 0x0,
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
NULL, HFILL}
},
{&hf_cflow_digest_hash_value,

View File

@ -49,7 +49,7 @@
* See also http://www.iana.org/assignments/rtp-parameters
*
* RTCP FB is specified in RFC 4585 and extended by RFC 5104
*
*
*/
@ -767,7 +767,7 @@ dissect_rtcp_rtpfb_tmmbr( tvbuff_t *tvb, int offset, proto_tree *rtcp_tree, prot
static int
dissect_rtcp_rtpfb_nack( tvbuff_t *tvb, int offset, proto_tree *rtcp_tree, proto_item *top_item)
{
{
int i;
char strbuf[64];
int nack_num_frames_lost = 0;
@ -777,11 +777,11 @@ dissect_rtcp_rtpfb_nack( tvbuff_t *tvb, int offset, proto_tree *rtcp_tree, proto
proto_item *ti = (proto_item*) NULL;
proto_tree_add_item(rtcp_tree, hf_rtcp_rtpfb_nack_pid, tvb, offset, 2, FALSE);
rtcp_rtpfb_nack_pid = tvb_get_ntohs(tvb, offset);
rtcp_rtpfb_nack_pid = tvb_get_ntohs(tvb, offset);
offset += 2;
ti = proto_tree_add_item(rtcp_tree, hf_rtcp_rtpfb_nack_blp, tvb, offset, 2, FALSE);
proto_item_set_text(ti, "RTCP Transport Feedback NACK BLP: ");
rtcp_rtpfb_nack_blp = tvb_get_ntohs(tvb, offset);
bitfield_tree = proto_item_add_subtree( ti, ett_rtcp_nack_blp);
@ -804,7 +804,7 @@ dissect_rtcp_rtpfb_nack( tvbuff_t *tvb, int offset, proto_tree *rtcp_tree, proto
proto_item_set_text(ti, "0 (No additional frames lost)");
}
offset += 2;
if (top_item != NULL) {
proto_item_append_text(top_item, ": NACK: %d frames lost", nack_num_frames_lost);
}
@ -1060,16 +1060,17 @@ dissect_rtcp_app( tvbuff_t *tvb,packet_info *pinfo, int offset, proto_tree *tree
if (code == 103)
{
const gchar *buff;
item_len = tvb_get_guint8(tvb, offset);
offset += 1;
packet_len -= 1;
if (item_len != 8) /* SHALL be 8 */
return offset;
proto_tree_add_item(PoC1_tree, hf_rtcp_app_poc1_request_ts,
tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
buff = ntp_fmt_ts(tvb_get_ptr(tvb, offset, 8));
proto_tree_add_string_format(PoC1_tree, hf_rtcp_app_poc1_request_ts,
tvb, offset, 8, buff,
"Request timestamp: %s", buff );
offset += 8;
packet_len -=8;
@ -1719,7 +1720,7 @@ dissect_rtcp_sdes( tvbuff_t *tvb, int offset, proto_tree *tree,
chunk++;
}
return offset;
}
@ -1750,7 +1751,7 @@ static void parse_xr_type_specific_field(tvbuff_t *tvb, gint offset, guint block
static gboolean validate_xr_block_length(tvbuff_t *tvb, packet_info *pinfo, int offset, guint block_type, guint block_len, proto_tree *tree)
{
proto_item *ti;
ti = proto_tree_add_uint(tree, hf_rtcp_xr_block_length, tvb, offset, 2, block_len);
switch (block_type) {
case RTCP_XR_REF_TIME:
@ -2257,7 +2258,6 @@ dissect_rtcp_sr( packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree
{
proto_item* item;
guint32 ts_msw, ts_lsw;
const gchar *buff;
int sr_offset = offset;
/* NTP timestamp */
@ -2267,8 +2267,7 @@ dissect_rtcp_sr( packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree
ts_lsw = tvb_get_ntohl(tvb, offset+4);
proto_tree_add_item(tree, hf_rtcp_ntp_lsw, tvb, offset+4, 4, FALSE);
buff=ntp_fmt_ts(tvb_get_ptr( tvb, offset, 8 ));
item = proto_tree_add_string_format( tree, hf_rtcp_ntp, tvb, offset, 8, buff, "MSW and LSW as NTP timestamp: %s", buff );
item = proto_tree_add_item(tree, hf_rtcp_ntp, tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
PROTO_ITEM_SET_GENERATED(item);
offset += 8;
@ -3026,10 +3025,10 @@ proto_register_rtcp(void)
{
&hf_rtcp_ntp,
{
"NTP timestamp",
"MSW and LSW as NTP timestamp",
"rtcp.timestamp.ntp",
FT_STRING,
BASE_NONE,
FT_ABSOLUTE_TIME,
ABSOLUTE_TIME_UTC,
NULL,
0x0,
NULL, HFILL
@ -3352,8 +3351,8 @@ proto_register_rtcp(void)
{
"Talk Burst Request Timestamp",
"rtcp.app.poc1.request.ts",
FT_STRING,
BASE_NONE,
FT_ABSOLUTE_TIME,
ABSOLUTE_TIME_UTC,
NULL,
0x0,
NULL, HFILL

View File

@ -67,7 +67,6 @@
#include "packet-rtp.h"
#include <epan/rtp_pt.h>
#include "packet-ntp.h"
#include <epan/conversation.h>
#include <epan/reassemble.h>
#include <epan/tap.h>
@ -1626,15 +1625,14 @@ dissect_pkt_ccc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti = NULL;
proto_tree *pkt_ccc_tree = NULL;
const guint8 *ptime = tvb_get_ptr(tvb, 4, 8);
if ( tree ) {
ti = proto_tree_add_item(tree, proto_pkt_ccc, tvb, 0, 12, FALSE);
pkt_ccc_tree = proto_item_add_subtree(ti, ett_pkt_ccc);
proto_tree_add_item(pkt_ccc_tree, hf_pkt_ccc_id, tvb, 0, 4, FALSE);
proto_tree_add_bytes_format(pkt_ccc_tree, hf_pkt_ccc_ts, tvb,
4, 8, ptime, "NTP timestamp: %s", ntp_fmt_ts(ptime));
proto_tree_add_item(pkt_ccc_tree, hf_pkt_ccc_ts, tvb, 4, 8,
ENC_TIME_NTP|ENC_BIG_ENDIAN);
}
dissect_rtp(tvb, pinfo, tree);
@ -1657,7 +1655,7 @@ proto_register_pkt_ccc(void)
BASE_DEC,
NULL,
0x0,
"CCC_ID", HFILL
NULL, HFILL
}
},
{
@ -1665,11 +1663,11 @@ proto_register_pkt_ccc(void)
{
"PacketCable CCC Timestamp",
"pkt_ccc.ts",
FT_BYTES,
BASE_NONE,
FT_ABSOLUTE_TIME,
ABSOLUTE_TIME_UTC,
NULL,
0x0,
"Timestamp", HFILL
NULL, HFILL
}
},