Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

wmem_tree.h
1 /* wmem_tree.h
2 * Definitions for the Wireshark Memory Manager Red-Black Tree
3 * Based on the red-black tree implementation in epan/emem.*
4 * Copyright 2013, Evan Huus <eapache@gmail.com>
5 *
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13 #ifndef __WMEM_TREE_H__
14 #define __WMEM_TREE_H__
15
16 #include "wmem_core.h"
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
21
36 struct _wmem_tree_t;
37 typedef struct _wmem_tree_t wmem_tree_t;
38
41 WS_DLL_PUBLIC
42 wmem_tree_t *
43 wmem_tree_new(wmem_allocator_t *allocator)
44 G_GNUC_MALLOC;
45
58 WS_DLL_PUBLIC
59 wmem_tree_t *
60 wmem_tree_new_autoreset(wmem_allocator_t *master, wmem_allocator_t *slave)
61 G_GNUC_MALLOC;
62
64 WS_DLL_PUBLIC
65 void
66 wmem_tree_destroy(wmem_tree_t *tree, gboolean free_keys, gboolean free_values);
67
69 WS_DLL_PUBLIC
70 gboolean
71 wmem_tree_is_empty(wmem_tree_t *tree);
72
74 WS_DLL_PUBLIC
75 guint
76 wmem_tree_count(wmem_tree_t* tree);
77
89 WS_DLL_PUBLIC
90 void
91 wmem_tree_insert32(wmem_tree_t *tree, guint32 key, void *data);
92
96 WS_DLL_PUBLIC
97 void *
98 wmem_tree_lookup32(wmem_tree_t *tree, guint32 key);
99
104 WS_DLL_PUBLIC
105 void *
106 wmem_tree_lookup32_le(wmem_tree_t *tree, guint32 key);
107
112 WS_DLL_PUBLIC
113 void *
114 wmem_tree_remove32(wmem_tree_t *tree, guint32 key);
115
117 #define WMEM_TREE_STRING_NOCASE 0x00000001
118
125 WS_DLL_PUBLIC
126 void
127 wmem_tree_insert_string(wmem_tree_t *tree, const gchar* key, void *data,
128 guint32 flags);
129
133 WS_DLL_PUBLIC
134 void *
135 wmem_tree_lookup_string(wmem_tree_t* tree, const gchar* key, guint32 flags);
136
140 WS_DLL_PUBLIC
141 void *
142 wmem_tree_remove_string(wmem_tree_t* tree, const gchar* key, guint32 flags);
143
144 typedef struct _wmem_tree_key_t {
145 guint32 length;
146 guint32 *key;
147 } wmem_tree_key_t;
148
184 WS_DLL_PUBLIC
185 void
186 wmem_tree_insert32_array(wmem_tree_t *tree, wmem_tree_key_t *key, void *data);
187
191 WS_DLL_PUBLIC
192 void *
193 wmem_tree_lookup32_array(wmem_tree_t *tree, wmem_tree_key_t *key);
194
205 WS_DLL_PUBLIC
206 void *
207 wmem_tree_lookup32_array_le(wmem_tree_t *tree, wmem_tree_key_t *key);
208
213 typedef gboolean (*wmem_foreach_func)(const void *key, void *value, void *userdata);
214
215
217 typedef void (*wmem_printer_func)(const void *data);
218
219
223 WS_DLL_PUBLIC
224 gboolean
225 wmem_tree_foreach(wmem_tree_t* tree, wmem_foreach_func callback,
226 void *user_data);
227
228
229 /* Accepts callbacks to print the key and/or data (both printers can be null) */
230 void
231 wmem_print_tree(wmem_tree_t *tree, wmem_printer_func key_printer, wmem_printer_func data_printer);
232
236 #ifdef __cplusplus
237 }
238 #endif /* __cplusplus */
239
240 #endif /* __WMEM_TREE_H__ */
241
242 /*
243 * Editor modelines - http://www.wireshark.org/tools/modelines.html
244 *
245 * Local variables:
246 * c-basic-offset: 4
247 * tab-width: 8
248 * indent-tabs-mode: nil
249 * End:
250 *
251 * vi: set shiftwidth=4 tabstop=8 expandtab:
252 * :indentSize=4:tabSize=8:noTabs=true:
253 */
_wmem_tree_t
Definition: wmem_tree-int.h:47
wmem_foreach_func
gboolean(* wmem_foreach_func)(const void *key, void *value, void *userdata)
Definition: wmem_tree.h:213
wmem_tree_remove32
WS_DLL_PUBLIC void * wmem_tree_remove32(wmem_tree_t *tree, guint32 key)
Definition: wmem_tree.c:582
wmem_tree_count
WS_DLL_PUBLIC guint wmem_tree_count(wmem_tree_t *tree)
Definition: wmem_tree.c:307
_wmem_tree_key_t::length
guint32 length
Definition: wmem_tree.h:145
wmem_tree_new
WS_DLL_PUBLIC wmem_tree_t * wmem_tree_new(wmem_allocator_t *allocator) G_GNUC_MALLOC
Definition: wmem_tree.c:198
wmem_tree_foreach
WS_DLL_PUBLIC gboolean wmem_tree_foreach(wmem_tree_t *tree, wmem_foreach_func callback, void *user_data)
Definition: wmem_tree.c:750
wmem_tree_is_empty
WS_DLL_PUBLIC gboolean wmem_tree_is_empty(wmem_tree_t *tree)
Definition: wmem_tree.c:293
wmem_tree_lookup32_array
WS_DLL_PUBLIC void * wmem_tree_lookup32_array(wmem_tree_t *tree, wmem_tree_key_t *key)
Definition: wmem_tree.c:701
wmem_tree_lookup32_le
WS_DLL_PUBLIC void * wmem_tree_lookup32_le(wmem_tree_t *tree, guint32 key)
Definition: wmem_tree.c:520
_wmem_tree_key_t
Definition: wmem_tree.h:144
wmem_printer_func
void(* wmem_printer_func)(const void *data)
Definition: wmem_tree.h:217
wmem_tree_destroy
WS_DLL_PUBLIC void wmem_tree_destroy(wmem_tree_t *tree, gboolean free_keys, gboolean free_values)
Definition: wmem_tree.c:284
wmem_tree_insert32_array
WS_DLL_PUBLIC void wmem_tree_insert32_array(wmem_tree_t *tree, wmem_tree_key_t *key, void *data)
Definition: wmem_tree.c:641
wmem_tree_lookup_string
WS_DLL_PUBLIC void * wmem_tree_lookup_string(wmem_tree_t *tree, const gchar *key, guint32 flags)
Definition: wmem_tree.c:610
_wmem_allocator_t
Definition: wmem_allocator.h:26
wmem_tree_new_autoreset
WS_DLL_PUBLIC wmem_tree_t * wmem_tree_new_autoreset(wmem_allocator_t *master, wmem_allocator_t *slave) G_GNUC_MALLOC
Definition: wmem_tree.c:237
wmem_tree_insert_string
WS_DLL_PUBLIC void wmem_tree_insert_string(wmem_tree_t *tree, const gchar *key, void *data, guint32 flags)
Definition: wmem_tree.c:593
wmem_tree_lookup32
WS_DLL_PUBLIC void * wmem_tree_lookup32(wmem_tree_t *tree, guint32 key)
Definition: wmem_tree.c:500
wmem_tree_lookup32_array_le
WS_DLL_PUBLIC void * wmem_tree_lookup32_array_le(wmem_tree_t *tree, wmem_tree_key_t *key)
Definition: wmem_tree.c:707
wmem_tree_remove_string
WS_DLL_PUBLIC void * wmem_tree_remove_string(wmem_tree_t *tree, const gchar *key, guint32 flags)
Definition: wmem_tree.c:624
wmem_tree_insert32
WS_DLL_PUBLIC void wmem_tree_insert32(wmem_tree_t *tree, guint32 key, void *data)
Definition: wmem_tree.c:494