aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/capture_file_dialog.cpp19
-rw-r--r--ui/qt/capture_file_dialog.h4
-rw-r--r--ui/qt/capture_file_properties_dialog.cpp2
-rw-r--r--ui/qt/gsm_map_summary_dialog.cpp2
-rw-r--r--ui/qt/import_text_dialog.cpp2
-rw-r--r--ui/qt/main_window.cpp22
-rw-r--r--ui/qt/main_window.h2
-rw-r--r--ui/qt/mtp3_summary_dialog.cpp2
-rw-r--r--ui/summary.c2
-rw-r--r--ui/summary.h70
-rw-r--r--ui/tap_export_pdu.c4
-rw-r--r--ui/win32/file_dlg_win32.c13
-rw-r--r--ui/win32/file_dlg_win32.h8
13 files changed, 77 insertions, 75 deletions
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index 6e8569dacc..f6bf201977 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -247,8 +247,8 @@ int CaptureFileDialog::selectedFileType() {
return file_type_;
}
-bool CaptureFileDialog::isCompressed() {
- return compressed_;
+wtap_compression_type CaptureFileDialog::compressionType() {
+ return compression_type_;
}
int CaptureFileDialog::open(QString &file_name, unsigned int &type) {
@@ -271,7 +271,7 @@ check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_suppo
GString *fname = g_string_new(file_name.toUtf8().constData());
gboolean wsf_status;
- wsf_status = win32_save_as_file((HWND)parentWidget()->effectiveWinId(), cap_file_, fname, &file_type_, &compressed_, must_support_all_comments);
+ wsf_status = win32_save_as_file((HWND)parentWidget()->effectiveWinId(), cap_file_, fname, &file_type_, &compression_type_, must_support_all_comments);
file_name = fname->str;
g_string_free(fname, TRUE);
@@ -287,7 +287,7 @@ check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name,
GString *fname = g_string_new(file_name.toUtf8().constData());
gboolean wespf_status;
- wespf_status = win32_export_specified_packets_file((HWND)parentWidget()->effectiveWinId(), cap_file_, fname, &file_type_, &compressed_, range);
+ wespf_status = win32_export_specified_packets_file((HWND)parentWidget()->effectiveWinId(), cap_file_, fname, &file_type_, &compression_type_, range);
file_name = fname->str;
g_string_free(fname, TRUE);
@@ -493,9 +493,9 @@ void CaptureFileDialog::fixFilenameExtension()
}
// Fixup the new suffix based on compression availability.
- if (!isCompressed() && new_suffix.endsWith(".gz")) {
+ if (compressionType() != WTAP_GZIP_COMPRESSED && new_suffix.endsWith(".gz")) {
new_suffix.chop(3);
- } else if (isCompressed() && valid_extensions.contains(new_suffix + ".gz")) {
+ } else if (compressionType() == WTAP_GZIP_COMPRESSED && valid_extensions.contains(new_suffix + ".gz")) {
new_suffix += ".gz";
}
@@ -559,8 +559,8 @@ int CaptureFileDialog::selectedFileType() {
return type_hash_.value(selectedNameFilter(), -1);
}
-bool CaptureFileDialog::isCompressed() {
- return compress_.isChecked();
+wtap_compression_type CaptureFileDialog::compressionType() {
+ return compress_.isChecked() ? WTAP_GZIP_COMPRESSED : WTAP_UNCOMPRESSED;
}
void CaptureFileDialog::addDisplayFilterEdit() {
@@ -585,7 +585,8 @@ void CaptureFileDialog::addFormatTypeSelector(QVBoxLayout &v_box) {
void CaptureFileDialog::addGzipControls(QVBoxLayout &v_box) {
compress_.setText(tr("Compress with g&zip"));
- if (cap_file_->iscompressed && wtap_dump_can_compress(default_ft_)) {
+ if (cap_file_->compression_type == WTAP_GZIP_COMPRESSED &&
+ wtap_dump_can_compress(default_ft_)) {
compress_.setChecked(true);
} else {
compress_.setChecked(false);
diff --git a/ui/qt/capture_file_dialog.h b/ui/qt/capture_file_dialog.h
index 3ef4f02e51..f9bd637b33 100644
--- a/ui/qt/capture_file_dialog.h
+++ b/ui/qt/capture_file_dialog.h
@@ -68,7 +68,7 @@ public:
int mergeType();
int selectedFileType();
- bool isCompressed();
+ wtap_compression_type compressionType();
private:
capture_file *cap_file_;
@@ -119,7 +119,7 @@ private:
#else // Q_OS_WIN
int file_type_;
int merge_type_;
- gboolean compressed_;
+ wtap_compression_type compression_type_;
#endif // Q_OS_WIN
signals:
diff --git a/ui/qt/capture_file_properties_dialog.cpp b/ui/qt/capture_file_properties_dialog.cpp
index 3b09256d34..a1fb3df5ca 100644
--- a/ui/qt/capture_file_properties_dialog.cpp
+++ b/ui/qt/capture_file_properties_dialog.cpp
@@ -177,7 +177,7 @@ QString CaptureFilePropertiesDialog::summaryToHtml()
<< table_row_end;
QString format_str = wtap_file_type_subtype_string(summary.file_type);
- if (summary.iscompressed) {
+ if (summary.compression_type == WTAP_GZIP_COMPRESSED) {
format_str.append(tr(" (gzip compressed)"));
}
out << table_row_begin
diff --git a/ui/qt/gsm_map_summary_dialog.cpp b/ui/qt/gsm_map_summary_dialog.cpp
index e53630e7c7..ecc6be98c2 100644
--- a/ui/qt/gsm_map_summary_dialog.cpp
+++ b/ui/qt/gsm_map_summary_dialog.cpp
@@ -107,7 +107,7 @@ QString GsmMapSummaryDialog::summaryToHtml()
<< table_row_end;
QString format_str = wtap_file_type_subtype_string(summary.file_type);
- if (summary.iscompressed) {
+ if (summary.compression_type == WTAP_GZIP_COMPRESSED) {
format_str.append(tr(" (gzip compressed)"));
}
out << table_row_begin
diff --git a/ui/qt/import_text_dialog.cpp b/ui/qt/import_text_dialog.cpp
index 46e158c167..e9b239cd2a 100644
--- a/ui/qt/import_text_dialog.cpp
+++ b/ui/qt/import_text_dialog.cpp
@@ -125,7 +125,7 @@ void ImportTextDialog::convertTextFile() {
params.encap = import_info_.encapsulation;
params.snaplen = import_info_.max_frame_length;
/* Use a random name for the temporary import buffer */
- import_info_.wdh = wtap_dump_open_tempfile(&tmpname, "import", WTAP_FILE_TYPE_SUBTYPE_PCAP, FALSE, &params, &err);
+ import_info_.wdh = wtap_dump_open_tempfile(&tmpname, "import", WTAP_FILE_TYPE_SUBTYPE_PCAP, WTAP_UNCOMPRESSED, &params, &err);
capfile_name_.append(tmpname ? tmpname : "temporary file");
qDebug() << capfile_name_ << ":" << import_info_.wdh << import_info_.encapsulation << import_info_.max_frame_length;
if (import_info_.wdh == NULL) {
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 0ee26d005d..bd99da6f3c 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -1364,7 +1364,7 @@ bool MainWindow::saveCaptureFile(capture_file *cf, bool dont_reopen) {
closes the current file and then opens and reloads the saved file,
so make a copy and free it later. */
file_name = cf->filename;
- status = cf_save_records(cf, qUtf8Printable(file_name), cf->cd_t, cf->iscompressed,
+ status = cf_save_records(cf, qUtf8Printable(file_name), cf->cd_t, cf->compression_type,
discard_comments, dont_reopen);
switch (status) {
@@ -1400,7 +1400,7 @@ bool MainWindow::saveCaptureFile(capture_file *cf, bool dont_reopen) {
bool MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments, bool dont_reopen) {
QString file_name = "";
int file_type;
- gboolean compressed;
+ wtap_compression_type compression_type;
cf_write_status_t status;
gchar *dirname;
gboolean discard_comments = FALSE;
@@ -1447,11 +1447,11 @@ bool MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments,
return false;
}
file_type = save_as_dlg.selectedFileType();
- compressed = save_as_dlg.isCompressed();
+ compression_type = save_as_dlg.compressionType();
#ifdef Q_OS_WIN
// the Windows dialog does not fixup extensions, do it manually here.
- fileAddExtension(file_name, file_type, compressed);
+ fileAddExtension(file_name, file_type, compression_type);
#endif // Q_OS_WIN
//#ifndef _WIN32
@@ -1464,7 +1464,7 @@ bool MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments,
//#endif
/* Attempt to save the file */
- status = cf_save_records(cf, qUtf8Printable(file_name), file_type, compressed,
+ status = cf_save_records(cf, qUtf8Printable(file_name), file_type, compression_type,
discard_comments, dont_reopen);
switch (status) {
@@ -1500,7 +1500,7 @@ bool MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments,
void MainWindow::exportSelectedPackets() {
QString file_name = "";
int file_type;
- gboolean compressed;
+ wtap_compression_type compression_type;
packet_range_t range;
cf_write_status_t status;
gchar *dirname;
@@ -1574,10 +1574,10 @@ void MainWindow::exportSelectedPackets() {
}
file_type = esp_dlg.selectedFileType();
- compressed = esp_dlg.isCompressed();
+ compression_type = esp_dlg.compressionType();
#ifdef Q_OS_WIN
// the Windows dialog does not fixup extensions, do it manually here.
- fileAddExtension(file_name, file_type, compressed);
+ fileAddExtension(file_name, file_type, compression_type);
#endif // Q_OS_WIN
//#ifndef _WIN32
@@ -1590,7 +1590,7 @@ void MainWindow::exportSelectedPackets() {
//#endif
/* Attempt to save the file */
- status = cf_export_specified_packets(capture_file_.capFile(), qUtf8Printable(file_name), &range, file_type, compressed);
+ status = cf_export_specified_packets(capture_file_.capFile(), qUtf8Printable(file_name), &range, file_type, compression_type);
switch (status) {
case CF_WRITE_OK:
@@ -1630,7 +1630,7 @@ void MainWindow::exportDissections(export_type_e export_type) {
}
#ifdef Q_OS_WIN
-void MainWindow::fileAddExtension(QString &file_name, int file_type, bool compressed) {
+void MainWindow::fileAddExtension(QString &file_name, int file_type, wtap_compression_type compression_type) {
QString file_name_lower;
GSList *extensions_list;
gboolean add_extension;
@@ -1678,7 +1678,7 @@ void MainWindow::fileAddExtension(QString &file_name, int file_type, bool compre
if (add_extension) {
if (wtap_default_file_extension(file_type) != NULL) {
file_name += tr(".") + wtap_default_file_extension(file_type);
- if (compressed) {
+ if (compression_type == WTAP_GZIP_COMPRESSED) {
file_name += ".gz";
}
}
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index de1e8f911f..4112d1ba78 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -241,7 +241,7 @@ private:
void exportDissections(export_type_e export_type);
#ifdef Q_OS_WIN
- void fileAddExtension(QString &file_name, int file_type, bool compressed);
+ void fileAddExtension(QString &file_name, int file_type, wtap_compression_type compression_type);
#endif // Q_OS_WIN
bool testCaptureFileClose(QString before_what, FileCloseContext context = Default);
void captureStop();
diff --git a/ui/qt/mtp3_summary_dialog.cpp b/ui/qt/mtp3_summary_dialog.cpp
index 81af57ef2d..412a0cb82f 100644
--- a/ui/qt/mtp3_summary_dialog.cpp
+++ b/ui/qt/mtp3_summary_dialog.cpp
@@ -111,7 +111,7 @@ QString Mtp3SummaryDialog::summaryToHtml()
<< table_row_end;
QString format_str = wtap_file_type_subtype_string(summary.file_type);
- if (summary.iscompressed) {
+ if (summary.compression_type == WTAP_GZIP_COMPRESSED) {
format_str.append(tr(" (gzip compressed)"));
}
out << table_row_begin
diff --git a/ui/summary.c b/ui/summary.c
index e3d73f3f9e..3eb02fe755 100644
--- a/ui/summary.c
+++ b/ui/summary.c
@@ -155,7 +155,7 @@ summary_fill_in(capture_file *cf, summary_tally *st)
st->filename = cf->filename;
st->file_length = cf->f_datalen;
st->file_type = cf->cd_t;
- st->iscompressed = cf->iscompressed;
+ st->compression_type = cf->compression_type;
st->is_tempfile = cf->is_tempfile;
st->file_encap_type = cf->lnk_t;
st->packet_encap_types = cf->linktypes;
diff --git a/ui/summary.h b/ui/summary.h
index ebf8e5cb8a..9c345944eb 100644
--- a/ui/summary.h
+++ b/ui/summary.h
@@ -33,42 +33,42 @@ typedef struct iface_summary_info_tag {
#define HASH_STR_SIZE (65) /* Max hash size * 2 + '\0' */
typedef struct _summary_tally {
- guint64 bytes; /**< total bytes */
- double start_time; /**< seconds, with msec resolution */
- double stop_time; /**< seconds, with msec resolution */
- double elapsed_time; /**< seconds, with msec resolution,
- includes time before first packet
- and after last packet */
- guint32 marked_count; /**< number of marked packets */
- guint32 marked_count_ts; /**< number of time-stamped marked packets */
- guint64 marked_bytes; /**< total bytes in the marked packets */
- double marked_start; /**< time in seconds, with msec resolution */
- double marked_stop; /**< time in seconds, with msec resolution */
- guint32 ignored_count; /**< number of ignored packets */
- guint32 packet_count; /**< total number of packets in trace */
- guint32 packet_count_ts; /**< total number of time-stamped packets in trace */
- guint32 filtered_count; /**< number of filtered packets */
- guint32 filtered_count_ts; /**< number of time-stamped filtered packets */
- guint64 filtered_bytes; /**< total bytes in the filtered packets */
- double filtered_start; /**< time in seconds, with msec resolution */
- double filtered_stop; /**< time in seconds, with msec resolution */
- const char *filename; /**< path of capture file */
- gint64 file_length; /**< file length in bytes */
- gchar file_sha256[HASH_STR_SIZE]; /**< SHA256 hash of capture file */
- gchar file_rmd160[HASH_STR_SIZE]; /**< RIPEMD160 hash of capture file */
- gchar file_sha1[HASH_STR_SIZE]; /**< SHA1 hash of capture file */
- int file_type; /**< wiretap file type */
- int iscompressed; /**< TRUE if file is compressed */
- int file_encap_type; /**< wiretap encapsulation type for file */
- GArray *packet_encap_types; /**< wiretap encapsulation types for packets */
- int snap; /**< Maximum captured packet length; 0 if not known */
- gboolean drops_known; /**< TRUE if number of packet drops is known */
- guint64 drops; /**< number of packet drops */
- const char *dfilter; /**< display filter */
- gboolean is_tempfile;
+ guint64 bytes; /**< total bytes */
+ double start_time; /**< seconds, with msec resolution */
+ double stop_time; /**< seconds, with msec resolution */
+ double elapsed_time; /**< seconds, with msec resolution,
+ includes time before first packet
+ and after last packet */
+ guint32 marked_count; /**< number of marked packets */
+ guint32 marked_count_ts; /**< number of time-stamped marked packets */
+ guint64 marked_bytes; /**< total bytes in the marked packets */
+ double marked_start; /**< time in seconds, with msec resolution */
+ double marked_stop; /**< time in seconds, with msec resolution */
+ guint32 ignored_count; /**< number of ignored packets */
+ guint32 packet_count; /**< total number of packets in trace */
+ guint32 packet_count_ts; /**< total number of time-stamped packets in trace */
+ guint32 filtered_count; /**< number of filtered packets */
+ guint32 filtered_count_ts; /**< number of time-stamped filtered packets */
+ guint64 filtered_bytes; /**< total bytes in the filtered packets */
+ double filtered_start; /**< time in seconds, with msec resolution */
+ double filtered_stop; /**< time in seconds, with msec resolution */
+ const char *filename; /**< path of capture file */
+ gint64 file_length; /**< file length in bytes */
+ gchar file_sha256[HASH_STR_SIZE]; /**< SHA256 hash of capture file */
+ gchar file_rmd160[HASH_STR_SIZE]; /**< RIPEMD160 hash of capture file */
+ gchar file_sha1[HASH_STR_SIZE]; /**< SHA1 hash of capture file */
+ int file_type; /**< wiretap file type */
+ wtap_compression_type compression_type; /**< compression type of file, or uncompressed */
+ int file_encap_type; /**< wiretap encapsulation type for file */
+ GArray *packet_encap_types; /**< wiretap encapsulation types for packets */
+ int snap; /**< Maximum captured packet length; 0 if not known */
+ gboolean drops_known; /**< TRUE if number of packet drops is known */
+ guint64 drops; /**< number of packet drops */
+ const char *dfilter; /**< display filter */
+ gboolean is_tempfile;
/* capture related, use summary_fill_in_capture() to get values */
- GArray *ifaces;
- gboolean legacy;
+ GArray *ifaces;
+ gboolean legacy;
} summary_tally;
extern void
diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c
index 5e6590b72d..5b8165de70 100644
--- a/ui/tap_export_pdu.c
+++ b/ui/tap_export_pdu.c
@@ -148,10 +148,10 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment)
};
if (fd == 1) {
exp_pdu_tap_data->wdh = wtap_dump_open_stdout(WTAP_FILE_TYPE_SUBTYPE_PCAPNG,
- FALSE, &params, &err);
+ WTAP_UNCOMPRESSED, &params, &err);
} else {
exp_pdu_tap_data->wdh = wtap_dump_fdopen(fd, WTAP_FILE_TYPE_SUBTYPE_PCAPNG,
- FALSE, &params, &err);
+ WTAP_UNCOMPRESSED, &params, &err);
}
if (exp_pdu_tap_data->wdh == NULL) {
g_assert(err != 0);
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c
index d316096b1a..8606ee5c5f 100644
--- a/ui/win32/file_dlg_win32.c
+++ b/ui/win32/file_dlg_win32.c
@@ -315,7 +315,8 @@ win32_check_save_as_with_comments(HWND parent, capture_file *cf, int file_type)
gboolean
win32_save_as_file(HWND h_wnd, capture_file *cf, GString *file_name, int *file_type,
- gboolean *compressed, gboolean must_support_all_comments)
+ wtap_compression_type *compression_type,
+ gboolean must_support_all_comments)
{
guint32 required_comment_types;
GArray *savable_file_types;
@@ -324,7 +325,7 @@ win32_save_as_file(HWND h_wnd, capture_file *cf, GString *file_name, int *file_t
int ofnsize = sizeof(OPENFILENAME);
BOOL gsfn_ok;
- if (!file_name || !file_type || !compressed)
+ if (!file_name || !file_type || !compression_type)
return FALSE;
if (file_name->len > 0) {
@@ -375,7 +376,7 @@ win32_save_as_file(HWND h_wnd, capture_file *cf, GString *file_name, int *file_t
g_string_printf(file_name, "%s", utf_16to8(file_name16));
/* What file format was specified? */
*file_type = g_array_index(savable_file_types, int, ofn->nFilterIndex - 1);
- *compressed = g_compressed;
+ *compression_type = g_compressed ? WTAP_GZIP_COMPRESSED : WTAP_UNCOMPRESSED;
} else {
/* User cancelled or closed the dialog, or an error occurred. */
if (CommDlgExtendedError() != 0) {
@@ -451,7 +452,7 @@ gboolean
win32_export_specified_packets_file(HWND h_wnd, capture_file *cf,
GString *file_name,
int *file_type,
- gboolean *compressed,
+ wtap_compression_type *compression_type,
packet_range_t *range) {
GArray *savable_file_types;
OPENFILENAME *ofn;
@@ -459,7 +460,7 @@ win32_export_specified_packets_file(HWND h_wnd, capture_file *cf,
int ofnsize = sizeof(OPENFILENAME);
BOOL gsfn_ok;
- if (!file_name || !file_type || !compressed || !range)
+ if (!file_name || !file_type || !compression_type || !range)
return FALSE;
if (file_name->len > 0) {
@@ -506,7 +507,7 @@ win32_export_specified_packets_file(HWND h_wnd, capture_file *cf,
g_string_printf(file_name, "%s", utf_16to8(file_name16));
/* What file format was specified? */
*file_type = g_array_index(savable_file_types, int, ofn->nFilterIndex - 1);
- *compressed = g_compressed;
+ *compression_type = g_compressed ? WTAP_GZIP_COMPRESSED : WTAP_UNCOMPRESSED;
} else {
/* User cancelled or closed the dialog, or an error occurred. */
if (CommDlgExtendedError() != 0) {
diff --git a/ui/win32/file_dlg_win32.h b/ui/win32/file_dlg_win32.h
index 63406eac61..e80c944de5 100644
--- a/ui/win32/file_dlg_win32.h
+++ b/ui/win32/file_dlg_win32.h
@@ -67,7 +67,7 @@ check_savability_t win32_check_save_as_with_comments(HWND parent, capture_file *
* @param cf capture_file Structure for the capture to be saved
* @param file_name File name. May be empty.
* @param file_type Wiretap file type.
- * @param compressed Compress the file with gzip.
+ * @param compression_type Compression type to use, or uncompressed.
* @param must_support_comments TRUE if the file format list should
* include only file formats that support comments
*
@@ -75,7 +75,7 @@ check_savability_t win32_check_save_as_with_comments(HWND parent, capture_file *
*/
gboolean win32_save_as_file(HWND h_wnd, capture_file *cf,
GString *file_name, int *file_type,
- gboolean *compressed,
+ wtap_compression_type *compression_type,
gboolean must_support_comments);
/** Open the "Export Specified Packets" dialog box.
@@ -84,7 +84,7 @@ gboolean win32_save_as_file(HWND h_wnd, capture_file *cf,
* @param cf capture_file Structure for the capture to be saved
* @param file_name File name. May be empty.
* @param file_type Wiretap file type.
- * @param compressed Compress the file with gzip.
+ * @param compression_type Compression type to use, or uncompressed.
* @param range Range of packets to export.
*
* @return TRUE if packets were discarded when saving, FALSE otherwise
@@ -93,7 +93,7 @@ gboolean win32_export_specified_packets_file(HWND h_wnd,
capture_file *cf,
GString *file_name,
int *file_type,
- gboolean *compressed,
+ wtap_compression_type *compression_type,
packet_range_t *range);