aboutsummaryrefslogtreecommitdiffstats
path: root/summary.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-12-29 21:30:28 +0000
committerGuy Harris <guy@alum.mit.edu>1999-12-29 21:30:28 +0000
commitc3e2626f7ae04efa95cea8251c0b315404247904 (patch)
treee5505782dfe75ac62979421ef2448cb94bc3301d /summary.c
parent8162d65615239222d3c22f684ce121d2b39f9039 (diff)
If there aren't any packets in the capture (which could be the case if,
for example, you're doing a live capture with "Update list of packets in real time" and none have arrived yet, or if you've read in a capture file where there aren't actually any packets), don't look for the start or stop time, and don't accumulate the number of captured bytes or the number of packets that passed the display filter. svn path=/trunk/; revision=1394
Diffstat (limited to 'summary.c')
-rw-r--r--summary.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/summary.c b/summary.c
index 68dc50a3a3..4a1951e215 100644
--- a/summary.c
+++ b/summary.c
@@ -1,7 +1,7 @@
/* summary.c
* Routines for capture file summary info
*
- * $Id: summary.c,v 1.15 1999/12/10 04:20:53 gram Exp $
+ * $Id: summary.c,v 1.16 1999/12/29 21:30:28 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -46,15 +46,15 @@ tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally)
cur_time = secs_usecs(cur_frame->abs_secs, cur_frame->abs_usecs);
- if (cur_time < sum_tally->start_time) {
- sum_tally->start_time = cur_time;
- }
- if (cur_time > sum_tally->stop_time){
- sum_tally->stop_time = cur_time;
- }
- sum_tally->bytes += cur_frame->pkt_len;
- if (cur_frame->passed_dfilter)
- sum_tally->filtered_count++;
+ if (cur_time < sum_tally->start_time) {
+ sum_tally->start_time = cur_time;
+ }
+ if (cur_time > sum_tally->stop_time){
+ sum_tally->stop_time = cur_time;
+ }
+ sum_tally->bytes += cur_frame->pkt_len;
+ if (cur_frame->passed_dfilter)
+ sum_tally->filtered_count++;
}
void
@@ -65,18 +65,23 @@ summary_fill_in(summary_tally *st)
int i;
frame_data *cur_glist;
- /* initialize the tally */
- first_frame = cf.plist;
- st->start_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs) ;
- st->stop_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs) ;
+ st->start_time = 0;
+ st->stop_time = 0;
st->bytes = 0;
st->filtered_count = 0;
- cur_glist = cf.plist;
- for (i = 0; i < cf.count; i++) {
- cur_frame = cur_glist;
- tally_frame_data(cur_frame, st);
- cur_glist = cur_glist->next;
+ /* initialize the tally */
+ if (cf.plist != NULL) {
+ first_frame = cf.plist;
+ st->start_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs);
+ st->stop_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs);
+ cur_glist = cf.plist;
+
+ for (i = 0; i < cf.count; i++) {
+ cur_frame = cur_glist;
+ tally_frame_data(cur_frame, st);
+ cur_glist = cur_glist->next;
+ }
}
st->filename = cf.filename;
@@ -94,7 +99,4 @@ summary_fill_in(summary_tally *st)
#else
st->cfilter = NULL;
#endif
-
-
}
-