summaryrefslogtreecommitdiff
path: root/epan/packet.h
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-07-01 23:56:54 -0400
committerAnders Broman <a.broman58@gmail.com>2015-07-02 08:58:46 +0000
commitcc7dc0332ad061a457980febf62f0313788f28a9 (patch)
treedace87f1d77f34e94e6df91093d135eb45c8fc5d /epan/packet.h
parent987cf4cd167a4c950cf58479db5de17bd647d538 (diff)
downloadwireshark-cc7dc0332ad061a457980febf62f0313788f28a9.tar.gz
Add support for a "custom" dissector table. This allows for a "custom" (not UINT or string) key to register dissector handles.
This was designed for RPC dissectors, but probably has use elsewhere. Change-Id: I1bca6b50ba312129a0c4fad5cc3c18cd9297c217 Reviewed-on: https://code.wireshark.org/review/9455 Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/packet.h')
-rw-r--r--epan/packet.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/epan/packet.h b/epan/packet.h
index f4182bf4b4..846567e5ba 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -201,6 +201,13 @@ WS_DLL_PUBLIC void dissector_all_tables_foreach_table (DATFunc_table func,
WS_DLL_PUBLIC dissector_table_t register_dissector_table(const char *name,
const char *ui_name, const ftenum_t type, const int param);
+/*
+ * Similar to register_dissector_table, but with a "custom" hash function
+ * to store subdissectors.
+ */
+WS_DLL_PUBLIC dissector_table_t register_custom_dissector_table(const char *name,
+ const char *ui_name, GHashFunc hash_func, GEqualFunc key_equal_func);
+
/* Find a dissector table by table name. */
WS_DLL_PUBLIC dissector_table_t find_dissector_table(const char *name);
@@ -322,6 +329,21 @@ WS_DLL_PUBLIC dissector_handle_t dissector_get_string_handle(
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_string_handle(
const char *name, const gchar *string);
+/* Add an entry to a "custom" dissector table. */
+WS_DLL_PUBLIC void dissector_add_custom_table_handle(const char *name, void *pattern,
+ dissector_handle_t handle);
+
+/** Look for a given key in a given "custom" dissector table and, if found,
+ * return the current dissector handle for that key.
+ *
+ * @param[in] sub_dissectors Dissector table to search.
+ * @param[in] key Value to match, e.g. RPC key for its subdissectors
+ * @return The matching dissector handle on success, NULL if no match is found.
+ */
+WS_DLL_PUBLIC dissector_handle_t dissector_get_custom_table_handle(
+ dissector_table_t sub_dissectors, void *key);
+
+
/* Add a handle to the list of handles that *could* be used with this
table. That list is used by the "Decode As"/"-d" code in the UI. */
WS_DLL_PUBLIC void dissector_add_for_decode_as(const char *name,
@@ -482,6 +504,8 @@ WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector,
const int proto);
WS_DLL_PUBLIC dissector_handle_t new_create_dissector_handle(new_dissector_t dissector,
const int proto);
+WS_DLL_PUBLIC dissector_handle_t new_create_dissector_handle_with_name(new_dissector_t dissector,
+ const int proto, const char* name);
/** Call a dissector through a handle and if no dissector was found
* pass it over to the "data" dissector instead.