| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
wmem_tree-int.h
Go to the documentation of this file.
1
13#ifndef __WMEM_TREE_INT_H__
14#define __WMEM_TREE_INT_H__
15
16#include "wmem_tree.h"
17
18#ifdef __cplusplus
19extern "C" {
20#endif /* __cplusplus */
21
28 typedef enum _wmem_node_color_t {
29 WMEM_NODE_COLOR_RED,
30 WMEM_NODE_COLOR_BLACK
31} wmem_node_color_t;
32
33
41 struct _wmem_tree_node_t {
42 struct _wmem_tree_node_t *parent;
43 struct _wmem_tree_node_t *left;
44 struct _wmem_tree_node_t *right;
46 const void *key;
47 void *data;
49 wmem_node_color_t color;
50 bool is_subtree;
51 bool is_removed;
52};
53
61 typedef struct _wmem_tree_node_t wmem_tree_node_t;
62
70 typedef struct _wmem_itree_node_t wmem_itree_node_t;
71
72
81 struct _wmem_tree_t {
82 wmem_allocator_t *metadata_allocator;
83 wmem_allocator_t *data_allocator;
84 wmem_tree_node_t *root;
86 unsigned metadata_scope_cb_id;
87 unsigned data_scope_cb_id;
89 void (*post_rotation_cb)(wmem_tree_node_t *);
90};
91
106 typedef int (*compare_func)(const void *a, const void *b);
107
121 wmem_tree_node_t *
122 wmem_tree_insert_node(wmem_tree_t *tree, const void *key, void *data, compare_func cmp);
123
131 typedef struct _wmem_range_t wmem_range_t;
132
143bool
144 wmem_itree_range_overlap(const wmem_range_t *r1, const wmem_range_t *r2);
145
146#ifdef __cplusplus
147}
148#endif /* __cplusplus */
149
150#endif /* __WMEM_TREE__INTERNALS_H__ */
151
152/*
153 * Editor modelines - https://www.wireshark.org/tools/modelines.html
154 *
155 * Local variables:
156 * c-basic-offset: 4
157 * tab-width: 8
158 * indent-tabs-mode: nil
159 * End:
160 *
161 * vi: set shiftwidth=4 tabstop=8 expandtab:
162 * :indentSize=4:tabSize=8:noTabs=true:
163 */
_wmem_allocator_t
Internal memory allocator interface used by the wmem subsystem.
Definition wmem_allocator.h:34
_wmem_range_t
Represents a numeric range used in wmem's internal range tree.
Definition wmem_interval_tree.h:54
_wmem_tree_node_t
Internal node structure for a wmem balanced tree.
Definition wmem_tree-int.h:41
_wmem_tree_node_t::is_removed
bool is_removed
Definition wmem_tree-int.h:51
_wmem_tree_node_t::is_subtree
bool is_subtree
Definition wmem_tree-int.h:50
_wmem_tree_node_t::color
wmem_node_color_t color
Definition wmem_tree-int.h:49
_wmem_tree_node_t::left
struct _wmem_tree_node_t * left
Definition wmem_tree-int.h:43
_wmem_tree_node_t::parent
struct _wmem_tree_node_t * parent
Definition wmem_tree-int.h:42
_wmem_tree_node_t::key
const void * key
Definition wmem_tree-int.h:46
_wmem_tree_node_t::data
void * data
Definition wmem_tree-int.h:47
_wmem_tree_node_t::right
struct _wmem_tree_node_t * right
Definition wmem_tree-int.h:44
_wmem_tree_t
Internal representation of a wmem balanced tree.
Definition wmem_tree-int.h:81
_wmem_tree_t::data_scope_cb_id
unsigned data_scope_cb_id
Definition wmem_tree-int.h:87
_wmem_tree_t::post_rotation_cb
void(* post_rotation_cb)(wmem_tree_node_t *)
Definition wmem_tree-int.h:89
_wmem_tree_t::root
wmem_tree_node_t * root
Definition wmem_tree-int.h:84
_wmem_tree_t::data_allocator
wmem_allocator_t * data_allocator
Definition wmem_tree-int.h:83
_wmem_tree_t::metadata_scope_cb_id
unsigned metadata_scope_cb_id
Definition wmem_tree-int.h:86
_wmem_tree_t::metadata_allocator
wmem_allocator_t * metadata_allocator
Definition wmem_tree-int.h:82
compare_func
int(* compare_func)(const void *a, const void *b)
Function pointer type for comparing two values.
Definition wmem_tree-int.h:106
wmem_node_color_t
enum _wmem_node_color_t wmem_node_color_t
Enumeration of node colors used in red-black trees.
wmem_itree_node_t
struct _wmem_itree_node_t wmem_itree_node_t
Opaque type representing a node in an interval tree.
Definition wmem_tree-int.h:70
wmem_tree_insert_node
wmem_tree_node_t * wmem_tree_insert_node(wmem_tree_t *tree, const void *key, void *data, compare_func cmp)
Insert a key-value pair into a wmem red-black tree and return the new node.
Definition wmem_tree.c:608
wmem_itree_range_overlap
bool wmem_itree_range_overlap(const wmem_range_t *r1, const wmem_range_t *r2)
Check whether two 32-bit ranges overlap.
Definition wmem_interval_tree.c:77
_wmem_node_color_t
_wmem_node_color_t
Enumeration of node colors used in red-black trees.
Definition wmem_tree-int.h:28
WMEM_NODE_COLOR_BLACK
@ WMEM_NODE_COLOR_BLACK
Definition wmem_tree-int.h:30
WMEM_NODE_COLOR_RED
@ WMEM_NODE_COLOR_RED
Definition wmem_tree-int.h:29
wmem_tree.h