aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2011-12-28 15:05:59 +0000
committerBill Meier <wmeier@newsguy.com>2011-12-28 15:05:59 +0000
commitebe33ba92a4e2e39e3b3d15ce119ef95d5016f83 (patch)
tree64e3ae38c891ee683a59e015aa2cccc30a49413e /epan
parent2a1eaf14e241c754adb7fba7667b0223894a8428 (diff)
Add tshark option '-G heuristic-decodes' to dump heuristic dissector tables.
svn path=/trunk/; revision=40309
Diffstat (limited to 'epan')
-rw-r--r--epan/libwireshark.def1
-rw-r--r--epan/packet.c32
-rw-r--r--epan/packet.h5
3 files changed, 37 insertions, 1 deletions
diff --git a/epan/libwireshark.def b/epan/libwireshark.def
index 82258be50a..acfd14b08f 100644
--- a/epan/libwireshark.def
+++ b/epan/libwireshark.def
@@ -329,6 +329,7 @@ dissector_change_uint
dissector_delete_string
dissector_delete_uint
dissector_dump_decodes
+dissector_dump_heur_decodes
dissector_filter_list DATA
dissector_get_string_handle
dissector_get_uint_handle
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)
{
diff --git a/epan/packet.h b/epan/packet.h
index f355ce5dba..c3caf370c0 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -458,6 +458,11 @@ extern void ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_ethertype,
extern void dissector_dump_decodes(void);
/*
+ * For each heuristic dissector table, dump list of dissectors (filter_names) for that table
+ */
+extern void dissector_dump_heur_decodes(void);
+
+/*
* post dissectors are to be called by packet-frame.c after every other
* dissector has been called.
*/