Wireshark  4.3.0
The Wireshark network protocol analyzer
Typedefs | Enumerations | Functions

Typedefs

typedef enum _wmem_cb_event_t wmem_cb_event_t
 
typedef bool(* wmem_user_cb_t) (wmem_allocator_t *, wmem_cb_event_t, void *)
 

Enumerations

enum  _wmem_cb_event_t { WMEM_CB_FREE_EVENT , WMEM_CB_DESTROY_EVENT }
 

Functions

WS_DLL_PUBLIC unsigned wmem_register_callback (wmem_allocator_t *allocator, wmem_user_cb_t callback, void *user_data)
 
WS_DLL_PUBLIC void wmem_unregister_callback (wmem_allocator_t *allocator, unsigned id)
 

Detailed Description

User callbacks.

Typedef Documentation

◆ wmem_cb_event_t

The events that can trigger a callback.

◆ wmem_user_cb_t

typedef bool(* wmem_user_cb_t) (wmem_allocator_t *, wmem_cb_event_t, void *)

Function signature for registered user callbacks.

allocator The allocator that triggered this callback. event The event type that triggered this callback. user_data Whatever user_data was originally passed to the call to wmem_register_callback().

Returns
false to unregister the callback, true otherwise.

Enumeration Type Documentation

◆ _wmem_cb_event_t

The events that can trigger a callback.

Enumerator
WMEM_CB_FREE_EVENT 

wmem_free_all()

WMEM_CB_DESTROY_EVENT 

wmem_destroy_allocator()

Function Documentation

◆ wmem_register_callback()

WS_DLL_PUBLIC unsigned wmem_register_callback ( wmem_allocator_t allocator,
wmem_user_cb_t  callback,
void *  user_data 
)

Register a callback function with the given allocator pool.

Parameters
allocatorThe allocator with which to register the callback.
callbackThe function to be called as the callback.
user_dataAn arbitrary data pointer that is passed to the callback as a way to specify extra parameters or store extra data. Note that this pointer is not freed when a callback is finished, you have to do that yourself in the callback, or just allocate it in the appropriate wmem pool.
Returns
ID of this callback that can be passed back to wmem_unregister_callback().

◆ wmem_unregister_callback()

WS_DLL_PUBLIC void wmem_unregister_callback ( wmem_allocator_t allocator,
unsigned  id 
)

Unregister the callback function with the given ID.

Parameters
allocatorThe allocator from which to unregister the callback.
idThe callback id as returned from wmem_register_callback().