Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
wmem_interval_tree.h
1 /* wmem_interval_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 2015, Matthieu coudron <matthieu.coudron@lip6.fr>
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 #ifndef __WMEM_INTERVAL_TREE_H__
13 #define __WMEM_INTERVAL_TREE_H__
14 
15 #include "wmem_core.h"
16 #include "wmem_tree.h"
17 #include "wmem_list.h"
18 
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif /* __cplusplus */
23 
36 struct _wmem_tree_t;
37 typedef struct _wmem_tree_t wmem_itree_t;
38 
39 struct _wmem_range_t {
40  guint64 low; /* low is used as the key in the binary tree */
41  guint64 high; /* Max value of the range */
42  guint64 max_edge; /* max value among subtrees */
43 };
44 
45 WS_DLL_PUBLIC
47 wmem_itree_new(wmem_allocator_t *allocator)
48 G_GNUC_MALLOC;
49 
50 
52 WS_DLL_PUBLIC
53 gboolean
55 
56 
61 WS_DLL_PUBLIC
62 void
63 wmem_itree_insert(wmem_itree_t *tree, const guint64 low, const guint64 high, void *data);
64 
65 
66 /*
67  * Save results in a wmem_list with the scope passed as a parameter.
68  * wmem_list_t is always allocated even if there is no result
69  */
70 WS_DLL_PUBLIC
72 wmem_itree_find_intervals(wmem_itree_t *tree, wmem_allocator_t *allocator, guint64 low, guint64 high);
73 
74 
78 void
80 
84 #ifdef __cplusplus
85 }
86 #endif /* __cplusplus */
87 
88 #endif /* __WMEM_INTERVAL_TREE_H__ */
89 
90 /*
91  * Editor modelines - http://www.wireshark.org/tools/modelines.html
92  *
93  * Local variables:
94  * c-basic-offset: 4
95  * tab-width: 8
96  * indent-tabs-mode: nil
97  * End:
98  *
99  * vi: set shiftwidth=4 tabstop=8 expandtab:
100  * :indentSize=4:tabSize=8:noTabs=true:
101  */
Definition: wmem_tree-int.h:47
WS_DLL_PUBLIC gboolean wmem_itree_is_empty(wmem_itree_t *tree)
Definition: wmem_interval_tree.c:90
WS_DLL_PUBLIC void wmem_itree_insert(wmem_itree_t *tree, const guint64 low, const guint64 high, void *data)
Definition: wmem_interval_tree.c:111
Definition: wmem_allocator.h:26
Definition: wmem_interval_tree.h:39
Definition: wmem_list.c:23
void wmem_print_itree(wmem_itree_t *tree)
Definition: wmem_interval_tree.c:164