OpenVPN
Macros | Functions
list.c File Reference
#include "syshead.h"
#include "integer.h"
#include "list.h"
#include "misc.h"
#include "memdbg.h"
Include dependency graph for list.c:

Go to the source code of this file.

Macros

#define mix(a, b, c)
 

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)
 
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)
 
bool hash_add (struct hash *hash, const void *key, void *value, bool replace)
 
void hash_remove_by_value (struct hash *hash, void *value)
 
static void hash_remove_marked (struct hash *hash, struct hash_bucket *bucket)
 
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 *hi)
 
static void hash_iterator_lock (struct hash_iterator *hi, struct hash_bucket *b)
 
static void hash_iterator_unlock (struct hash_iterator *hi)
 
static void hash_iterator_advance (struct hash_iterator *hi)
 
void hash_iterator_free (struct hash_iterator *hi)
 
struct hash_elementhash_iterator_next (struct hash_iterator *hi)
 
void hash_iterator_delete_element (struct hash_iterator *hi)
 
uint32_t hash_func (const uint8_t *k, uint32_t length, uint32_t initval)
 

Macro Definition Documentation

◆ mix

#define mix (   a,
  b,
 
)
Value:
{ \
a -= b; a -= c; a ^= (c>>13); \
b -= c; b -= a; b ^= (a<<8); \
c -= a; c -= b; c ^= (b>>13); \
a -= b; a -= c; a ^= (c>>12); \
b -= c; b -= a; b ^= (a<<16); \
c -= a; c -= b; c ^= (b>>5); \
a -= b; a -= c; a ^= (c>>3); \
b -= c; b -= a; b ^= (a<<10); \
c -= a; c -= b; c ^= (b>>15); \
}

Definition at line 573 of file list.c.

Function Documentation

◆ hash_add()

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

◆ 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_advance()

static void hash_iterator_advance ( struct hash_iterator hi)
inlinestatic

Definition at line 276 of file list.c.

References hash_iterator::elem, hash_iterator::last, and hash_element::next.

Referenced by hash_iterator_next().

◆ 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 hi 
)

◆ hash_iterator_init_range()

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

◆ hash_iterator_lock()

static void hash_iterator_lock ( struct hash_iterator hi,
struct hash_bucket b 
)
inlinestatic

Definition at line 253 of file list.c.

References hash_iterator::bucket, hash_iterator::bucket_marked, and hash_iterator::last.

Referenced by hash_iterator_next().

◆ hash_iterator_next()

struct hash_element* hash_iterator_next ( struct hash_iterator hi)

◆ hash_iterator_unlock()

static void hash_iterator_unlock ( struct hash_iterator hi)
inlinestatic

◆ hash_lookup_fast()

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

◆ 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_remove_marked()

static void hash_remove_marked ( struct hash hash,
struct hash_bucket bucket 
)
static

Definition at line 192 of file list.c.

References hash_element::key, hash_bucket::list, hash::n_elements, and hash_element::next.

Referenced by hash_iterator_unlock().