Plug memory leak.
[obnox/wireshark/wip.git] / summary.c
index b21706c6be82d2db28257ce695545ad2231430d4..9fc95c8d78ca21f6d64134179d6440854722fe93 100644 (file)
--- a/summary.c
+++ b/summary.c
@@ -3,8 +3,8 @@
  *
  * $Id$
  *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
  *
  * This program is free software; you can redistribute it and/or
 # include "config.h"
 #endif
 
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
 #include <epan/packet.h>
 #include "cfile.h"
 #include "summary.h"
@@ -54,7 +58,7 @@ tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally)
            sum_tally->filtered_stop = cur_time;
     } else {
            if (cur_time < sum_tally->filtered_start) {
-                   sum_tally->start_time = cur_time;
+                   sum_tally->filtered_start = cur_time;
            }
            if (cur_time > sum_tally->filtered_stop) {
                    sum_tally->filtered_stop = cur_time;
@@ -63,9 +67,21 @@ tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally)
     sum_tally->filtered_count++;
     sum_tally->filtered_bytes += cur_frame->pkt_len ;
   }
-  if (cur_frame->flags.marked)
+  if (cur_frame->flags.marked){
+    if (sum_tally->marked_count==0){
+           sum_tally->marked_start= cur_time;
+           sum_tally->marked_stop = cur_time;
+    } else {
+           if (cur_time < sum_tally->marked_start) {
+                   sum_tally->marked_start = cur_time;
+           }
+           if (cur_time > sum_tally->marked_stop) {
+                   sum_tally->marked_stop = cur_time;
+           }
+    }
     sum_tally->marked_count++;
-
+    sum_tally->marked_bytes += cur_frame->pkt_len ;
+  }
 }
 
 void
@@ -81,9 +97,12 @@ summary_fill_in(capture_file *cf, summary_tally *st)
   st->bytes = 0;
   st->filtered_count = 0;
   st->filtered_start = 0;
-  st->filtered_stop   = 0;
+  st->filtered_stop = 0;
   st->filtered_bytes = 0;
   st->marked_count = 0;
+  st->marked_start = 0;
+  st->marked_stop = 0;
+  st->marked_bytes = 0;
 
   /* initialize the tally */
   if (cf->plist != NULL) {
@@ -101,7 +120,8 @@ summary_fill_in(capture_file *cf, summary_tally *st)
 
   st->filename = cf->filename;
   st->file_length = cf->f_datalen;
-  st->encap_type = cf->cd_t;
+  st->file_type = cf->cd_t;
+  st->encap_type = cf->lnk_t;
   st->has_snap = cf->has_snap;
   st->snap = cf->snap;
   st->elapsed_time = nstime_to_sec(&cf->elapsed_time);
@@ -123,10 +143,6 @@ summary_fill_in_capture(capture_options *capture_opts, summary_tally *st)
 {
   st->cfilter = capture_opts->cfilter;
   st->iface = capture_opts->iface;
-  if(st->iface) {
-    st->iface_descr = get_interface_descriptive_name(st->iface);
-  } else {
-    st->iface_descr = NULL;
-  }
+  st->iface_descr = get_iface_description(capture_opts);
 }
 #endif