Provide create_dissector_handle_with_data

Provide function create_dissector_handle_with_data that creates an
anonymous handle that uses a dissector with callback argument.
This commit is contained in:
Joris Peeraer 2023-01-10 11:20:37 +01:00 committed by AndersBroman
parent f908bfa821
commit b782c599ae
2 changed files with 8 additions and 0 deletions

View File

@ -3296,6 +3296,12 @@ create_dissector_handle_with_name_and_description(dissector_t dissector,
return new_dissector_handle(DISSECTOR_TYPE_SIMPLE, dissector, proto, name, description, NULL);
}
dissector_handle_t
create_dissector_handle_with_data(dissector_cb_t dissector, const int proto, void* cb_data)
{
return new_dissector_handle(DISSECTOR_TYPE_CALLBACK, dissector, proto, NULL, NULL, cb_data);
}
/* Destroy an anonymous handle for a dissector. */
static void
destroy_dissector_handle(dissector_handle_t handle)

View File

@ -598,6 +598,8 @@ WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t d
const int proto, const char* name);
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name_and_description(dissector_t dissector,
const int proto, const char* name, const char* description);
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_data(dissector_cb_t dissector,
const int proto, void* cb_data);
/** Call a dissector through a handle and if no dissector was found
* pass it over to the "data" dissector instead.