diff options
author | Hadriel Kaplan <hadrielk@yahoo.com> | 2014-02-21 01:11:41 -0500 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2014-02-25 21:06:50 +0000 |
commit | bd36fe1bcbe19dd1b63836cc60d7351d7d8b4aa8 (patch) | |
tree | b70a11dd3fc984900da52bd3bdfd1b40f56b29ac /epan/epan.h | |
parent | 860747e1e78aefdaf31e77408ad590b9d759d1aa (diff) |
Fix bug 6357: Lua all_field_infos() broken within tap/listener
The current API for Lua provides a global function
"all_field_infos()" which returns all the populated field_info nodes
in the current proto_tree.
By default all_field_infos() "works", in the literal sense: it returns
exactly the fields the previous dissectors of the packet have
populated at that instant of time. But of course dissectors don't
populate all the applicable fields most of the time, because of the
TRY_TO_FAKE_THIS_ITEM optimization where they don't fill in things
that aren't needed at the time by a display, color, or tap's dfilter.
So this commit offers a way to force the dissectors to populate
all the applicable field_infos in the tree, by setting the proto_tree
to be visible. Obviously that is going to impact performance, since
it basically bypasses the TRY_TO_FAKE_THIS_ITEM optimization; so the
patch only does this if the Lua script author told it to explicitly,
by adding an argument to Listener.new() and register_postdissector().
Change-Id: I11d3559fbe8c14fbadf1b51415a3701dc1200b7b
Reviewed-on: https://code.wireshark.org/review/286
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/epan.h')
-rw-r--r-- | epan/epan.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/epan/epan.h b/epan/epan.h index 5a9dbda019..a50ee8d548 100644 --- a/epan/epan.h +++ b/epan/epan.h @@ -145,6 +145,18 @@ WS_DLL_PUBLIC void epan_free(epan_t *session); WS_DLL_PUBLIC const gchar* epan_get_version(void); +/** + * Set/unset the tree to always be visible when epan_dissect_init() is called. + * This state change sticks until cleared, rather than being done per function call. + * This is currently used when Lua scripts request all fields be generated. + * By default it only becomes visible if epan_dissect_init() makes it so, usually + * only when a packet is selected. + * Setting this overrides that so it's always visible, although it will still not be + * created if create_proto_tree is false in the call to epan_dissect_init(). + * Clearing this reverts the decision to epan_dissect_init() and proto_tree_visible. + */ +void epan_set_always_visible(gboolean force); + /** initialize an existing single packet dissection */ WS_DLL_PUBLIC epan_dissect_t* |