add new function tvb_get_ephemeral_stringz()
[obnox/wireshark/wip.git] / file.h
diff --git a/file.h b/file.h
index 4ab49dcec1ce838a5e14884a6ec19982b83b3fd7..ce7b1700cdea3453ded85b479bcfa2106c0e93ec 100644 (file)
--- a/file.h
+++ b/file.h
@@ -55,6 +55,38 @@ typedef enum {
        CF_PRINT_WRITE_ERROR    /**< print operation failed while writing to the printer */
 } cf_print_status_t;
 
+typedef enum {
+    cf_cb_file_closed,
+    cf_cb_file_read_start,
+    cf_cb_file_read_finished,
+#ifdef HAVE_LIBPCAP
+    cf_cb_live_capture_prepared,
+    cf_cb_live_capture_update_started,
+    cf_cb_live_capture_update_continue,
+    cf_cb_live_capture_update_finished,
+    cf_cb_live_capture_fixed_started,
+    cf_cb_live_capture_fixed_finished,
+#endif
+    cf_cb_packet_selected,
+    cf_cb_packet_unselected,
+    cf_cb_field_unselected,
+    cf_cb_file_safe_started,
+    cf_cb_file_safe_finished,
+    cf_cb_file_safe_reload_finished,
+    cf_cb_file_safe_failed
+} cf_cbs;
+
+typedef void (*cf_callback_t) (gint event, gpointer data, gpointer user_data);
+
+extern void
+cf_callback_invoke(int event, gpointer data);
+
+extern void
+cf_callback_add(cf_callback_t func, gpointer user_data);
+
+extern void
+cf_callback_remove(cf_callback_t func);
+
 /**
  * Open a capture file.
  *
@@ -154,36 +186,41 @@ int cf_packet_count(capture_file *cf);
 gboolean cf_is_tempfile(capture_file *cf);
 
 /**
- * Get the interface name to capture from.
+ * Set flag, that this file is a tempfile.
+ */
+void cf_set_tempfile(capture_file *cf, gboolean is_tempfile);
+
+/**
+ * Set flag, if the number of packet drops while capturing are known or not.
  * 
  * @param cf the capture file
- * @return the interface name (don't have to be g_free'd)
+ * @param drops_known TRUE if the number of packet drops are known, FALSE otherwise
  */
-gchar *cf_get_iface(capture_file *cf);
+void cf_set_drops_known(capture_file *cf, gboolean drops_known);
 
 /**
- * Get the capture filter of this capture file.
+ * Set the number of packet drops while capturing.
  * 
  * @param cf the capture file
- * @return the capture filter (don't have to be g_free'd)
+ * @param drops the number of packet drops occured while capturing
  */
-gchar *cf_get_cfilter(capture_file *cf);
+void cf_set_drops(capture_file *cf, guint32 drops);
 
 /**
- * Set flag, if the number of packet drops while capturing are known or not.
+ * Get flag state, if the number of packet drops while capturing are known or not.
  * 
  * @param cf the capture file
- * @param drops_known TRUE if the number of packet drops are known, FALSE otherwise
+ * @return TRUE if the number of packet drops are known, FALSE otherwise
  */
-void cf_set_drops_known(capture_file *cf, gboolean drops_known);
+gboolean cf_get_drops_known(capture_file *cf);
 
 /**
- * Set the number of packet drops while capturing.
+ * Get the number of packet drops while capturing.
  * 
  * @param cf the capture file
- * @param drops the number of packet drops occured while capturing
+ * @return the number of packet drops occured while capturing
  */
-void cf_set_drops(capture_file *cf, guint32 drops);
+guint32 cf_get_drops(capture_file *cf);
 
 /**
  * Set the read filter.
@@ -267,6 +304,15 @@ cf_print_status_t cf_write_pdml_packets(capture_file *cf, print_args_t *print_ar
  */
 cf_print_status_t cf_write_psml_packets(capture_file *cf, print_args_t *print_args);
 
+/**
+ * Print (export) the capture file into CSV format.
+ *
+ * @param cf the capture file
+ * @param print_args the arguments what and how to export
+ * @return one of cf_print_status_t
+ */
+cf_print_status_t cf_write_csv_packets(capture_file *cf, print_args_t *print_args);
+
 /**
  * Find Packet in protocol tree.
  * 
@@ -393,8 +439,9 @@ char *cf_read_error_message(int err, const gchar *err_info);
  * Merge two (or more) capture files into one.
  * @todo is this the right place for this function? It doesn't have to do a lot with capture_file.
  *
- * @param out_filename output filename
- * @param out_fd output file descriptor
+ * @param out_filename pointer to output filename; if output filename is
+ * NULL, a temporary file name is generated and *out_filename is set
+ * to point to the generated file name
  * @param in_file_count the number of input files to merge
  * @param in_filnames array of input filenames
  * @param file_type the output filetype
@@ -402,8 +449,7 @@ char *cf_read_error_message(int err, const gchar *err_info);
  * @return one of cf_status_t
  */
 cf_status_t
-cf_merge_files(const char *out_filename, int out_fd, int in_file_count,
+cf_merge_files(char **out_filename, int in_file_count,
                char *const *in_filenames, int file_type, gboolean do_append);
 
-
 #endif /* file.h */