2 * Routines for capture file summary info
4 * $Id: summary.c,v 1.22 2002/02/08 10:07:34 guy Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #include <epan/packet.h>
35 secs_usecs( guint32 s, guint32 us)
37 return (us / 1000000.0) + (double)s;
41 tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally)
45 cur_time = secs_usecs(cur_frame->abs_secs, cur_frame->abs_usecs);
47 if (cur_time < sum_tally->start_time) {
48 sum_tally->start_time = cur_time;
50 if (cur_time > sum_tally->stop_time){
51 sum_tally->stop_time = cur_time;
53 sum_tally->bytes += cur_frame->pkt_len;
54 if (cur_frame->flags.passed_dfilter)
55 sum_tally->filtered_count++;
56 if (cur_frame->flags.marked)
57 sum_tally->marked_count++;
62 summary_fill_in(summary_tally *st)
65 frame_data *first_frame, *cur_frame;
67 frame_data *cur_glist;
72 st->filtered_count = 0;
75 /* initialize the tally */
76 if (cfile.plist != NULL) {
77 first_frame = cfile.plist;
78 st->start_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs);
79 st->stop_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs);
80 cur_glist = cfile.plist;
82 for (i = 0; i < cfile.count; i++) {
83 cur_frame = cur_glist;
84 tally_frame_data(cur_frame, st);
85 cur_glist = cur_glist->next;
89 st->filename = cfile.filename;
90 st->file_length = cfile.f_len;
91 st->encap_type = cfile.cd_t;
92 st->has_snap = cfile.has_snap;
93 st->snap = cfile.snap;
94 st->elapsed_time = secs_usecs(cfile.esec, cfile.eusec);
95 st->packet_count = cfile.count;
96 st->drops_known = cfile.drops_known;
97 st->drops = cfile.drops;
98 st->iface = cfile.iface;
99 st->dfilter = cfile.dfilter;
102 st->cfilter = cfile.cfilter;