Wireshark  4.3.0
The Wireshark network protocol analyzer
wmem_tree.h
Go to the documentation of this file.
1 
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
44 G_GNUC_MALLOC;
45 
58 WS_DLL_PUBLIC
60 wmem_tree_new_autoreset(wmem_allocator_t *metadata_scope, wmem_allocator_t *data_scope)
61 G_GNUC_MALLOC;
62 
64 WS_DLL_PUBLIC
65 void
66 wmem_tree_destroy(wmem_tree_t *tree, bool free_keys, bool free_values);
67 
69 WS_DLL_PUBLIC
70 bool
72 
74 WS_DLL_PUBLIC
75 unsigned
77 
89 WS_DLL_PUBLIC
90 void
91 wmem_tree_insert32(wmem_tree_t *tree, uint32_t key, void *data);
92 
96 WS_DLL_PUBLIC
97 bool
98 wmem_tree_contains32(wmem_tree_t *tree, uint32_t key);
99 
103 WS_DLL_PUBLIC
104 void *
105 wmem_tree_lookup32(wmem_tree_t *tree, uint32_t key);
106 
111 WS_DLL_PUBLIC
112 void *
113 wmem_tree_lookup32_le(wmem_tree_t *tree, uint32_t key);
114 
119 WS_DLL_PUBLIC
120 void *
121 wmem_tree_remove32(wmem_tree_t *tree, uint32_t key);
122 
124 #define WMEM_TREE_STRING_NOCASE 0x00000001
132 WS_DLL_PUBLIC
133 void
134 wmem_tree_insert_string(wmem_tree_t *tree, const char* key, void *data,
135  uint32_t flags);
136 
140 WS_DLL_PUBLIC
141 void *
142 wmem_tree_lookup_string(wmem_tree_t* tree, const char* key, uint32_t flags);
143 
147 WS_DLL_PUBLIC
148 void *
149 wmem_tree_remove_string(wmem_tree_t* tree, const char* key, uint32_t flags);
150 
151 typedef struct _wmem_tree_key_t {
152  uint32_t length;
153  uint32_t *key;
155 
191 WS_DLL_PUBLIC
192 void
193 wmem_tree_insert32_array(wmem_tree_t *tree, wmem_tree_key_t *key, void *data);
194 
198 WS_DLL_PUBLIC
199 void *
201 
212 WS_DLL_PUBLIC
213 void *
215 
220 typedef bool (*wmem_foreach_func)(const void *key, void *value, void *userdata);
221 
222 
224 typedef void (*wmem_printer_func)(const void *data);
225 
226 
232 WS_DLL_PUBLIC
233 bool
235  void *user_data);
236 
237 
238 /* Accepts callbacks to print the key and/or data (both printers can be null) */
239 WS_DLL_PUBLIC
240 void
241 wmem_print_tree(wmem_tree_t *tree, wmem_printer_func key_printer, wmem_printer_func data_printer);
242 
246 #ifdef __cplusplus
247 }
248 #endif /* __cplusplus */
249 
250 #endif /* __WMEM_TREE_H__ */
251 
252 /*
253  * Editor modelines - https://www.wireshark.org/tools/modelines.html
254  *
255  * Local variables:
256  * c-basic-offset: 4
257  * tab-width: 8
258  * indent-tabs-mode: nil
259  * End:
260  *
261  * vi: set shiftwidth=4 tabstop=8 expandtab:
262  * :indentSize=4:tabSize=8:noTabs=true:
263  */
WS_DLL_PUBLIC void wmem_tree_insert_string(wmem_tree_t *tree, const char *key, void *data, uint32_t flags)
Definition: wmem_tree.c:626
WS_DLL_PUBLIC void * wmem_tree_lookup32_le(wmem_tree_t *tree, uint32_t key)
Definition: wmem_tree.c:549
WS_DLL_PUBLIC bool wmem_tree_is_empty(wmem_tree_t *tree)
Definition: wmem_tree.c:295
WS_DLL_PUBLIC void * wmem_tree_lookup32_array_le(wmem_tree_t *tree, wmem_tree_key_t *key)
Definition: wmem_tree.c:740
WS_DLL_PUBLIC wmem_tree_t * wmem_tree_new(wmem_allocator_t *allocator) G_GNUC_MALLOC
Definition: wmem_tree.c:196
WS_DLL_PUBLIC void wmem_tree_insert32(wmem_tree_t *tree, uint32_t key, void *data)
Definition: wmem_tree.c:496
WS_DLL_PUBLIC void * wmem_tree_remove_string(wmem_tree_t *tree, const char *key, uint32_t flags)
Definition: wmem_tree.c:657
void(* wmem_printer_func)(const void *data)
Definition: wmem_tree.h:224
WS_DLL_PUBLIC bool wmem_tree_contains32(wmem_tree_t *tree, uint32_t key)
Definition: wmem_tree.c:501
WS_DLL_PUBLIC unsigned wmem_tree_count(wmem_tree_t *tree)
Definition: wmem_tree.c:309
WS_DLL_PUBLIC void * wmem_tree_lookup32_array(wmem_tree_t *tree, wmem_tree_key_t *key)
Definition: wmem_tree.c:734
WS_DLL_PUBLIC void * wmem_tree_lookup32(wmem_tree_t *tree, uint32_t key)
Definition: wmem_tree.c:525
WS_DLL_PUBLIC void * wmem_tree_lookup_string(wmem_tree_t *tree, const char *key, uint32_t flags)
Definition: wmem_tree.c:643
WS_DLL_PUBLIC void wmem_tree_insert32_array(wmem_tree_t *tree, wmem_tree_key_t *key, void *data)
Definition: wmem_tree.c:674
WS_DLL_PUBLIC wmem_tree_t * wmem_tree_new_autoreset(wmem_allocator_t *metadata_scope, wmem_allocator_t *data_scope) G_GNUC_MALLOC
Definition: wmem_tree.c:235
WS_DLL_PUBLIC bool wmem_tree_foreach(wmem_tree_t *tree, wmem_foreach_func callback, void *user_data)
Definition: wmem_tree.c:783
WS_DLL_PUBLIC void wmem_tree_destroy(wmem_tree_t *tree, bool free_keys, bool free_values)
Definition: wmem_tree.c:282
bool(* wmem_foreach_func)(const void *key, void *value, void *userdata)
Definition: wmem_tree.h:220
WS_DLL_PUBLIC void * wmem_tree_remove32(wmem_tree_t *tree, uint32_t key)
Definition: wmem_tree.c:615
Definition: wmem_allocator.h:27
Definition: wmem_tree.h:151
uint32_t length
Definition: wmem_tree.h:152
Definition: wmem_tree-int.h:48