Added dissector_delete_all() to remove all entries from a dissector table.

svn path=/trunk/; revision=51859
This commit is contained in:
Stig Bjørlykke 2013-09-09 05:36:45 +00:00
parent e4025f4aba
commit 2b698e5c5f
2 changed files with 21 additions and 0 deletions

View File

@ -894,6 +894,24 @@ void dissector_delete_uint_range(const char *abbrev, range_t *range,
}
}
static gboolean
dissector_delete_all_check (gpointer key _U_, gpointer value, gpointer user_data)
{
dtbl_entry_t *dtbl_entry = value;
dissector_handle_t handle = user_data;
return (proto_get_id (dtbl_entry->current->protocol) == proto_get_id (handle->protocol));
}
/* Delete all entries from a dissector table. */
void dissector_delete_all(const char *name, dissector_handle_t handle)
{
dissector_table_t sub_dissectors = find_dissector_table(name);
g_assert (sub_dissectors);
g_hash_table_foreach_remove (sub_dissectors->hash_table, dissector_delete_all_check, handle);
}
/* Change the entry for a dissector in a uint dissector table
with a particular pattern to use a new dissector handle. */
void

View File

@ -188,6 +188,9 @@ WS_DLL_PUBLIC void dissector_delete_uint(const char *name, const guint32 pattern
WS_DLL_PUBLIC void dissector_delete_uint_range(const char *abbrev, range_t *range,
dissector_handle_t handle);
/* Delete all entries from a dissector table. */
WS_DLL_PUBLIC void dissector_delete_all(const char *name, dissector_handle_t handle);
/* Change the entry for a dissector in a uint dissector table
with a particular pattern to use a new dissector handle. */
WS_DLL_PUBLIC void dissector_change_uint(const char *abbrev, const guint32 pattern,