diff --git a/epan/print.c b/epan/print.c index 4ccc0d0ef4..05010cce82 100644 --- a/epan/print.c +++ b/epan/print.c @@ -59,6 +59,7 @@ typedef struct { gboolean print_hex_for_data; packet_char_enc encoding; epan_dissect_t *edt; + GHashTable *output_only_tables; /* output only these protocols */ } print_data; typedef struct { @@ -85,8 +86,6 @@ struct _output_fields { gboolean includes_col_fields; }; -GHashTable *output_only_tables = NULL; - static gchar *get_field_hex_value(GSList *src_list, field_info *fi); static void proto_tree_print_node(proto_node *node, gpointer data); static void proto_tree_write_node_pdml(proto_node *node, gpointer data); @@ -102,7 +101,7 @@ static void proto_tree_get_node_field_values(proto_node *node, gpointer data); gboolean proto_tree_print(print_args_t *print_args, epan_dissect_t *edt, - print_stream_t *stream) + GHashTable *output_only_tables, print_stream_t *stream) { print_data data; @@ -117,6 +116,7 @@ proto_tree_print(print_args_t *print_args, epan_dissect_t *edt, print uninterpreted data fields in hex as well. */ data.print_hex_for_data = !print_args->print_hex; data.edt = edt; + data.output_only_tables = output_only_tables; proto_tree_children_foreach(edt->tree, proto_tree_print_node, &data); return data.success; @@ -170,8 +170,8 @@ proto_tree_print_node(proto_node *node, gpointer data) * subitems whose abbreviation doesn't match the protocol--for example * text items (whose abbreviation is simply "text"). */ - if ((output_only_tables != NULL) && (pdata->level == 0) - && (g_hash_table_lookup(output_only_tables, fi->hfinfo->abbrev) == NULL)) { + if ((pdata->output_only_tables != NULL) && (pdata->level == 0) + && (g_hash_table_lookup(pdata->output_only_tables, fi->hfinfo->abbrev) == NULL)) { return; } diff --git a/epan/print.h b/epan/print.h index 020cce53ac..37a4a08204 100644 --- a/epan/print.h +++ b/epan/print.h @@ -94,17 +94,14 @@ WS_DLL_PUBLIC gboolean output_fields_set_option(output_fields_t* info, gchar* op WS_DLL_PUBLIC void output_fields_list_options(FILE *fh); WS_DLL_PUBLIC gboolean output_fields_has_cols(output_fields_t* info); -/* - * Output only these protocols - */ -WS_DLL_PUBLIC GHashTable *output_only_tables; - /* * Higher-level packet-printing code. */ -WS_DLL_PUBLIC gboolean proto_tree_print(print_args_t *print_args, epan_dissect_t *edt, - print_stream_t *stream); +WS_DLL_PUBLIC gboolean proto_tree_print(print_args_t *print_args, + epan_dissect_t *edt, + GHashTable *output_only_tables, + print_stream_t *stream); WS_DLL_PUBLIC gboolean print_hex_data(print_stream_t *stream, epan_dissect_t *edt); WS_DLL_PUBLIC void write_pdml_preamble(FILE *fh, const gchar* filename); diff --git a/file.c b/file.c index 8606b97a3d..d586090c3c 100644 --- a/file.c +++ b/file.c @@ -2495,7 +2495,7 @@ print_packet(capture_file *cf, frame_data *fdata, } /* Print the information in that tree. */ - if (!proto_tree_print(args->print_args, &args->edt, args->print_args->stream)) + if (!proto_tree_print(args->print_args, &args->edt, NULL, args->print_args->stream)) goto fail; /* Print a blank line if we print anything after this (aka more than one packet). */ diff --git a/tfshark.c b/tfshark.c index 2efaad0011..2d4315d9a2 100644 --- a/tfshark.c +++ b/tfshark.c @@ -172,6 +172,8 @@ static void failure_message_cont(const char *msg_format, va_list ap); capture_file cfile; +static GHashTable *output_only_tables = NULL; + #if 0 struct string_elem { const char *sstr; /* The short string */ @@ -2476,7 +2478,7 @@ print_packet(capture_file *cf, epan_dissect_t *edt) print_args.print_hex = print_hex; print_args.print_dissections = print_details ? print_dissections_expanded : print_dissections_none; - if (!proto_tree_print(&print_args, edt, print_stream)) + if (!proto_tree_print(&print_args, edt, output_only_tables, print_stream)) return FALSE; if (!print_hex) { if (!print_line(print_stream, 0, separator)) diff --git a/tshark.c b/tshark.c index 7879f296b9..b217b2f14d 100644 --- a/tshark.c +++ b/tshark.c @@ -225,6 +225,8 @@ static void failure_message_cont(const char *msg_format, va_list ap); capture_file cfile; +static GHashTable *output_only_tables = NULL; + struct string_elem { const char *sstr; /* The short string */ const char *lstr; /* The long string */ @@ -3926,7 +3928,7 @@ print_packet(capture_file *cf, epan_dissect_t *edt) print_args.print_hex = print_hex; print_args.print_dissections = print_details ? print_dissections_expanded : print_dissections_none; - if (!proto_tree_print(&print_args, edt, print_stream)) + if (!proto_tree_print(&print_args, edt, output_only_tables, print_stream)) return FALSE; if (!print_hex) { if (!print_line(print_stream, 0, separator))