diff options
author | Michael Mann <mmann78@netscape.net> | 2015-07-12 20:40:31 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-07-17 17:12:22 +0000 |
commit | 21e5a950ade6a20260b63b5f5c055c52ac07b599 (patch) | |
tree | 417e76e5a3082c2431ce0f5c6d88cbf7701e0489 /epan/packet.c | |
parent | 5bd6c4aff21dbc8a7ebf31c5d1510fcedf66d875 (diff) |
Remove all preferences related to enabling/disabling heuristic dissectors.
The preferences are still supported for backwards compatibility, but the heuristic_protos file has final say on the "preference" to enable/disable a heuristic dissector.
Also add parameter to heur_dissector_add() for the "default" enable/disable of a heuristic dissector. With this parameter, a few more (presumably weak) heuristic dissectors have been "registered" but of course default to being disabled.
Change-Id: I51bebb2146ef3fbb8418d4f5c7f2cb2b58003a22
Reviewed-on: https://code.wireshark.org/review/9610
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/packet.c')
-rw-r--r-- | epan/packet.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/epan/packet.c b/epan/packet.c index 18e61d337f..77ed6c2a48 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -1964,19 +1964,37 @@ has_heur_dissector_list(const gchar *name) { } +static int +find_matching_heur_dissector_by_short_name(gconstpointer a, gconstpointer b) +{ + const gchar *str_a = proto_get_protocol_short_name(((const heur_dtbl_entry_t *)a)->protocol); + const gchar *str_b = (const gchar*)b; + + return strcmp(str_a, str_b); +} + +heur_dtbl_entry_t* +find_heur_dissector_by_short_name(heur_dissector_list_t heur_list, const char *short_name) +{ + GSList *found_entry; + found_entry = g_slist_find_custom(heur_list->dissectors, (gpointer) short_name, find_matching_heur_dissector_by_short_name); + + return found_entry ? (heur_dtbl_entry_t *)(found_entry->data) : NULL; +} + heur_dtbl_entry_t* find_heur_dissector_by_unique_short_name(const char *short_name) { return (heur_dtbl_entry_t*)g_hash_table_lookup(heuristic_short_names, (gpointer)short_name); } void -heur_dissector_add(const char *name, heur_dissector_t dissector, const char *display_name, const char *short_name, const int proto) +heur_dissector_add(const char *name, heur_dissector_t dissector, const char *display_name, const char *short_name, const int proto, heuristic_enable_e enable) { heur_dissector_list_t sub_dissectors = find_heur_dissector_list(name); const char *proto_name; heur_dtbl_entry_t *hdtbl_entry; - guint i, list_size; - GSList *list_entry; + guint i, list_size; + GSList *list_entry; /* * Make sure the dissector table exists. @@ -2026,7 +2044,7 @@ heur_dissector_add(const char *name, heur_dissector_t dissector, const char *dis hdtbl_entry->display_name = display_name; hdtbl_entry->short_name = short_name; hdtbl_entry->list_name = g_strdup(name); - hdtbl_entry->enabled = TRUE; + hdtbl_entry->enabled = (enable == HEURISTIC_ENABLE); /* do the table insertion */ g_hash_table_insert(heuristic_short_names, (gpointer)short_name, hdtbl_entry); |