From Tom Brezinski:
[obnox/wireshark/wip.git] / summary.c
index d6d774f809f0cdbc6c053a2426014c36e0d0c982..21b91c29f60b1ca4fef18f80c86174a585a997f3 100644 (file)
--- a/summary.c
+++ b/summary.c
@@ -82,6 +82,9 @@ tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally)
     sum_tally->marked_count++;
     sum_tally->marked_bytes += cur_frame->pkt_len ;
   }
+  if (cur_frame->flags.ignored){
+    sum_tally->ignored_count++;
+  }
 }
 
 void
@@ -89,8 +92,7 @@ summary_fill_in(capture_file *cf, summary_tally *st)
 {
 
   frame_data    *first_frame, *cur_frame;
-  int          i;
-  frame_data    *cur_glist;
+  guint32        framenum;
 
   st->start_time = 0;
   st->stop_time = 0;
@@ -103,24 +105,25 @@ summary_fill_in(capture_file *cf, summary_tally *st)
   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;
-    st->start_time     = nstime_to_sec(&first_frame->abs_ts);
+  if (cf->count != 0) {
+    first_frame = frame_data_sequence_find(cf->frames, 1);
+    st->start_time = nstime_to_sec(&first_frame->abs_ts);
     st->stop_time = nstime_to_sec(&first_frame->abs_ts);
-    cur_glist = cf->plist;
 
-    for (i = 0; i < cf->count; i++) {
-      cur_frame = cur_glist;
+    for (framenum = 1; framenum <= cf->count; framenum++) {
+      cur_frame = frame_data_sequence_find(cf->frames, framenum);
       tally_frame_data(cur_frame, st);
-      cur_glist = cur_glist->next;
     }
   }
 
   st->filename = cf->filename;
   st->file_length = cf->f_datalen;
-  st->encap_type = cf->cd_t;
+  st->file_type = cf->cd_t;
+  st->is_tempfile = cf->is_tempfile;
+  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);
@@ -129,10 +132,7 @@ summary_fill_in(capture_file *cf, summary_tally *st)
   st->drops = cf->drops;
   st->dfilter = cf->dfilter;
 
-  /* capture related */
-  st->cfilter = NULL;
-  st->iface = NULL;
-  st->iface_descr = NULL;
+  st->ifaces  = g_array_new(FALSE, FALSE, sizeof(iface_options));
 }
 
 
@@ -140,8 +140,30 @@ summary_fill_in(capture_file *cf, summary_tally *st)
 void
 summary_fill_in_capture(capture_options *capture_opts, summary_tally *st)
 {
-  st->cfilter = capture_opts->cfilter;
-  st->iface = capture_opts->iface;
-  st->iface_descr = get_iface_description(capture_opts);
+  iface_options iface;
+  interface_options interface_opts;
+  guint i;
+
+  while (st->ifaces->len > 0) {
+    iface = g_array_index(st->ifaces, iface_options, 0);
+    st->ifaces = g_array_remove_index(st->ifaces, 0);
+    g_free(iface.name);
+    g_free(iface.descr);
+    g_free(iface.cfilter);
+  }
+  if (st->is_tempfile) {
+    for (i = 0; i < capture_opts->ifaces->len; i++) {
+      interface_opts = g_array_index(capture_opts->ifaces, interface_options, i);
+      iface.cfilter = g_strdup(interface_opts.cfilter);
+      iface.name = g_strdup(interface_opts.name);
+      iface.descr = g_strdup(interface_opts.descr);
+      iface.drops_known = FALSE;
+      iface.drops = 0;
+      iface.has_snap = interface_opts.has_snaplen;
+      iface.snap = interface_opts.snaplen;
+      iface.linktype = interface_opts.linktype;
+      g_array_append_val(st->ifaces, iface);
+    }
+  }
 }
 #endif