本文整理汇总了C++中proto_tree_add_time函数的典型用法代码示例。如果您正苦于以下问题:C++ proto_tree_add_time函数的具体用法?C++ proto_tree_add_time怎么用?C++ proto_tree_add_time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了proto_tree_add_time函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dissect_dvb_tdt
static void
dissect_dvb_tdt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0;
proto_item *ti;
proto_tree *dvb_tdt_tree;
nstime_t utc_time;
col_set_str(pinfo->cinfo, COL_INFO, "Time and Date Table (TDT)");
ti = proto_tree_add_item(tree, proto_dvb_tdt, tvb, offset, -1, ENC_NA);
dvb_tdt_tree = proto_item_add_subtree(ti, ett_dvb_tdt);
offset += packet_mpeg_sect_header(tvb, offset, dvb_tdt_tree, NULL, NULL);
if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
proto_tree_add_text(dvb_tdt_tree, tvb, offset, 5, "Unparseable time");
} else {
proto_tree_add_time(dvb_tdt_tree, hf_dvb_tdt_utc_time, tvb, offset, 5, &utc_time);
}
offset += 5;
proto_item_set_len(ti, offset);
}
开发者ID:huzhiren,项目名称:wireshark,代码行数:27,代码来源:packet-dvb-tdt.c
示例2: dissect_e100
static int
dissect_e100(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
int ret_val = 0;
tvbuff_t *next_tvb = NULL;
/* heuristic testing:
* (1) tvb packet is larger than e100 packet
* (2) e100 header is 1
* (3) e100 capture size matches tvb packet size
*/
if (tvb_length(tvb) >= e100_encap_len &&
tvb_get_guint8(tvb, e100_header_ver.offset) == 1 &&
tvb_get_ntohl(tvb, e100_bytes_cap.offset) == tvb_length(tvb)-e100_encap_len)
{
guint32 bytes_captured=0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "e100");
col_set_str(pinfo->cinfo, COL_INFO, "E100 Encapsulated Packet");
if (tree)
{
/* pick apart protocol for display */
proto_item *ti = NULL;
proto_tree *e100_tree = NULL;
ti = proto_tree_add_item(tree, proto_e100, tvb, 0, e100_encap_len, FALSE);
e100_tree = proto_item_add_subtree(ti, ett_e100);
proto_tree_add_item(e100_tree, hf_e100_header, tvb,
e100_header_ver.offset, e100_header_ver.len, FALSE);
proto_tree_add_item(e100_tree, hf_e100_port, tvb,
e100_port_recv.offset, e100_port_recv.len, FALSE);
proto_tree_add_item(e100_tree, hf_e100_seq, tvb,
e100_seq.offset, e100_seq.len, FALSE);
proto_tree_add_item(e100_tree, hf_e100_ip, tvb,
e100_ip.offset, e100_ip.len, FALSE);
proto_tree_add_item(e100_tree, hf_e100_mon_pkt_id, tvb,
e100_mon_pkt_id.offset, e100_mon_pkt_id.len, FALSE);
{
nstime_t ts;
ts.secs = tvb_get_ntohl(tvb, e100_ts.offset);
ts.nsecs = tvb_get_ntohl(tvb, e100_ts.offset+4)*1000;
proto_tree_add_time(e100_tree, hf_e100_pkt_ts, tvb,
e100_ts.offset, e100_ts.len, &ts);
}
proto_tree_add_item(e100_tree, hf_e100_bytes_cap, tvb,
e100_bytes_cap.offset, e100_bytes_cap.len, FALSE);
proto_tree_add_item(e100_tree, hf_e100_bytes_orig, tvb,
e100_bytes_orig.offset, e100_bytes_orig.len, FALSE);
} /* if(tree) */
bytes_captured = tvb_get_ntohl(tvb, e100_bytes_cap.offset);
next_tvb = tvb_new_subset(tvb, e100_encap_len, -1, bytes_captured);
call_dissector(eth_handle, next_tvb, pinfo, tree);
ret_val = tvb_length(tvb);
} /* heuristic testing */
return ret_val;
}
开发者ID:RazZziel,项目名称:wireshark-dplay,代码行数:59,代码来源:packet-e100.c
示例3: dissect_rx_response_encrypted
static int
dissect_rx_response_encrypted(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
proto_tree *tree;
proto_item *item;
int old_offset=offset;
int i;
guint32 callnumber;
item = proto_tree_add_item(parent_tree, hf_rx_encrypted, tvb, offset, -1, ENC_NA);
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;
}
/* cid : 4 bytes */
proto_tree_add_item(tree, hf_rx_cid, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
/*FIXME don't know how to handle this checksum, skipping it */
offset += 4;
/* sequrityindex : 1 byte */
proto_tree_add_item(tree, hf_rx_securityindex, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 4;
for (i=0; i<RX_MAXCALLS; i++) {
/* callnumber : 4 bytes */
callnumber = tvb_get_ntohl(tvb, offset);
proto_tree_add_uint(tree, hf_rx_callnumber, tvb,
offset, 4, callnumber);
offset += 4;
}
/* inc nonce : 4 bytes */
proto_tree_add_item(tree, hf_rx_inc_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
/* level : 4 bytes */
proto_tree_add_item(tree, hf_rx_level, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_item_set_len(item, offset-old_offset);
return offset;
}
开发者ID:crondaemon,项目名称:wireshark,代码行数:53,代码来源:packet-rx.c
示例4: nlm_print_msgres_reply
static void
nlm_print_msgres_reply(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb)
{
nlm_msg_res_matched_data *md;
md=(nlm_msg_res_matched_data *)g_hash_table_lookup(nlm_msg_res_matched, GINT_TO_POINTER(pinfo->fd->num));
if(md){
nstime_t ns;
proto_tree_add_uint(tree, hf_nlm_request_in, tvb, 0, 0, md->req_frame);
nstime_delta(&ns, &pinfo->fd->abs_ts, &md->ns);
proto_tree_add_time(tree, hf_nlm_time, tvb, 0, 0, &ns);
}
}
开发者ID:SayCV,项目名称:wireshark,代码行数:13,代码来源:packet-nlm.c
示例5: dissect_ayiya
static void
dissect_ayiya(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *ayiya_tree;
int offset = 0;
int idlen, siglen, ayiya_len;
guint8 next_header, opcode;
tvbuff_t *payload;
idlen = 1 << tvb_get_bits8(tvb, 0, 4);
siglen = tvb_get_bits8(tvb, 8, 4) * 4;
opcode = tvb_get_bits8(tvb, 20, 4);
next_header = tvb_get_guint8(tvb, 3);
ayiya_len = 8+idlen+siglen;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AYIYA");
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);
proto_tree_add_bits_item(ayiya_tree, hf_id_len, tvb, 0, 4, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(ayiya_tree, hf_id_type, tvb, 4, 4, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(ayiya_tree, hf_sig_len, tvb, 8, 4, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(ayiya_tree, hf_hash_method, tvb, 12, 4, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(ayiya_tree, hf_auth_method, tvb, 16, 4, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(ayiya_tree, hf_opcode, tvb, 20, 4, ENC_BIG_ENDIAN);
proto_tree_add_uint_format(ayiya_tree, hf_next_header, tvb,
3, 1, next_header,
"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_identity, tvb, 8, idlen, ENC_NA);
proto_tree_add_item(ayiya_tree, hf_signature, tvb, 8+idlen, siglen, ENC_NA);
}
offset = ayiya_len;
switch (opcode) {
case OPCODE_FORWARD:
payload = tvb_new_subset_remaining(tvb, offset);
dissector_try_uint(ip_dissector_table, next_header, payload, pinfo, tree);
break;
}
}
开发者ID:giuliano108,项目名称:wireshark-rtpmon,代码行数:49,代码来源:packet-ayiya.c
示例6: dissect_kt_replication
static int
dissect_kt_replication(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
{
gint new_offset;
guint32 next32, size;
guint64 ts;
nstime_t ns_ts;
proto_item *pi;
new_offset = offset;
proto_tree_add_item(tree, hf_kt_magic, tvb, new_offset, 1, ENC_BIG_ENDIAN);
new_offset++;
if (tvb_reported_length_remaining(tvb, new_offset) > 0) {
next32 = tvb_get_ntohl(tvb, new_offset);
if (next32 <= 1) { /* This means request. the 32 bits are flags */
proto_tree_add_item(tree, hf_kt_flags, tvb, new_offset, 4, ENC_BIG_ENDIAN);
new_offset += 4;
proto_tree_add_item(tree, hf_kt_ts, tvb, new_offset, 8, ENC_BIG_ENDIAN);
new_offset += 8;
proto_tree_add_item(tree, hf_kt_sid, tvb, new_offset, 2, ENC_BIG_ENDIAN);
new_offset += 2;
} else { /* This is a response. The 32 bits are the first half of the ts */
ts = tvb_get_ntoh64(tvb, new_offset);
ns_ts.secs = (time_t)(ts/1000000000);
ns_ts.nsecs = (int)(ts%1000000000);
proto_tree_add_time(tree, hf_kt_ts, tvb, new_offset, 8, &ns_ts);
new_offset += 8;
size = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(tree, hf_kt_size, tvb, new_offset, 4, size);
new_offset += 4;
proto_tree_add_item(tree, hf_kt_log, tvb, new_offset, size, ENC_NA);
new_offset += size;
}
} else {
/* This is an empty ack to the message with magic 0xB0. */
pi = proto_tree_add_uint(tree, hf_kt_type, tvb, offset, 1, KT_OPER_RESPONSE);
PROTO_ITEM_SET_GENERATED(pi);
col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "[response]");
}
return new_offset;
}
开发者ID:RayHightower,项目名称:wireshark,代码行数:48,代码来源:packet-kt.c
示例7: add_integer_value
static void
add_integer_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
int offset, int name_length, int value_length, guint8 tag)
{
char *name_val = NULL;
offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
value_length, &name_val);
switch (tag) {
case TAG_BOOLEAN:
if (value_length == 1) {
proto_tree_add_item(tree, hf_ipp_bool_value, tvb, offset, value_length, ENC_NA);
}
break;
case TAG_INTEGER:
case TAG_ENUM:
/* Some fields in IPP are really unix timestamps but IPP
* transports these as 4 byte integers.
* A simple heuristic to make the display of these fields
* more human readable is to assume that if the field name
* ends in '-time' then assume they are timestamps instead
* of integers.
*/
if (value_length == 4) {
if ((name_length > 5) && name_val && !strcmp(name_val+name_length-5, "-time")) {
nstime_t ns;
ns.secs=tvb_get_ntohl(tvb, offset);
ns.nsecs=0;
proto_tree_add_time(tree, hf_ipp_timestamp, tvb, offset, 4, &ns);
}
else if ((name_length > 5) && name_val && !strcmp(name_val, "printer-state")) {
proto_tree_add_item(tree, hf_ipp_printer_state, tvb, offset, value_length, ENC_BIG_ENDIAN);
}
else if ((name_length > 5) && name_val && !strcmp(name_val, "job-state")) {
proto_tree_add_item(tree, hf_ipp_job_state, tvb, offset, value_length, ENC_BIG_ENDIAN);
}
else{
proto_tree_add_item(tree, hf_ipp_uint32_value, tvb, offset, value_length, ENC_BIG_ENDIAN);
}
}
break;
}
}
开发者ID:ARK1988,项目名称:wireshark,代码行数:47,代码来源:packet-ipp.c
示例8: dissect_zcl_thermostat_schedule
/**
*Helper function to dissect a Thermostat schedule, which has
*
*@param tree pointer to data tree Wireshark uses to display packet.
*@param tvb pointer to buffer containing raw packet.
*@param offset payload offset of the ZoneStatus value.
*@return length of parsed data.
*/
static int
dissect_zcl_thermostat_schedule(proto_tree *tree, tvbuff_t *tvb, guint offset)
{
guint start = offset;
guint8 num_transitions;
guint8 mode_sequence;
int i;
num_transitions = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(tree, hf_zbee_zcl_thermostat_schedule_num_trans, tvb, offset, 1,
num_transitions);
offset++;
dissect_zcl_thermostat_schedule_days(tree, tvb, offset);
offset++;
mode_sequence = tvb_get_guint8(tvb, offset);
dissect_zcl_thermostat_schedule_mode(tree, tvb, offset);
offset++;
/* Parse the list of setpoint transitions. */
for (i = 0; i < num_transitions; i++) {
nstime_t tv;
tv.secs = tvb_get_letohs(tvb, offset) * 60;
tv.nsecs = 0;
proto_tree_add_time(tree, hf_zbee_zcl_thermostat_schedule_time, tvb, offset, 2, &tv);
offset += 2;
if (mode_sequence & ZBEE_ZCL_CMD_THERMOSTAT_SCHEDULE_MODE_SEQUENCE_HEAT) {
float setpoint = (gint16)tvb_get_letohs(tvb, offset);
proto_tree_add_float(tree, hf_zbee_zcl_thermostat_schedule_heat,
tvb, offset, 2, (setpoint / 100.0f));
offset += 2;
}
if (mode_sequence & ZBEE_ZCL_CMD_THERMOSTAT_SCHEDULE_MODE_SEQUENCE_COOL) {
float setpoint = (gint16)tvb_get_letohs(tvb, offset);
proto_tree_add_float(tree, hf_zbee_zcl_thermostat_schedule_cool,
tvb, offset, 2, (setpoint / 100.0f));
offset += 2;
}
} /* for */
/* Return the number of bytes parsed. */
return (offset - start);
} /* dissect_zcl_thermostat_cmd_schedule */
开发者ID:CharaD7,项目名称:wireshark,代码行数:53,代码来源:packet-zbee-zcl-misc.c
示例9: dissect_whoent
static void
dissect_whoent(tvbuff_t *tvb, int offset, proto_tree *tree)
{
proto_tree *whoent_tree = NULL;
proto_item *whoent_ti = NULL;
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,
line_offset, SIZE_OF_WHOENT, ENC_NA);
whoent_tree = proto_item_add_subtree(whoent_ti, ett_whoent);
out_line = tvb_get_stringzpad(wmem_packet_scope(), tvb, line_offset, 8, ENC_ASCII|ENC_NA);
proto_tree_add_string(whoent_tree, hf_who_tty, tvb, line_offset,
8, out_line);
line_offset += 8;
out_name = tvb_get_stringzpad(wmem_packet_scope(), tvb, line_offset, 8, ENC_ASCII|ENC_NA);
proto_tree_add_string(whoent_tree, hf_who_uid, tvb, line_offset,
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);
line_offset += 4;
idle_secs = tvb_get_ntohl(tvb, line_offset);
proto_tree_add_uint_format(whoent_tree, hf_who_idle, tvb,
line_offset, 4, idle_secs, "Idle: %s",
time_secs_to_str(wmem_packet_scope(), idle_secs));
line_offset += 4;
whoent_num++;
}
}
开发者ID:ARK1988,项目名称:wireshark,代码行数:44,代码来源:packet-who.c
示例10: dissect_whoent
static void
dissect_whoent(tvbuff_t *tvb, int offset, proto_tree *tree)
{
proto_tree *whoent_tree = NULL;
proto_item *whoent_ti = NULL;
int line_offset = offset;
gchar out_line[9];
gchar out_name[9];
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,
line_offset, SIZE_OF_WHOENT, FALSE);
whoent_tree = proto_item_add_subtree(whoent_ti, ett_whoent);
tvb_get_nstringz0(tvb, line_offset, sizeof(out_line), (guint8*)out_line);
proto_tree_add_string(whoent_tree, hf_who_tty, tvb, line_offset,
8, out_line);
line_offset += 8;
tvb_get_nstringz0(tvb, line_offset, sizeof(out_name), (guint8*)out_name);
proto_tree_add_string(whoent_tree, hf_who_uid, tvb, line_offset,
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);
line_offset += 4;
idle_secs = tvb_get_ntohl(tvb, line_offset);
proto_tree_add_uint_format(whoent_tree, hf_who_idle, tvb,
line_offset, 4, idle_secs, "Idle: %s",
time_secs_to_str(idle_secs));
line_offset += 4;
whoent_num++;
}
}
开发者ID:flaub,项目名称:HotFuzz,代码行数:44,代码来源:packet-who.c
示例11: dissect_kt_replication_wait
/* Dissection routines */
static int
dissect_kt_replication_wait(tvbuff_t *tvb, proto_tree *tree, gint offset)
{
gint new_offset;
guint64 ts;
nstime_t ns_ts;
new_offset = offset;
proto_tree_add_item(tree, hf_kt_magic, tvb, new_offset, 1, ENC_BIG_ENDIAN);
new_offset++;
ts = tvb_get_ntoh64(tvb, new_offset);
ns_ts.secs = (time_t)(ts/1000000000);
ns_ts.nsecs = (int)(ts%1000000000);
proto_tree_add_time(tree, hf_kt_ts, tvb, new_offset, 8, &ns_ts);
new_offset += 8;
return new_offset;
}
开发者ID:RayHightower,项目名称:wireshark,代码行数:21,代码来源:packet-kt.c
示例12: rtpproxy_add_tid
static rtpproxy_info_t *
rtpproxy_add_tid(gboolean is_request, tvbuff_t *tvb, packet_info *pinfo, proto_tree *rtpproxy_tree, rtpproxy_conv_info_t *rtpproxy_conv, gchar* cookie)
{
rtpproxy_info_t *rtpproxy_info;
proto_item *pi;
if (!PINFO_FD_VISITED(pinfo)) {
if (is_request) {
rtpproxy_info = wmem_new(wmem_file_scope(), rtpproxy_info_t);
rtpproxy_info->req_frame = PINFO_FD_NUM(pinfo);
rtpproxy_info->resp_frame = 0;
rtpproxy_info->req_time = pinfo->fd->abs_ts;
rtpproxy_info->callid = NULL;
wmem_tree_insert_string(rtpproxy_conv->trans, cookie, rtpproxy_info, 0);
} else {
rtpproxy_info = (rtpproxy_info_t *)wmem_tree_lookup_string(rtpproxy_conv->trans, cookie, 0);
if (rtpproxy_info) {
rtpproxy_info->resp_frame = PINFO_FD_NUM(pinfo);
}
}
} else {
rtpproxy_info = (rtpproxy_info_t *)wmem_tree_lookup_string(rtpproxy_conv->trans, cookie, 0);
if (rtpproxy_info && (is_request ? rtpproxy_info->resp_frame : rtpproxy_info->req_frame)) {
nstime_t ns;
pi = proto_tree_add_uint(rtpproxy_tree, is_request ? hf_rtpproxy_response_in : hf_rtpproxy_request_in, tvb, 0, 0, is_request ? rtpproxy_info->resp_frame : rtpproxy_info->req_frame);
PROTO_ITEM_SET_GENERATED(pi);
/* If reply then calculate response time */
if (!is_request) {
nstime_delta(&ns, &pinfo->fd->abs_ts, &rtpproxy_info->req_time);
pi = proto_tree_add_time(rtpproxy_tree, hf_rtpproxy_response_time, tvb, 0, 0, &ns);
PROTO_ITEM_SET_GENERATED(pi);
if (nstime_cmp(&rtpproxy_timeout_ns, &ns) < 0)
expert_add_info_format(pinfo, rtpproxy_tree, &ei_rtpproxy_timeout, "Response timeout %.3f seconds", nstime_to_sec(&ns));
}
}
}
/* Could be NULL so we should check it before dereferencing */
return rtpproxy_info;
}
开发者ID:hashbrowncipher,项目名称:wireshark,代码行数:41,代码来源:packet-rtpproxy.c
示例13: dissect_om2k_time
static gint
dissect_om2k_time(tvbuff_t *tvb, gint offset, proto_tree *tree)
{
nstime_t tmptime;
time_t tval;
struct tm _time;
_time.tm_year = 100 + tvb_get_guint8(tvb, offset++);
_time.tm_mon = tvb_get_guint8(tvb, offset++) - 1;
_time.tm_mday = tvb_get_guint8(tvb, offset++);
_time.tm_hour = tvb_get_guint8(tvb, offset++);
_time.tm_min = tvb_get_guint8(tvb, offset++);
_time.tm_sec = tvb_get_guint8(tvb, offset++);
_time.tm_isdst = -1;
tval = mktime(&_time);
tmptime.secs = tval;
tmptime.nsecs = 0;
proto_tree_add_time(tree, hf_om2k_cal_time, tvb, offset, 6,
&tmptime);
return 6;
}
开发者ID:CharaD7,项目名称:wireshark,代码行数:23,代码来源:packet-gsm_abis_om2000.c
示例14: dissect_dvb_tot
static void
dissect_dvb_tot(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0;
guint descriptor_len;
proto_item *ti;
proto_tree *dvb_tot_tree;
nstime_t utc_time;
col_set_str(pinfo->cinfo, COL_INFO, "Time Offset Table (TOT)");
ti = proto_tree_add_item(tree, proto_dvb_tot, tvb, offset, -1, ENC_NA);
dvb_tot_tree = proto_item_add_subtree(ti, ett_dvb_tot);
offset += packet_mpeg_sect_header(tvb, offset, dvb_tot_tree, NULL, NULL);
if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
proto_tree_add_time_format_value(dvb_tot_tree, hf_dvb_tot_utc_time, tvb, offset, 5, &utc_time, "Unparseable time");
} else {
proto_tree_add_time(dvb_tot_tree, hf_dvb_tot_utc_time, tvb, offset, 5, &utc_time);
}
offset += 5;
descriptor_len = tvb_get_ntohs(tvb, offset) & DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK;
proto_tree_add_item(dvb_tot_tree, hf_dvb_tot_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_tot_tree, hf_dvb_tot_descriptors_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
offset += proto_mpeg_descriptor_loop_dissect(tvb, offset, descriptor_len, dvb_tot_tree);
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_tot_tree, 0, offset);
proto_item_set_len(ti, offset);
}
开发者ID:MultipathDTLS,项目名称:wireshark,代码行数:37,代码来源:packet-dvb-tot.c
示例15: dissect_ccn_contentobject
//.........这里部分代码省略.........
ccn_charbuf_as_string(c));
name_tree = proto_item_add_subtree(titem, ett_name);
ccn_charbuf_destroy(&c);
/* Name Components */
for (i = 0; i < comps->n - 1; i++) {
res = ccn_name_comp_get(ccnb, comps, i, &comp, &comp_size);
titem = proto_tree_add_item(name_tree, hf_ccn_name_components, tvb, comp - ccnb, comp_size, FALSE);
}
/* /Name */
/* SignedInfo */
l = pco->offset[CCN_PCO_E_SignedInfo] - pco->offset[CCN_PCO_B_SignedInfo];
titem = proto_tree_add_text(tree, tvb,
pco->offset[CCN_PCO_B_SignedInfo], l,
"SignedInfo");
signedinfo_tree = proto_item_add_subtree(titem, ett_signedinfo);
/* PublisherPublicKeyDigest */
l = pco->offset[CCN_PCO_E_PublisherPublicKeyDigest] - pco->offset[CCN_PCO_B_PublisherPublicKeyDigest];
if (l > 0) {
res = ccn_ref_tagged_BLOB(CCN_DTAG_PublisherPublicKeyDigest, ccnb,
pco->offset[CCN_PCO_B_PublisherPublicKeyDigest],
pco->offset[CCN_PCO_E_PublisherPublicKeyDigest],
&blob, &blob_size);
titem = proto_tree_add_bytes(signedinfo_tree, hf_ccn_publisherpublickeydigest, tvb, blob - ccnb, blob_size, blob);
}
/* Timestamp */
l = pco->offset[CCN_PCO_E_Timestamp] - pco->offset[CCN_PCO_B_Timestamp];
if (l > 0) {
res = ccn_ref_tagged_BLOB(CCN_DTAG_Timestamp, ccnb,
pco->offset[CCN_PCO_B_Timestamp],
pco->offset[CCN_PCO_E_Timestamp],
&blob, &blob_size);
dt = 0.0;
for (i = 0; i < blob_size; i++)
dt = dt * 256.0 + (double)blob[i];
dt /= 4096.0;
timestamp.secs = dt; /* truncates */
timestamp.nsecs = (dt - (double) timestamp.secs) * 1000000000.0;
titem = proto_tree_add_time(signedinfo_tree, hf_ccn_timestamp, tvb, blob - ccnb, blob_size, ×tamp);
}
/* Type */
l = pco->offset[CCN_PCO_E_Type] - pco->offset[CCN_PCO_B_Type];
if (l > 0) {
res = ccn_ref_tagged_BLOB(CCN_DTAG_Type, ccnb,
pco->offset[CCN_PCO_B_Type],
pco->offset[CCN_PCO_E_Type],
&blob, &blob_size);
titem = proto_tree_add_int(signedinfo_tree, hf_ccn_contenttype, tvb, blob - ccnb, blob_size, pco->type);
} else {
titem = proto_tree_add_int(signedinfo_tree, hf_ccn_contenttype, NULL, 0, 0, pco->type);
}
/* FreshnessSeconds */
l = pco->offset[CCN_PCO_E_FreshnessSeconds] - pco->offset[CCN_PCO_B_FreshnessSeconds];
if (l > 0) {
res = ccn_ref_tagged_BLOB(CCN_DTAG_FreshnessSeconds, ccnb,
pco->offset[CCN_PCO_B_FreshnessSeconds],
pco->offset[CCN_PCO_E_FreshnessSeconds],
&blob, &blob_size);
i = ccn_fetch_tagged_nonNegativeInteger(CCN_DTAG_FreshnessSeconds, ccnb,
pco->offset[CCN_PCO_B_FreshnessSeconds],
pco->offset[CCN_PCO_E_FreshnessSeconds]);
titem = proto_tree_add_uint(signedinfo_tree, hf_ccn_freshnessseconds, tvb, blob - ccnb, blob_size, i);
}
/* FinalBlockID */
l = pco->offset[CCN_PCO_E_FinalBlockID] - pco->offset[CCN_PCO_B_FinalBlockID];
if (l > 0) {
res = ccn_ref_tagged_BLOB(CCN_DTAG_FinalBlockID, ccnb,
pco->offset[CCN_PCO_B_FinalBlockID],
pco->offset[CCN_PCO_E_FinalBlockID],
&blob, &blob_size);
titem = proto_tree_add_item(signedinfo_tree, hf_ccn_finalblockid, tvb, blob - ccnb, blob_size, FALSE);
}
/* TODO: KeyLocator */
/* /SignedInfo */
/* Content */
l = pco->offset[CCN_PCO_E_Content] - pco->offset[CCN_PCO_B_Content];
res = ccn_ref_tagged_BLOB(CCN_DTAG_Content, ccnb,
pco->offset[CCN_PCO_B_Content],
pco->offset[CCN_PCO_E_Content],
&blob, &blob_size);
titem = proto_tree_add_text(tree, tvb,
pco->offset[CCN_PCO_B_Content], l,
"Content: %d bytes", blob_size);
if (blob_size > 0) {
content_tree = proto_item_add_subtree(titem, ett_content);
titem = proto_tree_add_item(content_tree, hf_ccn_contentdata, tvb, blob - ccnb, blob_size, FALSE);
}
return (ccnb_size);
}
开发者ID:futtre,项目名称:ccnx,代码行数:101,代码来源:packet-ccn.c
示例16: dissect_cmp_tcp_pdu
static int dissect_cmp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
{
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;
proto_tree *tcptrans_tree=NULL;
asn1_ctx_t asn1_ctx;
int offset=0;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CMP");
col_set_str(pinfo->cinfo, COL_INFO, "PKIXCMP");
if(parent_tree){
item=proto_tree_add_item(parent_tree, proto_cmp, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_cmp);
}
pdu_len=tvb_get_ntohl(tvb, 0);
pdu_type=tvb_get_guint8(tvb, 4);
if (pdu_type < 10) {
/* RFC2510 TCP transport */
ti = proto_tree_add_item(tree, proto_cmp, tvb, offset, 5, ENC_NA);
tcptrans_tree = proto_item_add_subtree(ti, ett_cmp);
proto_tree_add_item(tree, hf_cmp_tcptrans_len, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_cmp_tcptrans_type, tvb, offset++, 1, ENC_BIG_ENDIAN);
} else {
/* post RFC2510 TCP transport - the former "type" field is now "version" */
ti = proto_tree_add_text(tree, tvb, offset, 7, "TCP transport");
tcptrans_tree = proto_item_add_subtree(ti, ett_cmp);
pdu_type=tvb_get_guint8(tvb, 6);
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans_len, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans10_version, tvb, offset++, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans10_flags, tvb, offset++, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans_type, tvb, offset++, 1, ENC_BIG_ENDIAN);
}
col_add_str (pinfo->cinfo, COL_INFO, val_to_str (pdu_type, cmp_pdu_types, "0x%x"));
switch(pdu_type){
case CMP_TYPE_PKIMSG:
next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), pdu_len);
dissect_cmp_pdu(next_tvb, tree, &asn1_ctx);
offset += tvb_length_remaining(tvb, offset);
break;
case CMP_TYPE_POLLREP:
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);
offset += 4;
break;
case CMP_TYPE_POLLREQ:
proto_tree_add_item(tcptrans_tree, hf_cmp_tcptrans_poll_ref, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
break;
case CMP_TYPE_NEGPOLLREP:
break;
case CMP_TYPE_PARTIALMSGREP:
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);
offset += 4;
next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), pdu_len);
dissect_cmp_pdu(next_tvb, tree, &asn1_ctx);
offset += tvb_length_remaining(tvb, offset);
break;
case CMP_TYPE_FINALMSGREP:
next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), pdu_len);
dissect_cmp_pdu(next_tvb, tree, &asn1_ctx);
offset += tvb_length_remaining(tvb, offset);
break;
case CMP_TYPE_ERRORMSGREP:
/*XXX to be added*/
break;
}
return offset;
}
开发者ID:giuliano108,项目名称:wireshark-rtpmon,代码行数:94,代码来源:packet-cmp-template.c
示例17: dissect_frame
static void
dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
{
proto_item *volatile ti = NULL;
nstime_t ts;
int cap_len = 0, frame_len = 0;
proto_tree *volatile tree;
proto_item *item;
guint32 frame_number;
frame_number=pinfo->fd->num; /* dummy so that the buildbot crashdumps
will show the packetnumber where the
crash occurred.
*/
tree=parent_tree;
pinfo->current_proto = "Frame";
if (pinfo->pseudo_header != NULL) {
switch (pinfo->fd->lnk_t) {
case WTAP_ENCAP_WFLEET_HDLC:
case WTAP_ENCAP_CHDLC_WITH_PHDR:
case WTAP_ENCAP_PPP_WITH_PHDR:
case WTAP_ENCAP_SDLC:
case WTAP_ENCAP_BLUETOOTH_H4:
case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR:
pinfo->p2p_dir = pinfo->pseudo_header->p2p.sent ?
P2P_DIR_SENT : P2P_DIR_RECV;
break;
case WTAP_ENCAP_BLUETOOTH_HCI:
pinfo->p2p_dir = pinfo->pseudo_header->bthci.sent;
break;
case WTAP_ENCAP_LAPB:
case WTAP_ENCAP_FRELAY_WITH_PHDR:
pinfo->p2p_dir =
(pinfo->pseudo_header->x25.flags & FROM_DCE) ?
P2P_DIR_RECV : P2P_DIR_SENT;
break;
case WTAP_ENCAP_ISDN:
pinfo->p2p_dir = pinfo->pseudo_header->isdn.uton ?
P2P_DIR_SENT : P2P_DIR_RECV;
break;
case WTAP_ENCAP_LINUX_LAPD:
pinfo->p2p_dir = (pinfo->pseudo_header->lapd.pkttype == 3 ||
pinfo->pseudo_header->lapd.pkttype == 4) ?
P2P_DIR_SENT : P2P_DIR_RECV;
break;
case WTAP_ENCAP_MTP2_WITH_PHDR:
pinfo->p2p_dir = pinfo->pseudo_header->mtp2.sent ?
P2P_DIR_SENT : P2P_DIR_RECV;
pinfo->link_number = pinfo->pseudo_header->mtp2.link_number;
pinfo->annex_a_used = pinfo->pseudo_header->mtp2.annex_a_used;
break;
case WTAP_ENCAP_GSM_UM:
pinfo->p2p_dir = pinfo->pseudo_header->gsm_um.uplink ?
P2P_DIR_SENT : P2P_DIR_RECV;
break;
}
}
/* if FRAME is not referenced from any filters we dont need to worry about
generating any tree items. */
if(!proto_field_is_referenced(tree, proto_frame)) {
tree=NULL;
if(pinfo->fd->abs_ts.nsecs < 0 || pinfo->fd->abs_ts.nsecs >= 1000000000)
expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_WARN,
"Arrival Time: Fractional second out of range (0-1000000000)");
} else {
proto_tree *fh_tree;
/* Put in frame header information. */
cap_len = tvb_length(tvb);
frame_len = tvb_reported_length(tvb);
ti = proto_tree_add_protocol_format(tree, proto_frame, tvb, 0, -1,
"Frame %u (%u bytes on wire, %u bytes captured)", pinfo->fd->num, frame_len, cap_len);
fh_tree = proto_item_add_subtree(ti, ett_frame);
ts = pinfo->fd->abs_ts;
proto_tree_add_time(fh_tree, hf_frame_arrival_time, tvb,
0, 0, &ts);
if(ts.nsecs < 0 || ts.nsecs >= 1000000000) {
item = proto_tree_add_none_format(fh_tree, hf_frame_time_invalid, tvb,
0, 0, "Arrival Time: Fractional second %09ld is invalid, the valid range is 0-1000000000", (long) ts.nsecs);
PROTO_ITEM_SET_GENERATED(item);
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "Arrival Time: Fractional second out of range (0-1000000000)");
}
ts = pinfo->fd->del_cap_ts;
//.........这里部分代码省略.........
开发者ID:RazZziel,项目名称:wireshark-dplay,代码行数:101,代码来源:packet-frame.c
示例18: dissect_kt_get_bulk
static int
dissect_kt_get_bulk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
{
guint32 next32, rnum, ksiz, vsiz;
guint64 xt;
nstime_t ts;
gint new_offset, rec_start_offset;
proto_item *ti;
proto_item *pi;
proto_tree *rec_tree;
new_offset = offset;
proto_tree_add_item(tree, hf_kt_magic, tvb, new_offset, 1, ENC_BIG_ENDIAN);
new_offset++;
next32 = tvb_get_ntohl(tvb, new_offset);
if (next32 == 0) {
if (tvb_reported_length_remaining(tvb, (new_offset + 4)) > 0) { /* request */
pi = proto_tree_add_uint(tree, hf_kt_type, tvb, offset, 1, KT_OPER_REQUEST);
PROTO_ITEM_SET_GENERATED(pi);
proto_tree_add_uint(tree, hf_kt_flags, tvb, new_offset, 4, next32);
new_offset += 4;
rnum = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(tree, hf_kt_rnum, tvb, new_offset, 4, rnum);
new_offset += 4;
while (rnum > 0) {
/* Create a sub-tree for each record */
ti = proto_tree_add_item(tree, hf_kt_rec, tvb, new_offset, -1, ENC_NA);
rec_tree = proto_item_add_subtree(ti, ett_kt_rec);
rec_start_offset = new_offset;
proto_tree_add_item(rec_tree, hf_kt_dbidx, tvb, new_offset, 2, ENC_BIG_ENDIAN);
new_offset += 2;
ksiz = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(rec_tree, hf_kt_ksiz, tvb, new_offset, 4, ksiz);
new_offset += 4;
proto_tree_add_item(rec_tree, hf_kt_key, tvb, new_offset, ksiz, ENC_NA);
if (kt_present_key_val_as_ascii) {
pi = proto_tree_add_item(rec_tree, hf_kt_key_str, tvb, new_offset, ksiz, ENC_ASCII|ENC_NA);
PROTO_ITEM_SET_GENERATED(pi);
}
new_offset += ksiz;
proto_item_set_len(ti, new_offset - rec_start_offset);
rnum--;
}
} else { /* response - no records */
pi = proto_tree_add_uint(tree, hf_kt_type, tvb, offset, 1, KT_OPER_RESPONSE);
PROTO_ITEM_SET_GENERATED(pi);
col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "[response]");
proto_tree_add_uint(tree, hf_kt_hits, tvb, new_offset, 4, next32);
new_offset += 4;
}
} else { /* response - one or more records */
pi = proto_tree_add_uint(tree, hf_kt_type, tvb, offset, 1, KT_OPER_RESPONSE);
PROTO_ITEM_SET_GENERATED(pi);
col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "[response]");
rnum = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(tree, hf_kt_hits, tvb, new_offset, 4, rnum);
new_offset += 4;
while (rnum > 0) {
/* Create a sub-tree for each record */
ti = proto_tree_add_item(tree, hf_kt_rec, tvb, new_offset, -1, ENC_NA);
rec_tree = proto_item_add_subtree(ti, ett_kt_rec);
rec_start_offset = new_offset;
proto_tree_add_item(rec_tree, hf_kt_dbidx, tvb, new_offset, 2, ENC_BIG_ENDIAN);
new_offset += 2;
ksiz = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(rec_tree, hf_kt_ksiz, tvb, new_offset, 4, ksiz);
new_offset += 4;
vsiz = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(rec_tree, hf_kt_vsiz, tvb, new_offset, 4, vsiz);
new_offset += 4;
xt = tvb_get_ntoh64(tvb, new_offset);
ts.secs = (time_t)(xt&0xFFFFFFFF);
ts.nsecs = 0;
proto_tree_add_time(rec_tree, hf_kt_xt_resp, tvb, new_offset, 8, &ts);
new_offset += 8;
proto_tree_add_item(rec_tree, hf_kt_key, tvb, new_offset, ksiz, ENC_NA);
if (kt_present_key_val_as_ascii) {
pi = proto_tree_add_item(rec_tree, hf_kt_key_str, tvb, new_offset, ksiz, ENC_ASCII|ENC_NA);
PROTO_ITEM_SET_GENERATED(pi);
}
new_offset += ksiz;
//.........这里部分代码省略.........
开发者ID:RayHightower,项目名称:wireshark,代码行数:101,代码来源:packet-kt.c
示例19: dissect_zep
//.........这里部分代码省略.........
else {
/* Although, only type 1 corresponds to data, if another value is present, assume it is dissected the same. */
zep_header_len = ZEP_V2_HEADER_LEN;
zep_data.channel_id = tvb_get_guint8(tvb, 4);
zep_data.device_id = tvb_get_ntohs(tvb, 5);
zep_data.lqi_mode = tvb_get_guint8(tvb, 7)?1:0;
zep_data.lqi = tvb_get_guint8(tvb, 8);
ntp_to_nstime(tvb, 9, &(zep_data.ntp_time));
zep_data.seqno = tvb_get_ntohl(tvb, 17);
ieee_packet_len = (tvb_get_guint8(tvb, ZEP_V2_HEADER_LEN - 1) & ZEP_LENGTH_MASK);
}
}
#if 0
/*??dat*/
if (zep_data.ntp_time.secs && zep_data.ntp_time.nsecs) {
pinfo->fd->abs_ts = zep_data.ntp_time;
}
#endif
if(ieee_packet_len < tvb_length(tvb)-zep_header_len){
/* Packet's length is mis-reported, abort dissection */
call_dissector(data_handle, tvb, pinfo, tree);
return;
}
/* Enter name info protocol field */
col_set_str(pinfo->cinfo, COL_PROTOCOL, (zep_data.version==1)?"ZEP":"ZEPv2");
/* Enter name info protocol field */
col_clear(pinfo->cinfo, COL_INFO);
if (!((zep_data.version>=2) && (zep_data.type==ZEP_V2_TYPE_ACK)))
col_add_fstr(pinfo->cinfo, COL_INFO, "Encapsulated ZigBee Packet [Channel]=%i [Length]=%i", zep_data.channel_id, ieee_packet_len);
else
col_add_fstr(pinfo->cinfo, COL_INFO, "Ack, Sequence Number: %i", zep_data.seqno);
if(tree){
/* Create subtree for the ZEP Header */
if (!((zep_data.version>
|
请发表评论