17#ifndef _ASTERISK_ASTOBJ2_H
18#define _ASTERISK_ASTOBJ2_H
402#define ao2_t_alloc_options(data_size, destructor_fn, options, debug_msg) \
403 __ao2_alloc((data_size), (destructor_fn), (options), (debug_msg), __FILE__, __LINE__, __PRETTY_FUNCTION__)
404#define ao2_alloc_options(data_size, destructor_fn, options) \
405 __ao2_alloc((data_size), (destructor_fn), (options), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
407#define ao2_t_alloc(data_size, destructor_fn, debug_msg) \
408 __ao2_alloc((data_size), (destructor_fn), AO2_ALLOC_OPT_LOCK_MUTEX, (debug_msg), __FILE__, __LINE__, __PRETTY_FUNCTION__)
409#define ao2_alloc(data_size, destructor_fn) \
410 __ao2_alloc((data_size), (destructor_fn), AO2_ALLOC_OPT_LOCK_MUTEX, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
431#define ao2_alloc_with_lockobj(data_size, destructor_fn, lockobj, tag) \
432 __ao2_alloc_with_lockobj((data_size), (destructor_fn), (lockobj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
459#define ao2_ref(o,delta) __ao2_ref((o), (delta), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
460#define ao2_t_ref(o,delta,tag) __ao2_ref((o), (delta), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
480#define ao2_bump(obj) \
481 ao2_t_bump((obj), NULL)
483#define ao2_t_bump(obj, tag) \
485 typeof(obj) __obj_ ## __LINE__ = (obj); \
486 if (__obj_ ## __LINE__) { \
487 ao2_t_ref(__obj_ ## __LINE__, +1, (tag)); \
489 __obj_ ## __LINE__; \
492int __ao2_ref(
void *o,
int delta,
const char *tag,
const char *
file,
int line,
const char *func);
501#define ao2_replace(dst, src) \
502 ao2_t_replace((dst), (src), NULL)
504#define ao2_t_replace(dst, src, tag) \
506 typeof(dst) *__dst_ ## __LINE__ = &dst; \
507 typeof(src) __src_ ## __LINE__ = src; \
508 if (__src_ ## __LINE__ != *__dst_ ## __LINE__) { \
509 if (__src_ ## __LINE__) {\
510 ao2_t_ref(__src_ ## __LINE__, +1, (tag)); \
512 if (*__dst_ ## __LINE__) {\
513 ao2_t_ref(*__dst_ ## __LINE__, -1, (tag)); \
515 *__dst_ ## __LINE__ = __src_ ## __LINE__; \
538#define AO2_WEAKPROXY() struct ao2_weakproxy __weakproxy##__LINE__
550#define ao2_weakproxy_alloc(data_size, destructor_fn) \
551 __ao2_weakproxy_alloc(data_size, destructor_fn, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
553#define ao2_t_weakproxy_alloc(data_size, destructor_fn, tag) \
554 __ao2_weakproxy_alloc(data_size, destructor_fn, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__)
579#define ao2_weakproxy_set_object(weakproxy, obj, flags) \
580 __ao2_weakproxy_set_object(weakproxy, obj, flags, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
582#define ao2_t_weakproxy_set_object(weakproxy, obj, flags, tag) \
583 __ao2_weakproxy_set_object(weakproxy, obj, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__)
586 const char *tag,
const char *
file,
int line,
const char *func);
601#define ao2_weakproxy_ref_object(weakproxy, delta, flags) \
602 ao2_t_weakproxy_ref_object(weakproxy, delta, flags, NULL)
604#define ao2_t_weakproxy_ref_object(weakproxy, delta, flags, tag) \
605 __ao2_weakproxy_ref_object(weakproxy, delta, flags, \
606 tag, __FILE__, __LINE__, __PRETTY_FUNCTION__)
609 const char *tag,
const char *
file,
int line,
const char *func);
621#define ao2_weakproxy_get_object(weakproxy, flags) \
622 __ao2_weakproxy_get_object(weakproxy, flags, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
624#define ao2_t_weakproxy_get_object(weakproxy, flags, tag) \
625 __ao2_weakproxy_get_object(weakproxy, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__)
688#define ao2_get_weakproxy(obj) \
689 __ao2_get_weakproxy(obj, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
691#define ao2_t_get_weakproxy(obj, tag) \
692 __ao2_get_weakproxy(obj, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__)
717#define ao2_lock(a) __ao2_lock(a, AO2_LOCK_REQ_MUTEX, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
718#define ao2_rdlock(a) __ao2_lock(a, AO2_LOCK_REQ_RDLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
719#define ao2_wrlock(a) __ao2_lock(a, AO2_LOCK_REQ_WRLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
729#define ao2_unlock(a) __ao2_unlock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
739#define ao2_trylock(a) __ao2_trylock(a, AO2_LOCK_REQ_MUTEX, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
740#define ao2_tryrdlock(a) __ao2_trylock(a, AO2_LOCK_REQ_RDLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
741#define ao2_trywrlock(a) __ao2_trylock(a, AO2_LOCK_REQ_WRLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
829#ifndef HAVE_PTHREAD_RWLOCK_INITIALIZER
830#define AO2_GLOBAL_OBJ_STATIC(name) \
831 struct ao2_global_obj name; \
832 static void __attribute__((constructor)) __init_##name(void) \
834 ast_rwlock_init(&name.lock); \
837 static void __attribute__((destructor)) __fini_##name(void) \
840 ao2_ref(name.obj, -1); \
843 ast_rwlock_destroy(&name.lock); \
845 struct __dummy_##name
847#define AO2_GLOBAL_OBJ_STATIC(name) \
848 struct ao2_global_obj name = { \
849 .lock = AST_RWLOCK_INIT_VALUE, \
859#define ao2_global_obj_release(holder) \
860 __ao2_global_obj_replace_unref(&holder, NULL, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
861#define ao2_t_global_obj_release(holder, tag) \
862 __ao2_global_obj_replace_unref(&holder, NULL, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
878#define ao2_global_obj_replace(holder, obj) \
879 __ao2_global_obj_replace(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
881#define ao2_t_global_obj_replace(holder, obj, tag) \
882 __ao2_global_obj_replace(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
901#define ao2_global_obj_replace_unref(holder, obj) \
902 __ao2_global_obj_replace_unref(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
904#define ao2_t_global_obj_replace_unref(holder, obj, tag) \
905 __ao2_global_obj_replace_unref(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
918#define ao2_global_obj_ref(holder) \
919 __ao2_global_obj_ref(&holder, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
921#define ao2_t_global_obj_ref(holder, tag) \
922 __ao2_global_obj_ref(&holder, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
1150#define OBJ_POINTER OBJ_SEARCH_OBJECT
1151#define OBJ_KEY OBJ_SEARCH_KEY
1152#define OBJ_PARTIAL_KEY OBJ_SEARCH_PARTIAL_KEY
1276typedef int (
ao2_sort_fn)(
const void *obj_left,
const void *obj_right,
int flags);
1303#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn) \
1304 __ao2_container_alloc_hash((ao2_options), (container_options), (n_buckets), (hash_fn), (sort_fn), (cmp_fn), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1306#define ao2_t_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn, tag) \
1307 __ao2_container_alloc_hash((ao2_options), (container_options), (n_buckets), (hash_fn), (sort_fn), (cmp_fn), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
1310 unsigned int container_options,
unsigned int n_buckets,
ao2_hash_fn *hash_fn,
1327#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn) \
1328 __ao2_container_alloc_list((ao2_options), (container_options), (sort_fn), (cmp_fn), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1330#define ao2_t_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn, tag) \
1331 __ao2_container_alloc_list((ao2_options), (container_options), (sort_fn), (cmp_fn), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
1349#define ao2_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn) \
1350 __ao2_container_alloc_rbtree((ao2_options), (container_options), (sort_fn), (cmp_fn), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1352#define ao2_t_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn, tag) \
1353 __ao2_container_alloc_rbtree((ao2_options), (container_options), (sort_fn), (cmp_fn), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
1419#define ao2_container_clone(orig, flags) \
1420 __ao2_container_clone(orig, flags, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1422#define ao2_t_container_clone(orig, flags, tag) \
1423 __ao2_container_clone(orig, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1435typedef void (
ao2_prnt_fn)(
void *where,
const char *fmt, ...) __attribute__((format(printf, 2, 3)));
1532#define ao2_link(container, obj) \
1533 __ao2_link((container), (obj), 0, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1534#define ao2_t_link(container, obj, tag) \
1535 __ao2_link((container), (obj), 0, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
1554#define ao2_link_flags(container, obj, flags) \
1555 __ao2_link((container), (obj), (flags), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1556#define ao2_t_link_flags(container, obj, flags, tag) \
1557 __ao2_link((container), (obj), (flags), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
1560 const char *tag,
const char *
file,
int line,
const char *func);
1578#define ao2_unlink(container, obj) \
1579 __ao2_unlink((container), (obj), 0, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1580#define ao2_t_unlink(container, obj, tag) \
1581 __ao2_unlink((container), (obj), 0, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
1600#define ao2_unlink_flags(container, obj, flags) \
1601 __ao2_unlink((container), (obj), (flags), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1603#define ao2_t_unlink_flags(container, obj, flags, tag) \
1604 __ao2_unlink((container), (obj), (flags), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
1607 const char *tag,
const char *
file,
int line,
const char *func);
1693#define ao2_callback(c, flags, cb_fn, arg) \
1694 __ao2_callback((c), (flags), (cb_fn), (arg), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1696#define ao2_t_callback(c, flags, cb_fn, arg, tag) \
1697 __ao2_callback((c), (flags), (cb_fn), (arg), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
1721#define ao2_t_callback_data(container, flags, cb_fn, arg, data, tag) \
1722 __ao2_callback_data((container), (flags), (cb_fn), (arg), (data), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
1723#define ao2_callback_data(container, flags, cb_fn, arg, data) \
1724 __ao2_callback_data((container), (flags), (cb_fn), (arg), (data), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1728 int line,
const char *func);
1734#define ao2_t_find(container, arg, flags, tag) \
1735 __ao2_find((container), (arg), (flags), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
1736#define ao2_find(container, arg, flags) \
1737 __ao2_find((container), (arg), (flags), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1740 const char *tag,
const char *
file,
int line,
const char *func);
1748#define ao2_weakproxy_find(c, arg, flags, tag) \
1749 __ao2_weakproxy_find(c, arg, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1751 const char *tag,
const char *
file,
int line,
const char *func);
1903#if defined(TEST_FRAMEWORK)
1909#define ao2_t_iterator_next(iter, tag) \
1910 __ao2_iterator_next((iter), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
1911#define ao2_iterator_next(iter) \
1912 __ao2_iterator_next((iter), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1934#define ao2_cleanup(obj) __ao2_cleanup_debug((obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__)
1935#define ao2_t_cleanup(obj, tag) __ao2_cleanup_debug((obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
1957#define AO2_FIELD_HASH_FN(stype, field, hash_fn) \
1958static int stype ## _hash_fn(const void *obj, const int flags) \
1960 const struct stype *object = obj; \
1962 switch (flags & OBJ_SEARCH_MASK) { \
1963 case OBJ_SEARCH_KEY: \
1966 case OBJ_SEARCH_OBJECT: \
1967 key = object->field; \
1973 return hash_fn(key); \
1977#define AO2_FIELD_TRANSFORM_CMP_FN(cmp) ((cmp) ? 0 : CMP_MATCH)
1978#define AO2_FIELD_TRANSFORM_SORT_FN(cmp) (cmp)
1999#define AO2_FIELD_CMP_FN(stype, fn_suffix, field, key_cmp, partial_key_cmp, transform, argconst) \
2000static int stype ## fn_suffix(argconst void *obj, argconst void *arg, int flags) \
2002 const struct stype *object_left = obj, *object_right = arg; \
2003 const char *right_key = arg; \
2005 switch (flags & OBJ_SEARCH_MASK) { \
2006 case OBJ_SEARCH_OBJECT: \
2007 right_key = object_right->field; \
2008 case OBJ_SEARCH_KEY: \
2009 cmp = key_cmp(object_left->field, right_key); \
2011 case OBJ_SEARCH_PARTIAL_KEY: \
2012 cmp = partial_key_cmp(object_left->field, right_key, strlen(right_key)); \
2018 return transform(cmp); \
2032#define AO2_STRING_FIELD_HASH_FN(stype, field) \
2033 AO2_FIELD_HASH_FN(stype, field, ast_str_hash)
2034#define AO2_STRING_FIELD_CASE_HASH_FN(stype, field) \
2035 AO2_FIELD_HASH_FN(stype, field, ast_str_case_hash)
2048#define AO2_STRING_FIELD_CMP_FN(stype, field) \
2049 AO2_FIELD_CMP_FN(stype, _cmp_fn, field, strcmp, strncmp, AO2_FIELD_TRANSFORM_CMP_FN,)
2050#define AO2_STRING_FIELD_CASE_CMP_FN(stype, field) \
2051 AO2_FIELD_CMP_FN(stype, _cmp_fn, field, strcasecmp, strncasecmp, AO2_FIELD_TRANSFORM_CMP_FN,)
2064#define AO2_STRING_FIELD_SORT_FN(stype, field) \
2065 AO2_FIELD_CMP_FN(stype, _sort_fn, field, strcmp, strncmp, AO2_FIELD_TRANSFORM_SORT_FN, const)
2066#define AO2_STRING_FIELD_CASE_SORT_FN(stype, field) \
2067 AO2_FIELD_CMP_FN(stype, _sort_fn, field, strcasecmp, strncasecmp, AO2_FIELD_TRANSFORM_SORT_FN, const)
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
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_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.
void() ao2_prnt_obj_fn(void *v_obj, void *where, ao2_prnt_fn *prnt)
Print object key.
int ao2_weakproxy_unsubscribe(void *weakproxy, ao2_weakproxy_notification_cb cb, void *data, int flags)
Remove notification of real object destruction.
int ao2_weakproxy_subscribe(void *weakproxy, ao2_weakproxy_notification_cb cb, void *data, int flags)
Request notification when weakproxy points to NULL.
unsigned int ao2_options_get(void *obj)
Retrieve the ao2 options used to create the object.
_cb_results
A callback function will return a combination of CMP_MATCH and CMP_STOP. The latter will terminate th...
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
ao2_alloc_opts
Options available when allocating an ao2 object.
@ AO2_ALLOC_OPT_LOCK_NOLOCK
@ AO2_ALLOC_OPT_LOCK_RWLOCK
@ AO2_ALLOC_OPT_LOCK_MUTEX
@ AO2_ALLOC_OPT_LOCK_MASK
@ AO2_ALLOC_OPT_NO_REF_DEBUG
void ao2_iterator_cleanup(struct ao2_iterator *iter)
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)
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.
int ao2_match_by_addr(void *obj, void *arg, int flags)
A common ao2_callback is one that matches by address.
int ao2_container_check(struct ao2_container *self, enum search_flags flags)
Perform an integrity check on the specified container.
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_container_unregister(const char *name)
Unregister a container for CLI stats and integrity check.
ao2_lock_req
Which lock to request.
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
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)
void * __ao2_weakproxy_get_object(void *weakproxy, int flags, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result
void(* ao2_weakproxy_notification_cb)(void *weakproxy, void *data)
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.
int() ao2_callback_fn(void *obj, void *arg, int flags)
Type of a generic callback function.
@ AO2_ITERATOR_DONTLOCK
Assume that the ao2_container is already locked.
@ AO2_ITERATOR_DESCENDING
int __ao2_weakproxy_ref_object(void *weakproxy, int delta, int flags, const char *tag, const char *file, int line, const char *func)
void(* ao2_destructor_fn)(void *vdoomed)
Typedef for an object destructor.
int __ao2_link(struct ao2_container *c, void *obj_new, int flags, const char *tag, const char *file, int line, const char *func)
int ao2_ref_and_lock(void *obj)
Increment reference count on an object and lock it.
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
int ao2_iterator_count(struct ao2_iterator *iter)
Get a count of the iterated container objects.
int() ao2_sort_fn(const void *obj_left, const void *obj_right, int flags)
Type of generic container sort function.
void ao2_iterator_restart(struct ao2_iterator *iter)
Restart an iteration.
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
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)
int() ao2_hash_fn(const void *obj, int flags)
int __ao2_weakproxy_set_object(void *weakproxy, void *obj, int flags, const char *tag, const char *file, int line, const char *func)
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
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)
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
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
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_cleanup(void *obj)
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.
void * ao2_object_get_lockaddr(void *obj)
Return the mutex lock address of an object.
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.
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_cleanup_debug(void *obj, const char *tag, const char *file, int line, const char *function)
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
int() ao2_callback_data_fn(void *obj, void *arg, void *data, int flags)
Type of a generic callback function.
int __ao2_ref(void *o, int delta, const char *tag, const char *file, int line, const char *func)
search_flags
Flags passed to ao2_callback_fn(), ao2_hash_fn(), and ao2_sort_fn() to modify behaviour.
@ OBJ_ORDER_MASK
Traverse order option field mask.
@ OBJ_SEARCH_PARTIAL_KEY
The arg parameter is a partial search key similar to OBJ_SEARCH_KEY.
@ OBJ_ORDER_DESCENDING
Traverse in descending order (Last to first container object)
@ OBJ_SEARCH_OBJECT
The arg parameter is an object of the same type.
@ OBJ_ORDER_PRE
Traverse in pre-order (Node then children, for tree container)
@ OBJ_ORDER_ASCENDING
Traverse in ascending order (First to last container object)
@ OBJ_NOLOCK
Assume that the ao2_container is already locked.
@ OBJ_SEARCH_MASK
Search option field mask.
@ OBJ_ORDER_POST
Traverse in post-order (Children then node, for tree container)
@ OBJ_SEARCH_KEY
The arg parameter is a search key, but is not an object.
@ OBJ_SEARCH_NONE
The arg parameter has no meaning to the astobj2 code.
void * __ao2_unlink(struct ao2_container *c, void *obj, int flags, const char *tag, const char *file, int line, const char *func)
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
int __ao2_unlock(void *a, const char *file, const char *func, int line, const char *var)
Unlock an object.
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.
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_prnt_fn(void *where, const char *fmt,...)
Print output.
int ao2_unlock_and_unref(void *obj)
Unlock an object and decrement its reference count.
void * __ao2_get_weakproxy(void *obj, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result
ao2_container_opts
Options available when allocating an ao2 container object.
@ AO2_CONTAINER_ALLOC_OPT_DUPS_OBJ_REJECT
Reject duplicate objects in container.
@ AO2_CONTAINER_ALLOC_OPT_INSERT_BEGIN
Insert objects at the beginning of the container. (Otherwise it is the opposite; insert at the end....
@ AO2_CONTAINER_ALLOC_OPT_DUPS_ALLOW
Allow objects with duplicate keys in container.
@ AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT
Reject objects with duplicate keys in container.
@ AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE
Replace objects with duplicate keys in container.
@ AO2_CONTAINER_ALLOC_OPT_DUPS_MASK
The ao2 container objects with duplicate keys option field mask.
#define attribute_warn_unused_result
General Definitions for Asterisk top level program Included by asterisk.h to handle platform-specific...
Inlinable API function macro.
#define AST_INLINE_API(hdr, body)
A set of macros to manage forward-linked lists.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
Asterisk locking-related definitions:
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
This struct should be opaque, but it's size is needed.
struct ao2_weakproxy::@186 destroyed_cb
Structure for rwlock and tracking information.