1 #ifndef ACL_HTABLE_INCLUDE_H 2 #define ACL_HTABLE_INCLUDE_H 9 #include "../thread/acl_thread.h" 86 #define ACL_HTABLE_FLAG_KEY_REUSE (1 << 0) 89 #define ACL_HTABLE_FLAG_USE_LOCK (1 << 1) 92 #define ACL_HTABLE_FLAG_MSLOOK (1 << 2) 95 #define ACL_HTABLE_FLAG_KEY_LOWER (1 << 3) 109 #define ACL_HTABLE_CTL_END 0 110 #define ACL_HTABLE_CTL_RWLOCK 1 111 #define ACL_HTABLE_CTL_HASH_FN 2 119 #define ACL_HTABLE_STAT_OK 0 120 #define ACL_HTABLE_STAT_INVAL 1 121 #define ACL_HTABLE_STAT_DUPLEX_KEY 2 141 const char *key,
void *value);
200 void (*callback)(
void *value,
void *arg),
void *arg);
211 void (*free_fn) (
void *));
212 #define acl_htable_delete_r acl_htable_delete 222 void (*free_fn) (
void *));
240 #define acl_htable_reset_r acl_htable_reset 250 #define acl_htable_walk_r acl_htable_walk 278 #define acl_htable_stat_r acl_htable_stat 290 #define ACL_HTABLE_ITER_KEY(iter) ((iter).ptr->key.c_key) 291 #define acl_htable_iter_key ACL_HTABLE_ITER_KEY 293 #define ACL_HTABLE_ITER_VALUE(iter) ((iter).ptr->value) 294 #define acl_htable_iter_value ACL_HTABLE_ITER_VALUE 325 #define ACL_HTABLE_FOREACH(iter, table_ptr) \ 327 for((iter).size = acl_htable_size((table_ptr)), (iter).i = 0, \ 328 (iter).h = acl_htable_data((table_ptr)); (iter).i < (iter).size; (iter).i++) \ 329 for ((iter).ptr = *(iter).h++; (iter).ptr; (iter).ptr = (iter).ptr->next) 330 #define ACL_HTABLE_FOREACH_REVERSE(iter, table_ptr) \ 332 for((iter).size = acl_htable_size((table_ptr)), (iter).i = (iter).size - 1, \ 333 (iter).h = acl_htable_data((table_ptr)) + (iter).i; (iter).i >= 0; (iter).i--) \ 334 for ((iter).ptr = *(iter).h--; (iter).ptr; (iter).ptr = (iter).ptr->next) 336 #define ACL_HTABLE_FOREACH(iter, table_ptr) \ 338 for((void) acl_htable_iter_head((table_ptr), &iter); \ 340 (void) acl_htable_iter_next(&iter)) 341 #define ACL_HTABLE_FOREACH_REVERSE(iter, table_ptr) \ 343 for((void) acl_htable_iter_tail((table_ptr), &iter); \ 345 (void) acl_htable_iter_prev(&iter)) 348 #define acl_htable_foreach ACL_HTABLE_FOREACH 349 #define acl_htable_foreach_reverse ACL_HTABLE_FOREACH_REVERSE ACL_API int acl_htable_delete(ACL_HTABLE *table, const char *key, void(*free_fn)(void *))
ACL_API int acl_htable_reset(ACL_HTABLE *table, void(*free_fn)(void *))
ACL_API ACL_HTABLE_INFO * acl_htable_locate(ACL_HTABLE *table, const char *key)
ACL_API ACL_HTABLE_INFO * acl_htable_enter(ACL_HTABLE *table, const char *key, void *value)
ACL_API const ACL_HTABLE_INFO * acl_htable_iter_prev(ACL_HTABLE_ITER *iter)
ACL_API const ACL_HTABLE_INFO * acl_htable_iter_head(ACL_HTABLE *table, ACL_HTABLE_ITER *iter)
HTTP_API void const char * name
ACL_API const ACL_HTABLE_INFO * acl_htable_iter_next(ACL_HTABLE_ITER *iter)
unsigned(* ACL_HASH_FN)(const void *buf, size_t len)
ACL_API int acl_htable_errno(ACL_HTABLE *table)
ACL_API ACL_HTABLE_INFO ** acl_htable_list(const ACL_HTABLE *table)
ACL_API void acl_htable_free(ACL_HTABLE *table, void(*free_fn)(void *))
ACL_API ACL_HTABLE_INFO ** acl_htable_data(ACL_HTABLE *table)
ACL_API void acl_htable_delete_entry(ACL_HTABLE *table, ACL_HTABLE_INFO *ht, void(*free_fn)(void *))
struct ACL_HTABLE_INFO * prev
ACL_API int acl_htable_locate_r(ACL_HTABLE *table, const char *key, void(*callback)(ACL_HTABLE_INFO *ht, void *arg), void *arg)
ACL_API int acl_htable_used(const ACL_HTABLE *table)
ACL_API void acl_htable_stat(const ACL_HTABLE *table)
ACL_API void acl_htable_walk(ACL_HTABLE *table, void(*walk_fn)(ACL_HTABLE_INFO *, void *), void *arg)
ACL_API const ACL_HTABLE_INFO * acl_htable_iter_tail(ACL_HTABLE *table, ACL_HTABLE_ITER *iter)
ACL_API void * acl_htable_find(ACL_HTABLE *table, const char *key)
struct ACL_HTABLE_ITER ACL_HTABLE_ITER
ACL_API ACL_HTABLE * acl_htable_create3(int size, unsigned int flag, ACL_SLICE_POOL *slice)
acl_pthread_mutex_t * rwlock
ACL_API int acl_htable_find_r(ACL_HTABLE *table, const char *key, void(*callback)(void *value, void *arg), void *arg)
ACL_API void acl_htable_ctl(ACL_HTABLE *table, int name,...)
ACL_API int acl_htable_enter_r(ACL_HTABLE *table, const char *key, void *value, void(*callback)(ACL_HTABLE_INFO *ht, void *arg), void *arg)
struct ACL_HTABLE_INFO * next
ACL_API void acl_htable_set_errno(ACL_HTABLE *table, int error)
ACL_API ACL_HTABLE * acl_htable_create(int size, unsigned int flag)
ACL_API int acl_htable_size(const ACL_HTABLE *table)