Asterisk - The Open Source Telephony Project
18.5.0
|
Common, private definitions for astobj2 containers. More...
#include "asterisk/astobj2.h"
Go to the source code of this file.
Data Structures | |
struct | ao2_container |
Generic container type. More... | |
struct | ao2_container_methods |
struct | ao2_container_node |
Generic container node. More... | |
Macros | |
#define | __container_unlink_node(node, flags) __container_unlink_node_debug(node, flags, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | AO2_TRAVERSAL_STATE_SIZE 100 |
Typedefs | |
typedef struct ao2_container *(* | ao2_container_alloc_empty_clone_fn) (struct ao2_container *self, const char *tag, const char *file, int line, const char *func) |
Create an empty copy of this container. More... | |
typedef void(* | ao2_container_destroy_fn) (struct ao2_container *self) |
Destroy this container. More... | |
typedef void(* | ao2_container_display) (struct ao2_container *self, void *where, ao2_prnt_fn *prnt, ao2_prnt_obj_fn *prnt_obj) |
Display contents of the specified container. More... | |
typedef void(* | ao2_container_find_cleanup_fn) (void *v_state) |
Cleanup the container traversal state. More... | |
typedef struct ao2_container_node *(* | ao2_container_find_first_fn) (struct ao2_container *self, enum search_flags flags, void *arg, void *v_state) |
Find the first container node in a traversal. More... | |
typedef struct ao2_container_node *(* | ao2_container_find_next_fn) (struct ao2_container *self, void *v_state, struct ao2_container_node *prev) |
Find the next container node in a traversal. More... | |
typedef enum ao2_container_insert(* | ao2_container_insert_fn) (struct ao2_container *self, struct ao2_container_node *node) |
Insert a node into this container. More... | |
typedef int(* | ao2_container_integrity) (struct ao2_container *self) |
Perform an integrity check on the specified container. More... | |
typedef struct ao2_container_node *(* | ao2_container_new_node_fn) (struct ao2_container *self, void *obj_new, const char *tag, const char *file, int line, const char *func) |
Create a new container node. More... | |
typedef void(* | ao2_container_statistics) (struct ao2_container *self, void *where, ao2_prnt_fn *prnt) |
Display statistics of the specified container. More... | |
typedef struct ao2_container_node *(* | ao2_iterator_next_fn) (struct ao2_container *self, struct ao2_container_node *prev, enum ao2_iterator_flags flags) |
Find the next non-empty iteration node in the container. More... | |
typedef void(* | ao2_link_node_stat_fn) (struct ao2_container *container, struct ao2_container_node *node) |
typedef void(* | ao2_unlink_node_stat_fn) (struct ao2_container *container, struct ao2_container_node *node) |
Enumerations | |
enum | ao2_callback_type { AO2_CALLBACK_DEFAULT, AO2_CALLBACK_WITH_DATA } |
enum | ao2_container_insert { AO2_CONTAINER_INSERT_NODE_INSERTED, AO2_CONTAINER_INSERT_NODE_OBJ_REPLACED, AO2_CONTAINER_INSERT_NODE_REJECTED } |
enum | ao2_unlink_node_flags { AO2_UNLINK_NODE_UNLINK_OBJECT = (1 << 0), AO2_UNLINK_NODE_NOUNREF_OBJECT = (1 << 1), AO2_UNLINK_NODE_UNREF_NODE = (1 << 2), AO2_UNLINK_NODE_DEC_COUNT = (1 << 3) } |
Functions | |
int | __container_unlink_node_debug (struct ao2_container_node *node, uint32_t flags, const char *tag, const char *file, int line, const char *func) |
void | container_destruct (void *_c) |
int | container_init (void) |
Common, private definitions for astobj2 containers.
Definition in file astobj2_container_private.h.
#define __container_unlink_node | ( | node, | |
flags | |||
) | __container_unlink_node_debug(node, flags, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Definition at line 325 of file astobj2_container_private.h.
Referenced by hash_ao2_node_destructor(), and rb_ao2_node_destructor().
#define AO2_TRAVERSAL_STATE_SIZE 100 |
Allow enough room for container specific traversal state structs
Definition at line 60 of file astobj2_container_private.h.
Referenced by internal_ao2_traverse().
typedef struct ao2_container*(* ao2_container_alloc_empty_clone_fn) (struct ao2_container *self, const char *tag, const char *file, int line, const char *func) |
Create an empty copy of this container.
self | Container to operate upon. |
tag | used for debugging. |
file | Debug file name invoked from |
line | Debug line invoked from |
func | Debug function name invoked from |
empty-container | on success. |
NULL | on error. |
Definition at line 98 of file astobj2_container_private.h.
typedef void(* ao2_container_destroy_fn) (struct ao2_container *self) |
Destroy this container.
self | Container to operate upon. |
Definition at line 84 of file astobj2_container_private.h.
typedef void(* ao2_container_display) (struct ao2_container *self, void *where, ao2_prnt_fn *prnt, ao2_prnt_obj_fn *prnt_obj) |
Display contents of the specified container.
self | Container to dump. |
where | User data needed by prnt to determine where to put output. |
prnt | Print output callback function to use. |
prnt_obj | Callback function to print the given object's key. (NULL if not available) |
Definition at line 185 of file astobj2_container_private.h.
typedef void(* ao2_container_find_cleanup_fn) (void *v_state) |
Cleanup the container traversal state.
v_state | Traversal state to cleanup. |
Definition at line 158 of file astobj2_container_private.h.
typedef struct ao2_container_node*(* ao2_container_find_first_fn) (struct ao2_container *self, enum search_flags flags, void *arg, void *v_state) |
Find the first container node in a traversal.
self | Container to operate upon. |
flags | search_flags to control traversing the container |
arg | Comparison callback arg parameter. |
v_state | Traversal state to restart container traversal. |
node-ptr | of found node (Reffed). |
NULL | when no node found. |
Definition at line 136 of file astobj2_container_private.h.
typedef struct ao2_container_node*(* ao2_container_find_next_fn) (struct ao2_container *self, void *v_state, struct ao2_container_node *prev) |
Find the next container node in a traversal.
self | Container to operate upon. |
v_state | Traversal state to restart container traversal. |
prev | Previous node returned by the traversal search functions. The ref ownership is passed back to this function. |
node-ptr | of found node (Reffed). |
NULL | when no node found. |
Definition at line 149 of file astobj2_container_private.h.
typedef enum ao2_container_insert(* ao2_container_insert_fn) (struct ao2_container *self, struct ao2_container_node *node) |
Insert a node into this container.
self | Container to operate upon. |
node | Container node to insert into the container. |
Definition at line 123 of file astobj2_container_private.h.
typedef int(* ao2_container_integrity) (struct ao2_container *self) |
Perform an integrity check on the specified container.
self | Container to check integrity. |
0 | on success. |
-1 | on error. |
Definition at line 210 of file astobj2_container_private.h.
typedef struct ao2_container_node*(* ao2_container_new_node_fn) (struct ao2_container *self, void *obj_new, const char *tag, const char *file, int line, const char *func) |
Create a new container node.
self | Container to operate upon. |
obj_new | Object to put into the node. |
tag | used for debugging. |
file | Debug file name invoked from |
line | Debug line invoked from |
func | Debug function name invoked from |
initialized-node | on success. |
NULL | on error. |
Definition at line 113 of file astobj2_container_private.h.
typedef void(* ao2_container_statistics) (struct ao2_container *self, void *where, ao2_prnt_fn *prnt) |
Display statistics of the specified container.
self | Container to display statistics. |
where | User data needed by prnt to determine where to put output. |
prnt | Print output callback function to use. |
Definition at line 198 of file astobj2_container_private.h.
typedef struct ao2_container_node*(* ao2_iterator_next_fn) (struct ao2_container *self, struct ao2_container_node *prev, enum ao2_iterator_flags flags) |
Find the next non-empty iteration node in the container.
self | Container to operate upon. |
prev | Previous node returned by the iterator. |
flags | search_flags to control iterating the container. Only AO2_ITERATOR_DESCENDING is useful by the method. |
node | on success. |
NULL | on error or no more nodes in the container. |
Definition at line 173 of file astobj2_container_private.h.
typedef void(* ao2_link_node_stat_fn) (struct ao2_container *container, struct ao2_container_node *node) |
Definition at line 222 of file astobj2_container_private.h.
typedef void(* ao2_unlink_node_stat_fn) (struct ao2_container *container, struct ao2_container_node *node) |
Definition at line 234 of file astobj2_container_private.h.
enum ao2_callback_type |
Enumerator | |
---|---|
AO2_CALLBACK_DEFAULT | |
AO2_CALLBACK_WITH_DATA |
Definition at line 45 of file astobj2_container_private.h.
enum ao2_container_insert |
Definition at line 50 of file astobj2_container_private.h.
Definition at line 33 of file astobj2_container_private.h.
int __container_unlink_node_debug | ( | struct ao2_container_node * | node, |
uint32_t | flags, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 39 of file astobj2_container.c.
References __ao2_ref(), ao2_ref, AO2_UNLINK_NODE_DEC_COUNT, AO2_UNLINK_NODE_NOUNREF_OBJECT, AO2_UNLINK_NODE_UNLINK_OBJECT, AO2_UNLINK_NODE_UNREF_NODE, ast_atomic_fetchadd_int(), container, ao2_container::elements, ao2_container_node::my_container, NULL, ao2_container_node::obj, and ao2_container::v_table.
Referenced by __ao2_iterator_next(), and internal_ao2_traverse().
void container_destruct | ( | void * | _c | ) |
Definition at line 635 of file astobj2_container.c.
References ao2_t_callback, ast_atomic_fetchadd_int(), ao2_container_methods::destroy, ao2_container::destroying, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, and ao2_container::v_table.
Referenced by __ao2_container_alloc_hash(), and __ao2_container_alloc_rbtree().
int container_init | ( | void | ) |
Definition at line 1183 of file astobj2_container.c.
References AO2_ALLOC_OPT_LOCK_RWLOCK, AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE, ao2_t_container_alloc_list, ARRAY_LEN, ast_cli_register_multiple, ast_register_cleanup(), and NULL.
Referenced by astobj2_init().