| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Typedefs | Functions
wmem_map.h File Reference
`#include <glib.h>`
`#include "wmem_core.h"`
`#include "wmem_list.h"`

Go to the source code of this file.

## Typedefs
typedef struct _wmem_map_t | wmem_map_t
| Opaque type representing a wmem-managed hash map.

## Functions
WS_DLL_PUBLIC wmem_map_t * | wmem_map_new (wmem_allocator_t *allocator, GHashFunc hash_func, GEqualFunc eql_func) G_GNUC_MALLOC
| Creates a map with the given allocator scope.
WS_DLL_PUBLIC wmem_map_t * | wmem_map_new_autoreset (wmem_allocator_t *metadata_scope, wmem_allocator_t *data_scope, GHashFunc hash_func, GEqualFunc eql_func) G_GNUC_MALLOC
| Creates a map with two allocator scopes.
WS_DLL_PUBLIC void * | wmem_map_insert (wmem_map_t *map, const void *key, void *value)
| Inserts a value into the map.
WS_DLL_PUBLIC bool | wmem_map_contains (const wmem_map_t *map, const void *key)
| Check if a value is in the map.
WS_DLL_PUBLIC void * | wmem_map_lookup (const wmem_map_t *map, const void *key)
| Lookup a value in the map.
WS_DLL_PUBLIC bool | wmem_map_lookup_extended (const wmem_map_t *map, const void *key, const void **orig_key, void **value)
| Lookup a value in the map, returning the key, value, and a boolean which is true if the key is found.
WS_DLL_PUBLIC void * | wmem_map_remove (wmem_map_t *map, const void *key)
| Remove a value from the map. If no value is stored at that key, nothing happens.
WS_DLL_PUBLIC bool | wmem_map_steal (wmem_map_t *map, const void *key)
| Remove a key and value from the map but does not destroy (free) them. If no value is stored at that key, nothing happens.
WS_DLL_PUBLIC wmem_list_t * | wmem_map_get_keys (wmem_allocator_t *list_allocator, const wmem_map_t *map)
| Retrieves a list of keys inside the map.
WS_DLL_PUBLIC void | wmem_map_foreach (const wmem_map_t *map, GHFunc foreach_func, void *user_data)
| Run a function against all key/value pairs in the map.
WS_DLL_PUBLIC unsigned | wmem_map_foreach_remove (wmem_map_t *map, GHRFunc foreach_func, void *user_data)
| Run a function against all key/value pairs in the map. If the function returns true, then the key/value pair is removed from the map.
WS_DLL_PUBLIC void * | wmem_map_find (const wmem_map_t *map, GHRFunc foreach_func, void *user_data)
| Run a function against all key/value pairs in the map until the function returns true, at which point the value of matching pair is returned. If no pair that matches the function is found, NULL is returned. The order of the calls is unpredictable, since it is based on the internal storage of data.
WS_DLL_PUBLIC unsigned | wmem_map_size (const wmem_map_t *map)
| Return the number of elements in the map.
WS_DLL_PUBLIC size_t | wmem_map_reserve (wmem_map_t *map, uint64_t capacity)
| Ensure that a certain number of elements can be stored in the wmem_map without having to grow the internal table.
WS_DLL_PUBLIC void | wmem_map_destroy (wmem_map_t *map, bool free_keys, bool free_values)
| Cleanup memory used by the map instead of waiting for the allocator pool to be freed or destroyed.
WS_DLL_PUBLIC uint32_t | wmem_strong_hash (const uint8_t *buf, const size_t len)
| Compute a strong hash value for an arbitrary sequence of bytes.
WS_DLL_PUBLIC unsigned | wmem_str_hash (const void *key)
| Secure hash function for string keys using wmem_strong_hash.
WS_DLL_PUBLIC unsigned | wmem_int64_hash (const void *key)
| Secure hash function for 64-bit integer keys using wmem_strong_hash.
WS_DLL_PUBLIC unsigned | wmem_double_hash (const void *key)
| Secure hash function for double-precision floating-point keys using wmem_strong_hash.

## Detailed Description

Definitions for the Wireshark Memory Manager Hash Map Copyright 2014, Evan Huus eapac.nosp@m.he@g.nosp@m.mail..nosp@m.com

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later