Revert r35132 so that a better fix can be implemented that doesn't break
[obnox/wireshark/wip.git] / summary.c
index 9633550fc04f1d0e1004a764e4f5a1b9c15960d2..82831b78d4ac6ac662ab40de187a1b49c12fe579 100644 (file)
--- a/summary.c
+++ b/summary.c
 # 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,24 @@ 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 ;
+  }
+  if (cur_frame->flags.ignored){
+    sum_tally->ignored_count++;
+  }
 }
 
 void
@@ -81,16 +100,20 @@ 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;
+  st->ignored_count = 0;
 
   /* initialize the tally */
-  if (cf->plist != NULL) {
-    first_frame = cf->plist;
+  if (cf->plist_start != NULL) {
+    first_frame = cf->plist_start;
     st->start_time     = nstime_to_sec(&first_frame->abs_ts);
     st->stop_time = nstime_to_sec(&first_frame->abs_ts);
-    cur_glist = cf->plist;
+    cur_glist = cf->plist_start;
 
     for (i = 0; i < cf->count; i++) {
       cur_frame = cur_glist;
@@ -101,7 +124,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 +147,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