aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-09-14 21:57:30 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-09-14 21:57:30 +0000
commit84cf7ce7675b450311dcec0b34b785974b2e85d0 (patch)
tree714a0f5ff24c62c46cc312f5a3a5eb7fe1ee581c /file.c
parent1d0e5b105ca2c952f8a252b07a65e7ff883ee8b4 (diff)
added compression support for capture file output. The Save/As dialog now has a checkbox "Compress with gzip"
currently limited to Ethereal and all the variants of libpcap filetypes only. We might want to add output compression support to the other tools as well (tethereal, mergecap, ...). We might also want to add support for the other filetypes, but this is only possible if the filetype functions doesn't use special output operations like fseek. One bug is still left: if the input and output filetypes while saving are the same, Ethereal currently optimizes this by simply copy the binary file instead of using wiretap (so it will be faster but it will ignore the compress setting). Don't know a good workaround for this, as I don't know a way to find out if the input file is currently compressed or not. One idea might be to use a heuristic on the filesize (compared to the packet size summmary). Another workaround I see is to remove this optimization, which is of course not the way I like to do it ... svn path=/trunk/; revision=15804
Diffstat (limited to 'file.c')
-rw-r--r--file.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/file.c b/file.c
index 53b7e6055f..9b4f9977e6 100644
--- a/file.c
+++ b/file.c
@@ -983,7 +983,8 @@ cf_merge_files(char **out_filenamep, int in_file_count,
pdh = wtap_dump_fdopen(out_fd, file_type,
merge_select_frame_type(in_file_count, in_files),
- merge_max_snapshot_length(in_file_count, in_files), &open_err);
+ merge_max_snapshot_length(in_file_count, in_files),
+ FALSE /* compressed */, &open_err);
if (pdh == NULL) {
close(out_fd);
merge_close_in_files(in_file_count, in_files);
@@ -3081,7 +3082,7 @@ save_packet(capture_file *cf _U_, frame_data *fdata,
}
cf_status_t
-cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_format)
+cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_format, gboolean compressed)
{
gchar *from_filename;
int err;
@@ -3160,7 +3161,8 @@ cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_f
/* Either we're filtering packets, or we're saving in a different
format; we can't do that by copying or moving the capture file,
we have to do it by writing the packets out in Wiretap. */
- pdh = wtap_dump_open(fname, save_format, cf->lnk_t, cf->snap, &err);
+ pdh = wtap_dump_open(fname, save_format, cf->lnk_t, cf->snap,
+ compressed, &err);
if (pdh == NULL) {
cf_open_failure_alert_box(fname, err, NULL, TRUE, save_format);
goto fail;
@@ -3359,6 +3361,11 @@ cf_open_failure_alert_box(const char *filename, int err, gchar *err_info,
filename);
break;
+ case WTAP_ERR_COMPRESSION_NOT_SUPPORTED:
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
+ "Gzip compression not supported by this file type.");
+ break;
+
default:
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"The file \"%s\" could not be %s: %s.",