aboutsummaryrefslogtreecommitdiffstats
path: root/epan/packet.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2011-09-05 13:04:23 +0000
committerAnders Broman <anders.broman@ericsson.com>2011-09-05 13:04:23 +0000
commit377bfd19a0e9c1a4efda47ab177b0a513f236efb (patch)
treed28cbd961c583c70a5c2d24e3ccee7fc19605965 /epan/packet.c
parent8947dcb6559c9947fc07c3771783ccc1a4839e80 (diff)
List heuristic tables in Internals->Disscetor tables menu.
svn path=/trunk/; revision=38881
Diffstat (limited to 'epan/packet.c')
-rw-r--r--epan/packet.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/epan/packet.c b/epan/packet.c
index 50a0b0d13e..c6f0edfc90 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -1532,10 +1532,6 @@ get_dissector_table_base(const char *name)
static GHashTable *heur_dissector_lists = NULL;
-typedef struct {
- heur_dissector_t dissector;
- protocol_t *protocol;
-} heur_dtbl_entry_t;
/* Finds a heuristic dissector table by field name. */
static heur_dissector_list_t *
@@ -1691,6 +1687,38 @@ dissector_try_heuristic(heur_dissector_list_t sub_dissectors,
return status;
}
+/*
+ * Called for each entry in the table of all heuristic dissector tables.
+ */
+typedef struct heur_dissector_foreach_table_info {
+ gpointer caller_data;
+ DATFunc_heur_table caller_func;
+} heur_dissector_foreach_table_info_t;
+
+static void
+dissector_all_heur_tables_foreach_table_func (gpointer key, const gpointer value, const gpointer user_data)
+{
+ heur_dissector_foreach_table_info_t *info;
+
+ info = user_data;
+ (*info->caller_func)((gchar*)key, value, info->caller_data);
+}
+
+/*
+ * Walk all heuristic dissector tables calling a user supplied function on each
+ * table.
+ */
+void
+dissector_all_heur_tables_foreach_table (DATFunc_heur_table func,
+ gpointer user_data)
+{
+ heur_dissector_foreach_table_info_t info;
+
+ info.caller_data = user_data;
+ info.caller_func = func;
+ g_hash_table_foreach(heur_dissector_lists, dissector_all_heur_tables_foreach_table_func, &info);
+}
+
void
register_heur_dissector_list(const char *name, heur_dissector_list_t *sub_dissectors)
{