aboutsummaryrefslogtreecommitdiffstats
path: root/file.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-05-22 10:36:40 +0000
committerGuy Harris <guy@alum.mit.edu>2012-05-22 10:36:40 +0000
commitae7d57d5fa1762e21a8e70be0bf0876f334b893c (patch)
tree7f98d17c321c1404ae38fc1e63cfdaff33beb9d0 /file.h
parentdf7289bb99180fc661260ab209c84d481e530572 (diff)
We're an editor now, as we let you add, delete, and edit frame comments,
so "Save" should, for non-temporary files, mean "save the current state of the capture file on top of the existing file" without prompting for a file name. That means we have to do a "safe save" - i.e, write the capture out to a new file and, if that succeeds, rename the new file on top of the old file - as the actual packet data to write out is in the file we're overwriting, not in memory. (We'd want to do that anyway, of course....) Update some comments. Clean up indentation slightly, and get rid of an unnecessary variable (in all the cases where we use it, we assign it the same value, and that value isn't modified out from under us before we use it). Note that after a "Save", or a "Save As" that writes out all captured packets, we shouldn't have to close the current file and open the new file and reread it - we should be able to open the new file and update the frame offsets in the frame_data structures. Note that we need to do some a better job of reporting rename failures. svn path=/trunk/; revision=42777
Diffstat (limited to 'file.h')
-rw-r--r--file.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/file.h b/file.h
index 1b093e3c7e..6371b611c4 100644
--- a/file.h
+++ b/file.h
@@ -196,7 +196,20 @@ cf_read_status_t cf_finish_tail(capture_file *cf, int *err);
gboolean cf_can_save_as(capture_file *cf);
/**
- * Save a capture file (or a range of it).
+ * Save a capture file. Does a "safe save" if the specified
+ * pathname already exists.
+ *
+ * @param cf the capture file to save to
+ * @param fname the filename to save to
+ * @param save_format the format of the file to save (libpcap, ...)
+ * @param compressed whether to gzip compress the file
+ * @return one of cf_status_t
+ */
+cf_status_t cf_save(capture_file * cf, const char *fname, guint save_format, gboolean compressed);
+
+/**
+ * Save a capture file (or a range of it). Fails if the specified
+ * pathname already exists.
*
* @param cf the capture file to save to
* @param fname the filename to save to
@@ -205,7 +218,7 @@ gboolean cf_can_save_as(capture_file *cf);
* @param compressed whether to gzip compress the file
* @return one of cf_status_t
*/
-cf_status_t cf_save(capture_file * cf, const char *fname, packet_range_t *range, guint save_format, gboolean compressed);
+cf_status_t cf_save_as(capture_file * cf, const char *fname, packet_range_t *range, guint save_format, gboolean compressed);
/**
* Get a displayable name of the capture file.