Go to the documentation of this file.
57 #ifndef OPENSSL_HEADER_LHASH_INTERNAL_H
58 #define OPENSSL_HEADER_LHASH_INTERNAL_H
62 #if defined(__cplusplus)
134 int (*cmp_key)(
const void *
key,
156 void (*
func)(
void *,
void *),
159 #define DEFINE_LHASH_OF(type) \
160 DECLARE_LHASH_OF(type) \
162 typedef int (*lhash_##type##_cmp_func)(const type *, const type *); \
163 typedef uint32_t (*lhash_##type##_hash_func)(const type *); \
165 OPENSSL_INLINE int lh_##type##_call_cmp_func(lhash_cmp_func func, \
166 const void *a, const void *b) { \
167 return ((lhash_##type##_cmp_func)func)((const type *)a, (const type *)b); \
170 OPENSSL_INLINE uint32_t lh_##type##_call_hash_func(lhash_hash_func func, \
172 return ((lhash_##type##_hash_func)func)((const type *)a); \
175 OPENSSL_INLINE LHASH_OF(type) *lh_##type##_new( \
176 lhash_##type##_hash_func hash, lhash_##type##_cmp_func comp) { \
177 return (LHASH_OF(type) *)OPENSSL_lh_new((lhash_hash_func)hash, \
178 (lhash_cmp_func)comp); \
181 OPENSSL_INLINE void lh_##type##_free(LHASH_OF(type) *lh) { \
182 OPENSSL_lh_free((_LHASH *)lh); \
185 OPENSSL_INLINE size_t lh_##type##_num_items(const LHASH_OF(type) *lh) { \
186 return OPENSSL_lh_num_items((const _LHASH *)lh); \
189 OPENSSL_INLINE type *lh_##type##_retrieve(const LHASH_OF(type) *lh, \
190 const type *data) { \
191 return (type *)OPENSSL_lh_retrieve((const _LHASH *)lh, data, \
192 lh_##type##_call_hash_func, \
193 lh_##type##_call_cmp_func); \
197 int (*cmp_key)(const void *key, const type *value); \
199 } LHASH_CMP_KEY_##type; \
201 OPENSSL_INLINE int lh_##type##_call_cmp_key(const void *key, \
202 const void *value) { \
203 const LHASH_CMP_KEY_##type *cb = (const LHASH_CMP_KEY_##type *)key; \
204 return cb->cmp_key(cb->key, (const type *)value); \
207 OPENSSL_INLINE type *lh_##type##_retrieve_key( \
208 const LHASH_OF(type) *lh, const void *key, uint32_t key_hash, \
209 int (*cmp_key)(const void *key, const type *value)) { \
210 LHASH_CMP_KEY_##type cb = {cmp_key, key}; \
211 return (type *)OPENSSL_lh_retrieve_key((const _LHASH *)lh, &cb, key_hash, \
212 lh_##type##_call_cmp_key); \
215 OPENSSL_INLINE int lh_##type##_insert(LHASH_OF(type) *lh, type **old_data, \
217 void *old_data_void = NULL; \
218 int ret = OPENSSL_lh_insert((_LHASH *)lh, &old_data_void, data, \
219 lh_##type##_call_hash_func, \
220 lh_##type##_call_cmp_func); \
221 *old_data = (type *)old_data_void; \
225 OPENSSL_INLINE type *lh_##type##_delete(LHASH_OF(type) *lh, \
226 const type *data) { \
227 return (type *)OPENSSL_lh_delete((_LHASH *)lh, data, \
228 lh_##type##_call_hash_func, \
229 lh_##type##_call_cmp_func); \
233 void (*doall_arg)(type *, void *); \
235 } LHASH_DOALL_##type; \
237 OPENSSL_INLINE void lh_##type##_call_doall_arg(void *value, void *arg) { \
238 const LHASH_DOALL_##type *cb = (const LHASH_DOALL_##type *)arg; \
239 cb->doall_arg((type *)value, cb->arg); \
242 OPENSSL_INLINE void lh_##type##_doall_arg( \
243 LHASH_OF(type) *lh, void (*func)(type *, void *), void *arg) { \
244 LHASH_DOALL_##type cb = {func, arg}; \
245 OPENSSL_lh_doall_arg((_LHASH *)lh, lh_##type##_call_doall_arg, &cb); \
249 #if defined(__cplusplus)
253 #endif // OPENSSL_HEADER_LHASH_INTERNAL_H
OPENSSL_EXPORT void * OPENSSL_lh_retrieve(const _LHASH *lh, const void *data, lhash_hash_func_helper call_hash_func, lhash_cmp_func_helper call_cmp_func)
OPENSSL_EXPORT void OPENSSL_lh_doall_arg(_LHASH *lh, void(*func)(void *, void *), void *arg)
OPENSSL_EXPORT size_t OPENSSL_lh_num_items(const _LHASH *lh)
OPENSSL_EXPORT void * OPENSSL_lh_retrieve_key(const _LHASH *lh, const void *key, uint32_t key_hash, int(*cmp_key)(const void *key, const void *value))
OPENSSL_EXPORT void OPENSSL_lh_free(_LHASH *lh)
int(* lhash_cmp_func_helper)(lhash_cmp_func func, const void *a, const void *b)
OPENSSL_EXPORT int OPENSSL_lh_insert(_LHASH *lh, void **old_data, void *data, lhash_hash_func_helper call_hash_func, lhash_cmp_func_helper call_cmp_func)
uint32_t(* lhash_hash_func)(const void *a)
OPENSSL_EXPORT _LHASH * OPENSSL_lh_new(lhash_hash_func hash, lhash_cmp_func comp)
OPENSSL_EXPORT void * OPENSSL_lh_delete(_LHASH *lh, const void *data, lhash_hash_func_helper call_hash_func, lhash_cmp_func_helper call_cmp_func)
int(* lhash_cmp_func)(const void *a, const void *b)
uint32_t(* lhash_hash_func_helper)(lhash_hash_func func, const void *a)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:07