OpenVPN
list.c File Reference
#include "syshead.h"
#include "integer.h"
#include "list.h"
#include "crypto.h"
Include dependency graph for list.c:

Go to the source code of this file.

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)
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)
bool hash_add (struct hash *hash, const void *key, void *value, bool replace)
void hash_remove_by_value (struct hash *hash, const 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, uint32_t start_bucket, uint32_t 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_element * hash_iterator_next (struct hash_iterator *hi)
void hash_iterator_delete_element (struct hash_iterator *hi)

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

void hash_iterator_advance ( struct hash_iterator * hi)
inlinestatic

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

◆ hash_iterator_init()

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

◆ hash_iterator_init_range()

◆ hash_iterator_lock()

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

Definition at line 242 of file list.c.

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

Referenced by hash_iterator_next().

◆ hash_iterator_next()

◆ hash_iterator_unlock()

void hash_iterator_unlock ( struct hash_iterator * hi)
inlinestatic

◆ hash_lookup_fast()

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

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

Definition at line 184 of file list.c.

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

Referenced by hash_iterator_unlock().