2 * Definitions for the Wireshark Memory Manager Doubly-Linked List
3 * Copyright 2012, Evan Huus <eapache@gmail.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __WMEM_LIST_H__
13 #define __WMEM_LIST_H__
18 #include "wmem_core.h"
22 #endif /* __cplusplus */
26 * @defgroup wmem-list Doubly-Linked List
28 * A doubly-linked list implementation on top of wmem.
34 struct _wmem_list_frame_t
;
36 typedef struct _wmem_list_t wmem_list_t
;
37 typedef struct _wmem_list_frame_t wmem_list_frame_t
;
41 wmem_list_count(const wmem_list_t
*list
);
45 wmem_list_head(const wmem_list_t
*list
);
49 wmem_list_tail(const wmem_list_t
*list
);
53 wmem_list_frame_next(const wmem_list_frame_t
*frame
);
57 wmem_list_frame_prev(const wmem_list_frame_t
*frame
);
61 wmem_list_frame_data(const wmem_list_frame_t
*frame
);
65 wmem_list_remove(wmem_list_t
*list
, void *data
);
69 wmem_list_remove_frame(wmem_list_t
*list
, wmem_list_frame_t
*frame
);
72 * Linear search, search is O(n)
76 wmem_list_find(wmem_list_t
*list
, const void *data
);
80 wmem_list_find_custom(wmem_list_t
*list
, const void *data
, GCompareFunc func
);
84 wmem_list_prepend(wmem_list_t
*list
, void *data
);
88 wmem_list_append(wmem_list_t
*list
, void *data
);
92 wmem_list_insert_sorted(wmem_list_t
*list
, void* data
, GCompareFunc func
);
95 * Appender Insertion (start search from the tail)
99 wmem_list_append_sorted(wmem_list_t
*list
, void* data
, GCompareFunc func
);
104 wmem_list_new(wmem_allocator_t
*allocator
)
109 wmem_list_foreach(wmem_list_t
*list
, GFunc foreach_func
, void * user_data
);
113 wmem_destroy_list(wmem_list_t
*list
);
120 #endif /* __cplusplus */
122 #endif /* __WMEM_LIST_H__ */
125 * Editor modelines - https://www.wireshark.org/tools/modelines.html
130 * indent-tabs-mode: nil
133 * vi: set shiftwidth=4 tabstop=8 expandtab:
134 * :indentSize=4:tabSize=8:noTabs=true: