OpenVPN
list.h File Reference
#include "basic.h"
#include "buffer.h"
Include dependency graph for list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hash_element
struct  hash_bucket
struct  hash
struct  hash_iterator

Macros

#define HASH_KEY_LEN   16

Functions

struct hash * hash_init (const uint32_t n_buckets, uint64_t(*hash_function)(const void *key, const uint8_t hash_key[HASH_KEY_LEN]), 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, uint64_t hv)
bool hash_remove_fast (struct hash *hash, struct hash_bucket *bucket, const void *key, uint64_t hv)
void hash_remove_by_value (struct hash *hash, const void *value)
void hash_iterator_init_range (struct hash *hash, struct hash_iterator *hi, uint32_t start_bucket, uint32_t 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)
static uint64_t hash_value (const struct hash *hash, const void *key)
static uint32_t hash_n_elements (const struct hash *hash)
static uint32_t hash_n_buckets (const struct hash *hash)
static struct hash_bucket * hash_bucket (struct hash *hash, uint64_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, uint64_t hv, void *value)
static bool hash_remove (struct hash *hash, const void *key)

Macro Definition Documentation

◆ HASH_KEY_LEN

#define HASH_KEY_LEN   16

Function Documentation

◆ hash_add()

bool hash_add ( struct hash * hash,
const void * key,
void * value,
bool replace )

◆ hash_add_fast()

void hash_add_fast ( struct hash * hash,
struct hash_bucket * bucket,
const void * key,
uint64_t hv,
void * value )
inlinestatic

◆ hash_bucket()

struct hash_bucket * hash_bucket ( struct hash * hash,
uint64_t hv )
inlinestatic

◆ hash_free()

void hash_free ( struct hash * hash)

Definition at line 62 of file list.c.

References hash::buckets, hash_bucket::list, hash::n_buckets, and hash_element::next.

Referenced by multi_uninit(), test_list(), and test_sid_hash_list().

◆ hash_init()

struct hash * hash_init ( const uint32_t n_buckets,
uint64_t(* hash_function )(const void *key, const uint8_t hash_key[HASH_KEY_LEN]),
bool(* compare_function )(const void *key1, const void *key2) )

◆ hash_iterator_delete_element()

void hash_iterator_delete_element ( struct hash_iterator * hi)

◆ hash_iterator_free()

◆ hash_iterator_init()

void hash_iterator_init ( struct hash * hash,
struct hash_iterator * iter )

◆ hash_iterator_init_range()

◆ hash_iterator_next()

◆ hash_lookup()

void * hash_lookup ( struct hash * hash,
const void * key )
inlinestatic

◆ hash_lookup_fast()

◆ hash_n_buckets()

uint32_t hash_n_buckets ( const struct hash * hash)
inlinestatic

Definition at line 119 of file list.h.

References hash::n_buckets.

Referenced by check_stale_routes(), multi_reap_all(), multi_reap_process_dowork(), and test_list().

◆ hash_n_elements()

uint32_t hash_n_elements ( const struct hash * hash)
inlinestatic

Definition at line 113 of file list.h.

References hash::n_elements.

Referenced by multi_print_status(), and test_list().

◆ hash_remove()

bool hash_remove ( struct hash * hash,
const void * key )
inlinestatic

Definition at line 164 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().

◆ hash_remove_by_value()

void hash_remove_by_value ( struct hash * hash,
const void * value )

◆ hash_remove_fast()

bool hash_remove_fast ( struct hash * hash,
struct hash_bucket * bucket,
const void * key,
uint64_t hv )

◆ hash_value()

uint64_t hash_value ( const struct hash * hash,
const void * key )
inlinestatic