Пример #1
0
static gboolean
process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
{
    epan_dissect_t			edt;
    union wtap_pseudo_header	phdr;
    guint8				pd[WTAP_MAX_PACKET_SIZE];
    double				cur_time;

    /* Load the frame from the capture file */
    if (!cf_read_frame_r(&cfile, frame, &phdr, pd))
        return FALSE;	/* failure */

    /* Dissect the frame   tree  not visible */
    epan_dissect_init(&edt, TRUE, FALSE);
    /* Don't fake protocols. We need them for the protocol hierarchy */
    epan_dissect_fake_protocols(&edt, FALSE);
    epan_dissect_run(&edt, &phdr, pd, frame, cinfo);

    /* Get stats from this protocol tree */
    process_tree(edt.tree, ps, frame->pkt_len);

    /* Update times */
    cur_time = nstime_to_sec(&frame->abs_ts);
    if (cur_time < ps->first_time) {
        ps->first_time = cur_time;
    }
    if (cur_time > ps->last_time) {
        ps->last_time = cur_time;
    }

    /* Free our memory. */
    epan_dissect_cleanup(&edt);

    return TRUE;	/* success */
}
Пример #2
0
static gboolean
process_record(capture_file *cf, frame_data *frame, column_info *cinfo, ph_stats_t* ps)
{
	epan_dissect_t			edt;
	struct wtap_pkthdr              phdr;
	Buffer				buf;
	double				cur_time;

	wtap_phdr_init(&phdr);

	/* Load the record from the capture file */
	ws_buffer_init(&buf, 1500);
	if (!cf_read_record_r(cf, frame, &phdr, &buf))
		return FALSE;	/* failure */

	/* Dissect the record   tree  not visible */
	epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
	/* Don't fake protocols. We need them for the protocol hierarchy */
	epan_dissect_fake_protocols(&edt, FALSE);
	epan_dissect_run(&edt, cf->cd_t, &phdr, frame_tvbuff_new_buffer(frame, &buf), frame, cinfo);

	/* Get stats from this protocol tree */
	process_tree(edt.tree, ps, frame->pkt_len);

	if (frame->flags.has_ts) {
		/* Update times */
		cur_time = nstime_to_sec(&frame->abs_ts);
		if (cur_time < ps->first_time)
			ps->first_time = cur_time;
		if (cur_time > ps->last_time)
			ps->last_time = cur_time;
	}

	/* Free our memory. */
	epan_dissect_cleanup(&edt);
	wtap_phdr_cleanup(&phdr);
	ws_buffer_free(&buf);

	return TRUE;	/* success */
}
Пример #3
0
    static gboolean
process_record(capture_file *cf, frame_data *frame, column_info *cinfo,
               wtap_rec *rec, Buffer *buf, ph_stats_t* ps)
{
    epan_dissect_t	edt;
    double		cur_time;

    /* Load the record from the capture file */
    if (!cf_read_record(cf, frame, rec, buf))
        return FALSE;	/* failure */

    /* Dissect the record   tree  not visible */
    epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
    /* Don't fake protocols. We need them for the protocol hierarchy */
    epan_dissect_fake_protocols(&edt, FALSE);
    epan_dissect_run(&edt, cf->cd_t, rec,
                     frame_tvbuff_new_buffer(&cf->provider, frame, buf),
                     frame, cinfo);

    /* Get stats from this protocol tree */
    process_tree(edt.tree, ps);

    if (frame->has_ts) {
        /* Update times */
        cur_time = nstime_to_sec(&frame->abs_ts);
        if (cur_time < ps->first_time)
            ps->first_time = cur_time;
        if (cur_time > ps->last_time)
            ps->last_time = cur_time;
    }

    /* Free our memory. */
    epan_dissect_cleanup(&edt);

    return TRUE;	/* success */
}