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 45 of file list.h.

◆ hashsize

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

Definition at line 44 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 
)
static

◆ hash_free()

void hash_free ( struct hash hash)

◆ hash_func()

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

Definition at line 590 of file list.c.

References dummy(), and mix.

Referenced by hash_iterator_delete_element(), mroute_addr_hash_function(), and set_common_name().

◆ 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

◆ hash_n_elements()

static int hash_n_elements ( const struct hash hash)
inlinestatic

Definition at line 131 of file list.h.

References hash::n_elements.

Referenced by hash_iterator_delete_element(), multi_create_instance(), and multi_print_status().

◆ hash_remove()

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

◆ 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