当前位置: 首页>>代码示例>>C++>>正文


C++ proto_tree_add_time函数代码示例

本文整理汇总了C++中proto_tree_add_time函数的典型用法代码示例。如果您正苦于以下问题:C++ proto_tree_add_time函数的具体用法?C++ proto_tree_add_time怎么用?C++ proto_tree_add_time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了proto_tree_add_time函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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, &timestamp);
    }

    /* 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


注:本文中的proto_tree_add_time函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。