Asterisk - The Open Source Telephony Project
21.4.1
|
Hash table functions implementing astobj2 containers. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/astobj2.h"
#include "astobj2_private.h"
#include "astobj2_container_private.h"
#include "asterisk/dlinkedlists.h"
#include "asterisk/utils.h"
Go to the source code of this file.
Data Structures | |
struct | ao2_container_hash |
struct | hash_bucket |
struct | hash_bucket_node |
struct | hash_traversal_state |
struct | hash_traversal_state_check |
Functions | |
struct ao2_container * | __ao2_container_alloc_hash (unsigned int ao2_options, unsigned int container_options, unsigned int n_buckets, ao2_hash_fn *hash_fn, ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn, const char *tag, const char *file, int line, const char *func) |
struct ao2_container * | __ao2_container_alloc_list (unsigned int ao2_options, unsigned int container_options, ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn, const char *tag, const char *file, int line, const char *func) |
static struct ao2_container * | hash_ao2_alloc_empty_clone (struct ao2_container_hash *self, const char *tag, const char *file, int line, const char *func) |
static struct ao2_container * | hash_ao2_container_init (struct ao2_container_hash *self, unsigned int options, unsigned int n_buckets, ao2_hash_fn *hash_fn, ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn) |
Initialize a hash container with the desired number of buckets. More... | |
static void | hash_ao2_destroy (struct ao2_container_hash *self) |
static struct hash_bucket_node * | hash_ao2_find_first (struct ao2_container_hash *self, enum search_flags flags, void *arg, struct hash_traversal_state *state) |
static struct hash_bucket_node * | hash_ao2_find_next (struct ao2_container_hash *self, struct hash_traversal_state *state, struct hash_bucket_node *prev) |
static enum ao2_container_insert | hash_ao2_insert_node (struct ao2_container_hash *self, struct hash_bucket_node *node) |
static struct hash_bucket_node * | hash_ao2_iterator_next (struct ao2_container_hash *self, struct hash_bucket_node *node, enum ao2_iterator_flags flags) |
static struct hash_bucket_node * | hash_ao2_new_node (struct ao2_container_hash *self, void *obj_new, const char *tag, const char *file, int line, const char *func) |
static void | hash_ao2_node_destructor (void *v_doomed) |
static int | hash_zero (const void *user_obj, const int flags) |
always zero hash function More... | |
Variables | |
static const struct ao2_container_methods | v_table_hash |
Hash table functions implementing astobj2 containers.
Definition in file astobj2_hash.c.
|
static |
Initialize a hash container with the desired number of buckets.
self | Container to initialize. |
options | Container behaviour options (See enum ao2_container_opts) |
n_buckets | Number of buckets for hash |
hash_fn | Pointer to a function computing a hash value. |
sort_fn | Pointer to a sort function. |
cmp_fn | Pointer to a compare function used by ao2_find. |
Definition at line 1045 of file astobj2_hash.c.
References ast_atomic_fetchadd_int(), ao2_container::cmp_fn, hash_zero(), ao2_container::options, ao2_container::sort_fn, and v_table_hash.
|
static |
always zero hash function
it is convenient to have a hash function that always returns 0. This is basically used when we want to have a container that is a simple linked list.
0 |
Definition at line 1028 of file astobj2_hash.c.
Referenced by hash_ao2_container_init().
|
static |
Hash container virtual method table.
Definition at line 1002 of file astobj2_hash.c.
Referenced by hash_ao2_container_init().