API参考
载入中...
搜索中...
未找到
bsl_hash_list.h
1/*
2 * This file is part of the openHiTLS project.
3 *
4 * openHiTLS is licensed under the Mulan PSL v2.
5 * You can use this software according to the terms and conditions of the Mulan PSL v2.
6 * You may obtain a copy of Mulan PSL v2 at:
7 *
8 * http://license.coscl.org.cn/MulanPSL2
9 *
10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13 * See the Mulan PSL v2 for more details.
14 */
15
20
21#ifndef BSL_HASH_LIST_H
22#define BSL_HASH_LIST_H
23
24#include "hitls_build.h"
25#ifdef HITLS_BSL_HASH
26
27#include <stdint.h>
28#include <stdbool.h>
29#include <stddef.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
44typedef void *(*ListDupFunc)(void *ptr, size_t size);
45
54typedef void (*ListFreeFunc)(void *ptr);
55
67typedef bool (*ListMatchFunc)(const void *node, uintptr_t data);
68
86typedef int32_t (*ListKeyCmpFunc)(uintptr_t key1, uintptr_t key2);
87
92typedef struct {
93 ListDupFunc dupFunc;
94 ListFreeFunc freeFunc;
95} ListDupFreeFuncPair;
96
101typedef struct BslListSt BSL_List;
102
107typedef struct BslListNodeSt *BSL_ListIterator;
108
124int32_t BSL_ListInit(BSL_List *list, const ListDupFreeFuncPair *dataFunc);
125
134int32_t BSL_ListClear(BSL_List *list);
135
144int32_t BSL_ListDeinit(BSL_List *list);
145
154bool BSL_ListIsEmpty(const BSL_List *list);
155
163size_t BSL_ListSize(const BSL_List *list);
164
174int32_t BSL_ListPushFront(BSL_List *list, uintptr_t userData, size_t userDataSize);
175
185int32_t BSL_ListPushBack(BSL_List *list, uintptr_t userData, size_t userDataSize);
186
197int32_t BSL_ListPopFront(BSL_List *list);
198
209int32_t BSL_ListPopBack(BSL_List *list);
210
222uintptr_t BSL_ListFront(const BSL_List *list);
223
234uintptr_t BSL_ListBack(const BSL_List *list);
235
243BSL_ListIterator BSL_ListIterBegin(const BSL_List *list);
244
253BSL_ListIterator BSL_ListIterEnd(BSL_List *list);
254
266BSL_ListIterator BSL_ListIterPrev(const BSL_List *list, const BSL_ListIterator it);
267
279BSL_ListIterator BSL_ListIterNext(const BSL_List *list, const BSL_ListIterator it);
280
291int32_t BSL_ListInsert(BSL_List *list, const BSL_ListIterator it, uintptr_t userData, size_t userDataSize);
292
307BSL_ListIterator BSL_ListIterErase(BSL_List *list, BSL_ListIterator it);
308
319uintptr_t BSL_ListIterData(const BSL_ListIterator it);
320
341BSL_ListIterator BSL_ListIterFind(BSL_List *list, ListKeyCmpFunc iterCmpFunc, uintptr_t data);
342
343#ifdef __cplusplus
344}
345#endif
346
347#endif /* HITLS_BSL_HASH */
348
349#endif // BSL_HASH_LIST_H