diff options
author | Bill Meier <wmeier@newsguy.com> | 2011-12-28 15:05:59 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2011-12-28 15:05:59 +0000 |
commit | ebe33ba92a4e2e39e3b3d15ce119ef95d5016f83 (patch) | |
tree | 64e3ae38c891ee683a59e015aa2cccc30a49413e /epan/packet.c | |
parent | 2a1eaf14e241c754adb7fba7667b0223894a8428 (diff) |
Add tshark option '-G heuristic-decodes' to dump heuristic dissector tables.
svn path=/trunk/; revision=40309
Diffstat (limited to 'epan/packet.c')
-rw-r--r-- | epan/packet.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/epan/packet.c b/epan/packet.c index 95a1e2286a..9759f969b6 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -1559,7 +1559,7 @@ get_dissector_table_base(const char *name) static GHashTable *heur_dissector_lists = NULL; -/* Finds a heuristic dissector table by field name. */ +/* Finds a heuristic dissector table by table name. */ static heur_dissector_list_t * find_heur_dissector_list(const char *name) { @@ -1722,6 +1722,26 @@ typedef struct heur_dissector_foreach_table_info { DATFunc_heur_table caller_func; } heur_dissector_foreach_table_info_t; + +static void +dissector_dump_heur_decodes_display(const gchar *table_name, const gpointer value, const gpointer user_data _U_) +{ + heur_dissector_list_t sub_dissectors = *(heur_dissector_list_t *)value; + GSList *entry; + heur_dtbl_entry_t *dtbl_entry; + + for (entry = sub_dissectors; entry != NULL; entry = g_slist_next(entry)) { + dtbl_entry = (heur_dtbl_entry_t *)entry->data; + if (dtbl_entry->protocol != NULL) { + printf("%s\t%s\t%c\n", + table_name, + proto_get_protocol_filter_name(proto_get_id(dtbl_entry->protocol)), + (proto_is_protocol_enabled(dtbl_entry->protocol) && dtbl_entry->enabled) ? 'T' : 'F'); + } + } +} + + static void dissector_all_heur_tables_foreach_table_func (gpointer key, const gpointer value, const gpointer user_data) { @@ -1746,6 +1766,16 @@ dissector_all_heur_tables_foreach_table (DATFunc_heur_table func, g_hash_table_foreach(heur_dissector_lists, dissector_all_heur_tables_foreach_table_func, &info); } +/* + * For each heuristic dissector table, dump list of dissectors (filter_names) for that table + */ +void +dissector_dump_heur_decodes(void) +{ + dissector_all_heur_tables_foreach_table(dissector_dump_heur_decodes_display, NULL); +} + + void register_heur_dissector_list(const char *name, heur_dissector_list_t *sub_dissectors) { |