Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
wmem_map.h
1 /* wmem_map.h
2  * Definitions for the Wireshark Memory Manager Hash Map
3  * Copyright 2014, Evan Huus <eapache@gmail.com>
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
12 #ifndef __WMEM_MAP_H__
13 #define __WMEM_MAP_H__
14 
15 #include <glib.h>
16 
17 #include "wmem_core.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif /* __cplusplus */
22 
36 struct _wmem_map_t;
37 typedef struct _wmem_map_t wmem_map_t;
38 
55 WS_DLL_PUBLIC
56 wmem_map_t *
58  GHashFunc hash_func, GEqualFunc eql_func)
59 G_GNUC_MALLOC;
60 
73 WS_DLL_PUBLIC
74 wmem_map_t *
76  GHashFunc hash_func, GEqualFunc eql_func)
77 G_GNUC_MALLOC;
78 
86 WS_DLL_PUBLIC
87 void *
88 wmem_map_insert(wmem_map_t *map, const void *key, void *value);
89 
96 WS_DLL_PUBLIC
97 gboolean
98 wmem_map_contains(wmem_map_t *map, const void *key);
99 
106 WS_DLL_PUBLIC
107 void *
108 wmem_map_lookup(wmem_map_t *map, const void *key);
109 
119 WS_DLL_PUBLIC
120 gboolean
121 wmem_map_lookup_extended(wmem_map_t *map, const void *key, const void **orig_key, void **value);
122 
130 WS_DLL_PUBLIC
131 void *
132 wmem_map_remove(wmem_map_t *map, const void *key);
133 
141 WS_DLL_PUBLIC
142 gboolean
143 wmem_map_steal(wmem_map_t *map, const void *key);
144 
151 WS_DLL_PUBLIC
153 wmem_map_get_keys(wmem_allocator_t *list_allocator, wmem_map_t *map);
154 
163 WS_DLL_PUBLIC
164 void
165 wmem_map_foreach(wmem_map_t *map, GHFunc foreach_func, gpointer user_data);
166 
172 WS_DLL_PUBLIC
173 guint
175 
186 WS_DLL_PUBLIC
187 guint32
188 wmem_strong_hash(const guint8 *buf, const size_t len);
189 
193 WS_DLL_PUBLIC
194 guint
195 wmem_str_hash(gconstpointer key);
196 
200 WS_DLL_PUBLIC
201 guint
202 wmem_int64_hash(gconstpointer key);
203 
207 WS_DLL_PUBLIC
208 guint
209 wmem_double_hash(gconstpointer key);
210 
214 #ifdef __cplusplus
215 }
216 #endif /* __cplusplus */
217 
218 #endif /* __WMEM_MAP_H__ */
219 
220 /*
221  * Editor modelines - http://www.wireshark.org/tools/modelines.html
222  *
223  * Local variables:
224  * c-basic-offset: 4
225  * tab-width: 8
226  * indent-tabs-mode: nil
227  * End:
228  *
229  * vi: set shiftwidth=4 tabstop=8 expandtab:
230  * :indentSize=4:tabSize=8:noTabs=true:
231  */
WS_DLL_PUBLIC wmem_map_t * wmem_map_new(wmem_allocator_t *allocator, GHashFunc hash_func, GEqualFunc eql_func) G_GNUC_MALLOC
Definition: wmem_map.c:88
WS_DLL_PUBLIC void * wmem_map_remove(wmem_map_t *map, const void *key)
Definition: wmem_map.c:308
WS_DLL_PUBLIC void * wmem_map_insert(wmem_map_t *map, const void *key, void *value)
Definition: wmem_map.c:187
WS_DLL_PUBLIC guint wmem_map_size(wmem_map_t *map)
Definition: wmem_map.c:412
WS_DLL_PUBLIC wmem_map_t * wmem_map_new_autoreset(wmem_allocator_t *master, wmem_allocator_t *slave, GHashFunc hash_func, GEqualFunc eql_func) G_GNUC_MALLOC
Definition: wmem_map.c:134
Definition: wmem_map.c:44
WS_DLL_PUBLIC guint wmem_str_hash(gconstpointer key)
Definition: wmem_map.c:459
WS_DLL_PUBLIC gboolean wmem_map_lookup_extended(wmem_map_t *map, const void *key, const void **orig_key, void **value)
Definition: wmem_map.c:278
WS_DLL_PUBLIC guint wmem_double_hash(gconstpointer key)
Definition: wmem_map.c:471
WS_DLL_PUBLIC gboolean wmem_map_steal(wmem_map_t *map, const void *key)
Definition: wmem_map.c:340
WS_DLL_PUBLIC void wmem_map_foreach(wmem_map_t *map, GHFunc foreach_func, gpointer user_data)
Definition: wmem_map.c:392
WS_DLL_PUBLIC guint32 wmem_strong_hash(const guint8 *buf, const size_t len)
Definition: wmem_map.c:423
WS_DLL_PUBLIC wmem_list_t * wmem_map_get_keys(wmem_allocator_t *list_allocator, wmem_map_t *map)
Definition: wmem_map.c:369
Definition: wmem_allocator.h:26
WS_DLL_PUBLIC void * wmem_map_lookup(wmem_map_t *map, const void *key)
Definition: wmem_map.c:254
Definition: wmem_list.c:23
WS_DLL_PUBLIC guint wmem_int64_hash(gconstpointer key)
Definition: wmem_map.c:465
WS_DLL_PUBLIC gboolean wmem_map_contains(wmem_map_t *map, const void *key)
Definition: wmem_map.c:230