Added a "Suppress Unmarked" option to the print dialog to

allow you to suppress the printing of unmarked packets.
This allows a user to mark the packets they wish to print and
print ONLY those packets by suppressing all other unmarked packets.

This may seem like a bit of a convoluted way of expressing things,
as usually the desired behavior would be to print the marked packets.
However, we do NOT print marked packets that are not displayed under
the current filter.  To be maximally explicite I've expressed this
as suppressing unmarked frames.

svn path=/trunk/; revision=3736
This commit is contained in:
Ed Warnicke 2001-07-17 05:32:44 +00:00
parent e55d1a4489
commit add908fabd
4 changed files with 29 additions and 7 deletions

8
file.c
View File

@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
* $Id: file.c,v 1.242 2001/07/05 00:34:38 guy Exp $
* $Id: file.c,v 1.243 2001/07/17 05:32:42 hagbard Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1181,8 +1181,10 @@ print_packets(capture_file *cf, print_args_t *print_args)
}
count++;
if (fdata->flags.passed_dfilter) {
/* Check to see if we are suppressing unmarked packets, if so,
* suppress them and then proceed to check for visibility.
*/
if (((print_args->suppress_unmarked && fdata->flags.marked ) || !(print_args->suppress_unmarked)) && fdata->flags.passed_dfilter) {
wtap_seek_read (cf->wth, fdata->file_off, &cf->pseudo_header,
cf->pd, fdata->cap_len);
if (print_args->print_summary) {

View File

@ -1,7 +1,7 @@
/* print_dlg.c
* Dialog boxes for printing
*
* $Id: print_dlg.c,v 1.23 2001/06/08 08:50:51 guy Exp $
* $Id: print_dlg.c,v 1.24 2001/07/17 05:32:44 hagbard Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -67,6 +67,7 @@ static gint print_format = PR_FMT_TEXT;
#define PRINT_HEX_CB_KEY "printer_hex_check_button"
#define PRINT_EXPAND_ALL_RB_KEY "printer_expand_all_radio_button"
#define PRINT_AS_DISPLAYED_RB_KEY "printer_as_displayed_radio_button"
#define PRINT_SUPPRESS_UNMARKED_CB_KEY "printer_suppress_unmarked_check_button"
#define E_FS_CALLER_PTR_KEY "fs_caller_ptr"
#define E_FILE_SEL_DIALOG_PTR_KEY "file_sel_dialog_ptr"
@ -93,7 +94,7 @@ file_print_cmd_cb(GtkWidget *widget, gpointer data)
GtkWidget *file_bt_hb, *file_bt, *file_te;
GSList *dest_grp;
GtkWidget *options_hb;
GtkWidget *print_type_vb, *summary_rb, *detail_rb, *hex_cb;
GtkWidget *print_type_vb, *summary_rb, *detail_rb, *hex_cb,*marked_cb;
GSList *summary_grp;
GtkWidget *expand_vb, *expand_all_rb, *as_displayed_rb;
GSList *expand_grp;
@ -251,6 +252,13 @@ file_print_cmd_cb(GtkWidget *widget, gpointer data)
gtk_container_add(GTK_CONTAINER(print_type_vb), hex_cb);
gtk_widget_show(hex_cb);
/* "Suppress Unmarked" check button. */
marked_cb = dlg_check_button_new_with_label_with_mnemonic("Suppress _unmarked frames",
accel_group);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(marked_cb), FALSE);
gtk_container_add(GTK_CONTAINER(print_type_vb), marked_cb);
gtk_widget_show(marked_cb);
/* Vertical box into which to put the "Expand all levels"/"Print as displayed"
radio buttons. */
expand_vb = gtk_vbox_new(FALSE, 5);
@ -293,6 +301,7 @@ file_print_cmd_cb(GtkWidget *widget, gpointer data)
gtk_object_set_data(GTK_OBJECT(ok_bt), PRINT_SUMMARY_RB_KEY, summary_rb);
gtk_object_set_data(GTK_OBJECT(ok_bt), PRINT_HEX_CB_KEY, hex_cb);
gtk_object_set_data(GTK_OBJECT(ok_bt), PRINT_EXPAND_ALL_RB_KEY, expand_all_rb);
gtk_object_set_data(GTK_OBJECT(ok_bt), PRINT_SUPPRESS_UNMARKED_CB_KEY, marked_cb);
gtk_signal_connect(GTK_OBJECT(ok_bt), "clicked",
GTK_SIGNAL_FUNC(print_ok_cb), GTK_OBJECT(print_w));
GTK_WIDGET_SET_FLAGS(ok_bt, GTK_CAN_DEFAULT);
@ -490,6 +499,10 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
PRINT_EXPAND_ALL_RB_KEY);
print_args.expand_all = GTK_TOGGLE_BUTTON (button)->active;
button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(ok_bt),
PRINT_SUPPRESS_UNMARKED_CB_KEY);
print_args.suppress_unmarked = GTK_TOGGLE_BUTTON (button)->active;
gtk_widget_destroy(GTK_WIDGET(parent_w));
/* Now print the packets */
@ -575,6 +588,7 @@ file_print_packet_cmd_cb(GtkWidget *widget, gpointer data) {
print_args.print_summary = FALSE;
print_args.print_hex = FALSE;
print_args.expand_all = TRUE;
print_args.suppress_unmarked = FALSE;
proto_tree_print(TRUE, &print_args, (GNode*) cfile.protocol_tree,
cfile.current_frame, fh);
print_finale(fh, prefs.pr_format);

View File

@ -1,7 +1,7 @@
/* print.h
* Definitions for printing packet analysis trees.
*
* $Id: print.h,v 1.22 2001/06/08 08:50:49 guy Exp $
* $Id: print.h,v 1.23 2001/07/17 05:32:43 hagbard Exp $
*
* Gilbert Ramirez <gram@xiexie.org>
*
@ -43,6 +43,11 @@ typedef struct {
FALSE if we should print only if not dissected. */
gboolean expand_all; /* TRUE if we should expand all levels;
FALSE if we should expand as displayed. */
gboolean suppress_unmarked; /* TRUE if we should suppress unmarked
frames FALSE if we should allow
both marked and unmarked frames to be
printed.
*/
} print_args_t;
/* Functions in print.h */

View File

@ -1,6 +1,6 @@
/* tethereal.c
*
* $Id: tethereal.c,v 1.87 2001/07/05 00:34:39 guy Exp $
* $Id: tethereal.c,v 1.88 2001/07/17 05:32:43 hagbard Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1172,6 +1172,7 @@ wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr, int offset,
print_args.print_summary = FALSE;
print_args.print_hex = print_hex;
print_args.expand_all = TRUE;
print_args.suppress_unmarked = FALSE;
proto_tree_print(FALSE, &print_args, (GNode *)protocol_tree,
&fdata, stdout);
if (!print_hex) {