OpenVPN
Data Structures | Macros | Functions
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 hashsize(n)   ((uint32_t)1<<(n))
 
#define hashmask(n)   (hashsize(n)-1)
 

Functions

struct hashhash_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_elementhash_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_elementhash_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_buckethash_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)
 

Macro Definition Documentation

◆ hashmask

#define hashmask (   n)    (hashsize(n)-1)

Definition at line 43 of file list.h.

◆ hashsize

#define hashsize (   n)    ((uint32_t)1<<(n))

Definition at line 42 of file list.h.

Function Documentation

◆ hash_add()

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

◆ hash_add_fast()

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

◆ hash_bucket()

static struct hash_bucket* hash_bucket ( struct hash hash,
uint32_t  hv 
)
inlinestatic

◆ hash_free()

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().

◆ hash_func()

uint32_t hash_func ( const uint8_t *  k,
uint32_t  length,
uint32_t  initval 
)

Definition at line 587 of file list.c.

References mix.

Referenced by mroute_addr_hash_function().

◆ hash_init()

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 
)

◆ hash_iterator_delete_element()

void hash_iterator_delete_element ( struct hash_iterator hi)

◆ hash_iterator_free()

void hash_iterator_free ( struct hash_iterator hi)

◆ hash_iterator_init()

void hash_iterator_init ( struct hash hash,
struct hash_iterator iter 
)

◆ hash_iterator_init_range()

void hash_iterator_init_range ( struct hash hash,
struct hash_iterator hi,
int  start_bucket,
int  end_bucket 
)

◆ hash_iterator_next()

struct hash_element* hash_iterator_next ( struct hash_iterator hi)

◆ hash_lookup()

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

◆ hash_lookup_fast()

struct hash_element* hash_lookup_fast ( struct hash hash,
struct hash_bucket bucket,
const void *  key,
uint32_t  hv 
)

◆ hash_n_buckets()

static int hash_n_buckets ( const struct hash hash)
inlinestatic

Definition at line 135 of file list.h.

References hash::n_buckets.

Referenced by check_stale_routes(), multi_reap_process_dowork(), and multi_reap_range().

◆ hash_n_elements()

static int hash_n_elements ( const struct hash hash)
inlinestatic

Definition at line 129 of file list.h.

References hash::n_elements.

Referenced by multi_create_instance(), and multi_print_status().

◆ hash_remove()

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

Definition at line 183 of file list.h.

References hash::buckets, hash_remove_fast(), hash_value(), and hash::mask.

Referenced by multi_close_instance(), and multi_process_float().

◆ hash_remove_by_value()

void hash_remove_by_value ( struct hash hash,
void *  value 
)

◆ hash_remove_fast()

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

◆ hash_value()

static uint32_t hash_value ( const struct hash hash,
const void *  key 
)
inlinestatic