From da1af6e549856c8e213dadc1ec37a41a50246e1d Mon Sep 17 00:00:00 2001 From: Hadriel Kaplan Date: Tue, 25 Mar 2014 18:11:05 -0400 Subject: Add filterable expert info for Lua This adds the ability for a Lua script to register expert info fields, similar to C-code dissectors. This change also removes the need for the expert_add_info_format_internal() function. Existing Lua scripts do not have to change, because the existing expert info function uses the internal "_ws.lua" protocol instead of nothing; but using the new functionality provides more benefits since it correctly registers the expert info fields to the dissector's protocol. The test suite was amended to generate both old and new forms. Change-Id: Ib5ae74e927cfa81312baf7b04ff4104b0b4f936e Reviewed-on: https://code.wireshark.org/review/830 Reviewed-by: Evan Huus Reviewed-by: Anders Broman --- epan/expert.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'epan/expert.c') diff --git a/epan/expert.c b/epan/expert.c index a59c5a60b8..46be838ac8 100644 --- a/epan/expert.c +++ b/epan/expert.c @@ -318,6 +318,7 @@ expert_set_info_vformat(packet_info *pinfo, proto_item *pi, int group, int sever highest_severity = severity; } + /* XXX: can we get rid of these checks and make them programming errors instead now? */ if (pi != NULL && PITEM_FINFO(pi) != NULL) { expert_set_item_flags(pi, group, severity); } @@ -371,24 +372,15 @@ expert_set_info_vformat(packet_info *pinfo, proto_item *pi, int group, int sever /* if we have a proto_item (not a faked item), set expert attributes to it */ if (pi != NULL && PITEM_FINFO(pi) != NULL) { ei->pitem = pi; - } else { + } + /* XXX: remove this because we don't have an internal-only function now? */ + else { ei->pitem = NULL; } tap_queue_packet(expert_tap, pinfo, ei); } - -void -expert_add_info_format_internal(packet_info *pinfo, proto_item *pi, int group, int severity, const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - expert_set_info_vformat(pinfo, pi, group, severity, -1, TRUE, format, ap); - va_end(ap); -} - void expert_add_info(packet_info *pinfo, proto_item *pi, expert_field *expindex) { -- cgit v1.2.3