OpenVPN
|
Go to the source code of this file.
Data Structures | |
struct | hash_element |
struct | hash_bucket |
struct | hash |
struct | hash_iterator |
Macros | |
#define | hashsize(n) ((uint32_t)1<<(n)) |
#define | hashmask(n) (hashsize(n)-1) |
Functions | |
struct hash * | hash_init (const int n_buckets, const uint32_t iv, uint32_t(*hash_function)(const void *key, uint32_t iv), bool(*compare_function)(const void *key1, const void *key2)) |
void | hash_free (struct hash *hash) |
bool | hash_add (struct hash *hash, const void *key, void *value, bool replace) |
struct hash_element * | hash_lookup_fast (struct hash *hash, struct hash_bucket *bucket, const void *key, uint32_t hv) |
bool | hash_remove_fast (struct hash *hash, struct hash_bucket *bucket, const void *key, uint32_t hv) |
void | hash_remove_by_value (struct hash *hash, void *value) |
void | hash_iterator_init_range (struct hash *hash, struct hash_iterator *hi, int start_bucket, int end_bucket) |
void | hash_iterator_init (struct hash *hash, struct hash_iterator *iter) |
struct hash_element * | hash_iterator_next (struct hash_iterator *hi) |
void | hash_iterator_delete_element (struct hash_iterator *hi) |
void | hash_iterator_free (struct hash_iterator *hi) |
uint32_t | hash_func (const uint8_t *k, uint32_t length, uint32_t initval) |
static uint32_t | hash_value (const struct hash *hash, const void *key) |
static int | hash_n_elements (const struct hash *hash) |
static int | hash_n_buckets (const struct hash *hash) |
static struct hash_bucket * | hash_bucket (struct hash *hash, uint32_t hv) |
static void * | hash_lookup (struct hash *hash, const void *key) |
static void | hash_add_fast (struct hash *hash, struct hash_bucket *bucket, const void *key, uint32_t hv, void *value) |
static bool | hash_remove (struct hash *hash, const void *key) |
bool hash_add | ( | struct hash * | hash, |
const void * | key, | ||
void * | value, | ||
bool | replace | ||
) |
Definition at line 147 of file list.c.
References hash::buckets, hash_add_fast(), hash_lookup_fast(), hash_value(), hash::mask, and hash_element::value.
Referenced by multi_create_instance(), multi_process_float(), and test_list().
|
inlinestatic |
Definition at line 158 of file list.h.
References ALLOC_OBJ, hash_element::hash_value, hash_element::key, hash_bucket::list, hash::n_elements, hash_element::next, and hash_element::value.
Referenced by hash_add(), multi_create_instance_tcp(), multi_get_create_instance_udp(), and multi_learn_addr().
|
inlinestatic |
Definition at line 134 of file list.h.
References hash::buckets, and hash::mask.
Referenced by multi_create_instance_tcp(), multi_get_create_instance_udp(), multi_learn_addr(), and multi_process_float().
void hash_free | ( | struct hash * | hash | ) |
Definition at line 63 of file list.c.
References hash::buckets, hash_bucket::list, hash::n_buckets, and hash_element::next.
Referenced by multi_uninit(), and test_list().
uint32_t hash_func | ( | const uint8_t * | k, |
uint32_t | length, | ||
uint32_t | initval | ||
) |
Definition at line 408 of file list.c.
References mix.
Referenced by mroute_addr_hash_function(), and word_hash_function().
struct hash* hash_init | ( | const int | n_buckets, |
const uint32_t | iv, | ||
uint32_t(*)(const void *key, uint32_t iv) | hash_function, | ||
bool(*)(const void *key1, const void *key2) | compare_function | ||
) |
Definition at line 38 of file list.c.
References adjust_power_of_2(), ALLOC_ARRAY, ALLOC_OBJ_CLEAR, ASSERT, hash::buckets, hash::compare_function, hash::hash_function, hash::iv, hash_bucket::list, hash::mask, and hash::n_buckets.
Referenced by multi_init(), and test_list().
void hash_iterator_delete_element | ( | struct hash_iterator * | hi | ) |
Definition at line 321 of file list.c.
References ASSERT, hash_iterator::bucket_marked, hash_element::key, and hash_iterator::last.
Referenced by check_stale_routes(), hash_remove_by_value(), multi_delete_dup(), and multi_reap_range().
void hash_iterator_free | ( | struct hash_iterator * | hi | ) |
Definition at line 283 of file list.c.
References hash_iterator_unlock().
Referenced by check_stale_routes(), hash_lookup_by_value(), hash_remove_by_value(), management_callback_kill_by_addr(), management_callback_kill_by_cn(), multi_bcast(), multi_delete_dup(), multi_print_status(), multi_push_restart_schedule_exit(), multi_reap_range(), multi_uninit(), and test_list().
void hash_iterator_init | ( | struct hash * | hash, |
struct hash_iterator * | iter | ||
) |
Definition at line 246 of file list.c.
References hash_iterator_init_range(), and hash::n_buckets.
Referenced by hash_lookup_by_value(), hash_remove_by_value(), management_callback_kill_by_addr(), management_callback_kill_by_cn(), multi_bcast(), multi_delete_dup(), multi_print_status(), multi_push_restart_schedule_exit(), and multi_uninit().
void hash_iterator_init_range | ( | struct hash * | hash, |
struct hash_iterator * | hi, | ||
int | start_bucket, | ||
int | end_bucket | ||
) |
Definition at line 223 of file list.c.
References ASSERT, hash_iterator::bucket, hash_iterator::bucket_index, hash_iterator::bucket_index_end, hash_iterator::bucket_index_start, hash_iterator::bucket_marked, hash_iterator::elem, hash_iterator::hash, hash_iterator::last, and hash::n_buckets.
Referenced by check_stale_routes(), hash_iterator_init(), multi_reap_range(), and test_list().
struct hash_element* hash_iterator_next | ( | struct hash_iterator * | hi | ) |
Definition at line 289 of file list.c.
References hash_iterator::bucket_index, hash_iterator::bucket_index_end, hash::buckets, hash_iterator::elem, hash_iterator::hash, hash_iterator_advance(), hash_iterator_lock(), hash_iterator_unlock(), and hash_bucket::list.
Referenced by check_stale_routes(), hash_lookup_by_value(), hash_remove_by_value(), management_callback_kill_by_addr(), management_callback_kill_by_cn(), multi_bcast(), multi_delete_dup(), multi_print_status(), multi_push_restart_schedule_exit(), multi_reap_range(), multi_uninit(), and test_list().
|
inlinestatic |
Definition at line 140 of file list.h.
References hash::buckets, hash_lookup_fast(), hash_value(), hash::mask, and hash_element::value.
Referenced by lookup_by_cid(), multi_get_instance_by_virtual_addr(), and test_list().
struct hash_element* hash_lookup_fast | ( | struct hash * | hash, |
struct hash_bucket * | bucket, | ||
const void * | key, | ||
uint32_t | hv | ||
) |
Definition at line 83 of file list.c.
References hash::compare_function, hash_element::hash_value, hash_element::key, hash_bucket::list, and hash_element::next.
Referenced by hash_add(), hash_lookup(), multi_create_instance_tcp(), multi_get_create_instance_udp(), multi_learn_addr(), and multi_process_float().
|
inlinestatic |
Definition at line 128 of file list.h.
References hash::n_buckets.
Referenced by check_stale_routes(), multi_reap_process_dowork(), multi_reap_range(), and test_list().
|
inlinestatic |
Definition at line 122 of file list.h.
References hash::n_elements.
Referenced by multi_create_instance(), multi_print_status(), and test_list().
|
inlinestatic |
Definition at line 176 of file list.h.
References hash::buckets, hash_remove_fast(), hash_value(), and hash::mask.
Referenced by multi_close_instance(), multi_process_float(), and test_list().
void hash_remove_by_value | ( | struct hash * | hash, |
void * | value | ||
) |
Definition at line 175 of file list.c.
References hash_iterator_delete_element(), hash_iterator_free(), hash_iterator_init(), hash_iterator_next(), and hash_element::value.
Referenced by test_list().
bool hash_remove_fast | ( | struct hash * | hash, |
struct hash_bucket * | bucket, | ||
const void * | key, | ||
uint32_t | hv | ||
) |
Definition at line 114 of file list.c.
References hash::compare_function, hash_element::hash_value, hash_element::key, hash_bucket::list, hash::n_elements, and hash_element::next.
Referenced by hash_remove().
|
inlinestatic |
Definition at line 116 of file list.h.
References hash::hash_function, hash::iv, and hash_element::key.
Referenced by hash_add(), hash_lookup(), hash_remove(), multi_create_instance_tcp(), multi_get_create_instance_udp(), multi_learn_addr(), and multi_process_float().