aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorJim Young <jyoung@gsu.edu>2015-07-14 00:28:49 -0400
committerMichael Mann <mmann78@netscape.net>2015-07-17 11:27:52 +0000
commitad82dfd5547e460359eb3597ddb6760a29c40439 (patch)
tree7e13c660c502985fef6eb075e5efe09c5e020d9a /epan
parent9d24a26c9b8c78260fca9c4f6ecf480e12010229 (diff)
Add new long options to GUIs to allow arbitrary protocols and heuristics to be disabled via command-line
Future: Allow multiple protocols to be disabled in one option statement (perhaps using a comma or colon delmited set of names in <proto_name>) instead of having to specify --disable-protocol <proto_name> multiple times. Change-Id: I9b8f960acf75298ebb098d9b667fca49dca52306 Reviewed-on: https://code.wireshark.org/review/9631 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')
-rw-r--r--epan/disabled_protos.c30
-rw-r--r--epan/disabled_protos.h13
2 files changed, 43 insertions, 0 deletions
diff --git a/epan/disabled_protos.c b/epan/disabled_protos.c
index 4d30e13510..602f48d57d 100644
--- a/epan/disabled_protos.c
+++ b/epan/disabled_protos.c
@@ -356,6 +356,27 @@ skip:
}
/*
+ * Disable a particular protocol by name
+ */
+
+void
+proto_disable_proto_by_name(const char *name)
+{
+ protocol_t *protocol;
+ int proto_id;
+
+ proto_id = proto_get_id_by_filter_name(name);
+ if (proto_id >= 0 ) {
+ protocol = find_protocol_by_id(proto_id);
+ if (proto_is_protocol_enabled(protocol) == TRUE) {
+ if (proto_can_toggle_protocol(proto_id) == TRUE) {
+ proto_set_decoding(proto_id, FALSE);
+ }
+ }
+ }
+}
+
+/*
* Write out a list of disabled protocols.
*
* On success, "*pref_path_return" is set to NULL.
@@ -792,6 +813,15 @@ save_disabled_heur_dissector_list(char **pref_path_return, int *errno_return)
g_free(ff_path);
}
+void
+proto_enable_heuristic_by_name(const char *name, gboolean enable)
+{
+ heur_dtbl_entry_t* heur = find_heur_dissector_by_unique_short_name(name);
+ if (heur != NULL) {
+ heur->enabled = enable;
+ }
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
diff --git a/epan/disabled_protos.h b/epan/disabled_protos.h
index 2f06c22fc5..33e56f7d9b 100644
--- a/epan/disabled_protos.h
+++ b/epan/disabled_protos.h
@@ -62,6 +62,13 @@ WS_DLL_PUBLIC void
save_disabled_protos_list(char **pref_path_return, int *errno_return);
/*
+ * Disable a particular protocol by name
+ */
+
+WS_DLL_PUBLIC void
+proto_disable_proto_by_name(const char *name);
+
+/*
* Read in a list of disabled protocols.
*
* On success, "*pref_path_return" is set to NULL.
@@ -94,6 +101,12 @@ set_disabled_heur_dissector_list(void);
WS_DLL_PUBLIC void
save_disabled_heur_dissector_list(char **pref_path_return, int *errno_return);
+/*
+ * Enable/disable a particular heuristic dissector by name
+ */
+WS_DLL_PUBLIC void
+proto_enable_heuristic_by_name(const char *name, gboolean enable);
+
#ifdef __cplusplus
}