Allow for column headers not to be printed in order to make it possible to export packets as plain text in a format that could then have a chance of being imported again (assuming other factors such as packet bytes were printed, etc.) in order to recover the original pcap file.
Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1636 svn path=/trunk/; revision=50036
This commit is contained in:
parent
54d58d66f7
commit
909d2eb309
Binary file not shown.
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 83 KiB |
Binary file not shown.
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 48 KiB |
File diff suppressed because it is too large
Load Diff
10
file.c
10
file.c
|
@ -2410,6 +2410,8 @@ print_packet(capture_file *cf, frame_data *fdata,
|
|||
g_snprintf(bookmark_name, sizeof bookmark_name, "__frame%u__", fdata->num);
|
||||
|
||||
if (args->print_args->print_summary) {
|
||||
if (!args->print_args->print_col_headings)
|
||||
args->print_header_line = FALSE;
|
||||
if (args->print_header_line) {
|
||||
if (!print_line(args->print_args->stream, 0, args->header_line_buf))
|
||||
goto fail;
|
||||
|
@ -2479,7 +2481,8 @@ print_packet(capture_file *cf, frame_data *fdata,
|
|||
args->print_separator = TRUE;
|
||||
|
||||
/* Print a header line if we print any more packet summaries */
|
||||
args->print_header_line = TRUE;
|
||||
if (args->print_args->print_col_headings)
|
||||
args->print_header_line = TRUE;
|
||||
}
|
||||
|
||||
if (args->print_args->print_hex) {
|
||||
|
@ -2495,7 +2498,8 @@ print_packet(capture_file *cf, frame_data *fdata,
|
|||
args->print_separator = TRUE;
|
||||
|
||||
/* Print a header line if we print any more packet summaries */
|
||||
args->print_header_line = TRUE;
|
||||
if (args->print_args->print_col_headings)
|
||||
args->print_header_line = TRUE;
|
||||
} /* if (args->print_args->print_dissections != print_dissections_none) */
|
||||
|
||||
epan_dissect_cleanup(&edt);
|
||||
|
@ -2525,7 +2529,7 @@ cf_print_packets(capture_file *cf, print_args_t *print_args)
|
|||
fmt_data *cfmt;
|
||||
|
||||
callback_args.print_args = print_args;
|
||||
callback_args.print_header_line = TRUE;
|
||||
callback_args.print_header_line = print_args->print_col_headings;
|
||||
callback_args.header_line_buf = NULL;
|
||||
callback_args.header_line_buf_len = 256;
|
||||
callback_args.print_formfeed = FALSE;
|
||||
|
|
|
@ -128,13 +128,13 @@ FONT 8, "MS Shell Dlg"
|
|||
LTEXT "0", EWFD_RANGE_DISP, 282, 72, 41, 8, SS_RIGHT
|
||||
LTEXT "0", EWFD_IGNORED_DISP, 282, 84, 41, 8, SS_RIGHT
|
||||
|
||||
|
||||
GROUPBOX "Packet Format", EWFD_PKT_FORMAT_GB, 344, 0, 118, 102
|
||||
CONTROL "Packet summary line", EWFD_PKT_SUMMARY_CB, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 350, 15, 84, 10
|
||||
CONTROL "Packet details:", EWFD_PKT_DETAIL_CB, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 350, 27, 95, 10
|
||||
COMBOBOX EWFD_PKT_DETAIL_COMBO, 366, 39, 74, 45, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Packet Bytes", EWFD_PKT_BYTES_CB, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 350, 56, 80, 10
|
||||
CONTROL "Each packet on a new page", EWFD_PKT_NEW_PAGE_CB, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 350, 70, 106, 10
|
||||
CONTROL "Include column headings", EWFD_COL_HEADINGS_CB, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 362, 27, 94, 10
|
||||
CONTROL "Packet details:", EWFD_PKT_DETAIL_CB, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 350, 39, 95, 10
|
||||
COMBOBOX EWFD_PKT_DETAIL_COMBO, 362, 51, 74, 45, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Packet Bytes", EWFD_PKT_BYTES_CB, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 350, 68, 80, 10
|
||||
CONTROL "Each packet on a new page", EWFD_PKT_NEW_PAGE_CB, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 350, 80, 106, 10
|
||||
|
||||
}
|
||||
|
||||
|
|
24
print.h
24
print.h
|
@ -95,20 +95,20 @@ typedef enum {
|
|||
} print_dissections_e;
|
||||
|
||||
typedef struct {
|
||||
print_stream_t *stream; /* the stream to which we're printing */
|
||||
print_format_e format; /* plain text or PostScript */
|
||||
gboolean to_file; /* TRUE if we're printing to a file */
|
||||
char *file; /* file output pathname */
|
||||
char *cmd; /* print command string (not win32) */
|
||||
print_stream_t *stream; /* the stream to which we're printing */
|
||||
print_format_e format; /* plain text or PostScript */
|
||||
gboolean to_file; /* TRUE if we're printing to a file */
|
||||
char *file; /* file output pathname */
|
||||
char *cmd; /* print command string (not win32) */
|
||||
packet_range_t range;
|
||||
|
||||
gboolean print_summary; /* TRUE if we should just print summary;
|
||||
FALSE if we should print protocol tree. */
|
||||
print_dissections_e print_dissections;
|
||||
gboolean print_hex; /* TRUE if we should also print hex data;
|
||||
FALSE if we should print only if not dissected. */
|
||||
gboolean print_formfeed; /* TRUE if a formfeed should be printed
|
||||
before each new packet */
|
||||
gboolean print_summary; /* TRUE if we should print summary line. */
|
||||
gboolean print_col_headings; /* TRUE if we should print column headings */
|
||||
print_dissections_e print_dissections;
|
||||
gboolean print_hex; /* TRUE if we should print hex data;
|
||||
* FALSE if we should print only if not dissected. */
|
||||
gboolean print_formfeed; /* TRUE if a formfeed should be printed before
|
||||
* each new packet */
|
||||
} print_args_t;
|
||||
|
||||
/*
|
||||
|
|
|
@ -901,8 +901,9 @@ file_import_dlg_new(void)
|
|||
g_object_set_data(G_OBJECT(timefmt_cb), INPUT_TIMEFMT_LBL_KEY, timefmt_lbl);
|
||||
|
||||
timefmt_te = gtk_entry_new();
|
||||
gtk_entry_set_text(GTK_ENTRY(timefmt_te), "%F %T.");
|
||||
gtk_widget_set_tooltip_text(timefmt_te,
|
||||
"The format in which to parse timestamps in the text file (eg. %H:%M:%S.)."
|
||||
"The format in which to parse timestamps in the text file (eg. %F %T.)."
|
||||
" Format specifiers are based on strptime(3)");
|
||||
gtk_box_pack_start(GTK_BOX(timefmt_hb), timefmt_te, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -922,7 +923,7 @@ file_import_dlg_new(void)
|
|||
" (inbound or outbound) of the packet");
|
||||
gtk_box_pack_start(GTK_BOX(dir_hb), dir_cb, FALSE, FALSE, 0);
|
||||
|
||||
g_object_set_data(G_OBJECT(input_frm), INPUT_DIR_CB_KEY, dir_cb);
|
||||
g_object_set_data(G_OBJECT(input_frm), INPUT_DIR_CB_KEY, dir_cb);
|
||||
|
||||
/* Setup the import frame */
|
||||
|
||||
|
@ -1118,7 +1119,7 @@ file_import_dlg_new(void)
|
|||
|
||||
framelen_te = gtk_entry_new();
|
||||
gtk_widget_set_tooltip_text(framelen_te,
|
||||
"The maximum size of the frames to write to the import capture file (max 64000)");
|
||||
"The maximum size of the frames to write to the import capture file (max 65535)");
|
||||
gtk_box_pack_start(GTK_BOX(framelen_hb), framelen_te, FALSE, FALSE, 0);
|
||||
|
||||
g_object_set_data(G_OBJECT(import_frm), IMPORT_FRAME_LENGTH_TE_KEY, framelen_te);
|
||||
|
|
|
@ -96,6 +96,7 @@ static void print_destroy_cb(GtkWidget *win, gpointer user_data);
|
|||
#define PRINT_DEST_CB_KEY "printer_destination_check_button"
|
||||
|
||||
#define PRINT_SUMMARY_CB_KEY "printer_summary_check_button"
|
||||
#define PRINT_COL_HEADINGS_CB_KEY "printer_include_column_headings_button"
|
||||
#define PRINT_DETAILS_CB_KEY "printer_details_check_button"
|
||||
#define PRINT_COLLAPSE_ALL_RB_KEY "printer_collapse_all_radio_button"
|
||||
#define PRINT_AS_DISPLAYED_RB_KEY "printer_as_displayed_radio_button"
|
||||
|
@ -139,6 +140,7 @@ file_print_cmd(gboolean print_selected)
|
|||
args->file = g_strdup(prefs.pr_file);
|
||||
args->cmd = g_strdup(prefs.pr_cmd);
|
||||
args->print_summary = TRUE;
|
||||
args->print_col_headings = TRUE;
|
||||
args->print_dissections = print_dissections_as_displayed;
|
||||
args->print_hex = FALSE;
|
||||
args->print_formfeed = FALSE;
|
||||
|
@ -207,6 +209,7 @@ export_text_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
|
|||
args->file = g_strdup("");
|
||||
args->cmd = g_strdup("");
|
||||
args->print_summary = TRUE;
|
||||
args->print_col_headings = TRUE;
|
||||
args->print_dissections = print_dissections_as_displayed;
|
||||
args->print_hex = FALSE;
|
||||
args->print_formfeed = FALSE;
|
||||
|
@ -261,6 +264,7 @@ export_ps_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
|
|||
args->file = g_strdup("");
|
||||
args->cmd = g_strdup("");
|
||||
args->print_summary = TRUE;
|
||||
args->print_col_headings = TRUE;
|
||||
args->print_dissections = print_dissections_as_displayed;
|
||||
args->print_hex = FALSE;
|
||||
args->print_formfeed = FALSE;
|
||||
|
@ -315,6 +319,7 @@ export_psml_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
|
|||
args->file = g_strdup("");
|
||||
args->cmd = g_strdup("");
|
||||
args->print_summary = TRUE;
|
||||
args->print_col_headings = TRUE;
|
||||
args->print_dissections = print_dissections_as_displayed;
|
||||
args->print_hex = FALSE;
|
||||
args->print_formfeed = FALSE;
|
||||
|
@ -368,6 +373,7 @@ export_pdml_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
|
|||
args->file = g_strdup("");
|
||||
args->cmd = g_strdup("");
|
||||
args->print_summary = TRUE;
|
||||
args->print_col_headings = TRUE;
|
||||
args->print_dissections = print_dissections_as_displayed;
|
||||
args->print_hex = FALSE;
|
||||
args->print_formfeed = FALSE;
|
||||
|
@ -420,6 +426,7 @@ export_csv_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
|
|||
args->file = g_strdup("");
|
||||
args->cmd = g_strdup("");
|
||||
args->print_summary = FALSE;
|
||||
args->print_col_headings = FALSE;
|
||||
args->print_dissections = print_dissections_none;
|
||||
args->print_hex = FALSE;
|
||||
args->print_formfeed = FALSE;
|
||||
|
@ -472,6 +479,7 @@ export_carrays_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
|
|||
args->file = g_strdup("");
|
||||
args->cmd = g_strdup("");
|
||||
args->print_summary = FALSE;
|
||||
args->print_col_headings = FALSE;
|
||||
args->print_dissections = print_dissections_none;
|
||||
args->print_hex = FALSE;
|
||||
args->print_formfeed = FALSE;
|
||||
|
@ -517,6 +525,7 @@ open_print_dialog(const char *title, output_action_e action, print_args_t *args)
|
|||
|
||||
GtkWidget *format_fr, *format_vb;
|
||||
GtkWidget *summary_cb;
|
||||
GtkWidget *col_headings_cb;
|
||||
|
||||
GtkWidget *details_cb;
|
||||
GtkWidget *details_hb, *details_vb;
|
||||
|
@ -709,6 +718,13 @@ open_print_dialog(const char *title, output_action_e action, print_args_t *args)
|
|||
gtk_box_pack_start(GTK_BOX(format_vb), summary_cb, TRUE, TRUE, 0);
|
||||
gtk_widget_show(summary_cb);
|
||||
|
||||
/* "Include column headings" check button */
|
||||
col_headings_cb = gtk_check_button_new_with_mnemonic("Include column headings");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(col_headings_cb), args->print_col_headings);
|
||||
g_signal_connect(col_headings_cb, "clicked", G_CALLBACK(print_cmd_toggle_detail), main_win);
|
||||
gtk_widget_set_tooltip_text(col_headings_cb, "Include column headings when printing the packet summary line");
|
||||
gtk_box_pack_start(GTK_BOX(format_vb), col_headings_cb, TRUE, TRUE, 0);
|
||||
gtk_widget_show(col_headings_cb);
|
||||
|
||||
/* "Details" check button */
|
||||
details_cb = gtk_check_button_new_with_mnemonic("Packet details:");
|
||||
|
@ -780,6 +796,7 @@ open_print_dialog(const char *title, output_action_e action, print_args_t *args)
|
|||
|
||||
g_object_set_data(G_OBJECT(main_win), PRINT_ARGS_KEY, args);
|
||||
g_object_set_data(G_OBJECT(main_win), PRINT_SUMMARY_CB_KEY, summary_cb);
|
||||
g_object_set_data(G_OBJECT(main_win), PRINT_COL_HEADINGS_CB_KEY, col_headings_cb);
|
||||
g_object_set_data(G_OBJECT(main_win), PRINT_DETAILS_CB_KEY, details_cb);
|
||||
g_object_set_data(G_OBJECT(main_win), PRINT_COLLAPSE_ALL_RB_KEY, collapse_all_rb);
|
||||
g_object_set_data(G_OBJECT(main_win), PRINT_AS_DISPLAYED_RB_KEY, as_displayed_rb);
|
||||
|
@ -811,6 +828,7 @@ open_print_dialog(const char *title, output_action_e action, print_args_t *args)
|
|||
g_object_set_data(G_OBJECT(ok_bt), PRINT_ARGS_KEY, args);
|
||||
g_object_set_data(G_OBJECT(ok_bt), PRINT_FILE_TE_KEY, file_te);
|
||||
g_object_set_data(G_OBJECT(ok_bt), PRINT_SUMMARY_CB_KEY, summary_cb);
|
||||
g_object_set_data(G_OBJECT(ok_bt), PRINT_COL_HEADINGS_CB_KEY, col_headings_cb);
|
||||
g_object_set_data(G_OBJECT(ok_bt), PRINT_DETAILS_CB_KEY, details_cb);
|
||||
g_object_set_data(G_OBJECT(ok_bt), PRINT_COLLAPSE_ALL_RB_KEY, collapse_all_rb);
|
||||
g_object_set_data(G_OBJECT(ok_bt), PRINT_AS_DISPLAYED_RB_KEY, as_displayed_rb);
|
||||
|
@ -889,11 +907,13 @@ print_cmd_toggle_dest(GtkWidget *widget, gpointer data _U_)
|
|||
static void
|
||||
print_cmd_toggle_detail(GtkWidget *widget _U_, gpointer data)
|
||||
{
|
||||
GtkWidget *print_bt, *summary_cb, *details_cb, *collapse_all_rb, *expand_all_rb, *as_displayed_rb, *hex_cb;
|
||||
GtkWidget *print_bt, *summary_cb, *col_headings_cb, *details_cb;
|
||||
GtkWidget *collapse_all_rb, *expand_all_rb, *as_displayed_rb, *hex_cb;
|
||||
gboolean print_detail;
|
||||
|
||||
print_bt = GTK_WIDGET(g_object_get_data(G_OBJECT(data), PRINT_BT_KEY));
|
||||
summary_cb = GTK_WIDGET(g_object_get_data(G_OBJECT(data), PRINT_SUMMARY_CB_KEY));
|
||||
col_headings_cb = GTK_WIDGET(g_object_get_data(G_OBJECT(data), PRINT_COL_HEADINGS_CB_KEY));
|
||||
details_cb = GTK_WIDGET(g_object_get_data(G_OBJECT(data), PRINT_DETAILS_CB_KEY));
|
||||
collapse_all_rb = GTK_WIDGET(g_object_get_data(G_OBJECT(data), PRINT_COLLAPSE_ALL_RB_KEY));
|
||||
as_displayed_rb = GTK_WIDGET(g_object_get_data(G_OBJECT(data), PRINT_AS_DISPLAYED_RB_KEY));
|
||||
|
@ -1009,6 +1029,9 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
|
|||
button = (GtkWidget *)g_object_get_data(G_OBJECT(ok_bt), PRINT_SUMMARY_CB_KEY);
|
||||
args->print_summary = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (button));
|
||||
|
||||
button = (GtkWidget *)g_object_get_data(G_OBJECT(ok_bt), PRINT_COL_HEADINGS_CB_KEY);
|
||||
args->print_col_headings = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (button));
|
||||
|
||||
button = (GtkWidget *)g_object_get_data(G_OBJECT(ok_bt), PRINT_COLLAPSE_ALL_RB_KEY);
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (button))) {
|
||||
args->print_dissections = print_dissections_collapsed;
|
||||
|
|
|
@ -655,6 +655,7 @@ win32_export_file(HWND h_wnd, capture_file *cf, export_type_e export_type) {
|
|||
print_args.to_file = TRUE;
|
||||
print_args.cmd = NULL;
|
||||
print_args.print_summary = TRUE;
|
||||
print_args.print_col_headings = TRUE;
|
||||
print_args.print_dissections = print_dissections_as_displayed;
|
||||
print_args.print_hex = FALSE;
|
||||
print_args.print_formfeed = FALSE;
|
||||
|
@ -1031,10 +1032,20 @@ print_update_dynamic(HWND dlg_hwnd, print_args_t *args) {
|
|||
HWND cur_ctrl;
|
||||
|
||||
cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_PKT_SUMMARY_CB);
|
||||
if (SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
if (SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED) {
|
||||
args->print_summary = TRUE;
|
||||
else
|
||||
cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_COL_HEADINGS_CB);
|
||||
EnableWindow(cur_ctrl, TRUE);
|
||||
if (SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
args->print_col_headings = TRUE;
|
||||
else
|
||||
args->print_col_headings = FALSE;
|
||||
} else {
|
||||
args->print_summary = FALSE;
|
||||
args->print_col_headings = FALSE;
|
||||
cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_COL_HEADINGS_CB);
|
||||
EnableWindow(cur_ctrl, FALSE);
|
||||
}
|
||||
|
||||
cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_PKT_DETAIL_CB);
|
||||
if (SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED) {
|
||||
|
@ -1076,9 +1087,11 @@ static void
|
|||
format_handle_wm_initdialog(HWND dlg_hwnd, print_args_t *args) {
|
||||
HWND cur_ctrl;
|
||||
|
||||
/* Set the "Packet summary" box */
|
||||
/* Set the "Packet summary" and "Include column headings" boxes */
|
||||
cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_PKT_SUMMARY_CB);
|
||||
SendMessage(cur_ctrl, BM_SETCHECK, args->print_summary, 0);
|
||||
cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_COL_HEADINGS_CB);
|
||||
SendMessage(cur_ctrl, BM_SETCHECK, args->print_col_headings, 0);
|
||||
|
||||
/* Set the "Packet details" box */
|
||||
cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_PKT_DETAIL_CB);
|
||||
|
|
|
@ -72,7 +72,7 @@ gboolean win32_save_as_file(HWND h_wnd, capture_file *cf,
|
|||
* @param file_type Wiretap file type.
|
||||
* @param compressed Compress the file with gzip.
|
||||
* @param range Range of packets to export.
|
||||
*
|
||||
*
|
||||
* @return TRUE if packets were discarded when saving, FALSE otherwise
|
||||
*/
|
||||
gboolean win32_export_specified_packets_file(HWND h_wnd, GString *file_name,
|
||||
|
@ -190,10 +190,11 @@ void file_set_save_marked_sensitive();
|
|||
/* These MUST be contiguous */
|
||||
#define EWFD_PKT_FORMAT_GB 1050
|
||||
#define EWFD_PKT_SUMMARY_CB 1051
|
||||
#define EWFD_PKT_DETAIL_CB 1052
|
||||
#define EWFD_PKT_DETAIL_COMBO 1053
|
||||
#define EWFD_PKT_BYTES_CB 1054
|
||||
#define EWFD_PKT_NEW_PAGE_CB 1055
|
||||
#define EWFD_COL_HEADINGS_CB 1052
|
||||
#define EWFD_PKT_DETAIL_CB 1053
|
||||
#define EWFD_PKT_DETAIL_COMBO 1054
|
||||
#define EWFD_PKT_BYTES_CB 1055
|
||||
#define EWFD_PKT_NEW_PAGE_CB 1056
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue