Fix for bug 4535: The SSL dissector can not correctly resemple SSL records when the...
[obnox/wireshark/wip.git] / file.c
diff --git a/file.c b/file.c
index b8c46a7bb108d56483eb5d78934c9c0b92a41506..eb6b9f060d5e4e0f2e09e5281adf4a2d2caf7521 100644 (file)
--- a/file.c
+++ b/file.c
@@ -792,7 +792,7 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
 
 #ifdef NEW_PACKET_LIST
   new_packet_list_check_end();
-  /* Don't freeze/thaw the list when doing live capture */ 
+  /* Don't freeze/thaw the list when doing live capture */
   /*new_packet_list_freeze();*/
 #else
   packet_list_check_end();
@@ -839,7 +839,7 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
             /* Sleep(100); */
         };
 #ifdef NEW_PACKET_LIST
-               /* Don't freeze/thaw the list when doing live capture */ 
+               /* Don't freeze/thaw the list when doing live capture */
         /*new_packet_list_thaw();*/
 #else
         packet_list_thaw();
@@ -933,7 +933,8 @@ cf_finish_tail(capture_file *cf, int *err)
 
 #ifdef NEW_PACKET_LIST
   new_packet_list_check_end();
-  new_packet_list_freeze();
+  /* Don't freeze/thaw the list when doing live capture */
+  /*new_packet_list_freeze();*/
 #else
   packet_list_check_end();
   packet_list_freeze();
@@ -955,7 +956,8 @@ cf_finish_tail(capture_file *cf, int *err)
   }
 
 #ifdef NEW_PACKET_LIST
-  new_packet_list_thaw();
+  /* Don't freeze/thaw the list when doing live capture */
+  /*new_packet_list_thaw();*/
 #else
   packet_list_thaw();
 #endif
@@ -1022,11 +1024,35 @@ cf_get_display_name(capture_file *cf)
   } else {
     /* The file we read is a temporary file from a live capture;
        we don't mention its name. */
-    displayname = "(Untitled)";
+    if (cf->source) {
+      displayname = cf->source;
+    } else {
+      displayname = "(Untitled)";
+    }
   }
   return displayname;
 }
 
+void cf_set_tempfile_source(capture_file *cf, gchar *source) {
+  if (cf->source) {
+    g_free(cf->source);
+  }
+
+  if (source) {
+    cf->source = g_strdup(source);
+  } else {
+    cf->source = g_strdup("");
+  }
+}
+
+const gchar *cf_get_tempfile_source(capture_file *cf) {
+  if (!cf->source) {
+    return "";
+  }
+
+  return cf->source;
+}
+
 /* XXX - use a macro instead? */
 int
 cf_get_packet_count(capture_file *cf)
@@ -1597,6 +1623,7 @@ cf_filter_packets(capture_file *cf, gchar *dftext, gboolean force)
   const char *filter_new = dftext ? dftext : "";
   const char *filter_old = cf->dfilter ? cf->dfilter : "";
   dfilter_t   *dfcode;
+  GTimeVal     start_time;
 
   /* if new filter equals old one, do nothing unless told to do so */
   if (!force && strcmp(filter_new, filter_old) == 0) {
@@ -1644,6 +1671,8 @@ cf_filter_packets(capture_file *cf, gchar *dftext, gboolean force)
   /* We have a valid filter.  Replace the current filter. */
   g_free(cf->dfilter);
   cf->dfilter = dftext;
+  g_get_current_time(&start_time);
+
 
   /* Now rescan the packet list, applying the new filter, but not
      throwing away information constructed on a previous pass. */
@@ -1775,8 +1804,6 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
   cf->first_displayed = NULL;
   cf->last_displayed = NULL;
 
-  reset_elapsed();
-
   /* We currently don't display any packets */
   cf->displayed_count = 0;
 
@@ -1946,6 +1973,9 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
   if (!add_to_packet_list)
     new_packet_list_recreate_visible_rows();
 
+  /* Compute the time it took to filter the file */
+  compute_elapsed(&start_time);
+
   new_packet_list_thaw();
 
   if (selected_frame_num == -1) {
@@ -2604,6 +2634,7 @@ print_packet(capture_file *cf, frame_data *fdata,
   /* Fill in the column information if we're printing the summary
      information. */
   if (args->print_args->print_summary) {
+    col_custom_prime_edt(&edt, &cf->cinfo);
     epan_dissect_run(&edt, pseudo_header, pd, fdata, &cf->cinfo);
     epan_dissect_fill_in_columns(&edt, FALSE, TRUE);
   } else
@@ -2936,6 +2967,7 @@ write_psml_packet(capture_file *cf, frame_data *fdata,
      if having custom columns. */
   proto_tree_needed = have_custom_cols(&cf->cinfo);
   epan_dissect_init(&edt, proto_tree_needed, proto_tree_needed);
+  col_custom_prime_edt(&edt, &cf->cinfo);
   epan_dissect_run(&edt, pseudo_header, pd, fdata, &cf->cinfo);
   epan_dissect_fill_in_columns(&edt, FALSE, TRUE);
 
@@ -3010,6 +3042,7 @@ write_csv_packet(capture_file *cf, frame_data *fdata,
      if having custom columns. */
   proto_tree_needed = have_custom_cols(&cf->cinfo);
   epan_dissect_init(&edt, proto_tree_needed, proto_tree_needed);
+  col_custom_prime_edt(&edt, &cf->cinfo);
   epan_dissect_run(&edt, pseudo_header, pd, fdata, &cf->cinfo);
   epan_dissect_fill_in_columns(&edt, FALSE, TRUE);
 
@@ -3657,7 +3690,7 @@ find_packet(capture_file *cf,
   gchar       status_str[100];
   int         progbar_nextstep;
   int         progbar_quantum;
-  char       *title;
+  const char *title;
 
   start_fd = cf->current_frame;
   if (start_fd != NULL)  {
@@ -4614,3 +4647,16 @@ cf_reload(capture_file *cf) {
      we should free up our copy. */
   g_free(filename);
 }
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 2
+ * tab-width: 2
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=2 tabstop=2 expandtab
+ * :indentSize=2:tabSize=2:noTabs=true:
+ */