Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
#include "asterisk/compat.h"
#include "asterisk/lock.h"
#include "asterisk/linkedlists.h"
#include "asterisk/inline_api.h"
Go to the source code of this file.
Data Structures | |
struct | ao2_global_obj |
struct | ao2_iterator |
When we need to walk through a container, we use an ao2_iterator to keep track of the current position. More... | |
struct | ao2_weakproxy |
This struct should be opaque, but it's size is needed. More... | |
Macros | |
#define | ao2_alloc_with_lockobj(data_size, destructor_fn, lockobj, tag) __ao2_alloc_with_lockobj((data_size), (destructor_fn), (lockobj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate and initialize an object with separate locking. More... | |
#define | ao2_callback_data(container, flags, cb_fn, arg, data) __ao2_callback_data((container), (flags), (cb_fn), (arg), (data), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_cleanup(obj) __ao2_cleanup_debug((obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | AO2_FIELD_CMP_FN(stype, fn_suffix, field, key_cmp, partial_key_cmp, transform, argconst) |
#define | AO2_FIELD_HASH_FN(stype, field, hash_fn) |
Creates a hash function for a structure field. More... | |
#define | AO2_FIELD_TRANSFORM_CMP_FN(cmp) ((cmp) ? 0 : CMP_MATCH) |
#define | AO2_FIELD_TRANSFORM_SORT_FN(cmp) (cmp) |
#define | ao2_find(container, arg, flags) __ao2_find((container), (arg), (flags), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_global_obj_ref(holder) __ao2_global_obj_ref(&holder, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
Get a reference to the object stored in the global holder. More... | |
#define | ao2_global_obj_release(holder) __ao2_global_obj_replace_unref(&holder, NULL, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
Release the ao2 object held in the global holder. More... | |
#define | ao2_global_obj_replace(holder, obj) __ao2_global_obj_replace(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
Replace an ao2 object in the global holder. More... | |
#define | ao2_global_obj_replace_unref(holder, obj) __ao2_global_obj_replace_unref(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
Replace an ao2 object in the global holder, throwing away any old object. More... | |
#define | AO2_GLOBAL_OBJ_STATIC(name) |
Define a global object holder to be used to hold an ao2 object, statically initialized. More... | |
#define | ao2_iterator_next(iter) __ao2_iterator_next((iter), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_lock(a) __ao2_lock(a, AO2_LOCK_REQ_MUTEX, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define | ao2_rdlock(a) __ao2_lock(a, AO2_LOCK_REQ_RDLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define | AO2_STRING_FIELD_CASE_CMP_FN(stype, field) AO2_FIELD_CMP_FN(stype, _cmp_fn, field, strcasecmp, strncasecmp, AO2_FIELD_TRANSFORM_CMP_FN,) |
#define | AO2_STRING_FIELD_CASE_HASH_FN(stype, field) AO2_FIELD_HASH_FN(stype, field, ast_str_case_hash) |
#define | AO2_STRING_FIELD_CASE_SORT_FN(stype, field) AO2_FIELD_CMP_FN(stype, _sort_fn, field, strcasecmp, strncasecmp, AO2_FIELD_TRANSFORM_SORT_FN, const) |
#define | AO2_STRING_FIELD_CMP_FN(stype, field) AO2_FIELD_CMP_FN(stype, _cmp_fn, field, strcmp, strncmp, AO2_FIELD_TRANSFORM_CMP_FN,) |
Creates a compare function for a structure string field. More... | |
#define | AO2_STRING_FIELD_HASH_FN(stype, field) AO2_FIELD_HASH_FN(stype, field, ast_str_hash) |
Creates a hash function for a structure string field. More... | |
#define | AO2_STRING_FIELD_SORT_FN(stype, field) AO2_FIELD_CMP_FN(stype, _sort_fn, field, strcmp, strncmp, AO2_FIELD_TRANSFORM_SORT_FN, const) |
Creates a sort function for a structure string field. More... | |
#define | ao2_t_callback_data(container, flags, cb_fn, arg, data, tag) __ao2_callback_data((container), (flags), (cb_fn), (arg), (data), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
ao2_callback_data() is a generic function that applies cb_fn() to all objects in a container. It is functionally identical to ao2_callback() except that instead of taking an ao2_callback_fn *, it takes an ao2_callback_data_fn *, and allows the caller to pass in arbitrary data. More... | |
#define | ao2_t_cleanup(obj, tag) __ao2_cleanup_debug((obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_find(container, arg, flags, tag) __ao2_find((container), (arg), (flags), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_global_obj_ref(holder, tag) __ao2_global_obj_ref(&holder, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
#define | ao2_t_global_obj_release(holder, tag) __ao2_global_obj_replace_unref(&holder, NULL, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
#define | ao2_t_global_obj_replace(holder, obj, tag) __ao2_global_obj_replace(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
#define | ao2_t_global_obj_replace_unref(holder, obj, tag) __ao2_global_obj_replace_unref(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
#define | ao2_t_iterator_next(iter, tag) __ao2_iterator_next((iter), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_trylock(a) __ao2_trylock(a, AO2_LOCK_REQ_MUTEX, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define | ao2_tryrdlock(a) __ao2_trylock(a, AO2_LOCK_REQ_RDLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define | ao2_trywrlock(a) __ao2_trylock(a, AO2_LOCK_REQ_WRLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define | ao2_unlock(a) __ao2_unlock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define | ao2_weakproxy_find(c, arg, flags, tag) __ao2_weakproxy_find(c, arg, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Perform an ao2_find on a container with ao2_weakproxy objects, returning the real object. More... | |
#define | ao2_wrlock(a) __ao2_lock(a, AO2_LOCK_REQ_WRLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define | OBJ_KEY OBJ_SEARCH_KEY |
#define | OBJ_PARTIAL_KEY OBJ_SEARCH_PARTIAL_KEY |
#define | OBJ_POINTER OBJ_SEARCH_OBJECT |
Typedefs | |
typedef int() | ao2_callback_data_fn(void *obj, void *arg, void *data, int flags) |
Type of a generic callback function. More... | |
typedef int() | ao2_callback_fn(void *obj, void *arg, int flags) |
Type of a generic callback function. More... | |
typedef void(* | ao2_destructor_fn) (void *vdoomed) |
Typedef for an object destructor. More... | |
typedef int() | ao2_hash_fn(const void *obj, int flags) |
typedef int() | ao2_sort_fn(const void *obj_left, const void *obj_right, int flags) |
Type of generic container sort function. More... | |
Functions | |
void * | __ao2_alloc_with_lockobj (size_t data_size, ao2_destructor_fn destructor_fn, void *lockobj, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result |
void * | __ao2_callback_data (struct ao2_container *c, enum search_flags flags, ao2_callback_data_fn *cb_fn, void *arg, void *data, const char *tag, const char *file, int line, const char *func) |
void | __ao2_cleanup (void *obj) |
void | __ao2_cleanup_debug (void *obj, const char *tag, const char *file, int line, const char *function) |
void * | __ao2_find (struct ao2_container *c, const void *arg, enum search_flags flags, const char *tag, const char *file, int line, const char *func) |
void * | __ao2_global_obj_ref (struct ao2_global_obj *holder, const char *tag, const char *file, int line, const char *func, const char *name) attribute_warn_unused_result |
void * | __ao2_global_obj_replace (struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name) attribute_warn_unused_result |
int | __ao2_global_obj_replace_unref (struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name) |
void * | __ao2_iterator_next (struct ao2_iterator *iter, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result |
int | __ao2_lock (void *a, enum ao2_lock_req lock_how, const char *file, const char *func, int line, const char *var) |
Lock an object. More... | |
int | __ao2_trylock (void *a, enum ao2_lock_req lock_how, const char *file, const char *func, int line, const char *var) |
Try locking– (don't block if fail) More... | |
int | __ao2_unlock (void *a, const char *file, const char *func, int line, const char *var) |
Unlock an object. More... | |
void * | __ao2_weakproxy_find (struct ao2_container *c, const void *arg, enum search_flags flags, const char *tag, const char *file, int line, const char *func) |
void | ao2_iterator_cleanup (struct ao2_iterator *iter) |
int | ao2_iterator_count (struct ao2_iterator *iter) |
Get a count of the iterated container objects. More... | |
void | ao2_iterator_destroy (struct ao2_iterator *iter) |
Destroy a container iterator. More... | |
struct ao2_iterator | ao2_iterator_init (struct ao2_container *c, int flags) attribute_warn_unused_result |
Create an iterator for a container. More... | |
void | ao2_iterator_restart (struct ao2_iterator *iter) |
Restart an iteration. More... | |
int | ao2_match_by_addr (void *obj, void *arg, int flags) |
A common ao2_callback is one that matches by address. More... | |
void * | ao2_object_get_lockaddr (void *obj) |
Return the mutex lock address of an object. More... | |
int | ao2_ref_and_lock (void *obj) |
Increment reference count on an object and lock it. More... | |
int | ao2_unlock_and_unref (void *obj) |
Unlock an object and decrement its reference count. More... | |
void * | __ao2_alloc (size_t data_size, ao2_destructor_fn destructor_fn, unsigned int options, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result |
#define | ao2_alloc(data_size, destructor_fn) __ao2_alloc((data_size), (destructor_fn), AO2_ALLOC_OPT_LOCK_MUTEX, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_alloc_options(data_size, destructor_fn, options) __ao2_alloc((data_size), (destructor_fn), (options), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_alloc(data_size, destructor_fn, debug_msg) __ao2_alloc((data_size), (destructor_fn), AO2_ALLOC_OPT_LOCK_MUTEX, (debug_msg), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_alloc_options(data_size, destructor_fn, options, debug_msg) __ao2_alloc((data_size), (destructor_fn), (options), (debug_msg), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate and initialize an object. More... | |
int | __ao2_ref (void *o, int delta, const char *tag, const char *file, int line, const char *func) |
#define | ao2_bump(obj) ao2_t_bump((obj), NULL) |
Bump refcount on an AO2 object by one, returning the object. More... | |
unsigned int | ao2_options_get (void *obj) |
Retrieve the ao2 options used to create the object. More... | |
#define | ao2_ref(o, delta) __ao2_ref((o), (delta), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Reference/unreference an object and return the old refcount. More... | |
#define | ao2_replace(dst, src) ao2_t_replace((dst), (src), NULL) |
Replace one object reference with another cleaning up the original. More... | |
#define | ao2_t_bump(obj, tag) |
#define | ao2_t_ref(o, delta, tag) __ao2_ref((o), (delta), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_replace(dst, src, tag) |
void * | __ao2_get_weakproxy (void *obj, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result |
void * | __ao2_weakproxy_alloc (size_t data_size, ao2_destructor_fn destructor_fn, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result |
void * | __ao2_weakproxy_get_object (void *weakproxy, int flags, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result |
int | __ao2_weakproxy_ref_object (void *weakproxy, int delta, int flags, const char *tag, const char *file, int line, const char *func) |
int | __ao2_weakproxy_set_object (void *weakproxy, void *obj, int flags, const char *tag, const char *file, int line, const char *func) |
#define | ao2_get_weakproxy(obj) __ao2_get_weakproxy(obj, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Get the weakproxy attached to obj. More... | |
#define | ao2_t_get_weakproxy(obj, tag) __ao2_get_weakproxy(obj, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_weakproxy_alloc(data_size, destructor_fn, tag) __ao2_weakproxy_alloc(data_size, destructor_fn, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_weakproxy_get_object(weakproxy, flags, tag) __ao2_weakproxy_get_object(weakproxy, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_weakproxy_ref_object(weakproxy, delta, flags, tag) |
#define | ao2_t_weakproxy_set_object(weakproxy, obj, flags, tag) __ao2_weakproxy_set_object(weakproxy, obj, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | AO2_WEAKPROXY() struct ao2_weakproxy __weakproxy##__LINE__ |
Macro which must be used at the beginning of weakproxy capable objects. More... | |
#define | ao2_weakproxy_alloc(data_size, destructor_fn) __ao2_weakproxy_alloc(data_size, destructor_fn, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate an ao2_weakproxy object. More... | |
#define | ao2_weakproxy_get_object(weakproxy, flags) __ao2_weakproxy_get_object(weakproxy, flags, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Get the object associated with weakproxy. More... | |
typedef void(* | ao2_weakproxy_notification_cb) (void *weakproxy, void *data) |
#define | ao2_weakproxy_ref_object(weakproxy, delta, flags) ao2_t_weakproxy_ref_object(weakproxy, delta, flags, NULL) |
Run ao2_t_ref on the object associated with weakproxy. More... | |
#define | ao2_weakproxy_set_object(weakproxy, obj, flags) __ao2_weakproxy_set_object(weakproxy, obj, flags, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Associate weakproxy with obj. More... | |
int | ao2_weakproxy_subscribe (void *weakproxy, ao2_weakproxy_notification_cb cb, void *data, int flags) |
Request notification when weakproxy points to NULL. More... | |
int | ao2_weakproxy_unsubscribe (void *weakproxy, ao2_weakproxy_notification_cb cb, void *data, int flags) |
Remove notification of real object destruction. More... | |
Object Containers | |
Here start declarations of containers. | |
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) attribute_warn_unused_result |
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) attribute_warn_unused_result |
struct ao2_container * | __ao2_container_alloc_rbtree (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) attribute_warn_unused_result |
struct ao2_container * | __ao2_container_clone (struct ao2_container *orig, enum search_flags flags, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result |
#define | ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn) __ao2_container_alloc_hash((ao2_options), (container_options), (n_buckets), (hash_fn), (sort_fn), (cmp_fn), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate and initialize a hash container with the desired number of buckets. More... | |
#define | ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn) __ao2_container_alloc_list((ao2_options), (container_options), (sort_fn), (cmp_fn), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate and initialize a list container. More... | |
#define | ao2_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn) __ao2_container_alloc_rbtree((ao2_options), (container_options), (sort_fn), (cmp_fn), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate and initialize a red-black tree container. More... | |
int | ao2_container_check (struct ao2_container *self, enum search_flags flags) |
Perform an integrity check on the specified container. More... | |
#define | ao2_container_clone(orig, flags) __ao2_container_clone(orig, flags, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Create a clone/copy of the given container. More... | |
int | ao2_container_count (struct ao2_container *c) |
Returns the number of elements in a container. More... | |
void | ao2_container_dump (struct ao2_container *self, enum search_flags flags, const char *name, void *where, ao2_prnt_fn *prnt, ao2_prnt_obj_fn *prnt_obj) |
Display contents of the specified container. More... | |
int | ao2_container_dup (struct ao2_container *dest, struct ao2_container *src, enum search_flags flags) |
Copy all object references in the src container into the dest container. More... | |
int | ao2_container_dup_weakproxy_objs (struct ao2_container *dest, struct ao2_container *src, enum search_flags flags) |
Copy object references associated with src container weakproxies into the dest container. More... | |
int | ao2_container_register (const char *name, struct ao2_container *self, ao2_prnt_obj_fn *prnt_obj) |
Register a container for CLI stats and integrity check. More... | |
void | ao2_container_stats (struct ao2_container *self, enum search_flags flags, const char *name, void *where, ao2_prnt_fn *prnt) |
Display statistics of the specified container. More... | |
void | ao2_container_unregister (const char *name) |
Unregister a container for CLI stats and integrity check. More... | |
typedef void() | ao2_prnt_fn(void *where, const char *fmt,...) |
Print output. More... | |
typedef void() | ao2_prnt_obj_fn(void *v_obj, void *where, ao2_prnt_fn *prnt) |
Print object key. More... | |
#define | ao2_t_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn, tag) __ao2_container_alloc_hash((ao2_options), (container_options), (n_buckets), (hash_fn), (sort_fn), (cmp_fn), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn, tag) __ao2_container_alloc_list((ao2_options), (container_options), (sort_fn), (cmp_fn), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn, tag) __ao2_container_alloc_rbtree((ao2_options), (container_options), (sort_fn), (cmp_fn), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_container_clone(orig, flags, tag) __ao2_container_clone(orig, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Object Management | |
Here we have functions to manage objects. We can use the functions below on any kind of object defined by the user. | |
int | __ao2_link (struct ao2_container *c, void *obj_new, int flags, const char *tag, const char *file, int line, const char *func) |
void * | __ao2_unlink (struct ao2_container *c, void *obj, int flags, const char *tag, const char *file, int line, const char *func) |
#define | ao2_link(container, obj) __ao2_link((container), (obj), 0, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Add an object to a container. More... | |
#define | ao2_link_flags(container, obj, flags) __ao2_link((container), (obj), (flags), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Add an object to a container. More... | |
#define | ao2_t_link(container, obj, tag) __ao2_link((container), (obj), 0, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_link_flags(container, obj, flags, tag) __ao2_link((container), (obj), (flags), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_unlink(container, obj, tag) __ao2_unlink((container), (obj), 0, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_t_unlink_flags(container, obj, flags, tag) __ao2_unlink((container), (obj), (flags), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | ao2_unlink(container, obj) __ao2_unlink((container), (obj), 0, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Remove an object from a container. More... | |
#define | ao2_unlink_flags(container, obj, flags) __ao2_unlink((container), (obj), (flags), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Remove an object from a container. More... | |
void * | __ao2_callback (struct ao2_container *c, enum search_flags flags, ao2_callback_fn *cb_fn, void *arg, const char *tag, const char *file, int line, const char *func) |
#define | ao2_callback(c, flags, cb_fn, arg) __ao2_callback((c), (flags), (cb_fn), (arg), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
ao2_callback() is a generic function that applies cb_fn() to all objects in a container, as described below. More... | |
#define | ao2_t_callback(c, flags, cb_fn, arg, tag) __ao2_callback((c), (flags), (cb_fn), (arg), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Object Model implementing objects and containers.
Definition in file astobj2.h.
#define ao2_alloc | ( | data_size, | |
destructor_fn | |||
) | __ao2_alloc((data_size), (destructor_fn), AO2_ALLOC_OPT_LOCK_MUTEX, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_alloc_options | ( | data_size, | |
destructor_fn, | |||
options | |||
) | __ao2_alloc((data_size), (destructor_fn), (options), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_alloc_with_lockobj | ( | data_size, | |
destructor_fn, | |||
lockobj, | |||
tag | |||
) | __ao2_alloc_with_lockobj((data_size), (destructor_fn), (lockobj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate and initialize an object with separate locking.
data_size | The sizeof() of the user-defined structure. |
destructor_fn | The destructor function (can be NULL) |
lockobj | A separate ao2 object that will provide locking. |
tag | An ao2 object debug tracing message. |
#define ao2_bump | ( | obj | ) | ao2_t_bump((obj), NULL) |
Bump refcount on an AO2 object by one, returning the object.
This is useful for inlining a ref bump, and you don't care about the ref count. Also NULL
safe, for even more convenience.
obj | AO2 object to bump the refcount on. |
#define ao2_callback | ( | c, | |
flags, | |||
cb_fn, | |||
arg | |||
) | __ao2_callback((c), (flags), (cb_fn), (arg), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
ao2_callback() is a generic function that applies cb_fn() to all objects in a container, as described below.
c | A pointer to the container to operate on. |
flags | A set of flags specifying the operation to perform, partially used by the container code, but also passed to the callback.
|
cb_fn | A function pointer, that will be called on all objects, to see if they match. This function returns CMP_MATCH if the object is matches the criteria; CMP_STOP if the traversal should immediately stop, or both (via bitwise ORing), if you find a match and want to end the traversal, and 0 if the object is not a match, but the traversal should continue. This is the function that is applied to each object traversed. Its arguments are: (void *obj, void *arg, int flags), where: obj is an object arg is the same as arg passed into ao2_callback flags is the same as flags passed into ao2_callback (flags are also used by ao2_callback). |
arg | passed to the callback. |
NULL | on failure or no matching object found. |
If the function returns any objects, their refcount is incremented, and the caller is in charge of decrementing them once done.
Typically, ao2_callback() is used for two purposes:
This function searches through a container and performs operations on objects according on flags passed. XXX describe better The comparison is done calling the compare function set implicitly. The arg pointer can be a pointer to an object or to a key, we can say this looking at flags value. If arg points to an object we will search for the object pointed by this value, otherwise we search for a key value. If the key is not unique we only find the first matching value.
The use of flags argument is the follow:
OBJ_UNLINK unlinks the object found OBJ_NODATA on match, do not return an object Callbacks use OBJ_NODATA as a default functions such as find() do OBJ_MULTIPLE return multiple matches Default is no. OBJ_SEARCH_OBJECT the pointer is to an object OBJ_SEARCH_KEY the pointer is to a search key OBJ_SEARCH_PARTIAL_KEY the pointer is to a partial search key
#define ao2_callback_data | ( | container, | |
flags, | |||
cb_fn, | |||
arg, | |||
data | |||
) | __ao2_callback_data((container), (flags), (cb_fn), (arg), (data), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_cleanup | ( | obj | ) | __ao2_cleanup_debug((obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_container_alloc_hash | ( | ao2_options, | |
container_options, | |||
n_buckets, | |||
hash_fn, | |||
sort_fn, | |||
cmp_fn | |||
) | __ao2_container_alloc_hash((ao2_options), (container_options), (n_buckets), (hash_fn), (sort_fn), (cmp_fn), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate and initialize a hash container with the desired number of buckets.
We allocate space for a struct astobj_container, struct container and the buckets[] array.
ao2_options | Container ao2 object options (See enum ao2_alloc_opts) |
container_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. (NULL if everyting goes in first bucket.) |
sort_fn | Pointer to a sort function. (NULL to not sort the buckets.) |
cmp_fn | Pointer to a compare function used by ao2_find. (NULL to match everything) |
#define ao2_container_alloc_list | ( | ao2_options, | |
container_options, | |||
sort_fn, | |||
cmp_fn | |||
) | __ao2_container_alloc_list((ao2_options), (container_options), (sort_fn), (cmp_fn), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate and initialize a list container.
ao2_options | Container ao2 object options (See enum ao2_alloc_opts) |
container_options | Container behaviour options (See enum ao2_container_opts) |
sort_fn | Pointer to a sort function. (NULL if list not sorted.) |
cmp_fn | Pointer to a compare function used by ao2_find. (NULL to match everything) |
#define ao2_container_alloc_rbtree | ( | ao2_options, | |
container_options, | |||
sort_fn, | |||
cmp_fn | |||
) | __ao2_container_alloc_rbtree((ao2_options), (container_options), (sort_fn), (cmp_fn), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate and initialize a red-black tree container.
ao2_options | Container ao2 object options (See enum ao2_alloc_opts) |
container_options | Container behaviour options (See enum ao2_container_opts) |
sort_fn | Pointer to a sort function. |
cmp_fn | Pointer to a compare function used by ao2_find. (NULL to match everything) |
#define ao2_container_clone | ( | orig, | |
flags | |||
) | __ao2_container_clone(orig, flags, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Create a clone/copy of the given container.
orig | Container to copy all object references from. |
flags | OBJ_NOLOCK if a lock is already held on the container. |
NULL | on error. |
#define AO2_FIELD_CMP_FN | ( | stype, | |
fn_suffix, | |||
field, | |||
key_cmp, | |||
partial_key_cmp, | |||
transform, | |||
argconst | |||
) |
#define AO2_FIELD_HASH_FN | ( | stype, | |
field, | |||
hash_fn | |||
) |
Creates a hash function for a structure field.
stype | The structure type |
field | The string field in the structure to hash |
hash_fn | Function which hashes the field |
AO2_FIELD_HASH_FN(mystruct, myfield, ast_str_hash) will produce a function named mystruct_hash_fn which hashes mystruct->myfield with ast_str_hash.
#define AO2_FIELD_TRANSFORM_CMP_FN | ( | cmp | ) | ((cmp) ? 0 : CMP_MATCH) |
#define ao2_find | ( | container, | |
arg, | |||
flags | |||
) | __ao2_find((container), (arg), (flags), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_get_weakproxy | ( | obj | ) | __ao2_get_weakproxy(obj, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_global_obj_ref | ( | holder | ) | __ao2_global_obj_ref(&holder, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
Get a reference to the object stored in the global holder.
holder | Global ao2 object holder. |
NULL | if no object available. |
#define ao2_global_obj_release | ( | holder | ) | __ao2_global_obj_replace_unref(&holder, NULL, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
Release the ao2 object held in the global holder.
holder | Global ao2 object holder. |
#define ao2_global_obj_replace | ( | holder, | |
obj | |||
) | __ao2_global_obj_replace(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
Replace an ao2 object in the global holder.
holder | Global ao2 object holder. |
obj | Object to put into the holder. Can be NULL. |
NULL | if no object available. |
#define ao2_global_obj_replace_unref | ( | holder, | |
obj | |||
) | __ao2_global_obj_replace_unref(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
Replace an ao2 object in the global holder, throwing away any old object.
holder | Global ao2 object holder. |
obj | Object to put into the holder. Can be NULL. |
0 | The global object was previously empty |
1 | The global object was not previously empty |
#define AO2_GLOBAL_OBJ_STATIC | ( | name | ) |
Define a global object holder to be used to hold an ao2 object, statically initialized.
name | This will be the name of the object holder. |
This macro creates a global object holder that can be used to hold an ao2 object accessible using the API. The structure is allocated and initialized to be empty.
Example usage:
This defines global_cfg, intended to hold an ao2 object accessible using an API.
#define ao2_iterator_next | ( | iter | ) | __ao2_iterator_next((iter), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_link | ( | container, | |
obj | |||
) | __ao2_link((container), (obj), 0, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Add an object to a container.
container | The container to operate on. |
obj | The object to be added. |
0 | on errors. |
1 | on success. |
This function inserts an object in a container according its key.
#define ao2_link_flags | ( | container, | |
obj, | |||
flags | |||
) | __ao2_link((container), (obj), (flags), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Add an object to a container.
container | The container to operate on. |
obj | The object to be added. |
flags | search_flags to control linking the object. (OBJ_NOLOCK) |
0 | on errors. |
1 | on success. |
This function inserts an object in a container according its key.
#define ao2_lock | ( | a | ) | __ao2_lock(a, AO2_LOCK_REQ_MUTEX, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define ao2_rdlock | ( | a | ) | __ao2_lock(a, AO2_LOCK_REQ_RDLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
Reference/unreference an object and return the old refcount.
o | A pointer to the object |
delta | Value to add to the reference counter. |
Increase/decrease the reference counter according the value of delta.
If the refcount goes to zero, the object is destroyed.
#define ao2_replace | ( | dst, | |
src | |||
) | ao2_t_replace((dst), (src), NULL) |
#define AO2_STRING_FIELD_CASE_CMP_FN | ( | stype, | |
field | |||
) | AO2_FIELD_CMP_FN(stype, _cmp_fn, field, strcasecmp, strncasecmp, AO2_FIELD_TRANSFORM_CMP_FN,) |
#define AO2_STRING_FIELD_CASE_HASH_FN | ( | stype, | |
field | |||
) | AO2_FIELD_HASH_FN(stype, field, ast_str_case_hash) |
#define AO2_STRING_FIELD_CASE_SORT_FN | ( | stype, | |
field | |||
) | AO2_FIELD_CMP_FN(stype, _sort_fn, field, strcasecmp, strncasecmp, AO2_FIELD_TRANSFORM_SORT_FN, const) |
#define AO2_STRING_FIELD_CMP_FN | ( | stype, | |
field | |||
) | AO2_FIELD_CMP_FN(stype, _cmp_fn, field, strcmp, strncmp, AO2_FIELD_TRANSFORM_CMP_FN,) |
Creates a compare function for a structure string field.
stype | The structure type |
field | The string field in the structure to compare |
AO2_STRING_FIELD_CMP_FN(mystruct, myfield) will produce a function named mystruct_cmp_fn which compares mystruct->myfield.
AO2_STRING_FIELD_CASE_CMP_FN(mystruct, myfield) would do the same except it performs case insensitive comparisons.
#define AO2_STRING_FIELD_HASH_FN | ( | stype, | |
field | |||
) | AO2_FIELD_HASH_FN(stype, field, ast_str_hash) |
Creates a hash function for a structure string field.
stype | The structure type |
field | The string field in the structure to hash |
AO2_STRING_FIELD_HASH_FN(mystruct, myfield) will produce a function named mystruct_hash_fn which hashes mystruct->myfield.
AO2_STRING_FIELD_HASH_FN(mystruct, myfield) would do the same except it uses the hash function which ignores case.
#define AO2_STRING_FIELD_SORT_FN | ( | stype, | |
field | |||
) | AO2_FIELD_CMP_FN(stype, _sort_fn, field, strcmp, strncmp, AO2_FIELD_TRANSFORM_SORT_FN, const) |
Creates a sort function for a structure string field.
stype | The structure type |
field | The string field in the structure to compare |
AO2_STRING_FIELD_SORT_FN(mystruct, myfield) will produce a function named mystruct_sort_fn which compares mystruct->myfield.
AO2_STRING_FIELD_CASE_SORT_FN(mystruct, myfield) would do the same except it performs case insensitive comparisons.
#define ao2_t_alloc | ( | data_size, | |
destructor_fn, | |||
debug_msg | |||
) | __ao2_alloc((data_size), (destructor_fn), AO2_ALLOC_OPT_LOCK_MUTEX, (debug_msg), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_alloc_options | ( | data_size, | |
destructor_fn, | |||
options, | |||
debug_msg | |||
) | __ao2_alloc((data_size), (destructor_fn), (options), (debug_msg), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate and initialize an object.
data_size | The sizeof() of the user-defined structure. |
destructor_fn | The destructor function (can be NULL) |
options | The ao2 object options (See enum ao2_alloc_opts) |
debug_msg | An ao2 object debug tracing message. |
Allocates a struct astobj2 with sufficient space for the user-defined structure.
#define ao2_t_callback | ( | c, | |
flags, | |||
cb_fn, | |||
arg, | |||
tag | |||
) | __ao2_callback((c), (flags), (cb_fn), (arg), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_callback_data | ( | container, | |
flags, | |||
cb_fn, | |||
arg, | |||
data, | |||
tag | |||
) | __ao2_callback_data((container), (flags), (cb_fn), (arg), (data), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
ao2_callback_data() is a generic function that applies cb_fn() to all objects in a container. It is functionally identical to ao2_callback() except that instead of taking an ao2_callback_fn *, it takes an ao2_callback_data_fn *, and allows the caller to pass in arbitrary data.
This call would be used instead of ao2_callback() when the caller needs to pass OBJ_SEARCH_OBJECT, OBJ_SEARCH_KEY, or OBJ_SEARCH_PARTIAL_KEY as part of the flags argument (which in turn requires passing in a known pointer type for 'arg') and also needs access to other non-global data to complete it's comparison or task.
See the documentation for ao2_callback() for argument descriptions.
#define ao2_t_cleanup | ( | obj, | |
tag | |||
) | __ao2_cleanup_debug((obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_container_alloc_hash | ( | ao2_options, | |
container_options, | |||
n_buckets, | |||
hash_fn, | |||
sort_fn, | |||
cmp_fn, | |||
tag | |||
) | __ao2_container_alloc_hash((ao2_options), (container_options), (n_buckets), (hash_fn), (sort_fn), (cmp_fn), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_container_alloc_list | ( | ao2_options, | |
container_options, | |||
sort_fn, | |||
cmp_fn, | |||
tag | |||
) | __ao2_container_alloc_list((ao2_options), (container_options), (sort_fn), (cmp_fn), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_container_alloc_rbtree | ( | ao2_options, | |
container_options, | |||
sort_fn, | |||
cmp_fn, | |||
tag | |||
) | __ao2_container_alloc_rbtree((ao2_options), (container_options), (sort_fn), (cmp_fn), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_container_clone | ( | orig, | |
flags, | |||
tag | |||
) | __ao2_container_clone(orig, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_find | ( | container, | |
arg, | |||
flags, | |||
tag | |||
) | __ao2_find((container), (arg), (flags), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
ao2_find() is a short hand for ao2_callback(c, flags, c->cmp_fn, arg) XXX possibly change order of arguments ?
#define ao2_t_get_weakproxy | ( | obj, | |
tag | |||
) | __ao2_get_weakproxy(obj, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_global_obj_ref | ( | holder, | |
tag | |||
) | __ao2_global_obj_ref(&holder, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
#define ao2_t_global_obj_release | ( | holder, | |
tag | |||
) | __ao2_global_obj_replace_unref(&holder, NULL, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
#define ao2_t_global_obj_replace | ( | holder, | |
obj, | |||
tag | |||
) | __ao2_global_obj_replace(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
#define ao2_t_global_obj_replace_unref | ( | holder, | |
obj, | |||
tag | |||
) | __ao2_global_obj_replace_unref(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder) |
#define ao2_t_iterator_next | ( | iter, | |
tag | |||
) | __ao2_iterator_next((iter), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_link | ( | container, | |
obj, | |||
tag | |||
) | __ao2_link((container), (obj), 0, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_link_flags | ( | container, | |
obj, | |||
flags, | |||
tag | |||
) | __ao2_link((container), (obj), (flags), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_ref | ( | o, | |
delta, | |||
tag | |||
) | __ao2_ref((o), (delta), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_unlink | ( | container, | |
obj, | |||
tag | |||
) | __ao2_unlink((container), (obj), 0, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_unlink_flags | ( | container, | |
obj, | |||
flags, | |||
tag | |||
) | __ao2_unlink((container), (obj), (flags), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_weakproxy_alloc | ( | data_size, | |
destructor_fn, | |||
tag | |||
) | __ao2_weakproxy_alloc(data_size, destructor_fn, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_weakproxy_get_object | ( | weakproxy, | |
flags, | |||
tag | |||
) | __ao2_weakproxy_get_object(weakproxy, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_t_weakproxy_ref_object | ( | weakproxy, | |
delta, | |||
flags, | |||
tag | |||
) |
#define ao2_t_weakproxy_set_object | ( | weakproxy, | |
obj, | |||
flags, | |||
tag | |||
) | __ao2_weakproxy_set_object(weakproxy, obj, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define ao2_trylock | ( | a | ) | __ao2_trylock(a, AO2_LOCK_REQ_MUTEX, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define ao2_tryrdlock | ( | a | ) | __ao2_trylock(a, AO2_LOCK_REQ_RDLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define ao2_trywrlock | ( | a | ) | __ao2_trylock(a, AO2_LOCK_REQ_WRLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define ao2_unlink | ( | container, | |
obj | |||
) | __ao2_unlink((container), (obj), 0, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Remove an object from a container.
container | The container to operate on. |
obj | The object to unlink. |
NULL | always |
#define ao2_unlink_flags | ( | container, | |
obj, | |||
flags | |||
) | __ao2_unlink((container), (obj), (flags), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Remove an object from a container.
container | The container to operate on. |
obj | The object to unlink. |
flags | search_flags to control unlinking the object. (OBJ_NOLOCK) |
NULL | always |
#define ao2_unlock | ( | a | ) | __ao2_unlock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define AO2_WEAKPROXY | ( | ) | struct ao2_weakproxy __weakproxy##__LINE__ |
#define ao2_weakproxy_alloc | ( | data_size, | |
destructor_fn | |||
) | __ao2_weakproxy_alloc(data_size, destructor_fn, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate an ao2_weakproxy object.
data_size | The sizeof() of the user-defined structure. |
destructor_fn | The destructor function (can be NULL) |
#define ao2_weakproxy_find | ( | c, | |
arg, | |||
flags, | |||
tag | |||
) | __ao2_weakproxy_find(c, arg, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Perform an ao2_find on a container with ao2_weakproxy objects, returning the real object.
#define ao2_weakproxy_get_object | ( | weakproxy, | |
flags | |||
) | __ao2_weakproxy_get_object(weakproxy, flags, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Get the object associated with weakproxy.
weakproxy | The weakproxy to read from. |
flags | OBJ_NOLOCK to avoid locking weakproxy. |
NULL | Either no object was set or the previously set object has been freed. |
#define ao2_weakproxy_ref_object | ( | weakproxy, | |
delta, | |||
flags | |||
) | ao2_t_weakproxy_ref_object(weakproxy, delta, flags, NULL) |
Run ao2_t_ref on the object associated with weakproxy.
weakproxy | The weakproxy to read from. |
delta | Value to add to the reference counter. |
flags | OBJ_NOLOCK to avoid locking weakproxy. |
-2 | weakproxy is not a valid ao2_weakproxy. |
-1 | weakproxy has no associated object. |
#define ao2_weakproxy_set_object | ( | weakproxy, | |
obj, | |||
flags | |||
) | __ao2_weakproxy_set_object(weakproxy, obj, flags, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Associate weakproxy with obj.
weakproxy | An object created by ao2_weakproxy_alloc. |
obj | An ao2 object not created by ao2_weakproxy_alloc. |
flags | OBJ_NOLOCK to avoid locking weakproxy. |
0 | Success |
-1 | Failure |
#define ao2_wrlock | ( | a | ) | __ao2_lock(a, AO2_LOCK_REQ_WRLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a) |
#define OBJ_KEY OBJ_SEARCH_KEY |
#define OBJ_PARTIAL_KEY OBJ_SEARCH_PARTIAL_KEY |
#define OBJ_POINTER OBJ_SEARCH_OBJECT |
typedef int() ao2_callback_data_fn(void *obj, void *arg, void *data, int flags) |
Type of a generic callback function.
obj | pointer to the (user-defined part) of an object. |
arg | callback argument from ao2_callback() |
data | arbitrary data from ao2_callback() |
flags | flags from ao2_callback() OBJ_SEARCH_OBJECT - if set, 'arg', is an object. OBJ_SEARCH_KEY - if set, 'arg', is a search key item that is not an object. OBJ_SEARCH_PARTIAL_KEY - if set, 'arg', is a partial search key item that is not an object. |
The return values are a combination of enum _cb_results. Callback functions are used to search or manipulate objects in a container.
typedef int() ao2_callback_fn(void *obj, void *arg, int flags) |
Type of a generic callback function.
obj | pointer to the (user-defined part) of an object. |
arg | callback argument from ao2_callback() |
flags | flags from ao2_callback() OBJ_SEARCH_OBJECT - if set, 'arg', is an object. OBJ_SEARCH_KEY - if set, 'arg', is a search key item that is not an object. OBJ_SEARCH_PARTIAL_KEY - if set, 'arg', is a partial search key item that is not an object. |
The return values are a combination of enum _cb_results. Callback functions are used to search or manipulate objects in a container.
typedef void(* ao2_destructor_fn) (void *vdoomed) |
typedef int() ao2_hash_fn(const void *obj, int flags) |
Type of a generic function to generate a hash value from an object.
obj | pointer to the (user-defined part) of an object. |
flags | flags from ao2_callback() OBJ_SEARCH_OBJECT - if set, 'obj', is an object. OBJ_SEARCH_KEY - if set, 'obj', is a search key item that is not an object. |
typedef void() ao2_prnt_fn(void *where, const char *fmt,...) |
typedef void() ao2_prnt_obj_fn(void *v_obj, void *where, ao2_prnt_fn *prnt) |
typedef int() ao2_sort_fn(const void *obj_left, const void *obj_right, int flags) |
Type of generic container sort function.
obj_left | pointer to the (user-defined part) of an object. |
obj_right | pointer to the (user-defined part) of an object. |
flags | flags from ao2_callback() OBJ_SEARCH_OBJECT - if set, 'obj_right', is an object. OBJ_SEARCH_KEY - if set, 'obj_right', is a search key item that is not an object. OBJ_SEARCH_PARTIAL_KEY - if set, 'obj_right', is a partial search key item that is not an object. |
negtaive | if obj_left < obj_right |
0 | if obj_left == obj_right |
positive | if obj_left > obj_right |
typedef void(* ao2_weakproxy_notification_cb) (void *weakproxy, void *data) |
enum _cb_results |
enum ao2_alloc_opts |
Options available when allocating an ao2 object.
Definition at line 361 of file astobj2.h.
enum ao2_container_opts |
Options available when allocating an ao2 container object.
Definition at line 1161 of file astobj2.h.
enum ao2_iterator_flags |
Flags that can be passed to ao2_iterator_init() to modify the behavior of the iterator.
Enumerator | |
---|---|
AO2_ITERATOR_DONTLOCK | Assume that the ao2_container is already locked.
|
AO2_ITERATOR_MALLOCD | Indicates that the iterator was dynamically allocated by astobj2 API and should be freed by ao2_iterator_destroy(). |
AO2_ITERATOR_UNLINK | Indicates that before the iterator returns an object from the container being iterated, the object should be unlinked from the container. |
AO2_ITERATOR_DESCENDING | Iterate in descending order (Last to first container object) (Otherwise ascending order)
|
Definition at line 1835 of file astobj2.h.
enum ao2_lock_req |
Which lock to request.
Enumerator | |
---|---|
AO2_LOCK_REQ_MUTEX | Request the mutex lock be acquired. |
AO2_LOCK_REQ_RDLOCK | Request the read lock be acquired. |
AO2_LOCK_REQ_WRLOCK | Request the write lock be acquired. |
Definition at line 700 of file astobj2.h.
enum search_flags |
Flags passed to ao2_callback_fn(), ao2_hash_fn(), and ao2_sort_fn() to modify behaviour.
Enumerator | |
---|---|
OBJ_UNLINK | Unlink the object for which the callback function returned CMP_MATCH. |
OBJ_NODATA | On match, don't return the object hence do not increase its refcount. |
OBJ_MULTIPLE | Don't stop at the first match in ao2_callback() unless the result of the callback function has the CMP_STOP bit set. |
OBJ_NOLOCK | Assume that the ao2_container is already locked.
|
OBJ_SEARCH_MASK | Search option field mask.
|
OBJ_SEARCH_NONE | The arg parameter has no meaning to the astobj2 code. |
OBJ_SEARCH_OBJECT | The arg parameter is an object of the same type. The arg parameter is an object of the same type as the one being searched for, so use the object's ao2_hash_fn and/or ao2_sort_fn functions for optimized searching.
|
OBJ_SEARCH_KEY | The arg parameter is a search key, but is not an object. This can be used when you want to be able to pass custom data to the container's stored ao2_hash_fn, ao2_sort_fn, and ao2_find ao2_callback_fn functions that is not a full object, but perhaps just a string.
|
OBJ_SEARCH_PARTIAL_KEY | The arg parameter is a partial search key similar to OBJ_SEARCH_KEY. The partial key can be used by the ao2_sort_fn to guide the search to find a contiguous subset of a sorted container. For example, a sorted container holds: "A", "B", "Bert", "Beth", "Earnie". Doing a partial key search with "B" will find the sorted subset of all held objects starting with "B".
|
OBJ_ORDER_MASK | Traverse order option field mask. |
OBJ_ORDER_ASCENDING | Traverse in ascending order (First to last container object) |
OBJ_ORDER_DESCENDING | Traverse in descending order (Last to first container object) |
OBJ_ORDER_PRE | Traverse in pre-order (Node then children, for tree container)
|
OBJ_ORDER_POST | Traverse in post-order (Children then node, for tree container)
|
Definition at line 1034 of file astobj2.h.
void * __ao2_alloc | ( | size_t | data_size, |
ao2_destructor_fn | destructor_fn, | ||
unsigned int | options, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 768 of file astobj2.c.
References make_ari_stubs::file, internal_ao2_alloc(), NULL, and options.
Referenced by __ao2_container_alloc_hash(), __ao2_container_alloc_rbtree(), __ao2_weakproxy_alloc(), __ast_channel_internal_alloc_with_initializers(), __ast_format_cap_alloc(), __ast_named_lock_get(), __ast_sorcery_open(), _moh_class_malloc(), and state_alloc().
void * __ao2_alloc_with_lockobj | ( | size_t | data_size, |
ao2_destructor_fn | destructor_fn, | ||
void * | lockobj, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 774 of file astobj2.c.
References AO2_ALLOC_OPT_LOCK_OBJ, make_ari_stubs::file, and internal_ao2_alloc().
void * __ao2_callback | ( | struct ao2_container * | c, |
enum search_flags | flags, | ||
ao2_callback_fn * | cb_fn, | ||
void * | arg, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 410 of file astobj2_container.c.
References AO2_CALLBACK_DEFAULT, c, make_ari_stubs::file, ao2_iterator::flags, internal_ao2_traverse(), and NULL.
Referenced by __ao2_find(), and __ao2_unlink().
void * __ao2_callback_data | ( | struct ao2_container * | c, |
enum search_flags | flags, | ||
ao2_callback_data_fn * | cb_fn, | ||
void * | arg, | ||
void * | data, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 417 of file astobj2_container.c.
References AO2_CALLBACK_WITH_DATA, c, make_ari_stubs::file, ao2_iterator::flags, and internal_ao2_traverse().
void __ao2_cleanup | ( | void * | obj | ) |
gcc attribute(cleanup()) functions
Definition at line 677 of file astobj2.c.
References ao2_ref.
Referenced by agent_request_exec(), ast_ari_bridges_set_video_source(), bridge_agent_hold_push(), bridge_builtin_set_limits(), bridge_stasis_queue_join_action(), dial_bridge_after_cb(), internal_bridge_after_cb(), native_rtp_bridge_framehook_attach(), parking_set_duration(), and speech_observer_loaded().
void __ao2_cleanup_debug | ( | void * | obj, |
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | function | ||
) |
Definition at line 670 of file astobj2.c.
References __ao2_ref(), and make_ari_stubs::file.
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 | ||
) |
Definition at line 1067 of file astobj2_hash.c.
References __ao2_alloc(), container_destruct(), make_ari_stubs::file, hash_ao2_container_init(), ao2_container_hash::hash_fn, and ao2_container_hash::n_buckets.
Referenced by __ao2_container_alloc_list(), and hash_ao2_alloc_empty_clone().
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 | ||
) |
Definition at line 1085 of file astobj2_hash.c.
References __ao2_container_alloc_hash(), ao2_container::cmp_fn, make_ari_stubs::file, NULL, and ao2_container::sort_fn.
struct ao2_container * __ao2_container_alloc_rbtree | ( | 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 | ||
) |
Definition at line 2022 of file astobj2_rbtree.c.
References __ao2_alloc(), __LOG_ERROR, ast_log, container_destruct(), make_ari_stubs::file, NULL, and rb_ao2_container_init().
Referenced by rb_ao2_alloc_empty_clone().
struct ao2_container * __ao2_container_clone | ( | struct ao2_container * | orig, |
enum search_flags | flags, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 753 of file astobj2_container.c.
References __ao2_ref(), __ast_assert_failed(), __is_ao2_object, ao2_container_methods::alloc_empty_clone, ao2_container_dup(), ao2_unlock, ao2_wrlock, make_ari_stubs::file, NULL, OBJ_NOLOCK, and ao2_container::v_table.
void * __ao2_find | ( | struct ao2_container * | c, |
const void * | arg, | ||
enum search_flags | flags, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
the find function just invokes the default callback with some reasonable flags.
Definition at line 427 of file astobj2_container.c.
References __ao2_callback(), ast_assert, c, make_ari_stubs::file, ao2_iterator::flags, and NULL.
Referenced by __ast_format_cache_get(), and _get_mohbyname().
void * __ao2_get_weakproxy | ( | void * | obj, |
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 917 of file astobj2.c.
References __ao2_ref(), __INTERNAL_OBJ_CHECK, AO2_MAGIC, make_ari_stubs::file, __priv_data::magic, NULL, astobj2::priv_data, and __priv_data::weakptr.
void * __ao2_global_obj_ref | ( | struct ao2_global_obj * | holder, |
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func, | ||
const char * | name | ||
) |
Definition at line 72 of file astobj2_global.c.
References __ao2_ref(), __ast_rwlock_rdlock(), __ast_rwlock_unlock(), ast_assert, ast_log, make_ari_stubs::file, ao2_global_obj::lock, LOG_ERROR, name, NULL, and ao2_global_obj::obj.
void * __ao2_global_obj_replace | ( | struct ao2_global_obj * | holder, |
void * | obj, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func, | ||
const char * | name | ||
) |
Definition at line 33 of file astobj2_global.c.
References __ao2_ref(), __ast_rwlock_unlock(), __ast_rwlock_wrlock(), ast_assert, ast_log, make_ari_stubs::file, ao2_global_obj::lock, LOG_ERROR, name, NULL, and ao2_global_obj::obj.
Referenced by __ao2_global_obj_replace_unref().
int __ao2_global_obj_replace_unref | ( | struct ao2_global_obj * | holder, |
void * | obj, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func, | ||
const char * | name | ||
) |
Definition at line 60 of file astobj2_global.c.
References __ao2_global_obj_replace(), __ao2_ref(), make_ari_stubs::file, and name.
void * __ao2_iterator_next | ( | struct ao2_iterator * | iter, |
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 556 of file astobj2_container.c.
References __adjust_lock(), __ao2_ref(), __ast_assert_failed(), __container_unlink_node_debug(), __is_ao2_object, AO2_ITERATOR_DONTLOCK, AO2_ITERATOR_UNLINK, AO2_LOCK_REQ_MUTEX, AO2_LOCK_REQ_RDLOCK, AO2_LOCK_REQ_WRLOCK, ao2_rdlock, ao2_ref, AO2_UNLINK_NODE_DEC_COUNT, ao2_unlock, ao2_wrlock, ao2_iterator::c, ao2_iterator::complete, make_ari_stubs::file, ao2_iterator::flags, ao2_container_methods::iterator_next, ao2_iterator::last_node, NULL, and ao2_container::v_table.
int __ao2_link | ( | struct ao2_container * | c, |
void * | obj_new, | ||
int | flags, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 94 of file astobj2_container.c.
References __adjust_lock(), __ast_assert_failed(), __is_ao2_object, ao2_container_check(), AO2_CONTAINER_INSERT_NODE_INSERTED, AO2_CONTAINER_INSERT_NODE_OBJ_REPLACED, AO2_CONTAINER_INSERT_NODE_REJECTED, AO2_DEVMODE_STAT, AO2_LOCK_REQ_MUTEX, AO2_LOCK_REQ_WRLOCK, ao2_ref, ao2_unlock, ao2_wrlock, ast_atomic_fetchadd_int(), ast_log, ao2_container::elements, make_ari_stubs::file, ao2_container_methods::insert, LOG_ERROR, ao2_container_methods::new_node, OBJ_NOLOCK, and ao2_container::v_table.
Referenced by internal_ao2_traverse().
int __ao2_lock | ( | void * | a, |
enum ao2_lock_req | lock_how, | ||
const char * | file, | ||
const char * | func, | ||
int | line, | ||
const char * | var | ||
) |
Lock an object.
a | A pointer to the object we want to lock. |
lock_how,file,func,line,var |
Definition at line 222 of file astobj2.c.
References __ao2_lock(), __ast_pthread_mutex_lock(), __ast_rwlock_rdlock(), __ast_rwlock_wrlock(), __INTERNAL_OBJ_CHECK, __LOG_ERROR, AO2_ALLOC_OPT_LOCK_MASK, AO2_ALLOC_OPT_LOCK_MUTEX, AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_ALLOC_OPT_LOCK_OBJ, AO2_ALLOC_OPT_LOCK_RWLOCK, AO2_LOCK_REQ_MUTEX, AO2_LOCK_REQ_RDLOCK, AO2_LOCK_REQ_WRLOCK, ast_atomic_fetchadd_int(), ast_log, make_ari_stubs::file, INTERNAL_OBJ_LOCKOBJ, INTERNAL_OBJ_MUTEX, INTERNAL_OBJ_RWLOCK, ao2_lock_priv::lock, ao2_rwlock_priv::lock, ao2_lockobj_priv::lock, astobj2_lockobj::lockobj, __priv_data::lockused, astobj2_lock::mutex, NULL, ao2_rwlock_priv::num_lockers, __priv_data::options, astobj2::priv_data, ref_log, astobj2_rwlock::rwlock, astobj2::user_data, astobj2_lockobj::user_data, and var.
Referenced by __ao2_lock(), _agent_lock(), _ast_bridge_channel_lock(), and _ast_bridge_lock().
int __ao2_ref | ( | void * | o, |
int | delta, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 498 of file astobj2.c.
References __ast_assert_failed(), __INTERNAL_OBJ_CHECK, __LOG_ERROR, AO2_ALLOC_OPT_LOCK_MASK, AO2_ALLOC_OPT_LOCK_MUTEX, AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_ALLOC_OPT_LOCK_OBJ, AO2_ALLOC_OPT_LOCK_RWLOCK, AO2_ALLOC_OPT_NO_REF_DEBUG, ao2_lock, AO2_MAGIC, ao2_ref, ao2_t_ref, ao2_unlock, ast_assert, ast_atomic_fetch_add, ast_atomic_fetchadd_int(), ast_free, ast_get_tid(), AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_REMOVE_HEAD, ast_log, ast_mutex_destroy, ast_rwlock_destroy, ao2_weakproxy_notification::cb, ao2_weakproxy_notification::data, ao2_weakproxy::destroyed_cb, __priv_data::destructor_fn, EXCESSIVE_REF_COUNT, make_ari_stubs::file, INTERNAL_OBJ_CHECK, INTERNAL_OBJ_LOCKOBJ, INTERNAL_OBJ_MUTEX, INTERNAL_OBJ_RWLOCK, ao2_weakproxy_notification::list, ao2_lock_priv::lock, ao2_rwlock_priv::lock, ao2_lockobj_priv::lock, astobj2_lockobj::lockobj, __priv_data::lockused, __priv_data::magic, astobj2_lock::mutex, NULL, __priv_data::options, astobj2::priv_data, __priv_data::ref_counter, ref_log, astobj2_rwlock::rwlock, astobj2::user_data, and __priv_data::weakptr.
Referenced by __ao2_cleanup_debug(), __ao2_container_clone(), __ao2_get_weakproxy(), __ao2_global_obj_ref(), __ao2_global_obj_replace(), __ao2_global_obj_replace_unref(), __ao2_iterator_next(), __ao2_weakproxy_get_object(), __ao2_weakproxy_ref_object(), __ao2_weakproxy_set_object(), __ast_format_cap_append(), __ast_module_ref(), __ast_module_unref(), __container_unlink_node_debug(), hash_ao2_new_node(), internal_ao2_traverse(), and rb_ao2_new_node().
int __ao2_trylock | ( | void * | a, |
enum ao2_lock_req | lock_how, | ||
const char * | file, | ||
const char * | func, | ||
int | line, | ||
const char * | var | ||
) |
Try locking– (don't block if fail)
a | A pointer to the object we want to lock. |
lock_how,file,func,line,var |
Definition at line 342 of file astobj2.c.
References __ao2_trylock(), __ast_pthread_mutex_trylock(), __ast_rwlock_tryrdlock(), __ast_rwlock_trywrlock(), __INTERNAL_OBJ_CHECK, __LOG_ERROR, AO2_ALLOC_OPT_LOCK_MASK, AO2_ALLOC_OPT_LOCK_MUTEX, AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_ALLOC_OPT_LOCK_OBJ, AO2_ALLOC_OPT_LOCK_RWLOCK, AO2_LOCK_REQ_MUTEX, AO2_LOCK_REQ_RDLOCK, AO2_LOCK_REQ_WRLOCK, ast_atomic_fetchadd_int(), ast_log, make_ari_stubs::file, INTERNAL_OBJ_LOCKOBJ, INTERNAL_OBJ_MUTEX, INTERNAL_OBJ_RWLOCK, ao2_lock_priv::lock, ao2_rwlock_priv::lock, ao2_lockobj_priv::lock, astobj2_lockobj::lockobj, __priv_data::lockused, astobj2_lock::mutex, NULL, ao2_rwlock_priv::num_lockers, __priv_data::options, astobj2::priv_data, ref_log, astobj2_rwlock::rwlock, astobj2::user_data, astobj2_lockobj::user_data, and var.
Referenced by __ao2_trylock(), _ast_bridge_channel_trylock(), and _ast_bridge_trylock().
void * __ao2_unlink | ( | struct ao2_container * | c, |
void * | obj, | ||
int | flags, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 175 of file astobj2_container.c.
References __ao2_callback(), __is_ao2_object, ao2_match_by_addr(), c, make_ari_stubs::file, NULL, OBJ_NODATA, OBJ_SEARCH_OBJECT, and OBJ_UNLINK.
int __ao2_unlock | ( | void * | a, |
const char * | file, | ||
const char * | func, | ||
int | line, | ||
const char * | var | ||
) |
Unlock an object.
a | A pointer to the object we want unlock. |
file,func,line,var |
Definition at line 288 of file astobj2.c.
References __ao2_unlock(), __ast_pthread_mutex_unlock(), __ast_rwlock_unlock(), __INTERNAL_OBJ_CHECK, __LOG_ERROR, AO2_ALLOC_OPT_LOCK_MASK, AO2_ALLOC_OPT_LOCK_MUTEX, AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_ALLOC_OPT_LOCK_OBJ, AO2_ALLOC_OPT_LOCK_RWLOCK, ast_atomic_fetchadd_int(), ast_log, make_ari_stubs::file, INTERNAL_OBJ_LOCKOBJ, INTERNAL_OBJ_MUTEX, INTERNAL_OBJ_RWLOCK, ao2_lock_priv::lock, ao2_rwlock_priv::lock, ao2_lockobj_priv::lock, astobj2_lockobj::lockobj, astobj2_lock::mutex, NULL, ao2_rwlock_priv::num_lockers, __priv_data::options, astobj2::priv_data, astobj2_rwlock::rwlock, astobj2::user_data, astobj2_lockobj::user_data, and var.
Referenced by __ao2_unlock(), _agent_unlock(), _ast_bridge_channel_unlock(), and _ast_bridge_unlock().
void * __ao2_weakproxy_alloc | ( | size_t | data_size, |
ao2_destructor_fn | destructor_fn, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 793 of file astobj2.c.
References __ao2_alloc(), AO2_ALLOC_OPT_LOCK_MUTEX, AO2_WEAK, ast_assert, ast_log, make_ari_stubs::file, INTERNAL_OBJ, LOG_ERROR, __priv_data::magic, NULL, and astobj2::priv_data.
void * __ao2_weakproxy_find | ( | struct ao2_container * | c, |
const void * | arg, | ||
enum search_flags | flags, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 440 of file astobj2_container.c.
References __adjust_lock(), __ao2_weakproxy_get_object(), ao2_find, AO2_LOCK_REQ_RDLOCK, AO2_LOCK_REQ_WRLOCK, ao2_rdlock, ao2_ref, ao2_unlink_flags, ao2_unlock, ast_assert, c, make_ari_stubs::file, ao2_iterator::flags, NULL, OBJ_NOLOCK, and OBJ_SEARCH_MASK.
Referenced by __ast_named_lock_get(), and __ast_sorcery_open().
void * __ao2_weakproxy_get_object | ( | void * | weakproxy, |
int | flags, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 889 of file astobj2.c.
References __ao2_ref(), __INTERNAL_OBJ_CHECK, ao2_lock, ao2_unlock, AO2_WEAK, make_ari_stubs::file, __priv_data::magic, NULL, OBJ_NOLOCK, astobj2::priv_data, and __priv_data::weakptr.
Referenced by __ao2_weakproxy_find().
int __ao2_weakproxy_ref_object | ( | void * | weakproxy, |
int | delta, | ||
int | flags, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 862 of file astobj2.c.
References __ao2_ref(), __INTERNAL_OBJ_CHECK, ao2_lock, ao2_unlock, AO2_WEAK, make_ari_stubs::file, __priv_data::magic, OBJ_NOLOCK, astobj2::priv_data, and __priv_data::weakptr.
int __ao2_weakproxy_set_object | ( | void * | weakproxy, |
void * | obj, | ||
int | flags, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 818 of file astobj2.c.
References __ao2_ref(), __INTERNAL_OBJ_CHECK, ao2_lock, AO2_MAGIC, ao2_unlock, AO2_WEAK, make_ari_stubs::file, __priv_data::magic, OBJ_NOLOCK, astobj2::priv_data, and __priv_data::weakptr.
int ao2_container_check | ( | struct ao2_container * | self, |
enum search_flags | flags | ||
) |
Perform an integrity check on the specified container.
self | Container to check integrity. |
flags | OBJ_NOLOCK if a lock is already held on the container. |
0 | on success. |
-1 | on error. |
Definition at line 856 of file astobj2_container.c.
References ao2_rdlock, ao2_unlock, ast_assert, is_ao2_object, OBJ_NOLOCK, and ao2_container::v_table.
Referenced by __ao2_link(), AST_TEST_DEFINE(), astobj2_test_1_helper(), hash_ao2_node_destructor(), insert_test_duplicates(), insert_test_vector(), rb_ao2_node_destructor(), and test_container_clone().
int ao2_container_count | ( | struct ao2_container * | c | ) |
Returns the number of elements in a container.
return the number of elements in the container
Definition at line 34 of file astobj2_container.c.
References ast_atomic_fetchadd_int(), and c.
Referenced by action_confbridgekick(), action_confbridgelist(), action_confbridgelistrooms(), action_confbridgesetsinglevideosrc(), action_confbridgestartrecord(), action_confbridgestoprecord(), action_lock_unlock_helper(), action_mute_unmute_helper(), ami_show_aors(), ami_show_auths(), ami_show_contacts(), ami_show_endpoints(), ami_show_resource_lists(), ao2_iterator_count(), app_is_finished(), ari_show(), ast_active_channels(), ast_ari_applications_list(), ast_bridge_transfer_attended(), ast_bridge_transfer_blind(), ast_cdr_generic_unregister(), ast_endpoint_snapshot_create(), ast_get_chan_applicationmap(), ast_get_namedgroups(), ast_merge_contexts_and_delete(), ast_namedgroups_intersect(), ast_sip_cli_traverse_objects(), ast_sip_initialize_system(), ast_sip_location_retrieve_first_aor_contact_filtered(), ast_sorcery_create(), ast_sorcery_delete(), ast_sorcery_retrieve_by_fields(), ast_sorcery_retrieve_by_prefix(), ast_sorcery_retrieve_by_regex(), ast_sorcery_update(), ast_srtp_unprotect(), AST_TEST_DEFINE(), ast_tone_zone_count(), astobj2_test_1_helper(), auth_observer(), bridges_scrape_cb(), calc_metric(), cc_cli_output_status(), cel_pre_apply_config(), channels_scrape_cb(), check_events(), check_expiration_thread(), cleanup(), cleanup_module(), cli_display_parking_lot(), cli_eprofile_show_all(), cli_fax_show_sessions(), cli_profile_show_all(), cli_show_modules(), cli_show_monitors(), cli_show_tasks(), cli_tn_show_all(), client_config_show_all(), common_identify(), control_command_count(), control_wait(), cpg_confchg_cb(), create_sound_blob(), create_unsolicited_mwi_subscriptions(), device_state_cb(), dial_state_process_bridge_enter(), do_timing(), endelm(), endpoints_scrape_cb(), exten_state_pub_data_alloc(), find_contact(), format_ami_aor_handler(), get_device_state_causing_channels(), global_loaded_observer(), grow(), handle_cli_sound_show(), handle_feature_show(), handle_manager_show_events(), handle_registrations(), handle_show_hint(), handle_show_hints(), insert_test_vector(), ip_identify_apply(), load_common(), locals_show(), member_add_to_queue(), memory_cache_full_update(), memory_cache_populate(), mid_test_sync(), mwi_subscription_established(), native_bridge_is_capable(), native_rtp_bridge_compatible_check(), object_type_loaded_observer(), one_protocol(), parking_lot_remove_if_unused(), pjsip_acf_dial_contacts_read(), presence_state_cb(), print_queue(), process_config(), pthread_timer_open(), publisher_start(), queue_exec(), queue_function_mem_read(), queued_set_size(), queued_task_pushed(), send_unsolicited_mwi_notify(), should_send_event(), shrink(), single_state_process_bridge_enter(), sip_options_apply_aor_configuration(), sip_options_contact_add_task(), sip_options_contact_delete_task(), sip_options_unused_endpoint_state_compositor(), sla_in_use(), smdi_load(), sorcery_memory_cache_create(), sorcery_memory_cache_dump(), sorcery_memory_cache_populate(), sorcery_memory_cache_retrieve_multiple(), sorcery_memory_cache_retrieve_prefix(), sorcery_memory_cache_retrieve_regex(), sorcery_memory_cache_show(), sorcery_object_load(), stale_cache_update(), stasis_app_set_global_debug(), stasis_app_to_cli(), system_create_resolver_and_set_nameservers(), test_ao2_iteration(), test_cel_peer_strings_match(), test_container_clone(), test_sub(), threadpool_send_state_changed(), tps_shutdown(), try_calling(), unload_module(), and xmpp_show_clients().
void ao2_container_dump | ( | struct ao2_container * | self, |
enum search_flags | flags, | ||
const char * | name, | ||
void * | where, | ||
ao2_prnt_fn * | prnt, | ||
ao2_prnt_obj_fn * | prnt_obj | ||
) |
Display contents of the specified container.
self | Container to dump. |
flags | OBJ_NOLOCK if a lock is already held on the container. |
name | Container name. (NULL if anonymous) |
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 792 of file astobj2_container.c.
References ao2_rdlock, ao2_unlock, ast_assert, is_ao2_object, name, OBJ_NOLOCK, and ao2_container::v_table.
Referenced by astobj2_test_1_helper(), and test_traversal_sorted().
int ao2_container_dup | ( | struct ao2_container * | dest, |
struct ao2_container * | src, | ||
enum search_flags | flags | ||
) |
Copy all object references in the src container into the dest container.
dest | Container to copy src object references into. |
src | Container to copy all object references from. |
flags | OBJ_NOLOCK if a lock is already held on both containers. Otherwise, the src container is locked first. |
0 | on success. |
-1 | on error. |
Definition at line 673 of file astobj2_container.c.
References ao2_callback, ao2_rdlock, ao2_t_ref, ao2_unlock, ao2_wrlock, dup_obj_cb(), NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_NOLOCK, and OBJ_UNLINK.
Referenced by __ao2_container_clone(), __queues_show(), cli_aor_get_container(), cli_endpoint_get_container(), cli_get_container(), cli_show_monitors(), cli_show_tasks(), cli_unid_get_container(), geoloc_config_list_locations(), geoloc_config_list_profiles(), geoloc_config_show_profiles(), handle_cli_sounds_show(), sip_options_apply_aor_configuration(), stasis_show_topics(), tps_report_taskprocessor_list(), and tps_shutdown().
int ao2_container_dup_weakproxy_objs | ( | struct ao2_container * | dest, |
struct ao2_container * | src, | ||
enum search_flags | flags | ||
) |
Copy object references associated with src container weakproxies into the dest container.
dest | Container to copy src strong object references into. |
src | Container to copy all weak object references from. |
flags | OBJ_NOLOCK if a lock is already held on both containers. Otherwise, the src container is locked first. |
src
with no associated object is ignored.0 | on success. |
-1 | on error. |
Definition at line 726 of file astobj2_container.c.
References ao2_callback, ao2_rdlock, ao2_t_ref, ao2_unlock, ao2_wrlock, dup_weakproxy_cb(), NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_NOLOCK, and OBJ_UNLINK.
Referenced by AST_TEST_DEFINE().
int ao2_container_register | ( | const char * | name, |
struct ao2_container * | self, | ||
ao2_prnt_obj_fn * | prnt_obj | ||
) |
Register a container for CLI stats and integrity check.
name | Name to register the container under. |
self | Container to register. |
prnt_obj | Callback function to print the given object's key. (NULL if not available) |
0 | on success. |
-1 | on error. |
Definition at line 958 of file astobj2_container.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_t_alloc_options, ao2_t_link, ao2_t_ref, and name.
Referenced by ast_bridging_init(), ast_channels_init(), ast_pbx_init(), load_module(), stasis_caching_topic_create(), stasis_state_manager_create(), and stasis_topic_pool_create().
void ao2_container_stats | ( | struct ao2_container * | self, |
enum search_flags | flags, | ||
const char * | name, | ||
void * | where, | ||
ao2_prnt_fn * | prnt | ||
) |
Display statistics of the specified container.
self | Container to display statistics. |
flags | OBJ_NOLOCK if a lock is already held on the container. |
name | Container name. (NULL if anonymous) |
where | User data needed by prnt to determine where to put output. |
prnt | Print output callback function to use. |
Definition at line 819 of file astobj2_container.c.
References ao2_rdlock, ao2_unlock, ast_assert, ao2_container::elements, is_ao2_object, name, OBJ_NOLOCK, and ao2_container::v_table.
Referenced by astobj2_test_1_helper(), and test_traversal_sorted().
void ao2_container_unregister | ( | const char * | name | ) |
Unregister a container for CLI stats and integrity check.
name | Name the container is registered under. |
Definition at line 985 of file astobj2_container.c.
References ao2_t_find, name, OBJ_NODATA, OBJ_SEARCH_KEY, and OBJ_UNLINK.
Referenced by bridge_cleanup(), cdr_engine_shutdown(), channels_shutdown(), load_module(), pbx_shutdown(), stasis_caching_topic_dtor(), state_manager_dtor(), topic_pool_dtor(), and unload_module().
void ao2_iterator_cleanup | ( | struct ao2_iterator * | iter | ) |
Definition at line 549 of file astobj2_container.c.
References ao2_iterator_destroy().
Referenced by AST_TEST_DEFINE(), and stasis_app_set_global_debug().
int ao2_iterator_count | ( | struct ao2_iterator * | iter | ) |
Get a count of the iterated container objects.
iter | the iterator to query |
Definition at line 630 of file astobj2_container.c.
References ao2_container_count(), and ao2_iterator::c.
void ao2_iterator_destroy | ( | struct ao2_iterator * | iter | ) |
Destroy a container iterator.
iter | the iterator to destroy |
This function will release the container reference held by the iterator and any other resources it may be holding.
Definition at line 534 of file astobj2_container.c.
References AO2_ITERATOR_MALLOCD, ao2_iterator_restart(), ao2_t_ref, ast_free, ao2_iterator::c, ao2_iterator::flags, and NULL.
Referenced by __iax2_show_peers(), __manager_event_sessions_va(), __queues_show(), __test_cel_generate_peer_str(), aco_set_defaults(), action_agents(), action_confbridgelistrooms(), action_coreshowchannelmap(), action_coreshowchannels(), action_devicestatelist(), action_extensionstatelist(), action_meetmelist(), action_presencestatelist(), add_ice_to_stream(), aeap_tab_complete_name(), agent_show_requested(), agents_post_apply_config(), agents_sweep(), alias_show(), ami_show_registration_contact_statuses(), ao2_iterator_cleanup(), app_to_json(), ari_show_apps(), ast_add_hint(), ast_ari_bridges_list(), ast_ari_channels_list(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_recordings_list_stored(), ast_bridge_channel_kick(), ast_bucket_file_json(), ast_bucket_json(), ast_cdr_setvar(), ast_channel_iterator_destroy(), ast_complete_channels(), ast_endpoint_snapshot_create(), ast_format_cache_get_by_codec(), ast_merge_contexts_and_delete(), ast_msg_var_iterator_destroy(), ast_multi_channel_blob_get_channels(), ast_pickup_find_by_group(), ast_print_namedgroups(), ast_refer_var_iterator_destroy(), ast_sip_destroy_scheduler(), ast_sip_for_each_contact(), ast_sorcery_objectset_create2(), ast_sorcery_objectset_json_create(), ast_srtp_unprotect(), AST_TEST_DEFINE(), ast_var_indications(), ast_var_indications_table(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), astobj2_test_1_helper(), auth_observer(), authenticate(), authenticate_reply(), bridge_app_subscribed_involved(), bridge_channel_event_join_leave(), bridge_channel_moving(), bridge_channel_talking(), bridges_scrape_cb(), build_cli_notify(), calendar_query_exec(), cel_generate_peer_str(), channels_scrape_cb(), check_access(), check_events(), clear_queue(), clear_stats(), cli_complete_endpoint(), cli_complete_notify(), cli_complete_registration(), cli_complete_show(), cli_complete_uri(), cli_console_active(), cli_display_named_acl_list(), cli_fax_show_sessions(), cli_list_devices(), cli_show_channels(), cli_show_modules(), cli_show_monitors(), cli_show_tasks(), cli_tps_reset_stats_all(), compare_weight(), complete_bridge_profile_name(), complete_confbridge_name(), complete_config_module(), complete_core_id(), complete_core_show_hint(), complete_country(), complete_iax2_peers(), complete_iax2_unregister(), complete_menu_name(), complete_mohclass_realtime(), complete_queue(), complete_queue_remove_member(), complete_show_sorcery_object(), complete_user_profile_name(), complete_userno(), conf_queue_dtmf(), config_hook_exec(), config_object_tab_complete_name(), configure_parking_extensions(), container_to_json_array(), control_dispatch_all(), control_flush_queue(), control_prestart_dispatch_all(), coreshowchannelmap_add_connected_channels(), destroy_pvts(), device_state_cb(), device_state_notify_callbacks(), dial_state_process_bridge_enter(), dialgroup_read(), disable_marked_lots(), dump_queue_members(), endpoints_scrape_cb(), event_session_shutdown(), exten_state_publisher_state_cb(), extension_state_cb(), fax_session_tab_complete(), find_contact(), find_queue_by_name_rt(), find_ringing_channel(), find_session(), find_session_by_nonce(), free_members(), generate_or_link_lots_to_configs(), geoloc_config_list_locations(), geoloc_config_list_profiles(), geoloc_config_show_profiles(), get_device_state_causing_channels(), get_member_status(), get_transferee(), get_udp_transport(), get_write_timeout(), handle_bridge_pairings(), handle_bridge_show_all(), handle_chanlist(), handle_cli_confbridge_list(), handle_cli_confbridge_show_bridge_profiles(), handle_cli_confbridge_show_menus(), handle_cli_confbridge_show_user_profiles(), handle_cli_iax2_show_callno_limits(), handle_cli_iax2_show_users(), handle_cli_indication_show(), handle_cli_moh_show_classes(), handle_cli_moh_show_files(), handle_cli_moh_unregister_class(), handle_cli_odbc_show(), handle_cli_sound_show(), handle_cli_status(), handle_export_primitives(), handle_kickmanconn(), handle_manager_show_event(), handle_manager_show_events(), handle_show_calendar(), handle_show_calendars(), handle_show_hint(), handle_show_hints(), handle_show_named_acl_cmd(), handle_showmanconn(), handle_skel_show_games(), handle_skel_show_levels(), handle_voicemail_show_aliases(), has_mwi_subscription(), iax2_getpeername(), iax2_getpeertrunk(), interface_exists(), ip_identify_apply(), is_longest_waiting_caller(), jingle_add_google_candidates_to_transport(), jingle_add_ice_udp_candidates_to_transport(), jingle_request(), keepalive_transport_thread(), kill_duplicate_offers(), load_users(), local_devicestate(), locals_show(), manager_fax_sessions(), manager_iax2_show_peer_list(), manager_parking_status_all_lots(), manager_parking_status_single_lot(), manager_queues_status(), manager_queues_summary(), mark_lots_as_disabled(), media_cache_handle_show_item(), meetme_menu_admin_extended(), meetme_show_cmd(), moh_rescan_files(), msg_func_write(), mwi_contact_deleted(), mwi_initial_events(), mwi_mailbox_delete_all(), mwi_mailbox_get(), mwi_subscription_mailboxes_str(), num_available_members(), parking_lot_get_space(), pjsip_acf_dial_contacts_read(), pjsip_aor_function_read(), poke_all_peers(), pp_each_user_helper(), presence_state_cb(), presence_state_notify_callbacks(), print_queue(), prune_peers(), prune_users(), purge_sessions(), queue_function_mem_read(), queue_function_qac_dep(), queue_function_queuememberlist(), queue_mwi_event(), qupd_exec(), reload(), reload_single_queue(), remove_all_configured_parking_lot_extensions(), remove_pending_parking_lot_extensions(), rt_handle_member_record(), set_member_paused(), set_member_value(), set_transfer_variables_all(), show_codecs(), single_state_process_bridge_enter(), sip_options_apply_aor_configuration(), sip_options_cleanup_task(), sip_options_endpoint_unlink_aor_feeders(), sip_options_get_endpoint_state_compositor_state(), sip_outbound_publish_synchronize(), sla_calc_station_delays(), sla_change_trunk_state(), sla_queue_event_conf(), sla_show_stations(), sla_show_trunks(), sorcery_memory_cache_complete_name(), sorcery_memory_cache_complete_object_name(), stasis_app_mailboxes_to_json(), stasis_app_to_cli(), stasis_show_topics(), stop_streams(), system_create_resolver_and_set_nameservers(), test_ao2_callback_traversal(), test_ao2_iteration(), test_container_clone(), test_expected_duplicates(), topic_complete_name(), tps_report_taskprocessor_list(), tps_taskprocessor_tab_complete(), transport_state_do_reg_callbacks(), try_calling(), unbound_config_preapply(), update_queue(), update_realtime_members(), xmpp_pubsub_create_affiliations(), xmpp_show_buddies(), and xmpp_show_clients().
struct ao2_iterator ao2_iterator_init | ( | struct ao2_container * | c, |
int | flags | ||
) |
Create an iterator for a container.
c | the container |
flags | one or more flags from ao2_iterator_flags. |
This function will take a reference on the container being iterated.
initialize an iterator so we start from the first object
Definition at line 485 of file astobj2_container.c.
References a, ao2_t_ref, c, and ao2_iterator::flags.
Referenced by __iax2_show_peers(), __manager_event_sessions_va(), __queues_show(), __test_cel_generate_peer_str(), aco_set_defaults(), action_agents(), action_confbridgelistrooms(), action_coreshowchannelmap(), action_coreshowchannels(), action_devicestatelist(), action_extensionstatelist(), action_meetmelist(), action_presencestatelist(), add_ice_to_stream(), aeap_tab_complete_name(), agent_show_requested(), agents_post_apply_config(), alias_show(), ami_show_registration_contact_statuses(), app_to_json(), ari_show_apps(), ast_add_hint(), ast_ari_bridges_list(), ast_ari_channels_list(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_recordings_list_stored(), ast_bridge_channel_kick(), ast_bucket_file_json(), ast_bucket_json(), ast_channel_iterator_all_new(), ast_complete_channels(), ast_endpoint_snapshot_create(), ast_format_cache_get_by_codec(), ast_merge_contexts_and_delete(), ast_msg_var_iterator_init(), ast_pickup_find_by_group(), ast_print_namedgroups(), ast_refer_var_iterator_init(), ast_sip_destroy_scheduler(), ast_sip_for_each_contact(), ast_sorcery_objectset_create2(), ast_sorcery_objectset_json_create(), ast_srtp_unprotect(), AST_TEST_DEFINE(), ast_tone_zone_iterator_init(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), astobj2_test_1_helper(), auth_observer(), authenticate(), authenticate_reply(), bridge_app_subscribed_involved(), bridge_channel_event_join_leave(), bridge_channel_moving(), bridge_channel_talking(), bridges_scrape_cb(), build_cli_notify(), calendar_query_exec(), cel_generate_peer_str(), channels_scrape_cb(), check_access(), check_events(), clear_queue(), clear_stats(), cli_complete_endpoint(), cli_complete_notify(), cli_complete_registration(), cli_complete_show(), cli_complete_uri(), cli_console_active(), cli_display_named_acl_list(), cli_fax_show_sessions(), cli_list_devices(), cli_show_channels(), cli_show_modules(), cli_show_monitors(), cli_show_tasks(), cli_tps_reset_stats_all(), compare_weight(), complete_bridge_profile_name(), complete_confbridge_name(), complete_config_module(), complete_core_id(), complete_core_show_hint(), complete_country(), complete_iax2_peers(), complete_iax2_unregister(), complete_menu_name(), complete_mohclass_realtime(), complete_queue(), complete_queue_remove_member(), complete_show_sorcery_object(), complete_user_profile_name(), complete_userno(), conf_queue_dtmf(), config_hook_exec(), config_object_tab_complete_name(), configure_parking_extensions(), container_to_json_array(), control_dispatch_all(), control_flush_queue(), control_prestart_dispatch_all(), coreshowchannelmap_add_connected_channels(), destroy_pvts(), device_state_cb(), device_state_notify_callbacks(), dial_state_process_bridge_enter(), dialgroup_read(), disable_marked_lots(), dump_queue_members(), endpoints_scrape_cb(), event_session_shutdown(), exten_state_publisher_state_cb(), extension_state_cb(), fax_session_tab_complete(), find_contact(), find_queue_by_name_rt(), find_ringing_channel(), find_session(), find_session_by_nonce(), free_members(), generate_or_link_lots_to_configs(), geoloc_config_list_locations(), geoloc_config_list_profiles(), geoloc_config_show_profiles(), get_device_state_causing_channels(), get_member_status(), get_transferee(), get_udp_transport(), get_write_timeout(), handle_bridge_pairings(), handle_bridge_show_all(), handle_chanlist(), handle_cli_confbridge_list(), handle_cli_confbridge_show_bridge_profiles(), handle_cli_confbridge_show_menus(), handle_cli_confbridge_show_user_profiles(), handle_cli_iax2_show_callno_limits(), handle_cli_iax2_show_users(), handle_cli_moh_show_classes(), handle_cli_moh_show_files(), handle_cli_moh_unregister_class(), handle_cli_odbc_show(), handle_cli_sound_show(), handle_cli_status(), handle_export_primitives(), handle_kickmanconn(), handle_manager_show_event(), handle_show_calendar(), handle_show_calendars(), handle_show_hint(), handle_show_hints(), handle_show_named_acl_cmd(), handle_showmanconn(), handle_skel_show_games(), handle_skel_show_levels(), handle_voicemail_show_aliases(), iax2_getpeername(), iax2_getpeertrunk(), interface_exists(), internal_ao2_traverse(), ip_identify_apply(), is_longest_waiting_caller(), jingle_add_google_candidates_to_transport(), jingle_add_ice_udp_candidates_to_transport(), jingle_request(), keepalive_transport_thread(), load_users(), local_devicestate(), locals_show(), manager_fax_sessions(), manager_iax2_show_peer_list(), manager_parking_status_all_lots(), manager_parking_status_single_lot(), manager_queues_status(), manager_queues_summary(), mark_lots_as_disabled(), media_cache_handle_show_item(), meetme_menu_admin_extended(), meetme_show_cmd(), moh_rescan_files(), msg_func_write(), mwi_initial_events(), mwi_mailbox_delete_all(), mwi_mailbox_get(), mwi_subscription_mailboxes_str(), num_available_members(), parking_lot_get_space(), pjsip_acf_dial_contacts_read(), pjsip_aor_function_read(), poke_all_peers(), pp_each_user_helper(), presence_state_notify_callbacks(), print_queue(), prune_peers(), prune_users(), purge_sessions(), queue_function_mem_read(), queue_function_qac_dep(), queue_function_queuememberlist(), qupd_exec(), reload(), reload_single_queue(), remove_all_configured_parking_lot_extensions(), remove_pending_parking_lot_extensions(), rt_handle_member_record(), set_member_paused(), set_member_value(), set_transfer_variables_all(), show_codecs(), single_state_process_bridge_enter(), sip_options_apply_aor_configuration(), sip_options_cleanup_task(), sip_options_endpoint_unlink_aor_feeders(), sip_options_get_endpoint_state_compositor_state(), sip_outbound_publish_synchronize(), sla_calc_station_delays(), sla_change_trunk_state(), sla_queue_event_conf(), sla_show_stations(), sla_show_trunks(), sorcery_memory_cache_complete_name(), sorcery_memory_cache_complete_object_name(), stasis_app_mailboxes_to_json(), stasis_app_set_global_debug(), stasis_show_topics(), stop_streams(), system_create_resolver_and_set_nameservers(), test_ao2_iteration(), test_container_clone(), topic_complete_name(), tps_report_taskprocessor_list(), tps_shutdown(), tps_taskprocessor_tab_complete(), try_calling(), unbound_config_preapply(), update_queue(), update_realtime_members(), xmpp_pubsub_create_affiliations(), xmpp_show_buddies(), and xmpp_show_clients().
void ao2_iterator_restart | ( | struct ao2_iterator * | iter | ) |
Restart an iteration.
iter | the iterator to restart |
Definition at line 497 of file astobj2_container.c.
References __adjust_lock(), AO2_ITERATOR_DONTLOCK, AO2_LOCK_REQ_MUTEX, AO2_LOCK_REQ_RDLOCK, ao2_rdlock, ao2_ref, ao2_unlock, ao2_iterator::c, ao2_iterator::complete, ao2_iterator::flags, is_ao2_object, ao2_iterator::last_node, and NULL.
Referenced by ao2_iterator_destroy().
int ao2_match_by_addr | ( | void * | user_data, |
void * | arg, | ||
int | flags | ||
) |
A common ao2_callback is one that matches by address.
A common ao2_callback is one that matches by address.
Definition at line 166 of file astobj2_container.c.
References CMP_MATCH, and CMP_STOP.
Referenced by __ao2_unlink(), load_module(), and test_container_clone().
void * ao2_object_get_lockaddr | ( | void * | obj | ) |
Return the mutex lock address of an object.
[in] | obj | A pointer to the object we want. |
This function comes in handy mainly for debugging locking situations, where the locking trace code reports the lock address, this allows you to correlate against object address, to match objects to reported locks.
Definition at line 476 of file astobj2.c.
References AO2_ALLOC_OPT_LOCK_MASK, AO2_ALLOC_OPT_LOCK_MUTEX, INTERNAL_OBJ_CHECK, INTERNAL_OBJ_MUTEX, ao2_lock_priv::lock, astobj2_lock::mutex, NULL, __priv_data::options, astobj2::priv_data, and astobj2_lock::user_data.
Referenced by ast_serializer_shutdown_group_join(), ast_sip_session_suspend(), bridge_channel_wait(), bridge_manager_thread(), consumer_should_stay(), consumer_wait_for(), consumer_wait_for_completion(), control_wait(), db_sync_thread(), pbx_outgoing_attempt(), rtp_deallocate_transport(), sip_session_suspend_task(), stasis_subscription_join(), transaction_wait(), and wait_for_stimulus().
unsigned int ao2_options_get | ( | void * | obj | ) |
Retrieve the ao2 options used to create the object.
obj | pointer to the (user-defined part) of an object. |
Definition at line 781 of file astobj2.c.
References INTERNAL_OBJ_CHECK, __priv_data::options, and astobj2::priv_data.
Referenced by __ast_named_lock_get(), hash_ao2_alloc_empty_clone(), and rb_ao2_alloc_empty_clone().
|
inline |
Increment reference count on an object and lock it.
[in] | obj | A pointer to the ao2 object |
0 | The object is not an ao2 object or wasn't locked successfully |
1 | The object's reference count was incremented and was locked |
Definition at line 780 of file astobj2.h.
References ao2_ref, and ao2_unlock.
|
inline |
Unlock an object and decrement its reference count.
[in] | obj | A pointer to the ao2 object |
0 | The object is not an ao2 object or wasn't unlocked successfully |
1 | The object was unlocked and it's reference count was decremented |
Definition at line 800 of file astobj2.h.
int ao2_weakproxy_subscribe | ( | void * | weakproxy, |
ao2_weakproxy_notification_cb | cb, | ||
void * | data, | ||
int | flags | ||
) |
Request notification when weakproxy points to NULL.
weakproxy | The weak object |
cb | Procedure to call when no real object is associated |
data | Passed to cb |
flags | OBJ_NOLOCK to avoid locking weakproxy. |
0 | Success |
-1 | Failure |
Definition at line 934 of file astobj2.c.
References ao2_lock, ao2_unlock, AO2_WEAK, ast_calloc, AST_LIST_INSERT_HEAD, ao2_weakproxy_notification::cb, ao2_weakproxy_notification::data, ao2_weakproxy::destroyed_cb, INTERNAL_OBJ_CHECK, ao2_weakproxy_notification::list, __priv_data::magic, NULL, OBJ_NOLOCK, astobj2::priv_data, sub, and __priv_data::weakptr.
Referenced by __ast_named_lock_get(), __ast_sorcery_open(), AST_TEST_DEFINE(), link_topic_proxy(), and state_alloc().
int ao2_weakproxy_unsubscribe | ( | void * | weakproxy, |
ao2_weakproxy_notification_cb | cb, | ||
void * | data, | ||
int | flags | ||
) |
Remove notification of real object destruction.
weakproxy | The weak object |
cb | Callback to remove from destroy notification list |
data | Data pointer to match |
flags | OBJ_NOLOCK to avoid locking weakproxy. OBJ_MULTIPLE to remove all copies of the same cb / data pair. |
0 | cb / data pair not found, nothing removed. |
-1 | Failure due to invalid parameters. |
Definition at line 973 of file astobj2.c.
References ao2_lock, ao2_unlock, AO2_WEAK, ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ao2_weakproxy_notification::data, ao2_weakproxy::destroyed_cb, INTERNAL_OBJ_CHECK, ao2_weakproxy_notification::list, __priv_data::magic, OBJ_MULTIPLE, OBJ_NOLOCK, astobj2::priv_data, and sub.
Referenced by AST_TEST_DEFINE().