aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/file-file.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-12-30 15:28:07 -0500
committerMichael Mann <mmann78@netscape.net>2016-01-01 17:36:11 +0000
commitb344107d757466e0768a3ef8927852479e926cf6 (patch)
tree7e5599b63bd060f710ad37d053d504f448589476 /epan/dissectors/file-file.c
parentb1281c8308a6ea11da91e022a2e7c407ab94c864 (diff)
Make color filters part of dissection
Color filters can be seen as a function that takes a tree and display filters as input and a (possibly empty) coloring rule as output. This coloring rule is then added to the frame tree and used by the GUI for coloring the packets list. From an architectural POV, "coloring" is part of the UI component, but since it influences the tree, it is something for the dissection component. Bug: 5703 Bug: 6099 Change-Id: I73d132ec1dca7262bcb1b55c8481ca564c6161d1 Reviewed-on: https://code.wireshark.org/review/12507 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/file-file.c')
-rw-r--r--epan/dissectors/file-file.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/epan/dissectors/file-file.c b/epan/dissectors/file-file.c
index e7a469a18e..e61d4310bf 100644
--- a/epan/dissectors/file-file.c
+++ b/epan/dissectors/file-file.c
@@ -88,13 +88,16 @@ call_file_record_end_routine(gpointer routine, gpointer dummy _U_)
/* XXX - "packet comment" is passed into dissector as data, but currently doesn't have a use */
static int
-dissect_file_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
+dissect_file_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data)
{
proto_item *volatile ti = NULL;
guint cap_len = 0, frame_len = 0;
+ proto_tree *volatile fh_tree = NULL;
proto_tree *volatile tree;
proto_item *item;
const gchar *cap_plurality, *frame_plurality;
+ const color_filter_t *color_filter;
+ file_data_t *file_data = (file_data_t*)data;
tree=parent_tree;
@@ -105,7 +108,6 @@ dissect_file_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
if(!proto_field_is_referenced(tree, proto_file)) {
tree=NULL;
} else {
- proto_tree *fh_tree;
gboolean old_visible;
/* Put in frame header information. */
@@ -171,16 +173,6 @@ dissect_file_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
pinfo->fd->file_off, pinfo->fd->file_off);
}
#endif
-
- if(pinfo->fd->color_filter != NULL) {
- const color_filter_t *color_filter = (const color_filter_t *)pinfo->fd->color_filter;
- item = proto_tree_add_string(fh_tree, hf_file_color_filter_name, tvb,
- 0, 0, color_filter->filter_name);
- PROTO_ITEM_SET_GENERATED(item);
- item = proto_tree_add_string(fh_tree, hf_file_color_filter_text, tvb,
- 0, 0, color_filter->filter_text);
- PROTO_ITEM_SET_GENERATED(item);
- }
}
if (pinfo->fd->flags.ignored) {
@@ -306,6 +298,19 @@ dissect_file_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
ENDTRY;
}
+ /* XXX optimize this so it doesn't need to scan the second time */
+ color_filter = color_filters_colorize_packet(file_data->color_edt);
+
+ if (color_filter) {
+ pinfo->fd->color_filter = color_filter;
+ item = proto_tree_add_string(fh_tree, hf_file_color_filter_name, tvb,
+ 0, 0, color_filter->filter_name);
+ PROTO_ITEM_SET_GENERATED(item);
+ item = proto_tree_add_string(fh_tree, hf_file_color_filter_text, tvb,
+ 0, 0, color_filter->filter_text);
+ PROTO_ITEM_SET_GENERATED(item);
+ }
+
tap_queue_packet(file_tap, pinfo, NULL);