Currently, this is only used to determine whether a protocol tree needs
to be built on the first pass or not - if there are postdissectors that
need fields, it does - but eventually we should be able to use it to
prime the dissection to deliver those fields in cases where we don't
need the *entire* protocol tree (rather than using a hack such as
cooking up a fake tap with a fake filter to do that).
Update MATE and TRANSUM to use it.
Clean up code to check whether we need a protocol tree, and add comments
before that code indicating, in each case, what the criteria are.
The array of postdissectors includes a length, so we don't need to
separately keep track of the number of postdissectors.
Clean up indentation while we're at it.
Change-Id: I71d4025848206d144bc54cc82941089a50e80ab7
Reviewed-on: https://code.wireshark.org/review/21029
Reviewed-by: Guy Harris <guy@alum.mit.edu>
14 files changed:
port_type_to_str@Base 1.12.0~rc1
port_with_resolution_to_str@Base 2.1.0
port_with_resolution_to_str_buf@Base 2.0.0
port_type_to_str@Base 1.12.0~rc1
port_with_resolution_to_str@Base 2.1.0
port_with_resolution_to_str_buf@Base 2.0.0
+ postdissectors_want_fields@Base 2.3.0
postseq_cleanup_all_protocols@Base 1.9.1
pref_clean_stash@Base 2.3.0
pref_stash@Base 2.3.0
postseq_cleanup_all_protocols@Base 1.9.1
pref_clean_stash@Base 2.3.0
pref_stash@Base 2.3.0
set_enabled_protos_list@Base 2.3.0
set_fd_time@Base 1.9.1
set_mac_lte_proto_data@Base 1.9.1
set_enabled_protos_list@Base 2.3.0
set_fd_time@Base 1.9.1
set_mac_lte_proto_data@Base 1.9.1
+ set_postdissector_wanted_fields@Base 2.3.0
set_srt_table_param_data@Base 1.99.8
set_tap_dfilter@Base 1.9.1
show_exception@Base 1.9.1
set_srt_table_param_data@Base 1.99.8
set_tap_dfilter@Base 1.9.1
show_exception@Base 1.9.1
* the final cleanup. */
static GSList *postseq_cleanup_routines;
* the final cleanup. */
static GSList *postseq_cleanup_routines;
-static GPtrArray* post_dissectors = NULL;
-static guint num_of_postdissectors = 0;
+/*
+ * Post-dissector information - handle for the dissector and a list
+ * of hfids for the fields the post-dissector wants.
+ */
+typedef struct {
+ dissector_handle_t handle;
+ GArray *wanted_fields;
+} postdissector;
+
+/*
+ * Array of all postdissectors.
+ */
+static GArray *postdissectors = NULL;
+
+/*
+ * i-th element of that array.
+ */
+#define POSTDISSECTORS(i) g_array_index(postdissectors, postdissector, i)
static void
destroy_depend_dissector_list(void *data)
static void
destroy_depend_dissector_list(void *data)
g_hash_table_destroy(heuristic_short_names);
g_slist_foreach(shutdown_routines, &call_routine, NULL);
g_slist_free(shutdown_routines);
g_hash_table_destroy(heuristic_short_names);
g_slist_foreach(shutdown_routines, &call_routine, NULL);
g_slist_free(shutdown_routines);
- if (post_dissectors)
- g_ptr_array_free(post_dissectors, TRUE);
+ if (postdissectors)
+ g_array_free(postdissectors, TRUE);
void
register_postdissector(dissector_handle_t handle)
{
void
register_postdissector(dissector_handle_t handle)
{
- if (!post_dissectors)
- post_dissectors = g_ptr_array_new();
- g_ptr_array_add(post_dissectors, handle);
- num_of_postdissectors++;
+ if (!postdissectors)
+ postdissectors = g_array_sized_new(FALSE, FALSE, (guint)sizeof(postdissector), 1);
+
+ p.handle = handle;
+ p.wanted_fields = NULL;
+ postdissectors = g_array_append_val(postdissectors, p);
+}
+
+void
+set_postdissector_wanted_fields(dissector_handle_t handle, GArray *wanted_fields)
+{
+ guint i;
+
+ if (!postdissectors) return;
+
+ for (i = 0; i < postdissectors->len; i++) {
+ if (POSTDISSECTORS(i).handle == handle) {
+ POSTDISSECTORS(i).wanted_fields = wanted_fields;
+ break;
+ }
+ }
}
void
deregister_postdissector(dissector_handle_t handle)
{
}
void
deregister_postdissector(dissector_handle_t handle)
{
- if (!post_dissectors) return;
+ guint i;
+
+ if (!postdissectors) return;
- if (g_ptr_array_remove(post_dissectors, handle)) {
- num_of_postdissectors--;
+ for (i = 0; i < postdissectors->len; i++) {
+ if (POSTDISSECTORS(i).handle == handle) {
+ postdissectors = g_array_remove_index_fast(postdissectors, i);
+ break;
+ }
guint i;
dissector_handle_t handle;
guint i;
dissector_handle_t handle;
- for(i = 0; i < num_of_postdissectors; i++) {
- handle = (dissector_handle_t) g_ptr_array_index(post_dissectors,i);
+ for (i = 0; i < postdissectors->len; i++) {
+ handle = POSTDISSECTORS(i).handle;
if (handle->protocol != NULL
&& proto_is_protocol_enabled(handle->protocol)) {
if (handle->protocol != NULL
&& proto_is_protocol_enabled(handle->protocol)) {
- for(i = 0; i < num_of_postdissectors; i++) {
- call_dissector_only((dissector_handle_t) g_ptr_array_index(post_dissectors,i),
- tvb,pinfo,tree, NULL);
+ for (i = 0; i < postdissectors->len; i++) {
+ call_dissector_only(POSTDISSECTORS(i).handle,
+ tvb, pinfo, tree, NULL);
+gboolean
+postdissectors_want_fields(void)
+{
+ guint i;
+
+ for (i = 0; i < postdissectors->len; i++) {
+ if (POSTDISSECTORS(i).wanted_fields != NULL &&
+ POSTDISSECTORS(i).wanted_fields->len != 0)
+ return TRUE;
+ }
+ return FALSE;
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
WS_DLL_PUBLIC void dissector_dump_heur_decodes(void);
/*
WS_DLL_PUBLIC void dissector_dump_heur_decodes(void);
/*
- * post dissectors are to be called by packet-frame.c after every other
+ * postdissectors are to be called by packet-frame.c after every other
* dissector has been called.
*/
* dissector has been called.
*/
-WS_DLL_PUBLIC void register_postdissector(dissector_handle_t);
+
+/*
+ * Register a postdissector; the argument is the dissector handle for it.
+ */
+WS_DLL_PUBLIC void register_postdissector(dissector_handle_t handle);
+
+/*
+ * Specify a set of fields that the postdissector will need.
+ * The GArray is an array of hfids.
+ */
+WS_DLL_PUBLIC void set_postdissector_wanted_fields(dissector_handle_t handle,
+ GArray *wanted_fields);
+
+/*
+ * Deregister a postdissector. Not for use in (post)dissectors or
+ * applications; only to be used by libwireshark itself.
+ */
void deregister_postdissector(dissector_handle_t handle);
void deregister_postdissector(dissector_handle_t handle);
+/*
+ * Return TRUE if we have at least one postdissector, FALSE if not.
+ * Not for use in (post)dissectors or applications; only to be used
+ * by libwireshark itself.
+ */
extern gboolean have_postdissector(void);
extern gboolean have_postdissector(void);
+
+/*
+ * Call all postdissectors, handing them the supplied arguments.
+ * Not for use in (post)dissectors or applications; only to be used
+ * by libwireshark itself.
+ */
extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+/*
+ * Return TRUE if at least one postdissector wants fields, FALSE otherwise.
+ * XXX - at some point this should return a bag of all fields requested by
+ * all postdissectors, so we can prime the epan_dissect_t with them rather
+ * than constructing a bogus tap with a bogus filter.
+ */
+WS_DLL_PUBLIC gboolean postdissectors_want_fields(void);
+
/** @} */
#ifdef __cplusplus
/** @} */
#ifdef __cplusplus
+ /*
+ * XXX - are there any Lua postdissectors that need "all fields",
+ * i.e. the entire protocol tree, or do they just look for
+ * *particular* fields, with field extractors?
+ *
+ * And do all of them require the actual *displayed* format of
+ * the fields they need?
+ *
+ * If not, this is overkill.
+ */
epan_set_always_visible(TRUE);
}
epan_set_always_visible(TRUE);
}
/* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
/* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
+
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a display filter;
+ *
+ * one of the tap listeners is going to apply a filter;
+ *
+ * one of the tap listeners requires a protocol tree;
+ *
+ * a postdissector wants field values on the first pass.
+ */
- (dfcode != NULL || have_filtering_tap_listeners() || (tap_flags & TL_REQUIRES_PROTO_TREE));
+ (dfcode != NULL || have_filtering_tap_listeners() ||
+ (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_fields());
+ /* If any tap listeners require the columns, construct them. */
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
/* Find the size of the file. */
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
/* Find the size of the file. */
/* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
/* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
+
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a display filter;
+ *
+ * one of the tap listeners is going to apply a filter;
+ *
+ * one of the tap listeners requires a protocol tree;
+ *
+ * a postdissector wants field values on the first pass.
+ */
- (dfcode != NULL || have_filtering_tap_listeners() || (tap_flags & TL_REQUIRES_PROTO_TREE));
+ (dfcode != NULL || have_filtering_tap_listeners() ||
+ (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_fields());
gint64 data_offset = 0;
column_info *cinfo;
gint64 data_offset = 0;
column_info *cinfo;
+ /* If any tap listeners require the columns, construct them. */
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
while (to_read != 0) {
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
while (to_read != 0) {
/* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
/* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
+
+ /* If any tap listeners require the columns, construct them. */
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
+
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a display filter;
+ *
+ * one of the tap listeners is going to apply a filter;
+ *
+ * one of the tap listeners requires a protocol tree;
+ *
+ * a postdissector wants field values on the first pass.
+ */
- (dfcode != NULL || have_filtering_tap_listeners() || (tap_flags & TL_REQUIRES_PROTO_TREE));
+ (dfcode != NULL || have_filtering_tap_listeners() ||
+ (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_fields());
if (cf->wth == NULL) {
cf_close(cf);
if (cf->wth == NULL) {
cf_close(cf);
/* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
/* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
+
+ /* If any tap listeners require the columns, construct them. */
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
+
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a display filter;
+ *
+ * one of the tap listeners is going to apply a filter;
+ *
+ * one of the tap listeners requires a protocol tree;
+ *
+ * we're redissecting and a postdissector wants field
+ * values on the first pass.
+ */
- (dfcode != NULL || have_filtering_tap_listeners() || (tap_flags & TL_REQUIRES_PROTO_TREE));
+ (dfcode != NULL || have_filtering_tap_listeners() ||
+ (tap_flags & TL_REQUIRES_PROTO_TREE) ||
+ (redissect && postdissectors_want_fields()));
reset_tap_listeners();
/* Which frame, if any, is the currently selected frame?
reset_tap_listeners();
/* Which frame, if any, is the currently selected frame?
{
packet_range_t range;
retap_callback_args_t callback_args;
{
packet_range_t range;
retap_callback_args_t callback_args;
- gboolean construct_protocol_tree;
- gboolean filtering_tap_listeners;
+ gboolean create_proto_tree;
guint tap_flags;
psp_return_t ret;
guint tap_flags;
psp_return_t ret;
cf_callback_invoke(cf_cb_file_retap_started, cf);
cf_callback_invoke(cf_cb_file_retap_started, cf);
- /* Do we have any tap listeners with filters? */
- filtering_tap_listeners = have_filtering_tap_listeners();
-
+ /* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
tap_flags = union_of_tap_listener_flags();
- /* If any tap listeners have filters, or require the protocol tree,
- construct the protocol tree. */
- construct_protocol_tree = filtering_tap_listeners ||
- (tap_flags & TL_REQUIRES_PROTO_TREE);
-
/* If any tap listeners require the columns, construct them. */
callback_args.cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
/* If any tap listeners require the columns, construct them. */
callback_args.cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * one of the tap listeners is going to apply a filter;
+ *
+ * one of the tap listeners requires a protocol tree.
+ */
+ create_proto_tree =
+ (have_filtering_tap_listeners() || (tap_flags & TL_REQUIRES_PROTO_TREE));
+
/* Reset the tap listeners. */
reset_tap_listeners();
/* Reset the tap listeners. */
reset_tap_listeners();
- epan_dissect_init(&callback_args.edt, cf->epan, construct_protocol_tree, FALSE);
+ epan_dissect_init(&callback_args.edt, cf->epan, create_proto_tree, FALSE);
/* Iterate through the list of packets, dissecting all packets and
re-running the taps. */
/* Iterate through the list of packets, dissecting all packets and
re-running the taps. */
+ GArray *wanted_fields; /* hfids of fields MATE needs */
+
GString* fields_filter; /* "ip.addr || dns.id || ... " for the tap */
GString* protos_filter; /* "dns || ftp || ..." for the tap */
gchar* tap_filter;
GString* fields_filter; /* "ip.addr || dns.id || ... " for the tap */
GString* protos_filter; /* "dns || ftp || ..." for the tap */
gchar* tap_filter;
+#if 0
+/*
+ * XXX - where is this suposed to be used?
+ */
extern gchar* add_ranges(gchar* range,GPtrArray* range_ptr_arr) {
gchar** ranges;
guint i;
extern gchar* add_ranges(gchar* range,GPtrArray* range_ptr_arr) {
gchar** ranges;
guint i;
static void new_attr_hfri(gchar* item_name, GHashTable* hfids, gchar* name) {
int* p_id = (int *)g_malloc(sizeof(int));
static void new_attr_hfri(gchar* item_name, GHashTable* hfids, gchar* name) {
int* p_id = (int *)g_malloc(sizeof(int));
mate_cfg_pdu* cfg = (mate_cfg_pdu *)p;
new_attr_hfri(cfg->name,cfg->my_hfids,(gchar*) v);
mate_cfg_pdu* cfg = (mate_cfg_pdu *)p;
new_attr_hfri(cfg->name,cfg->my_hfids,(gchar*) v);
+ /*
+ * Add this hfid to our table of hfids.
+ */
+ matecfg->wanted_fields = g_array_append_val(matecfg->wanted_fields, *(int *)k);
+
g_string_append_printf(matecfg->fields_filter,"||%s",my_protoname(*(int*)k));
}
g_string_append_printf(matecfg->fields_filter,"||%s",my_protoname(*(int*)k));
}
matecfg->hfid_mate = mate_hfid;
matecfg->hfid_mate = mate_hfid;
+ matecfg->wanted_fields = g_array_new(FALSE, FALSE, (guint)sizeof(int));
+
matecfg->fields_filter = g_string_new("");
matecfg->protos_filter = g_string_new("");
matecfg->fields_filter = g_string_new("");
matecfg->protos_filter = g_string_new("");
static proto_item *mate_i = NULL;
static proto_item *mate_i = NULL;
+static dissector_handle_t mate_handle;
+
static void
pdu_attrs_tree(proto_tree* tree, packet_info *pinfo, tvbuff_t *tvb, mate_pdu* pdu)
{
static void
pdu_attrs_tree(proto_tree* tree, packet_info *pinfo, tvbuff_t *tvb, mate_pdu* pdu)
{
proto_register_subtree_array((gint**)(void*)mc->ett->data, mc->ett->len);
register_init_routine(initialize_mate_runtime);
proto_register_subtree_array((gint**)(void*)mc->ett->data, mc->ett->len);
register_init_routine(initialize_mate_runtime);
+ /*
+ * Set the list of fields we want.
+ */
+ set_postdissector_wanted_fields(mate_handle,
+ mc->wanted_fields);
+
tap_error = register_tap_listener("frame", &mate_tap_data,
(char*) mc->tap_filter,
0,
tap_error = register_tap_listener("frame", &mate_tap_data,
(char*) mc->tap_filter,
0,
expert_module_t* expert_mate;
module_t *mate_module;
expert_module_t* expert_mate;
module_t *mate_module;
- dissector_handle_t mate_handle;
proto_mate = proto_register_protocol("Meta Analysis Tracing Engine", "MATE", "mate");
proto_register_field_array(proto_mate, hf, array_length(hf));
proto_mate = proto_register_protocol("Meta Analysis Tracing Engine", "MATE", "mate");
proto_register_field_array(proto_mate, hf, array_length(hf));
void proto_register_transum(void);
void proto_reg_handoff_transum(void);
void proto_register_transum(void);
void proto_reg_handoff_transum(void);
+static dissector_handle_t transum_handle;
+
#define CAPTURE_CLIENT 0
#define CAPTURE_INTERMEDIATE 1
#define CAPTURE_SERVICE 2
#define CAPTURE_CLIENT 0
#define CAPTURE_INTERMEDIATE 1
#define CAPTURE_SERVICE 2
*/
static wmem_list_t *temp_rsp_rrpd_list = NULL; /* Reuse these for speed and efficient memory use - issue a warning if we run out */
*/
static wmem_list_t *temp_rsp_rrpd_list = NULL; /* Reuse these for speed and efficient memory use - issue a warning if we run out */
+/*
+ * GArray of the hfids of all fields we're interested in.
+ */
+GArray *wanted_fields;
static gint ett_transum = -1;
static gint ett_transum_header = -1;
static gint ett_transum = -1;
static gint ett_transum_header = -1;
rrpd_list = wmem_list_new(wmem_file_scope());
temp_rsp_rrpd_list = wmem_list_new(wmem_file_scope());
rrpd_list = wmem_list_new(wmem_file_scope());
temp_rsp_rrpd_list = wmem_list_new(wmem_file_scope());
+ /* Indicate what fields we're interested in. */
+ wanted_fields = g_array_new(FALSE, FALSE, (guint)sizeof(int));
+ for (int i = 0; i < HF_INTEREST_END_OF_LIST; i++)
+ {
+ g_array_append_val(wanted_fields, hf_of_interest[i].hf);
+ }
+ set_postdissector_wanted_fields(transum_handle, wanted_fields);
+
GString* fake_tap_filter = g_string_new("frame || eth.type");
for (int i = 0; i < HF_INTEREST_END_OF_LIST; i++)
GString* fake_tap_filter = g_string_new("frame || eth.type");
for (int i = 0; i < HF_INTEREST_END_OF_LIST; i++)
RRPD *rrpd = (RRPD*)wmem_map_lookup(output_rrpd, GUINT_TO_POINTER(pinfo->num));
if (rrpd)
RRPD *rrpd = (RRPD*)wmem_map_lookup(output_rrpd, GUINT_TO_POINTER(pinfo->num));
if (rrpd)
- /* Add the RTE data to the protocol decode tree if we output_flag is set */
- write_rte(rrpd, buffer, tree, NULL);
+ {
+ if (tree)
+ {
+ /* Add the RTE data to the protocol decode tree if we output_flag is set */
+ write_rte(rrpd, buffer, tree, NULL);
+ }
+ }
proto_register_transum(void)
{
module_t *transum_module;
proto_register_transum(void)
{
module_t *transum_module;
- dissector_handle_t transum_handle;
static hf_register_info hf[] = {
{ &hf_tsum_status,
static hf_register_info hf[] = {
{ &hf_tsum_status,
cf->frames = new_frame_data_sequence();
{
cf->frames = new_frame_data_sequence();
{
- gboolean create_proto_tree = FALSE;
-
- /* If we're going to be applying a filter, we'll need to
- create a protocol tree against which to apply the filter. */
- if (cf->rfcode || cf->dfcode)
- create_proto_tree = TRUE;
+ gboolean create_proto_tree;
+
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a read filter;
+ *
+ * we're going to apply a display filter;
+ *
+ * a postdissector wants field values on the first pass.
+ */
+ create_proto_tree =
+ (cf->rfcode != NULL || cf->dfcode != NULL || postdissectors_want_fields());
/* We're not going to display the protocol tree on this pass,
so it's not going to be "visible". */
/* We're not going to display the protocol tree on this pass,
so it's not going to be "visible". */
int err;
char *err_info = NULL;
int err;
char *err_info = NULL;
- gboolean filtering_tap_listeners;
- gboolean construct_protocol_tree;
+ gboolean create_proto_tree;
epan_dissect_t edt;
column_info *cinfo;
epan_dissect_t edt;
column_info *cinfo;
- filtering_tap_listeners = have_filtering_tap_listeners();
+ /* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
tap_flags = union_of_tap_listener_flags();
- construct_protocol_tree = filtering_tap_listeners || (tap_flags & TL_REQUIRES_PROTO_TREE);
+ /* If any tap listeners require the columns, construct them. */
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cfile.cinfo : NULL;
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cfile.cinfo : NULL;
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * one of the tap listeners is going to apply a filter;
+ *
+ * one of the tap listeners requires a protocol tree.
+ */
+ create_proto_tree =
+ (have_filtering_tap_listeners() || (tap_flags & TL_REQUIRES_PROTO_TREE));
+
wtap_phdr_init(&phdr);
ws_buffer_init(&buf, 1500);
wtap_phdr_init(&phdr);
ws_buffer_init(&buf, 1500);
- epan_dissect_init(&edt, cfile.epan, construct_protocol_tree, FALSE);
+ epan_dissect_init(&edt, cfile.epan, create_proto_tree, FALSE);
cf->frames = new_frame_data_sequence();
if (do_dissection) {
cf->frames = new_frame_data_sequence();
if (do_dissection) {
- gboolean create_proto_tree = FALSE;
+ gboolean create_proto_tree;
- /* If we're going to be applying a filter, we'll need to
- create a protocol tree against which to apply the filter. */
- if (cf->rfcode)
- create_proto_tree = TRUE;
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a read filter;
+ *
+ * a postdissector wants field values on the first pass.
+ */
+ create_proto_tree =
+ (cf->rfcode != NULL || postdissectors_want_fields());
/* We're not going to display the protocol tree on this pass,
so it's not going to be "visible". */
/* We're not going to display the protocol tree on this pass,
so it's not going to be "visible". */
if (do_dissection) {
gboolean create_proto_tree;
if (do_dissection) {
gboolean create_proto_tree;
- if (cf->dfcode || print_details || filtering_tap_listeners ||
- (tap_flags & TL_REQUIRES_PROTO_TREE) || have_custom_cols(&cf->cinfo))
- create_proto_tree = TRUE;
- else
- create_proto_tree = FALSE;
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a display filter;
+ *
+ * we're going to print the protocol tree;
+ *
+ * one of the tap listeners requires a protocol tree;
+ *
+ * we have custom columns (which require field values, which
+ * currently requires that we build a protocol tree).
+ */
+ create_proto_tree =
+ (cf->dfcode || print_details || filtering_tap_listeners ||
+ (tap_flags & TL_REQUIRES_PROTO_TREE) || have_custom_cols(&cf->cinfo));
/* The protocol tree will be "visible", i.e., printed, only if we're
printing packet details, which is true if we're printing stuff
/* The protocol tree will be "visible", i.e., printed, only if we're
printing packet details, which is true if we're printing stuff
if (do_dissection) {
gboolean create_proto_tree;
if (do_dissection) {
gboolean create_proto_tree;
- if (cf->rfcode || cf->dfcode || print_details || filtering_tap_listeners ||
- (tap_flags & TL_REQUIRES_PROTO_TREE) || have_custom_cols(&cf->cinfo))
- create_proto_tree = TRUE;
- else
- create_proto_tree = FALSE;
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a read filter;
+ *
+ * we're going to apply a display filter;
+ *
+ * we're going to print the protocol tree;
+ *
+ * one of the tap listeners is going to apply a filter;
+ *
+ * one of the tap listeners requires a protocol tree;
+ *
+ * a postdissector wants field values on the first pass;
+ *
+ * we have custom columns (which require field values, which
+ * currently requires that we build a protocol tree).
+ */
+ create_proto_tree =
+ (cf->rfcode || cf->dfcode || print_details || filtering_tap_listeners ||
+ (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_fields() ||
+ have_custom_cols(&cf->cinfo));
/* The protocol tree will be "visible", i.e., printed, only if we're
printing packet details, which is true if we're printing stuff
/* The protocol tree will be "visible", i.e., printed, only if we're
printing packet details, which is true if we're printing stuff
gboolean create_proto_tree;
epan_dissect_t *edt;
gboolean create_proto_tree;
epan_dissect_t *edt;
- if (cf->rfcode || cf->dfcode || print_details || filtering_tap_listeners ||
- (tap_flags & TL_REQUIRES_PROTO_TREE) || have_custom_cols(&cf->cinfo))
- create_proto_tree = TRUE;
- else
- create_proto_tree = FALSE;
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a read filter;
+ *
+ * we're going to apply a display filter;
+ *
+ * we're going to print the protocol tree;
+ *
+ * one of the tap listeners is going to apply a filter;
+ *
+ * one of the tap listeners requires a protocol tree;
+ *
+ * a postdissector wants field values on the first pass;
+ *
+ * we have custom columns (which require field values, which
+ * currently requires that we build a protocol tree).
+ */
+ create_proto_tree =
+ (cf->rfcode || cf->dfcode || print_details || filtering_tap_listeners ||
+ (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_fields() ||
+ have_custom_cols(&cf->cinfo));
/* The protocol tree will be "visible", i.e., printed, only if we're
printing packet details, which is true if we're printing stuff
/* The protocol tree will be "visible", i.e., printed, only if we're
printing packet details, which is true if we're printing stuff
cf->frames = new_frame_data_sequence();
if (do_dissection) {
cf->frames = new_frame_data_sequence();
if (do_dissection) {
- gboolean create_proto_tree = FALSE;
+ gboolean create_proto_tree;
- /* If we're going to be applying a filter, we'll need to
- create a protocol tree against which to apply the filter. */
- if (cf->rfcode || cf->dfcode)
- create_proto_tree = TRUE;
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a read filter;
+ *
+ * we're going to apply a display filter;
+ *
+ * a postdissector wants field values on the first pass.
+ */
+ create_proto_tree =
+ (cf->rfcode != NULL || cf->dfcode != NULL || postdissectors_want_fields());
tshark_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE");
tshark_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE");
if (do_dissection) {
gboolean create_proto_tree;
if (do_dissection) {
gboolean create_proto_tree;
- if (cf->dfcode || print_details || filtering_tap_listeners ||
- (tap_flags & TL_REQUIRES_PROTO_TREE) || have_custom_cols(&cf->cinfo))
- create_proto_tree = TRUE;
- else
- create_proto_tree = FALSE;
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a display filter;
+ *
+ * we're going to print the protocol tree;
+ *
+ * one of the tap listeners requires a protocol tree;
+ *
+ * we have custom columns (which require field values, which
+ * currently requires that we build a protocol tree).
+ */
+ create_proto_tree =
+ (cf->dfcode || print_details || filtering_tap_listeners ||
+ (tap_flags & TL_REQUIRES_PROTO_TREE) || have_custom_cols(&cf->cinfo));
tshark_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE");
tshark_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE");
if (do_dissection) {
gboolean create_proto_tree;
if (do_dissection) {
gboolean create_proto_tree;
- if (cf->rfcode || cf->dfcode || print_details || filtering_tap_listeners ||
- (tap_flags & TL_REQUIRES_PROTO_TREE) || have_custom_cols(&cf->cinfo))
- create_proto_tree = TRUE;
- else
- create_proto_tree = FALSE;
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a read filter;
+ *
+ * we're going to apply a display filter;
+ *
+ * we're going to print the protocol tree;
+ *
+ * one of the tap listeners is going to apply a filter;
+ *
+ * one of the tap listeners requires a protocol tree;
+ *
+ * a postdissector wants field values on the first pass;
+ *
+ * we have custom columns (which require field values, which
+ * currently requires that we build a protocol tree).
+ */
+ create_proto_tree =
+ (cf->rfcode || cf->dfcode || print_details || filtering_tap_listeners ||
+ (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_fields() ||
+ have_custom_cols(&cf->cinfo))
tshark_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE");
tshark_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE");
return; /* error reading the record */
}
return; /* error reading the record */
}
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a color filter to this packet;
+ *
+ * we're need to fill in the columns and we have custom columns
+ * (which require field values, which currently requires that
+ * we build a protocol tree).
+ */
create_proto_tree = (dissect_color && color_filters_used()) ||
(dissect_columns && have_custom_cols(cinfo));
create_proto_tree = (dissect_color && color_filters_used()) ||
(dissect_columns && have_custom_cols(cinfo));
return; /* error reading the record */
}
return; /* error reading the record */
}
+ /*
+ * Determine whether we need to create a protocol tree.
+ * We do if:
+ *
+ * we're going to apply a color filter to this packet;
+ *
+ * we're need to fill in the columns and we have custom columns
+ * (which require field values, which currently requires that
+ * we build a protocol tree).
+ *
+ * XXX - field extractors? (Not done for GTK+....)
+ */
create_proto_tree = ((dissect_color && color_filters_used()) ||
(dissect_columns && (have_custom_cols(cinfo) ||
have_field_extractors())));
create_proto_tree = ((dissect_color && color_filters_used()) ||
(dissect_columns && (have_custom_cols(cinfo) ||
have_field_extractors())));