2 * Routines for capture file summary info
4 * $Id: summary.c,v 1.16 1999/12/29 21:30:28 guy Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
8 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
37 secs_usecs( guint32 s, guint32 us)
39 return (us / 1000000.0) + (double)s;
43 tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally)
47 cur_time = secs_usecs(cur_frame->abs_secs, cur_frame->abs_usecs);
49 if (cur_time < sum_tally->start_time) {
50 sum_tally->start_time = cur_time;
52 if (cur_time > sum_tally->stop_time){
53 sum_tally->stop_time = cur_time;
55 sum_tally->bytes += cur_frame->pkt_len;
56 if (cur_frame->passed_dfilter)
57 sum_tally->filtered_count++;
61 summary_fill_in(summary_tally *st)
64 frame_data *first_frame, *cur_frame;
66 frame_data *cur_glist;
71 st->filtered_count = 0;
73 /* initialize the tally */
74 if (cf.plist != NULL) {
75 first_frame = cf.plist;
76 st->start_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs);
77 st->stop_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs);
80 for (i = 0; i < cf.count; i++) {
81 cur_frame = cur_glist;
82 tally_frame_data(cur_frame, st);
83 cur_glist = cur_glist->next;
87 st->filename = cf.filename;
88 st->file_length = cf.f_len;
89 st->encap_type = cf.cd_t;
91 st->elapsed_time = secs_usecs(cf.esec, cf.eusec);
92 st->packet_count = cf.count;
95 st->dfilter = cf.dfilter;
98 st->cfilter = cf.cfilter;