aboutsummaryrefslogtreecommitdiffstats
path: root/ui/dissect_opts.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-04-08 12:45:19 -0700
committerGuy Harris <guy@alum.mit.edu>2017-04-08 20:40:08 +0000
commit2c44a7f930967335b442e899c17e1eb46831e3c1 (patch)
tree7ce2db4007feccf638308dc205f509ec385436a3 /ui/dissect_opts.c
parentf1751ef22fc9877e59fad3b1c60826bff8569d94 (diff)
Clean up handling of enabled/disabled protocols/heuristic dissectors.
Add a "report a warning message" routine to the "report_err" code in libwsutil, and rename files and routines appropriately, as they don't only handle errors any more. Have a routine read_enabled_and_disabled_protos() that reads all the files that enable or disable protocols or heuristic dissectors, enables and disables them based on the contents of those files, and reports errors itself (as warnings) using the new "report a warning message" routine. Fix that error reporting to report separately on the disabled protocols, enabled protocols, and heuristic dissectors files. Have a routine to set up the enabled and disabled protocols and heuristic dissectors from the command-line arguments, so it's done the same way in all programs. If we try to enable or disable an unknown heuristic dissector via a command-line argument, report an error. Update a bunch of comments. Update the name of disabled_protos_cleanup(), as it cleans up information for disabled *and* enabled protocols and for heuristic dissectors. Support the command-line flags to enable and disable protocols and heuristic dissectors in tfshark. Change-Id: I9b8bd29947cccdf6dc34a0540b5509ef941391df Reviewed-on: https://code.wireshark.org/review/20966 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/dissect_opts.c')
-rw-r--r--ui/dissect_opts.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/ui/dissect_opts.c b/ui/dissect_opts.c
index 65afd245c1..6b2ac21121 100644
--- a/ui/dissect_opts.c
+++ b/ui/dissect_opts.c
@@ -34,6 +34,7 @@
#include <epan/prefs.h>
#include <epan/timestamp.h>
#include <epan/addr_resolv.h>
+#include <epan/disabled_protos.h>
#include "ui/decode_as_utils.h"
@@ -161,6 +162,49 @@ dissect_opts_handle_opt(int opt, char *optarg_str_p)
return TRUE;
}
+gboolean
+setup_enabled_and_disabled_protocols(void)
+{
+ gboolean success = TRUE;
+
+ if (global_dissect_options.disable_protocol_slist) {
+ GSList *proto_disable;
+
+ for (proto_disable = global_dissect_options.disable_protocol_slist; proto_disable != NULL; proto_disable = g_slist_next(proto_disable))
+ proto_disable_proto_by_name((char*)proto_disable->data);
+ }
+
+ if (global_dissect_options.enable_protocol_slist) {
+ GSList *proto_enable;
+
+ for (proto_enable = global_dissect_options.enable_protocol_slist; proto_enable != NULL; proto_enable = g_slist_next(proto_enable))
+ proto_enable_proto_by_name((char*)proto_enable->data);
+ }
+
+ if (global_dissect_options.enable_heur_slist) {
+ GSList *heur_enable;
+
+ for (heur_enable = global_dissect_options.enable_heur_slist; heur_enable != NULL; heur_enable = g_slist_next(heur_enable)) {
+ if (!proto_enable_heuristic_by_name((char*)heur_enable->data, TRUE)) {
+ cmdarg_err("No such protocol %s, can't enable", (char*)heur_enable->data);
+ success = FALSE;
+ }
+ }
+ }
+
+ if (global_dissect_options.disable_heur_slist) {
+ GSList *heur_disable;
+
+ for (heur_disable = global_dissect_options.disable_heur_slist; heur_disable != NULL; heur_disable = g_slist_next(heur_disable)) {
+ if (!proto_enable_heuristic_by_name((char*)heur_disable->data, FALSE)) {
+ cmdarg_err("No such protocol %s, can't disable", (char*)heur_disable->data);
+ success = FALSE;
+ }
+ }
+ }
+ return success;
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*