diff options
author | Michael Mann <mmann78@netscape.net> | 2015-12-30 15:28:07 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-01-01 17:36:11 +0000 |
commit | b344107d757466e0768a3ef8927852479e926cf6 (patch) | |
tree | 7e5599b63bd060f710ad37d053d504f448589476 /epan/packet.c | |
parent | b1281c8308a6ea11da91e022a2e7c407ab94c864 (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/packet.c')
-rw-r--r-- | epan/packet.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/epan/packet.c b/epan/packet.c index 0e3c02b5f3..71c814191b 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -489,6 +489,7 @@ dissect_record(epan_dissect_t *edt, int file_type_subtype, else frame_dissector_data.pkt_comment = NULL; frame_dissector_data.file_type_subtype = file_type_subtype; + frame_dissector_data.color_edt = edt; /* Used strictly for "coloring rules" */ TRY { /* Add this tvbuffer into the data_src list */ @@ -518,6 +519,8 @@ void dissect_file(epan_dissect_t *edt, struct wtap_pkthdr *phdr, tvbuff_t *tvb, frame_data *fd, column_info *cinfo) { + file_data_t file_dissector_data; + if (cinfo != NULL) col_init(cinfo, edt->session); edt->pi.epan = edt->session; @@ -546,15 +549,15 @@ dissect_file(epan_dissect_t *edt, struct wtap_pkthdr *phdr, TRY { - const gchar *pkt_comment; - /* pkt comment use first user, later from phdr */ if (fd->flags.has_user_comment) - pkt_comment = epan_get_user_comment(edt->session, fd); + file_dissector_data.pkt_comment = epan_get_user_comment(edt->session, fd); else if (fd->flags.has_phdr_comment) - pkt_comment = phdr->opt_comment; + file_dissector_data.pkt_comment = phdr->opt_comment; else - pkt_comment = NULL; + file_dissector_data.pkt_comment = NULL; + file_dissector_data.color_edt = edt; /* Used strictly for "coloring rules" */ + /* Add this tvbuffer into the data_src list */ add_new_data_source(&edt->pi, edt->tvb, "File"); @@ -563,7 +566,7 @@ dissect_file(epan_dissect_t *edt, struct wtap_pkthdr *phdr, * sub-dissector can throw, dissect_frame() itself may throw * a ReportedBoundsError in bizarre cases. Thus, we catch the exception * in this function. */ - call_dissector_with_data(file_handle, edt->tvb, &edt->pi, edt->tree, (void*)pkt_comment); + call_dissector_with_data(file_handle, edt->tvb, &edt->pi, edt->tree, &file_dissector_data); } CATCH(BoundsError) { |