regen pidl all: rm epan/dissectors/pidl/*-stamp; pushd epan/dissectors/pidl/ && make...
[wireshark-sm.git] / wsutil / wmem / wmem_tree-int.h
blob977590b1b904b41f54c5e1a461c0050c1002f64e
1 /** @file
3 * Definitions for the Wireshark Memory Manager Red-Black Tree
4 * Copyright 2013, Evan Huus <eapache@gmail.com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #ifndef __WMEM_TREE_INT_H__
14 #define __WMEM_TREE_INT_H__
16 #include "wmem_tree.h"
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
22 typedef enum _wmem_node_color_t {
23 WMEM_NODE_COLOR_RED,
24 WMEM_NODE_COLOR_BLACK
25 } wmem_node_color_t;
28 struct _wmem_tree_node_t {
29 struct _wmem_tree_node_t *parent;
30 struct _wmem_tree_node_t *left;
31 struct _wmem_tree_node_t *right;
33 const void *key;
34 void *data;
36 wmem_node_color_t color;
37 bool is_subtree;
38 bool is_removed;
43 typedef struct _wmem_tree_node_t wmem_tree_node_t;
46 typedef struct _wmem_itree_node_t wmem_itree_node_t;
48 struct _wmem_tree_t {
49 wmem_allocator_t *metadata_allocator;
50 wmem_allocator_t *data_allocator;
51 wmem_tree_node_t *root;
52 unsigned metadata_scope_cb_id;
53 unsigned data_scope_cb_id;
55 void (*post_rotation_cb)(wmem_tree_node_t *);
58 typedef int (*compare_func)(const void *a, const void *b);
60 wmem_tree_node_t *
61 wmem_tree_insert_node(wmem_tree_t *tree, const void *key, void *data, compare_func cmp);
63 typedef struct _wmem_range_t wmem_range_t;
65 bool
66 wmem_itree_range_overlap(const wmem_range_t *r1, const wmem_range_t *r2);
68 #ifdef __cplusplus
70 #endif /* __cplusplus */
72 #endif /* __WMEM_TREE__INTERNALS_H__ */
75 * Editor modelines - https://www.wireshark.org/tools/modelines.html
77 * Local variables:
78 * c-basic-offset: 4
79 * tab-width: 8
80 * indent-tabs-mode: nil
81 * End:
83 * vi: set shiftwidth=4 tabstop=8 expandtab:
84 * :indentSize=4:tabSize=8:noTabs=true: