Thu Oct 11 06:34:44 2012

Asterisk developer's documentation


astobj2.h File Reference

#include "asterisk/compat.h"
#include "asterisk/lock.h"

Include dependency graph for astobj2.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...
#define ao2_alloc(data_size, destructor_fn)   __ao2_alloc((data_size), (destructor_fn), AO2_ALLOC_OPT_LOCK_MUTEX)
#define ao2_alloc_options(data_size, destructor_fn, options)   __ao2_alloc((data_size), (destructor_fn), (options))
#define ao2_t_alloc(data_size, destructor_fn, debug_msg)   __ao2_alloc((data_size), (destructor_fn), AO2_ALLOC_OPT_LOCK_MUTEX)
#define ao2_t_alloc_options(data_size, destructor_fn, options, debug_msg)   __ao2_alloc((data_size), (destructor_fn), (options))
 Allocate and initialize an object.
void * __ao2_alloc (size_t data_size, ao2_destructor_fn destructor_fn, unsigned int options)
void * __ao2_alloc_debug (size_t data_size, ao2_destructor_fn destructor_fn, unsigned int options, const char *tag, const char *file, int line, const char *func, int ref_debug)
#define ao2_callback(c, flags, cb_fn, arg)   __ao2_callback((c), (flags), (cb_fn), (arg))
#define ao2_t_callback(c, flags, cb_fn, arg, tag)   __ao2_callback((c), (flags), (cb_fn), (arg))
 ao2_callback() is a generic function that applies cb_fn() to all objects in a container, as described below.
void * __ao2_callback (struct ao2_container *c, enum search_flags flags, ao2_callback_fn *cb_fn, void *arg)
void * __ao2_callback_debug (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)

Object Containers

Here start declarations of containers.

#define ao2_container_alloc(n_buckets, hash_fn, cmp_fn)   ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_MUTEX, (n_buckets), (hash_fn), (cmp_fn))
#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))
#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))
#define ao2_container_alloc_options(options, n_buckets, hash_fn, cmp_fn)   ao2_container_alloc_hash((options), 0, (n_buckets), (hash_fn), NULL, (cmp_fn))
#define ao2_container_clone(orig, flags)   __ao2_container_clone(orig, flags)
#define ao2_t_container_alloc(n_buckets, hash_fn, cmp_fn, tag)   ao2_t_container_alloc_options(AO2_ALLOC_OPT_LOCK_MUTEX, (n_buckets), (hash_fn), (cmp_fn), (tag))
#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))
 Allocate and initialize a hash container with the desired number of buckets.
#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))
 Allocate and initialize a list container.
#define ao2_t_container_alloc_options(options, n_buckets, hash_fn, cmp_fn, tag)   ao2_t_container_alloc_hash((options), 0, (n_buckets), (hash_fn), NULL, (cmp_fn), (tag))
 Allocate and initialize a hash container with the desired number of buckets.
#define ao2_t_container_clone(orig, flags, tag)   __ao2_container_clone(orig, flags)
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)
struct ao2_container__ao2_container_alloc_hash_debug (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, int ref_debug)
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)
struct ao2_container__ao2_container_alloc_list_debug (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, int ref_debug)
struct ao2_container__ao2_container_clone (struct ao2_container *orig, enum search_flags flags)
 Create a clone/copy of the given container.
struct ao2_container__ao2_container_clone_debug (struct ao2_container *orig, enum search_flags flags, const char *tag, const char *file, int line, const char *func, int ref_debug)
int ao2_container_check (struct ao2_container *self, enum search_flags flags)
 Perform an integrity check on the specified container.
int ao2_container_count (struct ao2_container *c)
 Returns the number of elements in a container.
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.
int ao2_container_register (const char *name, struct ao2_container *self)
 Register a container for CLI stats and integrity check.
void ao2_container_unregister (const char *name)
 Unregister a container for CLI stats and integrity check.

Object Management

Here we have functions to manage objects.

We can use the functions below on any kind of object defined by the user.

#define ao2_link(container, obj)   __ao2_link((container), (obj), 0)
#define ao2_link_flags(container, obj, flags)   __ao2_link((container), (obj), (flags))
#define ao2_t_link(container, obj, tag)   __ao2_link((container), (obj), 0)
 Add an object to a container.
#define ao2_t_link_flags(container, obj, flags, tag)   __ao2_link((container), (obj), (flags))
#define ao2_t_unlink(container, obj, tag)   __ao2_unlink((container), (obj), 0)
 Remove an object from a container.
#define ao2_t_unlink_flags(container, obj, flags, tag)   __ao2_unlink((container), (obj), (flags))
#define ao2_unlink(container, obj)   __ao2_unlink((container), (obj), 0)
#define ao2_unlink_flags(container, obj, flags)   __ao2_unlink((container), (obj), (flags))
int __ao2_link (struct ao2_container *c, void *obj_new, int flags)
int __ao2_link_debug (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)
void * __ao2_unlink_debug (struct ao2_container *c, void *obj, int flags, const char *tag, const char *file, int line, const char *func)
#define ao2_ref(o, delta)   __ao2_ref((o), (delta))
#define ao2_t_ref(o, delta, tag)   __ao2_ref((o), (delta))
 Reference/unreference an object and return the old refcount.
int __ao2_ref (void *o, int delta)
int __ao2_ref_debug (void *o, int delta, const char *tag, const char *file, int line, const char *func)

Defines

#define ao2_callback_data(container, flags, cb_fn, arg, data)   __ao2_callback_data((container), (flags), (cb_fn), (arg), (data))
#define ao2_cleanup(obj)   __ao2_cleanup(obj)
#define ao2_find(container, arg, flags)   __ao2_find((container), (arg), (flags))
#define ao2_global_obj_ref(holder)   __ao2_global_obj_ref(&holder, "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
#define ao2_global_obj_release(holder)   __ao2_global_obj_release(&holder, "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
#define ao2_global_obj_replace(holder, obj)   __ao2_global_obj_replace(&holder, (obj), "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
#define ao2_global_obj_replace_unref(holder, obj)   __ao2_global_obj_replace_unref(&holder, (obj), "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
#define AO2_GLOBAL_OBJ_STATIC(name)
 Define a global object holder to be used to hold an ao2 object, statically initialized.
#define ao2_iterator_next(iter)   __ao2_iterator_next((iter))
#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_t_callback_data(container, flags, cb_fn, arg, data, tag)   __ao2_callback_data((container), (flags), (cb_fn), (arg), (data))
 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.
#define ao2_t_find(container, arg, flags, tag)   __ao2_find((container), (arg), (flags))
#define ao2_t_global_obj_ref(holder, tag)   __ao2_global_obj_ref(&holder, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
 Get a reference to the object stored in the global holder.
#define ao2_t_global_obj_release(holder, tag)   __ao2_global_obj_release(&holder, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
 Release the ao2 object held in the global holder.
#define ao2_t_global_obj_replace(holder, obj, tag)   __ao2_global_obj_replace(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
 Replace an ao2 object in the global holder.
#define ao2_t_global_obj_replace_unref(holder, obj, tag)   __ao2_global_obj_replace_unref(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
 Replace an ao2 object in the global holder, throwing away any old object.
#define ao2_t_iterator_next(iter, tag)   __ao2_iterator_next((iter))
#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_wrlock(a)   __ao2_lock(a, AO2_LOCK_REQ_WRLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)

Typedefs

typedef int( ao2_callback_data_fn )(void *obj, void *arg, void *data, int flags)
 Type of a generic callback function.
typedef int( ao2_callback_fn )(void *obj, void *arg, int flags)
 Type of a generic callback function.
typedef void(* ao2_destructor_fn )(void *)
 Typedef for an object destructor. This is called just before freeing the memory for the object. It is passed a pointer to the user-defined data of the object.
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.

Enumerations

enum  _cb_results { CMP_MATCH = 0x1, CMP_STOP = 0x2 }
 A callback function will return a combination of CMP_MATCH and CMP_STOP. The latter will terminate the search in a container. More...
enum  ao2_alloc_opts { AO2_ALLOC_OPT_LOCK_MUTEX = (0 << 0), AO2_ALLOC_OPT_LOCK_RWLOCK = (1 << 0), AO2_ALLOC_OPT_LOCK_NOLOCK = (2 << 0), AO2_ALLOC_OPT_LOCK_MASK = (3 << 0) }
 Options available when allocating an ao2 object. More...
enum  ao2_container_opts {
  AO2_CONTAINER_ALLOC_OPT_INSERT_BEGIN = (1 << 0), AO2_CONTAINER_ALLOC_OPT_DUPS_MASK = (3 << 1), AO2_CONTAINER_ALLOC_OPT_DUPS_ALLOW = (0 << 1), AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT = (1 << 1),
  AO2_CONTAINER_ALLOC_OPT_DUPS_OBJ_REJECT = (2 << 1), AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE = (3 << 1)
}
 Options available when allocating an ao2 container object. More...
enum  ao2_iterator_flags { AO2_ITERATOR_DONTLOCK = (1 << 0), AO2_ITERATOR_MALLOCD = (1 << 1), AO2_ITERATOR_UNLINK = (1 << 2), AO2_ITERATOR_DESCENDING = (1 << 3) }
enum  ao2_lock_req { AO2_LOCK_REQ_MUTEX, AO2_LOCK_REQ_RDLOCK, AO2_LOCK_REQ_WRLOCK }
 Which lock to request. More...
enum  search_flags {
  OBJ_UNLINK = (1 << 0), OBJ_NODATA = (1 << 1), OBJ_MULTIPLE = (1 << 2), OBJ_POINTER = (1 << 3),
  OBJ_CONTINUE = (1 << 4), OBJ_NOLOCK = (1 << 5), OBJ_KEY = (1 << 6), OBJ_PARTIAL_KEY = (1 << 7),
  OBJ_ORDER_MASK = (0x03 << 8), OBJ_ORDER_ASCENDING = (0 << 8), OBJ_ORDER_DESCENDING = (1 << 8)
}
 Flags passed to ao2_callback_fn(), ao2_hash_fn(), and ao2_sort_fn() to modify behaviour. More...

Functions

void * __ao2_callback_data (struct ao2_container *c, enum search_flags flags, ao2_callback_data_fn *cb_fn, void *arg, void *data)
void * __ao2_callback_data_debug (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 *file, int line, const char *function)
void * __ao2_find (struct ao2_container *c, const void *arg, enum search_flags flags)
void * __ao2_find_debug (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)
void __ao2_global_obj_release (struct ao2_global_obj *holder, const char *tag, const char *file, int line, const char *func, const char *name)
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)
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)
void * __ao2_iterator_next_debug (struct ao2_iterator *iter, const char *tag, const char *file, int line, const char *func)
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.
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_unlock (void *a, const char *file, const char *func, int line, const char *var)
 Unlock an object.
void ao2_bt (void)
void ao2_iterator_cleanup (struct ao2_iterator *iter)
void ao2_iterator_destroy (struct ao2_iterator *iter)
 Destroy a container iterator.
struct ao2_iterator ao2_iterator_init (struct ao2_container *c, int flags)
 Create an iterator for a container.
void ao2_iterator_restart (struct ao2_iterator *iter)
 Restart an iteration.
int ao2_match_by_addr (void *obj, void *arg, int flags)
 A common ao2_callback is one that matches by address.
void * ao2_object_get_lockaddr (void *obj)
 Return the mutex lock address of an object.


Detailed Description

Object Model implementing objects and containers.

Definition in file astobj2.h.


Define Documentation

#define ao2_alloc ( data_size,
destructor_fn   )     __ao2_alloc((data_size), (destructor_fn), AO2_ALLOC_OPT_LOCK_MUTEX)

Definition at line 459 of file astobj2.h.

Referenced by __aco_option_register(), __ast_channel_internal_alloc(), _ast_odbc_request_obj2(), _moh_class_malloc(), aco_option_register_deprecated(), add_calltoken_ignore(), add_column_name(), alloc_event_ref(), ast_add_hint(), ast_bridge_new(), ast_calendar_event_alloc(), ast_cel_linkedid_ref(), ast_channel_dialed_causes_add(), ast_config_hook_register(), ast_create_callid(), ast_format_cap_add(), ast_manager_register2(), ast_msg_alloc(), ast_msg_tech_register(), ast_register_indication(), ast_rtp_codecs_payloads_copy(), ast_rtp_codecs_payloads_default(), ast_rtp_codecs_payloads_set_m_type(), ast_rtp_codecs_payloads_set_rtpmap_type_rate(), ast_rtp_ice_add_cand(), ast_rtp_ice_add_remote_candidate(), ast_rtp_instance_new(), ast_taskprocessor_get(), ast_tcptls_client_create(), ast_tcptls_server_root(), ast_tone_zone_alloc(), ast_websocket_add_protocol(), ast_xmpp_client_config_alloc(), bridge_channel_alloc(), bridge_request(), build_calendar(), build_callno_limits(), build_device(), build_format_list_array(), build_mansession(), build_peer(), build_profile(), build_route(), build_user(), caldav_load_calendar(), calendar_query_exec(), chan_list_init(), conf_run(), create_callno_pools(), create_esc_entry(), create_parkinglot(), create_queue_member(), data_filter_alloc(), data_provider_new(), data_result_create(), data_search_alloc(), dialgroup_write(), ewscal_load_calendar(), exchangecal_load_calendar(), extension_state_add_destroy(), fax_detect_new(), fax_gateway_new(), fax_session_new(), fax_session_reserve(), featuremap_write(), format_list_add_custom(), format_list_add_static(), get_filestream(), ical_load_calendar(), inprocess_count(), jingle_alloc(), jingle_config_alloc(), jingle_endpoint_alloc(), jingle_endpoint_state_create(), join_conference_bridge(), kqueue_timer_open(), load_config(), load_odbc_config(), local_alloc(), msg_data_alloc(), multiplexed_bridge_create(), named_acl_alloc(), named_acl_config_alloc(), new_iax(), new_realtime_sqlite3_db(), parse_apps(), peercnt_add(), presence_state_cb(), proxy_from_config(), pthread_timer_open(), realtime_common(), session_details_new(), set_fn(), sip_monitor_instance_init(), sip_prepare_socket(), sip_tcptls_write(), sip_threadinfo_create(), skel_config_alloc(), skel_game_alloc(), skel_level_alloc(), skel_state_alloc(), softmix_bridge_create(), timerfd_timer_open(), try_calling(), udptl_snapshot_alloc(), ustmtext(), websocket_callback(), xml_translate(), xmpp_client_alloc(), xmpp_client_create_buddy(), xmpp_config_alloc(), and xmpp_pak_presence().

#define ao2_alloc_options ( data_size,
destructor_fn,
options   )     __ao2_alloc((data_size), (destructor_fn), (options))

#define ao2_callback ( c,
flags,
cb_fn,
arg   )     __ao2_callback((c), (flags), (cb_fn), (arg))

Definition at line 1495 of file astobj2.h.

Referenced by _ast_odbc_request_obj2(), _sip_show_peers(), acf_jabberstatus_read(), aco_option_find(), admin_exec(), ast_begin_shutdown(), ast_calendar_clear_events(), ast_calendar_merge_events(), ast_calendar_unregister(), ast_channel_dialed_causes_channels(), ast_channel_dialed_causes_clear(), ast_event_dump_cache(), ast_extension_state_del(), ast_format_cap_append(), ast_format_cap_best_byid(), ast_format_cap_copy(), ast_format_cap_dup(), ast_format_cap_has_joint(), ast_format_cap_joint(), ast_format_cap_remove(), ast_format_cap_remove_all(), ast_format_cap_remove_byid(), ast_format_cap_remove_bytype(), ast_merge_contexts_and_delete(), ast_namedgroups_intersect(), ast_rtp_codecs_payload_code(), ast_rtp_codecs_payload_formats(), ast_unregister_indication_country(), caldav_destructor(), calendar_is_busy(), calltoken_required(), cc_handle_publish_error(), channel_admin_exec(), cleanup(), conf_run(), delete_users(), destroy_hint(), do_reload(), do_timing(), event_dump_cache(), event_update_cache(), ewscal_destructor(), exchangecal_destructor(), handle_cc_notify(), handle_cli_status(), handle_response_subscribe(), icalendar_destructor(), joint_copy_helper(), load_config(), load_format_config(), load_indications(), load_module(), mark_all_databases_dirty(), meetme_data_provider_get(), multiplexed_bridge_create(), reload(), reload_config(), reload_queues(), reload_single_queue(), set_config_destroy(), set_peercnt_limit(), sip_tcp_locate(), unlink_dirty_databases(), unload_module(), xmpp_client_config_post_apply(), xmpp_config_post_apply(), xmpp_roster_hook(), and xmpp_status_exec().

#define ao2_callback_data ( container,
flags,
cb_fn,
arg,
data   )     __ao2_callback_data((container), (flags), (cb_fn), (arg), (data))

Definition at line 1533 of file astobj2.h.

Referenced by ast_channel_callback(), and function_amiclient().

#define ao2_cleanup ( obj   )     __ao2_cleanup(obj)

Definition at line 1765 of file astobj2.h.

Referenced by acf_jabberreceive_read(), acf_jabberstatus_read(), aco_process_ast_config(), aco_process_config(), aco_process_var(), app_exec(), ast_named_acl_find(), ast_namedgroups_intersect(), ast_rtp_codecs_payloads_destroy(), ast_udptl_new_with_bindaddr(), ast_unref_namedgroups(), ast_xmpp_client_config_destructor(), ast_xmpp_client_find(), cli_display_named_acl(), cli_display_named_acl_list(), delete_old_messages(), device_state_info_dt(), extensionstate_update(), handle_cli_show_config(), handle_request_subscribe(), handle_skel_show_config(), handle_skel_show_levels(), handle_statechange(), internal_type_destroy(), jingle_config_destructor(), jingle_endpoint_state_find_or_create(), jingle_request(), load_module(), manager_jabber_send(), named_acl_config_destructor(), namedgroup_match(), process_category(), skel_config_destructor(), skel_find_or_create_state(), skel_game_destructor(), skel_level_destructor(), udptl_config_destructor(), xmpp_action_hook(), xmpp_cli_create_collection(), xmpp_cli_create_leafnode(), xmpp_cli_delete_pubsub_node(), xmpp_cli_list_pubsub_nodes(), xmpp_cli_purge_pubsub_nodes(), xmpp_client_destructor(), xmpp_client_find_or_create(), xmpp_client_reconnect(), xmpp_client_send_message(), xmpp_client_set_group_presence(), xmpp_client_set_presence(), xmpp_client_thread(), xmpp_component_register_get_hook(), xmpp_component_service_discovery_get_hook(), xmpp_component_service_discovery_items_hook(), xmpp_config_destructor(), xmpp_config_post_apply(), xmpp_config_prelink(), xmpp_connect_hook(), xmpp_init_event_distribution(), xmpp_join_exec(), xmpp_leave_exec(), xmpp_log_hook(), xmpp_pubsub_build_publish_skeleton(), xmpp_pubsub_handle_error(), xmpp_pubsub_iq_create(), xmpp_pubsub_publish_device_state(), xmpp_pubsub_subscribe(), xmpp_roster_hook(), xmpp_send_cb(), xmpp_send_exec(), xmpp_sendgroup_exec(), xmpp_show_buddies(), xmpp_show_clients(), and xmpp_status_exec().

#define ao2_container_alloc ( n_buckets,
hash_fn,
cmp_fn   )     ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_MUTEX, (n_buckets), (hash_fn), (cmp_fn))

#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))

Definition at line 1130 of file astobj2.h.

#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))

Definition at line 1176 of file astobj2.h.

#define ao2_container_alloc_options ( options,
n_buckets,
hash_fn,
cmp_fn   )     ao2_container_alloc_hash((options), 0, (n_buckets), (hash_fn), NULL, (cmp_fn))

#define ao2_container_clone ( orig,
flags   )     __ao2_container_clone(orig, flags)

Definition at line 1240 of file astobj2.h.

#define ao2_find ( container,
arg,
flags   )     __ao2_find((container), (arg), (flags))

Definition at line 1558 of file astobj2.h.

Referenced by __find_callno(), _lookup_timer(), acf_jabberstatus_read(), action_confbridgekick(), action_confbridgelist(), action_confbridgesetsinglevideosrc(), action_confbridgestartrecord(), action_confbridgestoprecord(), action_messagesend(), add_calltoken_ignore(), admin_exec(), app_exec(), ast_add_hint(), ast_cel_check_retire_linkedid(), ast_cel_linkedid_ref(), ast_cel_report_event(), ast_change_hint(), ast_channel_dialed_causes_add(), ast_channel_dialed_causes_find(), ast_config_hook_unregister(), ast_event_get_cached(), ast_extension_state_del(), ast_format_attr_reg_interface(), ast_format_attr_unreg_interface(), ast_format_cap_get_compatible_format(), ast_format_cap_iscompatible(), ast_get_indication_zone(), ast_get_namedgroups(), ast_merge_contexts_and_delete(), ast_msg_send(), ast_msg_tech_register(), ast_msg_tech_unregister(), ast_remove_hint(), ast_rtp_codecs_find_payload_code(), ast_rtp_codecs_get_payload_format(), ast_rtp_codecs_payload_code(), ast_rtp_codecs_payload_lookup(), ast_rtp_codecs_payloads_copy(), ast_rtp_codecs_payloads_set_m_type(), ast_rtp_codecs_payloads_set_rtpmap_type_rate(), ast_rtp_codecs_payloads_unset(), ast_rtp_ice_add_cand(), ast_taskprocessor_get(), ast_unregister_indication_country(), ast_websocket_add_protocol(), ast_websocket_remove_protocol(), authenticate_request(), authenticate_verify(), build_callno_limits(), build_peer(), build_user(), builtin_feature_get_exten(), check_manager_session_inuse(), cli_alias_passthrough(), cli_fax_show_session(), client_buddy_handler(), compare_weight(), complete_indications(), conf_run(), data_filter_find(), data_provider_find(), data_result_find_child(), data_search_find(), dialgroup_read(), dialgroup_write(), extension_state_add_destroy(), featuremap_write(), find_calendar(), find_database(), find_event(), find_hint_by_cb_id(), find_interface(), find_member_by_queuename_and_interface(), find_parkinglot(), find_peer(), find_profile(), find_pvt(), find_timer(), find_user(), func_confbridge_info(), generic_lock_unlock_helper(), generic_mute_unmute_helper(), get_esc_entry(), get_unused_callno(), handle_cli_confbridge_kick(), handle_cli_confbridge_list(), handle_cli_confbridge_start_record(), handle_cli_confbridge_stop_record(), handle_cli_iax2_unregister(), handle_cli_indication_show(), iax2_destroy_helper(), inprocess_count(), jingle_action_hook(), jingle_endpoint_find(), jingle_request(), join_conference_bridge(), meetmemute(), msg_data_find(), msg_send_exec(), named_acl_find(), namedgroup_match(), parse_tone_zone(), peercnt_add(), peercnt_modify(), peercnt_remove_by_addr(), phoneprov_callback(), realtime_common(), realtime_sqlite3_require(), reload_single_member(), remove_from_queue(), sched_delay_remove(), set_fn(), sip_poke_peer_s(), skel_find_or_create_state(), skel_level_find(), timerfd_timer_ack(), timerfd_timer_close(), timerfd_timer_disable_continuous(), timerfd_timer_enable_continuous(), timerfd_timer_get_event(), timerfd_timer_set_rate(), update_queue(), ustmtext(), websocket_callback(), xml_translate(), xmpp_client_config_merge_buddies(), xmpp_client_service_discovery_result_hook(), xmpp_component_register_get_hook(), xmpp_config_find(), xmpp_pak_presence(), xmpp_pak_s10n(), xmpp_roster_hook(), and xmpp_status_exec().

#define ao2_global_obj_ref ( holder   )     __ao2_global_obj_ref(&holder, "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)

#define ao2_global_obj_release ( holder   )     __ao2_global_obj_release(&holder, "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)

Definition at line 633 of file astobj2.h.

Referenced by unload_module().

#define ao2_global_obj_replace ( holder,
obj   )     __ao2_global_obj_replace(&holder, (obj), "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)

Definition at line 655 of file astobj2.h.

#define ao2_global_obj_replace_unref ( holder,
obj   )     __ao2_global_obj_replace_unref(&holder, (obj), "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)

Definition at line 678 of file astobj2.h.

Referenced by apply_config().

#define AO2_GLOBAL_OBJ_STATIC ( name   ) 

Define a global object holder to be used to hold an ao2 object, statically initialized.

Since:
11.0
Parameters:
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:

 static AO2_GLOBAL_OBJ_STATIC(global_cfg);

This defines global_cfg, intended to hold an ao2 object accessible using an API.

Definition at line 599 of file astobj2.h.

#define ao2_iterator_next ( iter   )     __ao2_iterator_next((iter))

Definition at line 1733 of file astobj2.h.

Referenced by __ast_data_search_cmp_structure(), __ast_manager_event_multichan(), __data_result_print_cli(), __iax2_show_peers(), __queues_show(), aco_set_defaults(), action_confbridgelistrooms(), action_meetmelist(), add_ice_to_sdp(), alias_show(), ast_channel_iterator_next(), ast_data_iterator_next(), ast_data_search_match(), ast_format_cap_get_type(), ast_format_cap_has_joint(), ast_format_cap_has_type(), ast_format_cap_identical(), ast_format_cap_iter_next(), ast_format_cap_joint(), ast_format_cap_to_old_bitfield(), ast_merge_contexts_and_delete(), ast_msg_var_iterator_next(), ast_pickup_find_by_group(), ast_print_namedgroups(), ast_rtp_ice_start(), ast_srtp_unprotect(), ast_var_indications(), ast_var_indications_table(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), authenticate(), authenticate_reply(), build_dialplan_useage_map(), build_format_list_array(), calendar_query_exec(), check_access(), clear_queue(), cli_console_active(), cli_display_named_acl_list(), cli_fax_show_sessions(), cli_list_devices(), cli_tps_report(), complete_confbridge_name(), complete_core_show_hint(), complete_country(), complete_iax2_peers(), complete_iax2_unregister(), complete_queue_remove_member(), complete_userno(), conf_queue_dtmf(), conf_run(), config_hook_exec(), data_filter_find(), data_odbc_provider_handler(), data_provider_print_cli(), data_provider_release_all(), data_result_generate_node(), data_result_manager_output(), delete_profiles(), delete_routes(), delete_users(), destroy_pvts(), dialgroup_read(), do_parking_thread(), dump_queue_members(), extension_state_cb(), fax_session_tab_complete(), find_call(), find_queue_by_name_rt(), find_ringing_channel(), find_session(), find_session_by_nonce(), free_members(), get_device_state_causing_channels(), get_member_status(), handle_cli_confbridge_list(), handle_cli_iax2_show_callno_limits(), handle_cli_iax2_show_users(), handle_cli_indication_show(), handle_cli_odbc_show(), handle_feature_show(), handle_parkedcalls(), handle_presencechange(), handle_show_calendar(), handle_show_calendars(), handle_show_hint(), handle_show_hints(), handle_show_routes(), handle_showmanconn(), handle_skel_show_games(), handle_skel_show_levels(), handle_statechange(), hints_data_provider_get(), iax2_getpeername(), iax2_getpeertrunk(), interface_exists(), jingle_add_google_candidates_to_transport(), jingle_add_ice_udp_candidates_to_transport(), jingle_request(), joint_copy_helper(), local_devicestate(), locals_show(), manager_iax2_show_peer_list(), manager_optimize_away(), manager_parking_status(), manager_parkinglot_list(), manager_queues_status(), manager_queues_summary(), meetme_show_cmd(), moh_rescan_files(), msg_func_write(), num_available_members(), peers_data_provider_get(), poke_all_peers(), pp_each_user_helper(), prune_peers(), prune_users(), purge_sessions(), queue_function_mem_read(), queue_function_qac_dep(), queue_function_queuememberlist(), queues_data_provider_get(), queues_data_provider_get_helper(), reload(), rt_handle_member_record(), stop_streams(), tps_taskprocessor_tab_complete(), try_calling(), unload_module(), update_realtime_members(), users_data_provider_get(), xmpp_pubsub_create_affiliations(), xmpp_show_buddies(), and xmpp_show_clients().

#define ao2_link ( container,
obj   )     __ao2_link((container), (obj), 0)

Definition at line 1334 of file astobj2.h.

Referenced by __ast_channel_alloc_ap(), _ast_odbc_request_obj2(), add_calltoken_ignore(), add_column_name(), add_new_event_cb(), add_to_queue(), app_exec(), ast_add_hint(), ast_cel_linkedid_ref(), ast_change_hint(), ast_change_name(), ast_channel_dialed_causes_add(), ast_config_hook_register(), ast_do_masquerade(), ast_extension_state3(), ast_format_cap_add(), ast_get_namedgroups(), ast_merge_contexts_and_delete(), ast_msg_tech_register(), ast_register_indication_country(), ast_rtp_ice_add_cand(), ast_rtp_ice_add_remote_candidate(), ast_taskprocessor_get(), ast_taskprocessor_unreference(), build_calendar(), build_callno_limits(), build_device(), build_mansession(), build_parkinglot(), build_profile(), build_route(), caldav_add_event(), conf_run(), create_callno_pools(), create_dynamic_parkinglot(), create_new_sip_etag(), data_filter_add_child(), data_provider_add_child(), data_result_add_child(), data_search_add_child(), dialgroup_write(), endelm(), event_update_cache(), extension_state_add_destroy(), fax_session_new(), featuremap_write(), find_channel_by_group(), format_list_add_custom(), format_list_add_static(), get_lock(), icalendar_add_event(), inprocess_count(), jingle_action_session_initiate(), jingle_request(), join_conference_bridge(), kqueue_timer_open(), link_option_to_types(), load_config(), local_alloc(), msg_set_var_full(), multiplexed_bridge_create(), odbc_register_class(), on_dns_update_peer(), parse_apps(), parse_config(), parse_tag(), peercnt_add(), process_category(), pthread_timer_open(), realtime_common(), realtime_peer(), realtime_user(), reload_single_member(), replace_callno(), rt_handle_member_record(), set_config(), set_fn(), sip_monitor_instance_init(), store_by_peercallno(), store_by_transfercallno(), timerfd_timer_open(), ustmtext(), xml_translate(), xmpp_client_config_merge_buddies(), and xmpp_client_create_buddy().

#define ao2_link_flags ( container,
obj,
flags   )     __ao2_link((container), (obj), (flags))

#define ao2_lock (  )     __ao2_lock(a, AO2_LOCK_REQ_MUTEX, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)

Definition at line 529 of file astobj2.h.

Referenced by __ast_manager_event_multichan(), __queues_show(), _ast_odbc_request_obj2(), _sip_show_peer(), _sip_show_peers(), _sip_tcp_helper_thread(), action_confbridgekick(), action_confbridgelist(), action_confbridgelistrooms(), action_confbridgesetsinglevideosrc(), action_confbridgestartrecord(), action_confbridgestoprecord(), action_kick_last(), action_toggle_mute_participants(), action_waitevent(), add_calltoken_ignore(), add_sdp(), add_to_queue(), aoro2_obj_cb(), app_exec(), ast_add_hint(), ast_bridge_change_state(), ast_bridge_depart(), ast_bridge_destroy(), ast_bridge_dtmf_stream(), ast_bridge_is_video_src(), ast_bridge_join(), ast_bridge_merge(), ast_bridge_number_video_src(), ast_bridge_remove(), ast_bridge_remove_video_src(), ast_bridge_set_internal_sample_rate(), ast_bridge_set_mixing_interval(), ast_bridge_set_single_src_video_mode(), ast_bridge_set_talker_src_video_mode(), ast_bridge_suspend(), ast_bridge_unsuspend(), ast_bridge_update_talker_src_video_mode(), ast_change_hint(), ast_change_name(), ast_do_masquerade(), ast_extension_state_del(), ast_format_cap_iter_start(), ast_get_indication_tone(), ast_get_indication_zone(), ast_hook_send_action(), ast_manager_unregister(), ast_merge_contexts_and_delete(), ast_odbc_direct_execute(), ast_odbc_find_table(), ast_odbc_prepare_and_execute(), ast_odbc_smart_execute(), ast_register_indication_country(), ast_remove_hint(), ast_set_indication_country(), ast_taskprocessor_get(), ast_taskprocessor_unreference(), ast_unregister_indication_country(), ast_websocket_add_protocol(), ast_xmpp_client_lock(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), attended_abort_transfer(), auth_http_callback(), awesome_locking(), bridge_channel_join(), bridge_channel_join_multithreaded(), bridge_channel_join_singlethreaded(), bridge_channel_suspend(), bridge_channel_thread(), bridge_channel_unsuspend(), bridge_hangup(), bridge_thread(), bridge_write(), build_callno_limits(), build_parkinglot(), build_peer(), build_reply_digest(), builtin_feature_get_exten(), calendar_destructor(), change_callid_pvt(), check_bridge(), clear_stats(), cli_fax_show_sessions(), compare_weight(), complete_core_show_hint(), complete_queue_remove_member(), complete_sip_user(), conf_handle_dtmf(), conf_run(), create_addr_from_peer(), data_odbc_provider_handler(), db_destructor(), db_open(), db_sync_thread(), destroy_gateway(), destroy_v21_sessions(), event_update_cache(), execute_menu_entry(), execute_state_callback(), extension_state_add_destroy(), extension_state_cb(), featuremap_write(), find_member_by_queuename_and_interface(), find_queue_by_name_rt(), find_session(), find_session_by_nonce(), func_confbridge_info(), generic_fax_exec(), generic_http_callback(), generic_lock_unlock_helper(), generic_mute_unmute_helper(), generic_thread_loop(), get_input(), get_member_penalty(), get_member_status(), get_unused_callno(), handle_cli_confbridge_kick(), handle_cli_confbridge_list(), handle_cli_confbridge_start_record(), handle_cli_confbridge_stop_record(), handle_cli_misdn_send_facility(), handle_cli_odbc_show(), handle_presencechange(), handle_request_subscribe(), handle_show_hint(), handle_show_hints(), handle_showmanconn(), handle_statechange(), handle_video_on_exit(), handle_video_on_join(), inprocess_count(), is_our_turn(), jingle_fixup(), jingle_hangup(), jingle_new(), jingle_request(), jingle_session_lock_full(), join_conference_bridge(), join_queue(), leave_conference_bridge(), leave_queue(), load_indications(), local_answer(), local_bridgedchannel(), local_call(), local_devicestate(), local_digit_begin(), local_digit_end(), local_fixup(), local_indicate(), local_queryoption(), local_queue_frame(), local_sendhtml(), local_sendtext(), local_setoption(), local_write(), locals_show(), manager_optimize_away(), manager_queues_status(), manager_queues_summary(), manager_sip_peer_status(), moh_class_destructor(), moh_release(), mohalloc(), monmp3thread(), msg_data_func_read(), msg_data_func_write(), msg_func_read(), msg_func_write(), msg_send_exec(), multiplexed_add_or_remove(), multiplexed_bridge_create(), multiplexed_bridge_destroy(), multiplexed_thread_function(), on_dns_update_peer(), peercnt_add(), peercnt_remove(), peers_data_provider_get(), process_events(), process_message(), pthread_timer_ack(), pthread_timer_disable_continuous(), pthread_timer_enable_continuous(), pthread_timer_get_event(), pthread_timer_open(), pthread_timer_set_rate(), purge_sessions(), queue_function_mem_read(), queue_function_mem_write(), queue_function_qac_dep(), queue_function_queuememberlist(), queue_function_queuewaitingcount(), queue_function_var(), queues_data_provider_get(), realtime_sqlite3_execute_handle(), recalc_holdtime(), record_abandoned(), register_verify(), reload_queues(), reload_single_queue(), remove_from_queue(), replace_callno(), ring_entry(), rna(), run_timer(), schedule_calendar_event(), session_do(), set_eventmask(), set_member_paused(), set_member_penalty_help_members(), set_member_ringinuse_help_members(), set_queue_variables(), sip_keepalive_all_peers(), sip_poke_all_peers(), sip_prune_realtime(), sip_send_mwi_to_peer(), sip_show_inuse(), sip_show_user(), sip_show_users(), sip_tcptls_write(), smart_bridge_operation(), softmix_bridge_thread(), spandsp_fax_cli_show_session(), start_conf_record_thread(), timerfd_timer_ack(), timerfd_timer_disable_continuous(), timerfd_timer_enable_continuous(), timerfd_timer_get_event(), timerfd_timer_set_rate(), try_calling(), update_call_counter(), update_peer_lastmsgssent(), update_queue(), update_realtime_members(), xmpp_client_service_discovery_result_hook(), xmpp_pak_presence(), and xmpp_pak_s10n().

#define ao2_rdlock (  )     __ao2_lock(a, AO2_LOCK_REQ_RDLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)

#define ao2_ref ( o,
delta   )     __ao2_ref((o), (delta))

Definition at line 502 of file astobj2.h.

Referenced by __aco_option_register(), __ao2_cleanup(), __ast_channel_alloc_ap(), __ast_data_add(), __ast_data_register(), __ast_data_search_cmp_structure(), __data_result_print_cli(), __find_callno(), __queues_show(), __sip_destroy(), __unload_module(), _ast_event_queue(), _ast_odbc_request_obj2(), _sip_tcp_helper_thread(), acf_faxopt_read(), acf_faxopt_write(), acf_jabberstatus_read(), aco_option_register_deprecated(), aco_process_var(), aco_set_defaults(), action_confbridgekick(), action_confbridgelist(), action_confbridgelistrooms(), action_confbridgesetsinglevideosrc(), action_confbridgestartrecord(), action_confbridgestoprecord(), action_meetmelist(), action_messagesend(), add_calltoken_ignore(), add_cc_call_info_to_response(), add_column_name(), add_event_to_list(), add_hintdevice(), add_ice_to_sdp(), add_to_queue(), admin_exec(), alias_show(), announce_thread(), app_exec(), ast_add_hint(), ast_bridge_destroy(), ast_bridge_impart(), ast_bridge_join(), ast_bridge_merge(), ast_bridge_new(), ast_calendar_unref_event(), ast_cel_check_retire_linkedid(), ast_cel_engine_init(), ast_cel_engine_term(), ast_cel_linkedid_ref(), ast_cel_report_event(), ast_change_hint(), ast_channel_dialed_causes_add(), ast_closestream(), ast_config_text_file_save(), ast_data_free(), ast_data_iterator_end(), ast_data_iterator_next(), ast_data_search_match(), ast_event_get_cached(), ast_extension_state3(), ast_extension_state_del(), ast_extension_state_extended(), ast_format_attr_reg_interface(), ast_format_attr_unreg_interface(), ast_format_cap_add(), ast_format_cap_destroy(), ast_format_cap_get_compatible_format(), ast_format_cap_get_type(), ast_format_cap_has_joint(), ast_format_cap_has_type(), ast_format_cap_identical(), ast_format_cap_iscompatible(), ast_format_cap_iter_next(), ast_format_cap_joint(), ast_format_cap_remove(), ast_format_cap_to_old_bitfield(), ast_format_get_value(), ast_format_list_destroy(), ast_format_list_get(), ast_format_sdp_generate(), ast_format_sdp_parse(), ast_get_namedgroups(), ast_merge_contexts_and_delete(), ast_moh_destroy(), ast_msg_alloc(), ast_msg_destroy(), ast_msg_get_var(), ast_msg_queue(), ast_msg_ref(), ast_msg_send(), ast_msg_tech_register(), ast_msg_tech_unregister(), ast_msg_var_iterator_next(), ast_msg_var_unref_current(), ast_pickup_find_by_group(), ast_print_namedgroups(), ast_ref_namedgroups(), ast_remove_hint(), ast_rtcp_write(), ast_rtp_codecs_find_payload_code(), ast_rtp_codecs_get_payload_format(), ast_rtp_codecs_payload_code(), ast_rtp_codecs_payload_lookup(), ast_rtp_codecs_payloads_copy(), ast_rtp_codecs_payloads_default(), ast_rtp_codecs_payloads_set_m_type(), ast_rtp_codecs_payloads_set_rtpmap_type_rate(), ast_rtp_destroy(), ast_rtp_ice_add_cand(), ast_rtp_ice_add_remote_candidate(), ast_rtp_ice_get_local_candidates(), ast_rtp_instance_destroy(), ast_rtp_instance_make_compatible(), ast_rtp_instance_new(), ast_rtp_prop_set(), ast_rtp_raw_write(), ast_rtp_read(), ast_rtp_stop(), ast_taskprocessor_get(), ast_taskprocessor_unreference(), ast_tcptls_client_create(), ast_tcptls_client_start(), ast_tcptls_server_root(), ast_tone_zone_ref(), ast_tone_zone_sound_ref(), ast_tone_zone_sound_unref(), ast_tone_zone_unref(), ast_websocket_add_protocol(), ast_websocket_ref(), ast_websocket_remove_protocol(), ast_websocket_unref(), ast_xmpp_client_config_alloc(), ast_xmpp_client_find(), ast_xmpp_client_unref(), bridge_channel_alloc(), bridge_channel_destroy(), bridge_channel_join(), bridge_channel_thread(), bridge_hangup(), bridge_request(), bridge_thread(), build_callno_limits(), build_conf(), build_dialplan_useage_map(), build_format_list_array(), build_mansession(), builtin_feature_get_exten(), caldav_destructor(), calendar_destructor(), calendar_devstate_change(), calendar_event_notify(), calendar_query_exec(), callattempt_free(), calltoken_required(), cb_events(), cc_handle_publish_error(), chan_cleanup(), chan_list_destructor(), channel_admin_exec(), channels_shutdown(), clear_queue(), cli_alias_passthrough(), cli_display_named_acl_list(), cli_fax_show_session(), cli_fax_show_sessions(), cli_tps_ping(), cli_tps_report(), client_buddy_handler(), compare_weight(), complete_confbridge_name(), complete_core_show_hint(), complete_queue_remove_member(), complete_userno(), conf_free(), conf_queue_dtmf(), conf_run(), config_hook_exec(), copy_parkinglot(), copy_socket_data(), create_callno_pools(), create_esc_entry(), data_filter_add_nodes(), data_filter_alloc(), data_filter_destructor(), data_filter_find(), data_filter_generate(), data_filter_release(), data_odbc_provider_handler(), data_provider_create(), data_provider_destructor(), data_provider_find(), data_provider_new(), data_provider_print_cli(), data_provider_release(), data_provider_release_all(), data_result_create(), data_result_destructor(), data_result_find_child(), data_result_generate(), data_result_generate_node(), data_result_get_node(), data_result_manager_output(), data_search_alloc(), data_search_cmp_bool(), data_search_cmp_char(), data_search_cmp_dbl(), data_search_cmp_int(), data_search_cmp_ipaddr(), data_search_cmp_ptr(), data_search_cmp_string(), data_search_cmp_uint(), data_search_create(), data_search_destructor(), data_search_find(), data_search_get_node(), data_search_release(), db_start_batch(), destroy_callback(), destroy_escs(), destroy_faxdetect(), destroy_gateway(), destroy_hint(), destroy_queue(), destroy_session(), destroy_v21_sessions(), dialgroup_read(), dialgroup_write(), dialog_ref_debug(), dialog_unref_debug(), do_notify(), do_parking_thread(), dump_queue_members(), end_bridge_callback(), end_bridge_callback_data_fixup(), event_notification_duplicate(), event_shutdown(), event_update_cache(), eventlist_destroy(), eventlist_destructor(), eventlist_duplicate(), ewscal_destructor(), exchangecal_destructor(), expire_register(), extension_state_add_destroy(), extension_state_cb(), extensionstate_update(), fax_detect_attach(), fax_detect_framehook_destroy(), fax_detect_new(), fax_gateway_attach(), fax_gateway_detect_t38(), fax_gateway_framehook(), fax_gateway_framehook_destroy(), fax_gateway_new(), fax_gateway_request_t38(), fax_gateway_start(), fax_session_new(), fax_session_reserve(), fax_session_tab_complete(), feature_ds_destroy(), featuremap_write(), features_shutdown(), find_details(), find_hint_by_cb_id(), find_or_create_details(), find_queue_by_name_rt(), find_ringing_channel(), format_attr_shutdown(), format_cmp_helper(), format_isset_helper(), format_joint_helper(), format_list_add_static(), format_set_helper(), free_members(), func_confbridge_info(), generic_fax_exec(), generic_lock_unlock_helper(), generic_mute_unmute_helper(), get_destination(), get_device_state_causing_channels(), get_member_penalty(), get_member_status(), group_destroy(), gtalk_get_rtp_peer(), handle_cc_notify(), handle_cc_subscribe(), handle_cli_confbridge_kick(), handle_cli_confbridge_list(), handle_cli_confbridge_start_record(), handle_cli_confbridge_stop_record(), handle_cli_iax2_set_debug(), handle_cli_iax2_show_callno_limits(), handle_cli_odbc_show(), handle_event(), handle_feature_show(), handle_parkedcalls(), handle_presencechange(), handle_queue_remove_member(), handle_request_subscribe(), handle_response_subscribe(), handle_show_hint(), handle_show_hints(), handle_sip_publish_initial(), handle_sip_publish_modify(), handle_sip_publish_refresh(), handle_sip_publish_remove(), handle_skel_show_games(), handle_skel_show_levels(), handle_statechange(), handle_tcptls_connection(), hangupcause_read(), has_interface(), hintdevice_destroy(), hints_data_provider_get(), httpd_helper_thread(), iax2_destroy(), icalendar_destructor(), indications_shutdown(), inprocess_count(), interface_exists(), jingle_action_hook(), jingle_action_session_initiate(), jingle_add_google_candidates_to_transport(), jingle_add_ice_udp_candidates_to_transport(), jingle_alloc(), jingle_config_alloc(), jingle_endpoint_alloc(), jingle_endpoint_destructor(), jingle_endpoint_state_create(), jingle_endpoint_state_destructor(), jingle_endpoint_state_find_or_create(), jingle_get_rtp_peer(), jingle_hangup(), jingle_request(), join_conference_bridge(), joint_copy_helper(), kqueue_timer_close(), kqueue_timer_disable_continuous(), kqueue_timer_enable_continuous(), kqueue_timer_get_event(), kqueue_timer_open(), kqueue_timer_set_rate(), leave_conference_bridge(), link_option_to_types(), load_config(), load_module(), load_objects(), load_odbc_config(), local_alloc(), local_answer(), local_call(), local_devicestate(), local_digit_begin(), local_digit_end(), local_hangup(), local_indicate(), local_request(), local_sendhtml(), local_sendtext(), local_setoption(), local_write(), locals_show(), manager_optimize_away(), manager_parking_status(), manager_parkinglot_list(), manager_queues_status(), manager_queues_summary(), manager_remove_queue_member(), manager_shutdown(), meetme_show_cmd(), meetmemute(), message_shutdown(), mgcp_get_rtp_peer(), misdn_attempt_transfer(), moh_rescan_files(), msg_data_alloc(), msg_data_func_read(), msg_data_func_write(), msg_destructor(), msg_ds_destroy(), msg_func_read(), msg_func_write(), msg_q_cb(), msg_send_exec(), msg_set_var_full(), multiplexed_add_or_remove(), multiplexed_bridge_create(), multiplexed_bridge_destroy(), multiplexed_thread_function(), named_acl_config_alloc(), new_iax(), num_available_members(), odbc_class_destructor(), odbc_obj_destructor(), odbc_release_obj2(), oh323_get_rtp_peer(), parkinglot_addref(), parkinglot_unref(), parse_apps(), parse_moved_contact(), pbx_shutdown(), peer_ref(), peer_unref(), peercnt_add(), peercnt_modify(), peercnt_remove_by_addr(), peercnt_remove_cb(), peers_data_provider_get(), presence_state_cb(), proxy_from_config(), pthread_timer_ack(), pthread_timer_close(), pthread_timer_disable_continuous(), pthread_timer_enable_continuous(), pthread_timer_get_event(), pthread_timer_open(), pthread_timer_set_rate(), publish_expire(), queue_function_mem_read(), queue_function_mem_write(), queue_function_qac_dep(), queue_function_queuememberlist(), queue_ref(), queue_unref(), queues_data_provider_get_helper(), realtime_common(), realtime_sqlite3_execute(), realtime_sqlite3_require(), receivefax_exec(), record_thread(), ref_proxy(), ref_pvt(), reload(), reload_single_member(), remove_from_queue(), replace_callno(), rna(), rqm_exec(), rt_handle_member_record(), sched_delay_remove(), sendfax_exec(), session_details_new(), session_do(), set_fn(), set_member_paused(), set_member_penalty_help_members(), set_member_ringinuse_help_members(), set_peercnt_limit(), set_socket_transport(), sip_cc_monitor_suspend(), sip_destroy_peer(), sip_get_rtp_peer(), sip_get_trtp_peer(), sip_get_vrtp_peer(), sip_handle_cc(), sip_monitor_instance_init(), sip_prepare_socket(), sip_tcp_locate(), skel_config_alloc(), skel_find_or_create_state(), skel_game_alloc(), skel_level_alloc(), skinny_get_rtp_peer(), skinny_get_vrtp_peer(), softmix_bridge_create(), softmix_bridge_destroy(), softmix_bridge_thread(), spandsp_fax_gw_gen_alloc(), spandsp_fax_gw_gen_release(), start_conf_record_thread(), timerfd_timer_ack(), timerfd_timer_close(), timerfd_timer_disable_continuous(), timerfd_timer_enable_continuous(), timerfd_timer_get_event(), timerfd_timer_open(), timerfd_timer_set_rate(), tps_taskprocessor_tab_complete(), transmit_publish(), try_calling(), udptl_snapshot_alloc(), unistim_get_rtp_peer(), unload_module(), unref_caldav(), unref_calendar(), unref_db(), unref_ewscal(), unref_exchangecal(), unref_icalendar(), unref_instance_cond(), unref_mansession(), unref_profile(), unref_pvt(), unref_route(), unref_user(), update_queue(), update_realtime_members(), user_ref(), user_unref(), ustmtext(), websocket_callback(), xml_translate(), xmpp_buddy_destructor(), xmpp_client_alloc(), xmpp_client_config_merge_buddies(), xmpp_client_create_buddy(), xmpp_client_find_or_create(), xmpp_client_service_discovery_result_hook(), xmpp_component_register_get_hook(), xmpp_config_alloc(), xmpp_pak_presence(), xmpp_pak_s10n(), xmpp_pubsub_create_affiliations(), xmpp_roster_hook(), xmpp_show_buddies(), xmpp_show_clients(), and xmpp_status_exec().

#define ao2_t_alloc ( data_size,
destructor_fn,
debug_msg   )     __ao2_alloc((data_size), (destructor_fn), AO2_ALLOC_OPT_LOCK_MUTEX)

#define ao2_t_alloc_options ( data_size,
destructor_fn,
options,
debug_msg   )     __ao2_alloc((data_size), (destructor_fn), (options))

Allocate and initialize an object.

Parameters:
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.
Returns:
A pointer to user-data.
Allocates a struct astobj2 with sufficient space for the user-defined structure.
Note:
  • storage is zeroed; XXX maybe we want a flag to enable/disable this.
  • the refcount of the object just created is 1
  • the returned pointer cannot be free()'d or realloc()'ed; rather, we just call ao2_ref(o, -1);

Definition at line 452 of file astobj2.h.

Referenced by __ao2_container_alloc_hash(), and ao2_container_register().

#define ao2_t_callback ( c,
flags,
cb_fn,
arg,
tag   )     __ao2_callback((c), (flags), (cb_fn), (arg))

ao2_callback() is a generic function that applies cb_fn() to all objects in a container, as described below.

Parameters:
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.
  • If OBJ_NODATA is set, ao2_callback will return NULL. No refcounts of any of the traversed objects will be incremented. On the converse, if it is NOT set (the default), the ref count of the first matching object will be incremented and returned. If OBJ_MULTIPLE is set, the ref count of all matching objects will be incremented in an iterator for a temporary container and returned.
  • If OBJ_POINTER is set, the traversed items will be restricted to the objects in the bucket that the object key hashes to.
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.
tag used for debugging.
Return values:
NULL on failure or no matching object found.
object found if OBJ_MULTIPLE is not set in the flags parameter.
ao2_iterator pointer if OBJ_MULTIPLE is set in the flags parameter. The iterator must be destroyed with ao2_iterator_destroy() when the caller no longer needs it.
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:

  • to perform some action (including removal from the container) on one or more objects; in this case, cb_fn() can modify the object itself, and to perform deletion should set CMP_MATCH on the matching objects, and have OBJ_UNLINK set in flags.
  • to look for a specific object in a container; in this case, cb_fn() should not modify the object, but just return a combination of CMP_MATCH and CMP_STOP on the desired object. Other usages are also possible, of course.

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 return an object Callbacks use OBJ_NODATA as a default functions such as find() do OBJ_MULTIPLE return multiple matches Default is no. OBJ_POINTER the pointer is an object pointer OBJ_KEY the pointer is to a search key OBJ_PARTIAL_KEY the pointer is to a partial search key

Note:
When the returned object is no longer in use, ao2_ref() should be used to free the additional reference possibly created by this function.

Definition at line 1493 of file astobj2.h.

Referenced by __init_manager(), ast_cc_agent_callback(), ast_cc_monitor_count(), ast_moh_destroy(), ast_srtp_destroy(), cc_cli_output_status(), do_monitor(), find_call(), get_mohbydigit(), handle_cc_kill(), handle_statechange(), load_config(), load_moh_classes(), reload_config(), remove_hintdevice(), session_destructor(), sip_show_channels(), sip_show_channelstats(), sip_show_objects(), unlink_peers_from_tables(), and unload_module().

#define ao2_t_callback_data ( container,
flags,
cb_fn,
arg,
data,
tag   )     __ao2_callback_data((container), (flags), (cb_fn), (arg), (data))

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_POINTER as part of the flags argument (which in turn requires passing in a prototype ao2 object 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.

See also:
ao2_callback()

Definition at line 1531 of file astobj2.h.

Referenced by cccancel_exec(), ccreq_exec(), ccss_device_state(), count_agents(), kill_duplicate_offers(), match_filter(), and sip_find_peer_full().

#define ao2_t_container_alloc ( n_buckets,
hash_fn,
cmp_fn,
tag   )     ao2_t_container_alloc_options(AO2_ALLOC_OPT_LOCK_MUTEX, (n_buckets), (hash_fn), (cmp_fn), (tag))

Definition at line 1087 of file astobj2.h.

Referenced by ast_cc_init(), load_module(), and res_srtp_new().

#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))

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.

Parameters:
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)
tag used for debugging.
Returns:
A pointer to a struct container.
Note:
Destructor is set implicitly.

Definition at line 1128 of file astobj2.h.

Referenced by hash_ao2_alloc_empty_clone().

#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))

Allocate and initialize a list container.

Parameters:
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)
tag used for debugging.
Returns:
A pointer to a struct container.
Note:
Destructor is set implicitly.

Implemented as a degenerate hash table.

Definition at line 1174 of file astobj2.h.

Referenced by astobj2_init(), and internal_ao2_traverse().

#define ao2_t_container_alloc_options ( options,
n_buckets,
hash_fn,
cmp_fn,
tag   )     ao2_t_container_alloc_hash((options), 0, (n_buckets), (hash_fn), NULL, (cmp_fn), (tag))

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.

Parameters:
options Container ao2 object options (See enum ao2_alloc_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.)
cmp_fn Pointer to a compare function used by ao2_find. (NULL to match everything)
tag used for debugging.
Returns:
A pointer to a struct container.
Note:
Destructor is set implicitly.

This is legacy container creation that is mapped to the new method.

Definition at line 1082 of file astobj2.h.

#define ao2_t_container_clone ( orig,
flags,
tag   )     __ao2_container_clone(orig, flags)

Definition at line 1239 of file astobj2.h.

#define ao2_t_find ( container,
arg,
flags,
tag   )     __ao2_find((container), (arg), (flags))

#define ao2_t_global_obj_ref ( holder,
tag   )     __ao2_global_obj_ref(&holder, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)

Get a reference to the object stored in the global holder.

Since:
11.0
Parameters:
holder Global ao2 object holder.
tag used for debugging
Return values:
Reference to current ao2 object stored in the holder.
NULL if no object available.

Definition at line 692 of file astobj2.h.

#define ao2_t_global_obj_release ( holder,
tag   )     __ao2_global_obj_release(&holder, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)

Release the ao2 object held in the global holder.

Since:
11.0
Parameters:
holder Global ao2 object holder.
tag used for debugging
Returns:
Nothing

Definition at line 631 of file astobj2.h.

Referenced by manager_shutdown(), and udptl_shutdown().

#define ao2_t_global_obj_replace ( holder,
obj,
tag   )     __ao2_global_obj_replace(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)

Replace an ao2 object in the global holder.

Since:
11.0
Parameters:
holder Global ao2 object holder.
obj Object to put into the holder. Can be NULL.
tag used for debugging
Note:
This function automatically increases the reference count to account for the reference that the global holder now holds to the object.
Return values:
Reference to previous global ao2 object stored.
NULL if no object available.

Definition at line 653 of file astobj2.h.

#define ao2_t_global_obj_replace_unref ( holder,
obj,
tag   )     __ao2_global_obj_replace_unref(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)

Replace an ao2 object in the global holder, throwing away any old object.

Since:
11.0
Parameters:
holder Global ao2 object holder.
obj Object to put into the holder. Can be NULL.
tag used for debugging
Note:
This function automatically increases the reference count to account for the reference that the global holder now holds to the object. It also decreases the reference count of any object being replaced.
Return values:
0 The global object was previously empty
1 The global object was not previously empty

Definition at line 676 of file astobj2.h.

Referenced by __init_manager().

#define ao2_t_iterator_next ( iter,
tag   )     __ao2_iterator_next((iter))

#define ao2_t_link ( container,
obj,
tag   )     __ao2_link((container), (obj), 0)

Add an object to a container.

Parameters:
container The container to operate on.
obj The object to be added.
tag used for debugging.
Return values:
0 on errors.
1 on success.
This function inserts an object in a container according its key.

Note:
Remember to set the key before calling this function.

This function automatically increases the reference count to account for the reference that the container now holds to the object.

Definition at line 1333 of file astobj2.h.

Referenced by _moh_register(), add_hintdevice(), add_sdp(), ao2_container_register(), ast_srtp_add_stream(), ast_srtp_create(), authenticate(), cc_core_init_instance(), change_callid_pvt(), create_new_generic_list(), manager_add_filter(), parse_register_contact(), pvt_set_needdestroy(), realtime_peer(), register_verify(), reload_config(), sip_alloc(), sip_prune_realtime(), and sip_threadinfo_create().

#define ao2_t_link_flags ( container,
obj,
flags,
tag   )     __ao2_link((container), (obj), (flags))

Definition at line 1336 of file astobj2.h.

#define ao2_t_ref ( o,
delta,
tag   )     __ao2_ref((o), (delta))

Reference/unreference an object and return the old refcount.

Parameters:
o A pointer to the object
delta Value to add to the reference counter.
tag used for debugging
Returns:
The value of the reference counter before the operation.
Increase/decrease the reference counter according the value of delta.

If the refcount goes to zero, the object is destroyed.

Note:
The object must not be locked by the caller of this function, as it is invalid to try to unlock it after releasing the reference.

if we know the pointer to an object, it is because we have a reference count to it, so the only case when the object can go away is when we release our reference, and it is the last one in existence.

Definition at line 501 of file astobj2.h.

Referenced by __ao2_container_clone(), __ao2_container_clone_debug(), __init_manager(), __sip_destroy(), _sip_show_peer(), _sip_tcp_helper_thread(), action_find(), add_hintdevice(), ao2_container_dup(), ao2_container_register(), ao2_iterator_destroy(), ao2_iterator_init(), ast_channel_internal_cleanup(), ast_hook_send_action(), ast_manager_register2(), ast_manager_register_struct(), ast_manager_unregister(), ast_srtp_add_stream(), ast_srtp_change_source(), ast_srtp_destroy(), ast_srtp_policy_destroy(), ast_srtp_unprotect(), authenticate(), build_peer(), build_reply_digest(), cc_ref(), cc_shutdown(), cc_unref(), check_peer_ok(), create_addr_from_peer(), data_shutdown(), dialog_dump_func(), format_list_shutdown(), handle_request_do(), handle_statechange(), hash_ao2_new_node(), hash_ao2_node_destructor(), internal_ao2_iterator_next(), internal_ao2_traverse(), local_attended_transfer(), manager_add_filter(), peer_dump_func(), process_message(), reload_config(), session_destructor(), sip_alloc(), sip_call(), sip_cc_monitor_cancel_available_timer(), sip_cc_monitor_request_cc(), sip_destroy_peer(), sip_monitor_instance_destructor(), sip_prepare_socket(), sip_ref_peer(), sip_show_channel(), sip_show_history(), sip_show_settings(), sip_show_tcp(), sip_tcp_locate(), sip_tcptls_write(), sip_threadinfo_create(), sip_threadinfo_destructor(), sip_unref_peer(), temp_peer(), tps_shutdown(), and unload_module().

#define ao2_t_unlink ( container,
obj,
tag   )     __ao2_unlink((container), (obj), 0)

Remove an object from a container.

Parameters:
container The container to operate on.
obj The object to unlink.
tag used for debugging.
Return values:
NULL,always 
Note:
The object requested to be unlinked must be valid. However, if it turns out that it is not in the container, this function is still safe to be called.

If the object gets unlinked from the container, the container's reference to the object will be automatically released. (The refcount will be decremented).

Definition at line 1390 of file astobj2.h.

Referenced by _sip_tcp_helper_thread(), add_sdp(), ast_srtp_add_stream(), build_peer(), cc_complete(), cc_failed(), cc_generic_monitor_destructor(), dialog_unlink_all(), expire_register(), parse_register_contact(), sip_prepare_socket(), sip_prune_realtime(), and unlink_peer_from_tables().

#define ao2_t_unlink_flags ( container,
obj,
flags,
tag   )     __ao2_unlink((container), (obj), (flags))

Definition at line 1393 of file astobj2.h.

#define ao2_trylock (  )     __ao2_trylock(a, AO2_LOCK_REQ_MUTEX, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)

#define ao2_tryrdlock (  )     __ao2_trylock(a, AO2_LOCK_REQ_RDLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)

Definition at line 552 of file astobj2.h.

#define ao2_trywrlock (  )     __ao2_trylock(a, AO2_LOCK_REQ_WRLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)

Definition at line 553 of file astobj2.h.

#define ao2_unlink ( container,
obj   )     __ao2_unlink((container), (obj), 0)

#define ao2_unlink_flags ( container,
obj,
flags   )     __ao2_unlink((container), (obj), (flags))

Definition at line 1394 of file astobj2.h.

Referenced by xmpp_pak_presence().

#define ao2_unlock (  )     __ao2_unlock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)

Definition at line 541 of file astobj2.h.

Referenced by __ao2_container_clone(), __ao2_container_clone_debug(), __ast_manager_event_multichan(), __queues_show(), _ast_odbc_request_obj2(), _sip_show_peer(), _sip_show_peers(), _sip_tcp_helper_thread(), action_confbridgekick(), action_confbridgelist(), action_confbridgelistrooms(), action_confbridgesetsinglevideosrc(), action_confbridgestartrecord(), action_confbridgestoprecord(), action_kick_last(), action_toggle_mute_participants(), action_waitevent(), add_calltoken_ignore(), add_sdp(), add_to_queue(), adjust_lock(), ao2_container_check(), ao2_container_dup(), ao2_iterator_restart(), aoro2_obj_cb(), app_exec(), ast_add_hint(), ast_bridge_change_state(), ast_bridge_depart(), ast_bridge_destroy(), ast_bridge_dtmf_stream(), ast_bridge_is_video_src(), ast_bridge_join(), ast_bridge_merge(), ast_bridge_number_video_src(), ast_bridge_remove(), ast_bridge_remove_video_src(), ast_bridge_set_internal_sample_rate(), ast_bridge_set_mixing_interval(), ast_bridge_set_single_src_video_mode(), ast_bridge_set_talker_src_video_mode(), ast_bridge_suspend(), ast_bridge_unsuspend(), ast_bridge_update_talker_src_video_mode(), ast_change_hint(), ast_change_name(), ast_do_masquerade(), ast_extension_state_del(), ast_format_attr_reg_interface(), ast_format_attr_unreg_interface(), ast_format_cap_iter_end(), ast_format_get_value(), ast_format_sdp_generate(), ast_format_sdp_parse(), ast_get_indication_tone(), ast_get_indication_zone(), ast_hook_send_action(), ast_manager_unregister(), ast_merge_contexts_and_delete(), ast_odbc_direct_execute(), ast_odbc_find_table(), ast_odbc_prepare_and_execute(), ast_odbc_smart_execute(), ast_register_indication_country(), ast_remove_hint(), ast_set_indication_country(), ast_taskprocessor_get(), ast_taskprocessor_unreference(), ast_unregister_indication_country(), ast_websocket_add_protocol(), ast_xmpp_client_unlock(), astman_is_authed(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), attended_abort_transfer(), auth_http_callback(), awesome_locking(), bridge_channel_join(), bridge_channel_join_multithreaded(), bridge_channel_join_singlethreaded(), bridge_channel_suspend(), bridge_channel_thread(), bridge_channel_unsuspend(), bridge_hangup(), bridge_thread(), bridge_write(), build_callno_limits(), build_parkinglot(), build_peer(), build_reply_digest(), builtin_feature_get_exten(), caldav_load_calendar(), calendar_destructor(), change_callid_pvt(), check_bridge(), clear_stats(), cli_fax_show_sessions(), compare_weight(), complete_core_show_hint(), complete_queue_remove_member(), complete_sip_user(), conf_handle_dtmf(), conf_run(), create_addr_from_peer(), data_odbc_provider_handler(), db_destructor(), db_open(), db_sync_thread(), destroy_gateway(), destroy_v21_sessions(), event_update_cache(), ewscal_load_calendar(), exchangecal_load_calendar(), execute_menu_entry(), execute_state_callback(), extension_state_add_destroy(), extension_state_cb(), featuremap_write(), find_member_by_queuename_and_interface(), find_queue_by_name_rt(), find_session(), find_session_by_nonce(), format_cmp_helper(), format_isset_helper(), format_joint_helper(), format_set_helper(), func_confbridge_info(), generic_fax_exec(), generic_http_callback(), generic_lock_unlock_helper(), generic_mute_unmute_helper(), generic_thread_loop(), get_input(), get_member_penalty(), get_member_status(), get_unused_callno(), handle_cli_confbridge_kick(), handle_cli_confbridge_list(), handle_cli_confbridge_start_record(), handle_cli_confbridge_stop_record(), handle_cli_misdn_send_facility(), handle_cli_odbc_show(), handle_presencechange(), handle_request_subscribe(), handle_show_hint(), handle_show_hints(), handle_showmanconn(), handle_statechange(), handle_video_on_exit(), handle_video_on_join(), ical_load_calendar(), inprocess_count(), internal_ao2_iterator_next(), internal_ao2_link(), internal_ao2_traverse(), is_our_turn(), jingle_action_session_accept(), jingle_action_session_info(), jingle_action_session_terminate(), jingle_fixup(), jingle_hangup(), jingle_interpret_content(), jingle_new(), jingle_outgoing_hook(), jingle_queue_hangup_with_cause(), jingle_request(), jingle_session_lock_full(), join_conference_bridge(), join_queue(), leave_conference_bridge(), leave_queue(), load_indications(), local_answer(), local_bridgedchannel(), local_call(), local_devicestate(), local_digit_begin(), local_digit_end(), local_fixup(), local_hangup(), local_indicate(), local_queryoption(), local_queue_frame(), local_sendhtml(), local_sendtext(), local_setoption(), local_write(), locals_show(), manager_optimize_away(), manager_queues_status(), manager_queues_summary(), manager_sip_peer_status(), moh_class_destructor(), moh_release(), mohalloc(), monmp3thread(), msg_data_func_read(), msg_data_func_write(), msg_func_read(), msg_func_write(), msg_send_exec(), multiplexed_add_or_remove(), multiplexed_bridge_create(), multiplexed_bridge_destroy(), multiplexed_thread_function(), on_dns_update_peer(), peercnt_add(), peercnt_remove(), peers_data_provider_get(), process_events(), process_message(), pthread_timer_ack(), pthread_timer_disable_continuous(), pthread_timer_enable_continuous(), pthread_timer_get_event(), pthread_timer_open(), pthread_timer_set_rate(), purge_sessions(), queue_function_mem_read(), queue_function_mem_write(), queue_function_qac_dep(), queue_function_queuememberlist(), queue_function_queuewaitingcount(), queue_function_var(), queues_data_provider_get(), realtime_sqlite3_execute_handle(), recalc_holdtime(), record_abandoned(), register_verify(), reinvite_timeout(), reload_queues(), reload_single_queue(), remove_from_queue(), replace_callno(), ring_entry(), rna(), run_timer(), schedule_calendar_event(), session_do(), set_eventmask(), set_member_paused(), set_member_penalty_help_members(), set_member_ringinuse_help_members(), set_queue_variables(), sip_keepalive_all_peers(), sip_poke_all_peers(), sip_prune_realtime(), sip_send_mwi_to_peer(), sip_show_inuse(), sip_show_user(), sip_show_users(), sip_tcptls_write(), smart_bridge_operation(), softmix_bridge_thread(), spandsp_fax_cli_show_session(), start_conf_record_thread(), timerfd_timer_ack(), timerfd_timer_disable_continuous(), timerfd_timer_enable_continuous(), timerfd_timer_get_event(), timerfd_timer_set_rate(), try_calling(), update_call_counter(), update_peer_lastmsgssent(), update_queue(), update_realtime_members(), xmpp_client_service_discovery_result_hook(), xmpp_pak_presence(), and xmpp_pak_s10n().

#define ao2_wrlock (  )     __ao2_lock(a, AO2_LOCK_REQ_WRLOCK, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)


Typedef Documentation

typedef int( ao2_callback_data_fn)(void *obj, void *arg, void *data, int flags)

Type of a generic callback function.

Parameters:
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_POINTER - if set, 'arg', is an object. OBJ_KEY - if set, 'arg', is a search key item that is not an object. OBJ_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.

Definition at line 1027 of file astobj2.h.

typedef int( ao2_callback_fn)(void *obj, void *arg, int flags)

Type of a generic callback function.

Parameters:
obj pointer to the (user-defined part) of an object.
arg callback argument from ao2_callback()
flags flags from ao2_callback() OBJ_POINTER - if set, 'arg', is an object. OBJ_KEY - if set, 'arg', is a search key item that is not an object. OBJ_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.

Definition at line 1009 of file astobj2.h.

typedef void(* ao2_destructor_fn)(void *)

Typedef for an object destructor. This is called just before freeing the memory for the object. It is passed a pointer to the user-defined data of the object.

Definition at line 391 of file astobj2.h.

typedef int( ao2_hash_fn)(const void *obj, int flags)

Type of a generic function to generate a hash value from an object.

Parameters:
obj pointer to the (user-defined part) of an object.
flags flags from ao2_callback() OBJ_POINTER - if set, 'obj', is an object. OBJ_KEY - if set, 'obj', is a search key item that is not an object.
Returns:
Computed hash value.

Definition at line 1039 of file astobj2.h.

typedef int( ao2_sort_fn)(const void *obj_left, const void *obj_right, int flags)

Type of generic container sort function.

Parameters:
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_POINTER - if set, 'obj_right', is an object. OBJ_KEY - if set, 'obj_right', is a search key item that is not an object. OBJ_PARTIAL_KEY - if set, 'obj_right', is a partial search key item that is not an object.
Return values:
<0 if obj_left < obj_right
=0 if obj_left == obj_right
>0 if obj_left > obj_right

Definition at line 1055 of file astobj2.h.


Enumeration Type Documentation

A callback function will return a combination of CMP_MATCH and CMP_STOP. The latter will terminate the search in a container.

Enumerator:
CMP_MATCH  the object matches the request
CMP_STOP  stop the search now

Definition at line 811 of file astobj2.h.

00811                  {
00812    CMP_MATCH   = 0x1,   /*!< the object matches the request */
00813    CMP_STOP = 0x2,   /*!< stop the search now */
00814 };

Options available when allocating an ao2 object.

Enumerator:
AO2_ALLOC_OPT_LOCK_MUTEX  The ao2 object has a recursive mutex lock associated with it.
AO2_ALLOC_OPT_LOCK_RWLOCK  The ao2 object has a non-recursive read/write lock associated with it.
AO2_ALLOC_OPT_LOCK_NOLOCK  The ao2 object has no lock associated with it.
AO2_ALLOC_OPT_LOCK_MASK  The ao2 object locking option field mask.

Definition at line 394 of file astobj2.h.

00394                     {
00395    /*! The ao2 object has a recursive mutex lock associated with it. */
00396    AO2_ALLOC_OPT_LOCK_MUTEX = (0 << 0),
00397    /*! The ao2 object has a non-recursive read/write lock associated with it. */
00398    AO2_ALLOC_OPT_LOCK_RWLOCK = (1 << 0),
00399    /*! The ao2 object has no lock associated with it. */
00400    AO2_ALLOC_OPT_LOCK_NOLOCK = (2 << 0),
00401    /*! The ao2 object locking option field mask. */
00402    AO2_ALLOC_OPT_LOCK_MASK = (3 << 0),
00403 };

Options available when allocating an ao2 container object.

Note:
Each option is open to some interpretation by the container type as long as it makes sense with the option name.
Enumerator:
AO2_CONTAINER_ALLOC_OPT_INSERT_BEGIN  Insert objects at the beginning of the container. (Otherwise it is the opposite; insert at the end.).

Note:
If an ao2_sort_fn is provided, the object is inserted before any objects with duplicate keys.

Hash containers insert the object in the computed hash bucket in the indicated manner.

AO2_CONTAINER_ALLOC_OPT_DUPS_MASK  The ao2 container objects with duplicate keys option field mask.
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.

Note:
The container must be sorted. i.e. have an ao2_sort_fn.
AO2_CONTAINER_ALLOC_OPT_DUPS_OBJ_REJECT  Reject duplicate objects in container.

Don't link the same object into the container twice. However, you can link a different object with the same key.

Note:
The container must be sorted. i.e. have an ao2_sort_fn.

It is assumed that the objects are located where the search key says they should be located.

AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE  Replace objects with duplicate keys in container.

The existing duplicate object is removed and the new object takes the old object's place.

Note:
The container must be sorted. i.e. have an ao2_sort_fn.

Definition at line 944 of file astobj2.h.

00944                         {
00945    /*!
00946     * \brief Insert objects at the beginning of the container.
00947     * (Otherwise it is the opposite; insert at the end.)
00948     *
00949     * \note If an ao2_sort_fn is provided, the object is inserted
00950     * before any objects with duplicate keys.
00951     *
00952     * \note Hash containers insert the object in the computed hash
00953     * bucket in the indicated manner.
00954     */
00955    AO2_CONTAINER_ALLOC_OPT_INSERT_BEGIN = (1 << 0),
00956 
00957    /*!
00958     * \brief The ao2 container objects with duplicate keys option field mask.
00959     */
00960    AO2_CONTAINER_ALLOC_OPT_DUPS_MASK = (3 << 1),
00961    /*!
00962     * \brief Allow objects with duplicate keys in container.
00963     */
00964    AO2_CONTAINER_ALLOC_OPT_DUPS_ALLOW = (0 << 1),
00965    /*!
00966     * \brief Reject objects with duplicate keys in container.
00967     *
00968     * \note The container must be sorted.  i.e. have an
00969     * ao2_sort_fn.
00970     */
00971    AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT = (1 << 1),
00972    /*!
00973     * \brief Reject duplicate objects in container.
00974     *
00975     * \details Don't link the same object into the container twice.
00976     * However, you can link a different object with the same key.
00977     *
00978     * \note The container must be sorted.  i.e. have an
00979     * ao2_sort_fn.
00980     *
00981     * \note It is assumed that the objects are located where the
00982     * search key says they should be located.
00983     */
00984    AO2_CONTAINER_ALLOC_OPT_DUPS_OBJ_REJECT = (2 << 1),
00985    /*!
00986     * \brief Replace objects with duplicate keys in container.
00987     *
00988     * \details The existing duplicate object is removed and the new
00989     * object takes the old object's place.
00990     *
00991     * \note The container must be sorted.  i.e. have an
00992     * ao2_sort_fn.
00993     */
00994    AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE = (3 << 1),
00995 };

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.

Note:
For ao2_containers that have mutexes, no locking will be done.

For ao2_containers that have RWLOCKs, the lock will be promoted to write mode as needed. The lock will be returned to the original locked state.

Only use this flag if the ao2_container is manually locked already. You should hold the lock until after ao2_iterator_destroy(). If you must release the lock then you must at least hold the lock whenever you call an ao2_iterator_xxx function with this iterator.

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)

Note:
Other traversal orders such as pre-order and post-order do not make sense because they require the container structure to be static during the traversal. Iterators just about guarantee that is not going to happen because the container is allowed to change by other threads during the iteration.

Definition at line 1649 of file astobj2.h.

01649                         {
01650    /*!
01651     * \brief Assume that the ao2_container is already locked.
01652     *
01653     * \note For ao2_containers that have mutexes, no locking will
01654     * be done.
01655     *
01656     * \note For ao2_containers that have RWLOCKs, the lock will be
01657     * promoted to write mode as needed.  The lock will be returned
01658     * to the original locked state.
01659     *
01660     * \note Only use this flag if the ao2_container is manually
01661     * locked already.  You should hold the lock until after
01662     * ao2_iterator_destroy().  If you must release the lock then
01663     * you must at least hold the lock whenever you call an
01664     * ao2_iterator_xxx function with this iterator.
01665     */
01666    AO2_ITERATOR_DONTLOCK = (1 << 0),
01667    /*!
01668     * Indicates that the iterator was dynamically allocated by
01669     * astobj2 API and should be freed by ao2_iterator_destroy().
01670     */
01671    AO2_ITERATOR_MALLOCD = (1 << 1),
01672    /*!
01673     * Indicates that before the iterator returns an object from
01674     * the container being iterated, the object should be unlinked
01675     * from the container.
01676     */
01677    AO2_ITERATOR_UNLINK = (1 << 2),
01678    /*!
01679     * Iterate in descending order (Last to first container object)
01680     * (Otherwise ascending order)
01681     *
01682     * \note Other traversal orders such as pre-order and post-order
01683     * do not make sense because they require the container
01684     * structure to be static during the traversal.  Iterators just
01685     * about guarantee that is not going to happen because the
01686     * container is allowed to change by other threads during the
01687     * iteration.
01688     */
01689    AO2_ITERATOR_DESCENDING = (1 << 3),
01690 };

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 512 of file astobj2.h.

00512                   {
00513    /*! Request the mutex lock be acquired. */
00514    AO2_LOCK_REQ_MUTEX,
00515    /*! Request the read lock be acquired. */
00516    AO2_LOCK_REQ_RDLOCK,
00517    /*! Request the write lock be acquired. */
00518    AO2_LOCK_REQ_WRLOCK,
00519 };

Flags passed to ao2_callback_fn(), ao2_hash_fn(), and ao2_sort_fn() to modify behaviour.

Todo:
XXX OBJ_POINTER, OBJ_KEY, and OBJ_PARTIAL_KEY need to be put into a bit field like OBJ_ORDER_MASK since they are mutually exclusive. This change unfortunately is not backwards compatible.
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 of the callback function has the CMP_STOP bit set.
OBJ_POINTER  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.

Note:
The supplied ao2_callback_fn is called after the container nodes have been filtered by the ao2_hash_fn and/or ao2_sort_fn functions.

OBJ_POINTER, OBJ_KEY, and OBJ_PARTIAL_KEY are mutually exclusive.

OBJ_CONTINUE  Continue if a match is not found.

This flag forces a whole container search. The OBJ_POINTER, OBJ_KEY, and OBJ_PARTIAL_KEY flags just specify where to start the search in the container. If the search is not stopped early then the search _continues_ until the search wraps around to the starting point.

Normal searches start where the search key specifies to start and end when the search key indicates that the object is not in the container.

For hash containers, this tells the ao2_callback() core to keep searching through the rest of the buckets if a match is not found in the starting bucket defined by the hash value on the argument.

Note:
The supplied ao2_callback_fn is called for every node in the container from the starting point.
OBJ_NOLOCK  Assume that the ao2_container is already locked.

Note:
For ao2_containers that have mutexes, no locking will be done.

For ao2_containers that have RWLOCKs, the lock will be promoted to write mode as needed. The lock will be returned to the original locked state.

Only use this flag if the ao2_container is manually locked already.

OBJ_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.

Note:
The supplied ao2_callback_fn is called after the container nodes have been filtered by the ao2_hash_fn and/or ao2_sort_fn functions.

OBJ_POINTER, OBJ_KEY, and OBJ_PARTIAL_KEY are mutually exclusive.

OBJ_PARTIAL_KEY  The arg parameter is a partial search key similar to OBJ_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".

Note:
The supplied ao2_callback_fn is called after the container nodes have been filtered by the ao2_sort_fn function.

OBJ_POINTER, OBJ_KEY, and OBJ_PARTIAL_KEY are mutually exclusive.

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).

Definition at line 824 of file astobj2.h.

00824                   {
00825    /*!
00826     * Unlink the object for which the callback function returned
00827     * CMP_MATCH.
00828     */
00829    OBJ_UNLINK = (1 << 0),
00830    /*!
00831     * On match, don't return the object hence do not increase its
00832     * refcount.
00833     */
00834    OBJ_NODATA = (1 << 1),
00835    /*!
00836     * Don't stop at the first match in ao2_callback() unless the
00837     * result of of the callback function has the CMP_STOP bit set.
00838     */
00839    OBJ_MULTIPLE = (1 << 2),
00840    /*!
00841     * \brief The arg parameter is an object of the same type.
00842     *
00843     * \details
00844     * The arg parameter is an object of the same type as the one
00845     * being searched for, so use the object's ao2_hash_fn and/or
00846     * ao2_sort_fn functions for optimized searching.
00847     *
00848     * \note The supplied ao2_callback_fn is called after the
00849     * container nodes have been filtered by the ao2_hash_fn and/or
00850     * ao2_sort_fn functions.
00851     *
00852     * \note OBJ_POINTER, OBJ_KEY, and OBJ_PARTIAL_KEY are mutually
00853     * exclusive.
00854     */
00855    OBJ_POINTER = (1 << 3),
00856    /*!
00857     * \brief Continue if a match is not found.
00858     *
00859     * \details
00860     * This flag forces a whole container search.  The OBJ_POINTER,
00861     * OBJ_KEY, and OBJ_PARTIAL_KEY flags just specify where to
00862     * start the search in the container.  If the search is not
00863     * stopped early then the search _continues_ until the search
00864     * wraps around to the starting point.
00865     *
00866     * Normal searches start where the search key specifies to start
00867     * and end when the search key indicates that the object is not
00868     * in the container.
00869     *
00870     * For hash containers, this tells the ao2_callback() core to
00871     * keep searching through the rest of the buckets if a match is
00872     * not found in the starting bucket defined by the hash value on
00873     * the argument.
00874     *
00875     * \note The supplied ao2_callback_fn is called for every node
00876     * in the container from the starting point.
00877     */
00878    OBJ_CONTINUE = (1 << 4),
00879    /*!
00880     * \brief Assume that the ao2_container is already locked.
00881     *
00882     * \note For ao2_containers that have mutexes, no locking will
00883     * be done.
00884     *
00885     * \note For ao2_containers that have RWLOCKs, the lock will be
00886     * promoted to write mode as needed.  The lock will be returned
00887     * to the original locked state.
00888     *
00889     * \note Only use this flag if the ao2_container is manually
00890     * locked already.
00891     */
00892    OBJ_NOLOCK = (1 << 5),
00893    /*!
00894     * \brief The arg parameter is a search key, but is not an object.
00895     *
00896     * \details
00897     * This can be used when you want to be able to pass custom data
00898     * to the container's stored ao2_hash_fn, ao2_sort_fn, and
00899     * ao2_find ao2_callback_fn functions that is not a full object,
00900     * but perhaps just a string.
00901     *
00902     * \note The supplied ao2_callback_fn is called after the
00903     * container nodes have been filtered by the ao2_hash_fn and/or
00904     * ao2_sort_fn functions.
00905     *
00906     * \note OBJ_POINTER, OBJ_KEY, and OBJ_PARTIAL_KEY are mutually
00907     * exclusive.
00908     */
00909    OBJ_KEY = (1 << 6),
00910    /*!
00911     * \brief The arg parameter is a partial search key similar to OBJ_KEY.
00912     *
00913     * \details
00914     * The partial key can be used by the ao2_sort_fn to guide the
00915     * search to find a contiguous subset of a sorted container.
00916     * For example, a sorted container holds: "A", "B", "Bert",
00917     * "Beth", "Earnie".  Doing a partial key search with "B" will
00918     * find the sorted subset of all held objects starting with "B".
00919     *
00920     * \note The supplied ao2_callback_fn is called after the
00921     * container nodes have been filtered by the ao2_sort_fn
00922     * function.
00923     *
00924     * \note OBJ_POINTER, OBJ_KEY, and OBJ_PARTIAL_KEY are mutually
00925     * exclusive.
00926     */
00927    OBJ_PARTIAL_KEY = (1 << 7),
00928 
00929    /*! \brief Traverse order option field mask. */
00930    OBJ_ORDER_MASK = (0x03 << 8),
00931    /*! \brief Traverse in ascending order (First to last container object) */
00932    OBJ_ORDER_ASCENDING = (0 << 8),
00933    /*! \brief Traverse in descending order (Last to first container object) */
00934    OBJ_ORDER_DESCENDING = (1 << 8),
00935 };


Function Documentation

void* __ao2_alloc ( size_t  data_size,
ao2_destructor_fn  destructor_fn,
unsigned int  options 
)

Definition at line 656 of file astobj2.c.

References internal_ao2_alloc().

Referenced by hash_ao2_new_node().

00657 {
00658    return internal_ao2_alloc(data_size, destructor_fn, options, __FILE__, __LINE__, __FUNCTION__);
00659 }

void* __ao2_alloc_debug ( size_t  data_size,
ao2_destructor_fn  destructor_fn,
unsigned int  options,
const char *  tag,
const char *  file,
int  line,
const char *  func,
int  ref_debug 
)

Definition at line 636 of file astobj2.c.

References internal_ao2_alloc(), and REF_FILE.

Referenced by __ao2_container_alloc_hash_debug(), __ast_channel_internal_alloc(), and _moh_class_malloc().

00638 {
00639    /* allocation */
00640    void *obj;
00641    FILE *refo;
00642 
00643    if ((obj = internal_ao2_alloc(data_size, destructor_fn, options, file, line, func)) == NULL) {
00644       return NULL;
00645    }
00646 
00647    if (ref_debug && (refo = fopen(REF_FILE, "a"))) {
00648       fprintf(refo, "%p =1   %s:%d:%s (%s)\n", obj, file, line, func, tag);
00649       fclose(refo);
00650    }
00651 
00652    /* return a pointer to the user data */
00653    return obj;
00654 }

void* __ao2_callback ( struct ao2_container c,
enum search_flags  flags,
ao2_callback_fn cb_fn,
void *  arg 
)

Definition at line 1399 of file astobj2.c.

References AO2_CALLBACK_DEFAULT, and internal_ao2_traverse().

Referenced by __ao2_find(), __ao2_unlink(), ao2_container_dup(), and container_destruct().

01401 {
01402    return internal_ao2_traverse(c, flags, cb_fn, arg, NULL, AO2_CALLBACK_DEFAULT, NULL, NULL, 0, NULL);
01403 }

void* __ao2_callback_data ( struct ao2_container c,
enum search_flags  flags,
ao2_callback_data_fn cb_fn,
void *  arg,
void *  data 
)

Definition at line 1412 of file astobj2.c.

References AO2_CALLBACK_WITH_DATA, and internal_ao2_traverse().

01414 {
01415    return internal_ao2_traverse(c, flags, cb_fn, arg, data, AO2_CALLBACK_WITH_DATA, NULL, NULL, 0, NULL);
01416 }

void* __ao2_callback_data_debug ( 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 1405 of file astobj2.c.

References AO2_CALLBACK_WITH_DATA, and internal_ao2_traverse().

01408 {
01409    return internal_ao2_traverse(c, flags, cb_fn, arg, data, AO2_CALLBACK_WITH_DATA, tag, file, line, func);
01410 }

void* __ao2_callback_debug ( 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 1392 of file astobj2.c.

References AO2_CALLBACK_DEFAULT, and internal_ao2_traverse().

Referenced by __ao2_find_debug(), __ao2_unlink_debug(), and container_destruct_debug().

01395 {
01396    return internal_ao2_traverse(c, flags, cb_fn, arg, NULL, AO2_CALLBACK_DEFAULT, tag, file, line, func);
01397 }

void __ao2_cleanup ( void *  obj  ) 

gcc __attribute__(cleanup()) functions

Note:
they must be able to handle NULL parameters because most of the allocation/find functions can fail and we don't want to try to tear down a NULL

Definition at line 554 of file astobj2.c.

References ao2_ref.

00555 {
00556    if (obj) {
00557       ao2_ref(obj, -1);
00558    }
00559 }

void __ao2_cleanup_debug ( void *  obj,
const char *  file,
int  line,
const char *  function 
)

Definition at line 547 of file astobj2.c.

References __ao2_ref_debug().

00548 {
00549    if (obj) {
00550       __ao2_ref_debug(obj, -1, "ao2_cleanup", file, line, function);
00551    }
00552 }

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 
) [read]

Definition at line 2974 of file astobj2.c.

References ao2_t_alloc_options, container_destruct(), and hash_ao2_container_init().

Referenced by __ao2_container_alloc_list().

02977 {
02978    unsigned int num_buckets;
02979    size_t container_size;
02980    struct ao2_container_hash *self;
02981 
02982    num_buckets = hash_fn ? n_buckets : 1;
02983    container_size = sizeof(struct ao2_container_hash) + num_buckets * sizeof(struct hash_bucket);
02984 
02985    self = ao2_t_alloc_options(container_size, container_destruct, ao2_options,
02986       "New hash container");
02987    return hash_ao2_container_init(self, container_options, num_buckets,
02988       hash_fn, sort_fn, cmp_fn);
02989 }

struct ao2_container* __ao2_container_alloc_hash_debug ( 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,
int  ref_debug 
) [read]

Definition at line 2991 of file astobj2.c.

References __ao2_alloc_debug(), container_destruct_debug(), and hash_ao2_container_init().

Referenced by __ao2_container_alloc_list_debug(), and hash_ao2_alloc_empty_clone_debug().

02995 {
02996    unsigned int num_buckets;
02997    size_t container_size;
02998    struct ao2_container_hash *self;
02999 
03000    num_buckets = hash_fn ? n_buckets : 1;
03001    container_size = sizeof(struct ao2_container_hash) + num_buckets * sizeof(struct hash_bucket);
03002 
03003    self = __ao2_alloc_debug(container_size, container_destruct_debug, ao2_options,
03004       tag, file, line, func, ref_debug);
03005    return hash_ao2_container_init(self, container_options, num_buckets, hash_fn,
03006       sort_fn, cmp_fn);
03007 }

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 
) [read]

Definition at line 3009 of file astobj2.c.

References __ao2_container_alloc_hash().

03011 {
03012    return __ao2_container_alloc_hash(ao2_options, container_options, 1, NULL, sort_fn,
03013       cmp_fn);
03014 }

struct ao2_container* __ao2_container_alloc_list_debug ( 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,
int  ref_debug 
) [read]

Definition at line 3016 of file astobj2.c.

References __ao2_container_alloc_hash_debug().

03019 {
03020    return __ao2_container_alloc_hash_debug(ao2_options, container_options, 1, NULL,
03021       sort_fn, cmp_fn, tag, file, line, func, ref_debug);
03022 }

struct ao2_container* __ao2_container_clone ( struct ao2_container orig,
enum search_flags  flags 
) [read]

Create a clone/copy of the given container.

Since:
11.0
Parameters:
orig Container to copy all object references from.
flags OBJ_NOLOCK if a lock is already held on the container.
Note:
This can potentially be expensive because a malloc is needed for every object in the orig container.
Return values:
Clone container on success.
NULL on error.

Definition at line 1701 of file astobj2.c.

References ao2_container_methods::alloc_empty_clone, ao2_container_dup(), ao2_t_ref, ao2_unlock, ao2_wrlock, ast_assert, INTERNAL_OBJ(), OBJ_NOLOCK, and ao2_container::v_table.

01702 {
01703    struct ao2_container *clone;
01704    int failed;
01705 
01706    /* Create the clone container with the same properties as the original. */
01707    if (!INTERNAL_OBJ(orig) || !orig->v_table || !orig->v_table->alloc_empty_clone) {
01708       /* Sanity checks. */
01709       ast_assert(0);
01710       return NULL;
01711    }
01712    clone = orig->v_table->alloc_empty_clone(orig);
01713    if (!clone) {
01714       return NULL;
01715    }
01716 
01717    if (flags & OBJ_NOLOCK) {
01718       ao2_wrlock(clone);
01719    }
01720    failed = ao2_container_dup(clone, orig, flags);
01721    if (flags & OBJ_NOLOCK) {
01722       ao2_unlock(clone);
01723    }
01724    if (failed) {
01725       /* Object copy into the clone container failed. */
01726       ao2_t_ref(clone, -1, "Clone creation failed.");
01727       clone = NULL;
01728    }
01729    return clone;
01730 }

struct ao2_container* __ao2_container_clone_debug ( struct ao2_container orig,
enum search_flags  flags,
const char *  tag,
const char *  file,
int  line,
const char *  func,
int  ref_debug 
) [read]

Definition at line 1732 of file astobj2.c.

References __ao2_ref_debug(), ao2_container_methods::alloc_empty_clone_debug, ao2_container_dup(), ao2_t_ref, ao2_unlock, ao2_wrlock, ast_assert, INTERNAL_OBJ(), OBJ_NOLOCK, and ao2_container::v_table.

01733 {
01734    struct ao2_container *clone;
01735    int failed;
01736 
01737    /* Create the clone container with the same properties as the original. */
01738    if (!INTERNAL_OBJ(orig) || !orig->v_table || !orig->v_table->alloc_empty_clone_debug) {
01739       /* Sanity checks. */
01740       ast_assert(0);
01741       return NULL;
01742    }
01743    clone = orig->v_table->alloc_empty_clone_debug(orig, tag, file, line, func, ref_debug);
01744    if (!clone) {
01745       return NULL;
01746    }
01747 
01748    if (flags & OBJ_NOLOCK) {
01749       ao2_wrlock(clone);
01750    }
01751    failed = ao2_container_dup(clone, orig, flags);
01752    if (flags & OBJ_NOLOCK) {
01753       ao2_unlock(clone);
01754    }
01755    if (failed) {
01756       /* Object copy into the clone container failed. */
01757       if (ref_debug) {
01758          __ao2_ref_debug(clone, -1, tag, file, line, func);
01759       } else {
01760          ao2_t_ref(clone, -1, "Clone creation failed.");
01761       }
01762       clone = NULL;
01763    }
01764    return clone;
01765 }

void* __ao2_find ( struct ao2_container c,
const void *  arg,
enum search_flags  flags 
)

Definition at line 1434 of file astobj2.c.

References __ao2_callback(), ast_assert, and ao2_container::cmp_fn.

Referenced by _get_mohbyname().

01435 {
01436    void *arged = (void *) arg;/* Done to avoid compiler const warning */
01437 
01438    if (!c) {
01439       /* Sanity checks. */
01440       ast_assert(0);
01441       return NULL;
01442    }
01443    return __ao2_callback(c, flags, c->cmp_fn, arged);
01444 }

void* __ao2_find_debug ( 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 1421 of file astobj2.c.

References __ao2_callback_debug(), ast_assert, and ao2_container::cmp_fn.

Referenced by _get_mohbyname().

01423 {
01424    void *arged = (void *) arg;/* Done to avoid compiler const warning */
01425 
01426    if (!c) {
01427       /* Sanity checks. */
01428       ast_assert(0);
01429       return NULL;
01430    }
01431    return __ao2_callback_debug(c, flags, c->cmp_fn, arged, tag, file, line, func);
01432 }

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 724 of file astobj2.c.

References __ao2_ref_debug(), __ast_rwlock_rdlock(), __ast_rwlock_unlock(), ast_assert, ast_log(), ao2_global_obj::lock, LOG_ERROR, and ao2_global_obj::obj.

00725 {
00726    void *obj;
00727 
00728    if (!holder) {
00729       /* For sanity */
00730       ast_log(LOG_ERROR, "Must be called with a global object!\n");
00731       ast_assert(0);
00732       return NULL;
00733    }
00734 
00735    if (__ast_rwlock_rdlock(file, line, func, &holder->lock, name)) {
00736       /* Could not get the read lock. */
00737       ast_assert(0);
00738       return NULL;
00739    }
00740 
00741    obj = holder->obj;
00742    if (obj) {
00743       __ao2_ref_debug(obj, +1, tag, file, line, func);
00744    }
00745 
00746    __ast_rwlock_unlock(file, line, func, &holder->lock, name);
00747 
00748    return obj;
00749 }

void __ao2_global_obj_release ( struct ao2_global_obj holder,
const char *  tag,
const char *  file,
int  line,
const char *  func,
const char *  name 
)

Definition at line 662 of file astobj2.c.

References __ao2_ref_debug(), __ast_rwlock_unlock(), __ast_rwlock_wrlock(), ast_assert, ast_log(), ao2_global_obj::lock, LOG_ERROR, and ao2_global_obj::obj.

00663 {
00664    if (!holder) {
00665       /* For sanity */
00666       ast_log(LOG_ERROR, "Must be called with a global object!\n");
00667       ast_assert(0);
00668       return;
00669    }
00670    if (__ast_rwlock_wrlock(file, line, func, &holder->lock, name)) {
00671       /* Could not get the write lock. */
00672       ast_assert(0);
00673       return;
00674    }
00675 
00676    /* Release the held ao2 object. */
00677    if (holder->obj) {
00678       __ao2_ref_debug(holder->obj, -1, tag, file, line, func);
00679       holder->obj = NULL;
00680    }
00681 
00682    __ast_rwlock_unlock(file, line, func, &holder->lock, name);
00683 }

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 685 of file astobj2.c.

References __ao2_ref_debug(), __ast_rwlock_unlock(), __ast_rwlock_wrlock(), ast_assert, ast_log(), ao2_global_obj::lock, LOG_ERROR, and ao2_global_obj::obj.

Referenced by __ao2_global_obj_replace_unref().

00686 {
00687    void *obj_old;
00688 
00689    if (!holder) {
00690       /* For sanity */
00691       ast_log(LOG_ERROR, "Must be called with a global object!\n");
00692       ast_assert(0);
00693       return NULL;
00694    }
00695    if (__ast_rwlock_wrlock(file, line, func, &holder->lock, name)) {
00696       /* Could not get the write lock. */
00697       ast_assert(0);
00698       return NULL;
00699    }
00700 
00701    if (obj) {
00702       __ao2_ref_debug(obj, +1, tag, file, line, func);
00703    }
00704    obj_old = holder->obj;
00705    holder->obj = obj;
00706 
00707    __ast_rwlock_unlock(file, line, func, &holder->lock, name);
00708 
00709    return obj_old;
00710 }

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 712 of file astobj2.c.

References __ao2_global_obj_replace(), and __ao2_ref_debug().

00713 {
00714    void *obj_old;
00715 
00716    obj_old = __ao2_global_obj_replace(holder, obj, tag, file, line, func, name);
00717    if (obj_old) {
00718       __ao2_ref_debug(obj_old, -1, tag, file, line, func);
00719       return 1;
00720    }
00721    return 0;
00722 }

void* __ao2_iterator_next ( struct ao2_iterator iter  ) 

Definition at line 1613 of file astobj2.c.

References internal_ao2_iterator_next().

01614 {
01615    return internal_ao2_iterator_next(iter, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__);
01616 }

void* __ao2_iterator_next_debug ( struct ao2_iterator iter,
const char *  tag,
const char *  file,
int  line,
const char *  func 
)

Definition at line 1608 of file astobj2.c.

References internal_ao2_iterator_next().

01609 {
01610    return internal_ao2_iterator_next(iter, tag, file, line, func);
01611 }

int __ao2_link ( struct ao2_container c,
void *  obj_new,
int  flags 
)

Definition at line 1083 of file astobj2.c.

References internal_ao2_link().

Referenced by dup_obj_cb(), and internal_ao2_traverse().

01084 {
01085    return internal_ao2_link(c, obj_new, flags, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__);
01086 }

int __ao2_link_debug ( struct ao2_container c,
void *  obj_new,
int  flags,
const char *  tag,
const char *  file,
int  line,
const char *  func 
)

Definition at line 1078 of file astobj2.c.

References internal_ao2_link().

Referenced by internal_ao2_traverse().

01079 {
01080    return internal_ao2_link(c, obj_new, flags, tag, file, line, func);
01081 }

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.

Parameters:
a A pointer to the object we want to lock.
lock_how,file,func,line,var 
Returns:
0 on success, other values on error.

Definition at line 174 of file astobj2.c.

References __ast_pthread_mutex_lock(), __ast_rwlock_rdlock(), __ast_rwlock_wrlock(), __LOG_ERROR, AO2_ALLOC_OPT_LOCK_MASK, AO2_ALLOC_OPT_LOCK_MUTEX, AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_ALLOC_OPT_LOCK_RWLOCK, AO2_LOCK_REQ_MUTEX, AO2_LOCK_REQ_RDLOCK, AO2_LOCK_REQ_WRLOCK, ast_assert, ast_atomic_fetchadd_int(), ast_log(), INTERNAL_OBJ(), INTERNAL_OBJ_MUTEX, INTERNAL_OBJ_RWLOCK, ao2_rwlock_priv::lock, ao2_lock_priv::lock, astobj2_lock::mutex, ao2_rwlock_priv::num_lockers, __priv_data::options, astobj2::priv_data, and astobj2_rwlock::rwlock.

00175 {
00176    struct astobj2 *obj = INTERNAL_OBJ(user_data);
00177    struct astobj2_lock *obj_mutex;
00178    struct astobj2_rwlock *obj_rwlock;
00179    int res = 0;
00180 
00181    if (obj == NULL) {
00182       ast_assert(0);
00183       return -1;
00184    }
00185 
00186    switch (obj->priv_data.options & AO2_ALLOC_OPT_LOCK_MASK) {
00187    case AO2_ALLOC_OPT_LOCK_MUTEX:
00188       obj_mutex = INTERNAL_OBJ_MUTEX(user_data);
00189       res = __ast_pthread_mutex_lock(file, line, func, var, &obj_mutex->mutex.lock);
00190 #ifdef AO2_DEBUG
00191       if (!res) {
00192          ast_atomic_fetchadd_int(&ao2.total_locked, 1);
00193       }
00194 #endif
00195       break;
00196    case AO2_ALLOC_OPT_LOCK_RWLOCK:
00197       obj_rwlock = INTERNAL_OBJ_RWLOCK(user_data);
00198       switch (lock_how) {
00199       case AO2_LOCK_REQ_MUTEX:
00200       case AO2_LOCK_REQ_WRLOCK:
00201          res = __ast_rwlock_wrlock(file, line, func, &obj_rwlock->rwlock.lock, var);
00202          if (!res) {
00203             ast_atomic_fetchadd_int(&obj_rwlock->rwlock.num_lockers, -1);
00204 #ifdef AO2_DEBUG
00205             ast_atomic_fetchadd_int(&ao2.total_locked, 1);
00206 #endif
00207          }
00208          break;
00209       case AO2_LOCK_REQ_RDLOCK:
00210          res = __ast_rwlock_rdlock(file, line, func, &obj_rwlock->rwlock.lock, var);
00211          if (!res) {
00212             ast_atomic_fetchadd_int(&obj_rwlock->rwlock.num_lockers, +1);
00213 #ifdef AO2_DEBUG
00214             ast_atomic_fetchadd_int(&ao2.total_locked, 1);
00215 #endif
00216          }
00217          break;
00218       }
00219       break;
00220    case AO2_ALLOC_OPT_LOCK_NOLOCK:
00221       /* The ao2 object has no lock. */
00222       break;
00223    default:
00224       ast_log(__LOG_ERROR, file, line, func, "Invalid lock option on ao2 object %p\n",
00225          user_data);
00226       return -1;
00227    }
00228 
00229    return res;
00230 }

int __ao2_ref ( void *  o,
int  delta 
)

Definition at line 542 of file astobj2.c.

References internal_ao2_ref().

Referenced by ao2_iterator_restart(), hash_ao2_find_cleanup(), hash_ao2_find_first(), hash_ao2_find_next(), internal_ao2_iterator_next(), internal_ao2_link(), and internal_ao2_traverse().

00543 {
00544    return internal_ao2_ref(user_data, delta, __FILE__, __LINE__, __FUNCTION__);
00545 }

int __ao2_ref_debug ( void *  o,
int  delta,
const char *  tag,
const char *  file,
int  line,
const char *  func 
)

Definition at line 515 of file astobj2.c.

References ast_assert, __priv_data::destructor_fn, internal_ao2_ref(), INTERNAL_OBJ(), astobj2::priv_data, __priv_data::ref_counter, and REF_FILE.

Referenced by __ao2_cleanup_debug(), __ao2_container_clone_debug(), __ao2_global_obj_ref(), __ao2_global_obj_release(), __ao2_global_obj_replace(), __ao2_global_obj_replace_unref(), dialog_ref_debug(), dialog_unref_debug(), hash_ao2_new_node(), internal_ao2_iterator_next(), and internal_ao2_traverse().

00516 {
00517    struct astobj2 *obj = INTERNAL_OBJ(user_data);
00518 
00519    if (obj == NULL) {
00520       ast_assert(0);
00521       return -1;
00522    }
00523 
00524    if (delta != 0) {
00525       FILE *refo = fopen(REF_FILE, "a");
00526       if (refo) {
00527          fprintf(refo, "%p %s%d   %s:%d:%s (%s) [@%d]\n", user_data, (delta < 0 ? "" : "+"),
00528             delta, file, line, func, tag, obj->priv_data.ref_counter);
00529          fclose(refo);
00530       }
00531    }
00532    if (obj->priv_data.ref_counter + delta == 0 && obj->priv_data.destructor_fn != NULL) { /* this isn't protected with lock; just for o/p */
00533       FILE *refo = fopen(REF_FILE, "a");
00534       if (refo) {
00535          fprintf(refo, "%p **call destructor** %s:%d:%s (%s)\n", user_data, file, line, func, tag);
00536          fclose(refo);
00537       }
00538    }
00539    return internal_ao2_ref(user_data, delta, file, line, func);
00540 }

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).

Parameters:
a A pointer to the object we want to lock.
lock_how,file,func,line,var 
Returns:
0 on success, other values on error.

Definition at line 282 of file astobj2.c.

References __ast_pthread_mutex_trylock(), __ast_rwlock_tryrdlock(), __ast_rwlock_trywrlock(), __LOG_ERROR, AO2_ALLOC_OPT_LOCK_MASK, AO2_ALLOC_OPT_LOCK_MUTEX, AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_ALLOC_OPT_LOCK_RWLOCK, AO2_LOCK_REQ_MUTEX, AO2_LOCK_REQ_RDLOCK, AO2_LOCK_REQ_WRLOCK, ast_assert, ast_atomic_fetchadd_int(), ast_log(), INTERNAL_OBJ(), INTERNAL_OBJ_MUTEX, INTERNAL_OBJ_RWLOCK, ao2_rwlock_priv::lock, ao2_lock_priv::lock, astobj2_lock::mutex, ao2_rwlock_priv::num_lockers, __priv_data::options, astobj2::priv_data, and astobj2_rwlock::rwlock.

00283 {
00284    struct astobj2 *obj = INTERNAL_OBJ(user_data);
00285    struct astobj2_lock *obj_mutex;
00286    struct astobj2_rwlock *obj_rwlock;
00287    int res = 0;
00288 
00289    if (obj == NULL) {
00290       ast_assert(0);
00291       return -1;
00292    }
00293 
00294    switch (obj->priv_data.options & AO2_ALLOC_OPT_LOCK_MASK) {
00295    case AO2_ALLOC_OPT_LOCK_MUTEX:
00296       obj_mutex = INTERNAL_OBJ_MUTEX(user_data);
00297       res = __ast_pthread_mutex_trylock(file, line, func, var, &obj_mutex->mutex.lock);
00298 #ifdef AO2_DEBUG
00299       if (!res) {
00300          ast_atomic_fetchadd_int(&ao2.total_locked, 1);
00301       }
00302 #endif
00303       break;
00304    case AO2_ALLOC_OPT_LOCK_RWLOCK:
00305       obj_rwlock = INTERNAL_OBJ_RWLOCK(user_data);
00306       switch (lock_how) {
00307       case AO2_LOCK_REQ_MUTEX:
00308       case AO2_LOCK_REQ_WRLOCK:
00309          res = __ast_rwlock_trywrlock(file, line, func, &obj_rwlock->rwlock.lock, var);
00310          if (!res) {
00311             ast_atomic_fetchadd_int(&obj_rwlock->rwlock.num_lockers, -1);
00312 #ifdef AO2_DEBUG
00313             ast_atomic_fetchadd_int(&ao2.total_locked, 1);
00314 #endif
00315          }
00316          break;
00317       case AO2_LOCK_REQ_RDLOCK:
00318          res = __ast_rwlock_tryrdlock(file, line, func, &obj_rwlock->rwlock.lock, var);
00319          if (!res) {
00320             ast_atomic_fetchadd_int(&obj_rwlock->rwlock.num_lockers, +1);
00321 #ifdef AO2_DEBUG
00322             ast_atomic_fetchadd_int(&ao2.total_locked, 1);
00323 #endif
00324          }
00325          break;
00326       }
00327       break;
00328    case AO2_ALLOC_OPT_LOCK_NOLOCK:
00329       /* The ao2 object has no lock. */
00330       return 0;
00331    default:
00332       ast_log(__LOG_ERROR, file, line, func, "Invalid lock option on ao2 object %p\n",
00333          user_data);
00334       return -1;
00335    }
00336 
00337 
00338    return res;
00339 }

void* __ao2_unlink ( struct ao2_container c,
void *  obj,
int  flags 
)

Definition at line 1115 of file astobj2.c.

References __ao2_callback(), ao2_match_by_addr(), ast_assert, INTERNAL_OBJ(), OBJ_NODATA, OBJ_POINTER, and OBJ_UNLINK.

01116 {
01117    if (!INTERNAL_OBJ(user_data)) {
01118       /* Sanity checks. */
01119       ast_assert(0);
01120       return NULL;
01121    }
01122 
01123    flags |= (OBJ_UNLINK | OBJ_POINTER | OBJ_NODATA);
01124    __ao2_callback(c, flags, ao2_match_by_addr, user_data);
01125 
01126    return NULL;
01127 }

void* __ao2_unlink_debug ( struct ao2_container c,
void *  obj,
int  flags,
const char *  tag,
const char *  file,
int  line,
const char *  func 
)

Definition at line 1100 of file astobj2.c.

References __ao2_callback_debug(), ao2_match_by_addr(), ast_assert, INTERNAL_OBJ(), OBJ_NODATA, OBJ_POINTER, and OBJ_UNLINK.

01102 {
01103    if (!INTERNAL_OBJ(user_data)) {
01104       /* Sanity checks. */
01105       ast_assert(0);
01106       return NULL;
01107    }
01108 
01109    flags |= (OBJ_UNLINK | OBJ_POINTER | OBJ_NODATA);
01110    __ao2_callback_debug(c, flags, ao2_match_by_addr, user_data, tag, file, line, func);
01111 
01112    return NULL;
01113 }

int __ao2_unlock ( void *  a,
const char *  file,
const char *  func,
int  line,
const char *  var 
)

Unlock an object.

Parameters:
a A pointer to the object we want unlock.
file,func,line,var 
Returns:
0 on success, other values on error.

Definition at line 232 of file astobj2.c.

References __ast_pthread_mutex_unlock(), __ast_rwlock_unlock(), __LOG_ERROR, AO2_ALLOC_OPT_LOCK_MASK, AO2_ALLOC_OPT_LOCK_MUTEX, AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_ALLOC_OPT_LOCK_RWLOCK, ast_assert, ast_atomic_fetchadd_int(), ast_log(), INTERNAL_OBJ(), INTERNAL_OBJ_MUTEX, INTERNAL_OBJ_RWLOCK, ao2_rwlock_priv::lock, ao2_lock_priv::lock, astobj2_lock::mutex, ao2_rwlock_priv::num_lockers, __priv_data::options, astobj2::priv_data, and astobj2_rwlock::rwlock.

00233 {
00234    struct astobj2 *obj = INTERNAL_OBJ(user_data);
00235    struct astobj2_lock *obj_mutex;
00236    struct astobj2_rwlock *obj_rwlock;
00237    int res = 0;
00238    int current_value;
00239 
00240    if (obj == NULL) {
00241       ast_assert(0);
00242       return -1;
00243    }
00244 
00245    switch (obj->priv_data.options & AO2_ALLOC_OPT_LOCK_MASK) {
00246    case AO2_ALLOC_OPT_LOCK_MUTEX:
00247       obj_mutex = INTERNAL_OBJ_MUTEX(user_data);
00248       res = __ast_pthread_mutex_unlock(file, line, func, var, &obj_mutex->mutex.lock);
00249 #ifdef AO2_DEBUG
00250       if (!res) {
00251          ast_atomic_fetchadd_int(&ao2.total_locked, -1);
00252       }
00253 #endif
00254       break;
00255    case AO2_ALLOC_OPT_LOCK_RWLOCK:
00256       obj_rwlock = INTERNAL_OBJ_RWLOCK(user_data);
00257 
00258       current_value = ast_atomic_fetchadd_int(&obj_rwlock->rwlock.num_lockers, -1) - 1;
00259       if (current_value < 0) {
00260          /* It was a WRLOCK that we are unlocking.  Fix the count. */
00261          ast_atomic_fetchadd_int(&obj_rwlock->rwlock.num_lockers, -current_value);
00262       }
00263       res = __ast_rwlock_unlock(file, line, func, &obj_rwlock->rwlock.lock, var);
00264 #ifdef AO2_DEBUG
00265       if (!res) {
00266          ast_atomic_fetchadd_int(&ao2.total_locked, -1);
00267       }
00268 #endif
00269       break;
00270    case AO2_ALLOC_OPT_LOCK_NOLOCK:
00271       /* The ao2 object has no lock. */
00272       break;
00273    default:
00274       ast_log(__LOG_ERROR, file, line, func, "Invalid lock option on ao2 object %p\n",
00275          user_data);
00276       res = -1;
00277       break;
00278    }
00279    return res;
00280 }

void ao2_bt ( void   ) 

Definition at line 112 of file astobj2.c.

00112 {}

int ao2_container_check ( struct ao2_container self,
enum search_flags  flags 
)

Perform an integrity check on the specified container.

Since:
12.0.0
Parameters:
self Container to check integrity.
flags OBJ_NOLOCK if a lock is already held on the container.
Return values:
0 on success.
-1 on error.

Definition at line 1808 of file astobj2.c.

References ao2_rdlock, ao2_unlock, ast_assert, INTERNAL_OBJ(), and OBJ_NOLOCK.

01809 {
01810    int res = 0;
01811 
01812    if (!INTERNAL_OBJ(self) || !self->v_table) {
01813       /* Sanity checks. */
01814       ast_assert(0);
01815       return -1;
01816    }
01817 #if defined(AST_DEVMODE)
01818    if (!self->v_table->integrity) {
01819       /* No ingetrigy check available.  Assume container is ok. */
01820       return 0;
01821    }
01822 
01823    if (!(flags & OBJ_NOLOCK)) {
01824       ao2_rdlock(self);
01825    }
01826    res = self->v_table->integrity(self);
01827    if (!(flags & OBJ_NOLOCK)) {
01828       ao2_unlock(self);
01829    }
01830 #endif   /* defined(AST_DEVMODE) */
01831    return res;
01832 }

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 996 of file astobj2.c.

References ast_atomic_fetchadd_int(), and ao2_container::elements.

Referenced by __ast_data_register(), __ast_manager_event_multichan(), __queues_show(), _sip_show_peers(), action_confbridgekick(), action_confbridgelist(), action_confbridgelistrooms(), action_confbridgesetsinglevideosrc(), action_confbridgestartrecord(), action_confbridgestoprecord(), action_lock_unlock_helper(), action_mute_unmute_helper(), ast_active_channels(), ast_data_search_match(), ast_format_cap_get_type(), ast_format_cap_identical(), ast_format_cap_is_empty(), ast_format_cap_joint(), ast_get_namedgroups(), ast_merge_contexts_and_delete(), ast_namedgroups_intersect(), ast_rtp_ice_add_remote_candidate(), ast_rtp_ice_start(), ast_srtp_unprotect(), ast_tone_zone_count(), build_format_list_array(), calc_metric(), cc_cli_output_status(), cleanup(), cli_fax_show_sessions(), cli_tps_report(), data_odbc_provider_handler(), data_provider_release(), data_provider_release_all(), do_timing(), endelm(), func_confbridge_info(), get_device_state_causing_channels(), get_unused_callno(), handle_cli_iax2_show_callno_limits(), handle_show_hint(), handle_show_hints(), handle_statechange(), hints_data_provider_get(), joint_copy_helper(), list_hash_cb(), locals_show(), lock_broker(), match_filter(), meetme_data_provider_get(), pthread_timer_open(), queue_exec(), queue_function_mem_read(), queues_data_provider_get_helper(), try_calling(), unload_module(), and xmpp_show_clients().

00997 {
00998    return ast_atomic_fetchadd_int(&c->elements, 0);
00999 }

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.

Since:
11.0
Parameters:
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.
Precondition:
The dest container must be empty. If the duplication fails, the dest container will be returned empty.
Note:
This can potentially be expensive because a malloc is needed for every object in the src container.
Return values:
0 on success.
-1 on error.

Definition at line 1674 of file astobj2.c.

References __ao2_callback(), ao2_rdlock, ao2_t_ref, ao2_unlock, ao2_wrlock, dup_obj_cb(), OBJ_MULTIPLE, OBJ_NODATA, OBJ_NOLOCK, and OBJ_UNLINK.

Referenced by __ao2_container_clone(), and __ao2_container_clone_debug().

01675 {
01676    void *obj;
01677    int res = 0;
01678 
01679    if (!(flags & OBJ_NOLOCK)) {
01680       ao2_rdlock(src);
01681       ao2_wrlock(dest);
01682    }
01683    obj = __ao2_callback(src, OBJ_NOLOCK, dup_obj_cb, dest);
01684    if (obj) {
01685       /* Failed to put this obj into the dest container. */
01686       ao2_t_ref(obj, -1, "Failed to put this object into the dest container.");
01687 
01688       /* Remove all items from the dest container. */
01689       __ao2_callback(dest, OBJ_NOLOCK | OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, NULL,
01690          NULL);
01691       res = -1;
01692    }
01693    if (!(flags & OBJ_NOLOCK)) {
01694       ao2_unlock(dest);
01695       ao2_unlock(src);
01696    }
01697 
01698    return res;
01699 }

int ao2_container_register ( const char *  name,
struct ao2_container self 
)

Register a container for CLI stats and integrity check.

Since:
12.0.0
Parameters:
name Name to register the container under.
self Container to register.
Return values:
0 on success.
-1 on error.

Definition at line 3223 of file astobj2.c.

References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_t_alloc_options, ao2_t_link, and ao2_t_ref.

Referenced by ast_channels_init().

03224 {
03225    int res = 0;
03226 #if defined(AST_DEVMODE)
03227    struct ao2_reg_container *reg;
03228 
03229    reg = ao2_t_alloc_options(sizeof(*reg) + strlen(name), ao2_reg_destructor,
03230       AO2_ALLOC_OPT_LOCK_NOLOCK, "Container registration object.");
03231    if (!reg) {
03232       return -1;
03233    }
03234 
03235    /* Fill in registered entry */
03236    ao2_t_ref(self, +1, "Registering container.");
03237    reg->registered = self;
03238    strcpy(reg->name, name);/* safe */
03239 
03240    if (!ao2_t_link(reg_containers, reg, "Save registration object.")) {
03241       res = -1;
03242    }
03243 
03244    ao2_t_ref(reg, -1, "Done registering container.");
03245 #endif   /* defined(AST_DEVMODE) */
03246    return res;
03247 }

void ao2_container_unregister ( const char *  name  ) 

Unregister a container for CLI stats and integrity check.

Since:
12.0.0
Parameters:
name Name the container is registered under.
Returns:
Nothing

Definition at line 3249 of file astobj2.c.

References ao2_t_find, OBJ_NODATA, and OBJ_UNLINK.

Referenced by channels_shutdown().

03250 {
03251 #if defined(AST_DEVMODE)
03252    ao2_t_find(reg_containers, name, OBJ_UNLINK | OBJ_NODATA | OBJ_KEY,
03253       "Unregister container");
03254 #endif   /* defined(AST_DEVMODE) */
03255 }

void ao2_iterator_cleanup ( struct ao2_iterator iter  ) 

Definition at line 1508 of file astobj2.c.

References ao2_iterator_destroy().

01509 {
01510    if (iter) {
01511       ao2_iterator_destroy(iter);
01512    }
01513 }

void ao2_iterator_destroy ( struct ao2_iterator iter  ) 

Destroy a container iterator.

Parameters:
iter the iterator to destroy
Return values:
none This function will release the container reference held by the iterator and any other resources it may be holding.

Definition at line 1493 of file astobj2.c.

References AO2_ITERATOR_MALLOCD, ao2_iterator_restart(), ao2_t_ref, ast_free, ao2_iterator::c, and ao2_iterator::flags.

Referenced by __ast_data_search_cmp_structure(), __ast_manager_event_multichan(), __data_result_print_cli(), __iax2_show_peers(), __queues_show(), _sip_show_peers(), aco_set_defaults(), action_confbridgelistrooms(), action_meetmelist(), add_ice_to_sdp(), alias_show(), ao2_iterator_cleanup(), ast_channel_iterator_destroy(), ast_data_iterator_end(), ast_data_search_match(), ast_format_cap_get_type(), ast_format_cap_has_joint(), ast_format_cap_has_type(), ast_format_cap_identical(), ast_format_cap_iter_end(), ast_format_cap_joint(), ast_format_cap_to_old_bitfield(), ast_merge_contexts_and_delete(), ast_msg_var_iterator_destroy(), ast_pickup_find_by_group(), ast_print_namedgroups(), ast_rtp_ice_start(), ast_srtp_unprotect(), ast_var_indications(), ast_var_indications_table(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), authenticate(), authenticate_reply(), build_dialplan_useage_map(), build_format_list_array(), calendar_query_exec(), check_access(), clear_queue(), clear_stats(), cli_console_active(), cli_display_named_acl_list(), cli_fax_show_sessions(), cli_list_devices(), cli_tps_report(), compare_weight(), complete_confbridge_name(), complete_core_id(), complete_core_show_hint(), complete_country(), complete_iax2_peers(), complete_iax2_unregister(), complete_queue(), complete_queue_remove_member(), complete_sip_peer(), complete_sip_registered_peer(), complete_sip_user(), complete_sipch(), complete_userno(), conf_queue_dtmf(), conf_run(), config_hook_exec(), data_filter_find(), data_odbc_provider_handler(), data_provider_print_cli(), data_provider_release_all(), data_result_generate_node(), data_result_manager_output(), delete_profiles(), delete_routes(), delete_users(), destroy_pvts(), dialgroup_read(), do_parking_thread(), dump_queue_members(), extension_state_cb(), fax_session_tab_complete(), find_call(), find_queue_by_name_rt(), find_ringing_channel(), find_session(), find_session_by_nonce(), free_members(), get_device_state_causing_channels(), get_member_status(), handle_cli_confbridge_list(), 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_odbc_show(), handle_feature_show(), handle_parkedcalls(), handle_presencechange(), handle_show_calendar(), handle_show_calendars(), handle_show_hint(), handle_show_hints(), handle_show_routes(), handle_showmanconn(), handle_skel_show_games(), handle_skel_show_levels(), handle_statechange(), hints_data_provider_get(), iax2_getpeername(), iax2_getpeertrunk(), interface_exists(), jingle_add_google_candidates_to_transport(), jingle_add_ice_udp_candidates_to_transport(), jingle_request(), joint_copy_helper(), kill_duplicate_offers(), local_devicestate(), locals_show(), manager_iax2_show_peer_list(), manager_optimize_away(), manager_parking_status(), manager_queues_status(), manager_queues_summary(), manager_sip_peer_status(), meetme_show_cmd(), moh_rescan_files(), msg_func_write(), num_available_members(), peers_data_provider_get(), poke_all_peers(), pp_each_user_helper(), prune_peers(), prune_users(), purge_sessions(), queue_function_mem_read(), queue_function_qac_dep(), queue_function_queuememberlist(), queues_data_provider_get(), queues_data_provider_get_helper(), reload(), rt_handle_member_record(), set_member_paused(), set_member_value(), sip_keepalive_all_peers(), sip_poke_all_peers(), sip_prune_realtime(), sip_show_channel(), sip_show_history(), sip_show_inuse(), sip_show_tcp(), sip_show_users(), stop_streams(), tps_taskprocessor_tab_complete(), try_calling(), unload_module(), update_queue(), update_realtime_members(), users_data_provider_get(), xmpp_pubsub_create_affiliations(), xmpp_show_buddies(), and xmpp_show_clients().

01494 {
01495    /* Release any last container node reference. */
01496    ao2_iterator_restart(iter);
01497 
01498    /* Release the iterated container reference. */
01499    ao2_t_ref(iter->c, -1, "Unref iterator in ao2_iterator_destroy");
01500    iter->c = NULL;
01501 
01502    /* Free the malloced iterator. */
01503    if (iter->flags & AO2_ITERATOR_MALLOCD) {
01504       ast_free(iter);
01505    }
01506 }

struct ao2_iterator ao2_iterator_init ( struct ao2_container c,
int  flags 
) [read]

Create an iterator for a container.

Parameters:
c the container
flags one or more flags from ao2_iterator_flags.
Return values:
the constructed iterator
Note:
This function does not take a pointer to an iterator; rather, it returns an iterator structure that should be assigned to (overwriting) an existing iterator structure allocated on the stack or on the heap.
This function will take a reference on the container being iterated.

initialize an iterator so we start from the first object

Definition at line 1449 of file astobj2.c.

References ao2_t_ref, ao2_iterator::c, and ao2_iterator::flags.

Referenced by __ast_data_search_cmp_structure(), __ast_manager_event_multichan(), __data_result_print_cli(), __iax2_show_peers(), __queues_show(), aco_set_defaults(), action_confbridgelistrooms(), action_meetmelist(), add_ice_to_sdp(), alias_show(), ast_channel_iterator_all_new(), ast_data_iterator_init(), ast_data_search_match(), ast_format_cap_get_type(), ast_format_cap_has_joint(), ast_format_cap_has_type(), ast_format_cap_identical(), ast_format_cap_iter_start(), ast_format_cap_joint(), ast_format_cap_to_old_bitfield(), ast_merge_contexts_and_delete(), ast_msg_var_iterator_init(), ast_pickup_find_by_group(), ast_print_namedgroups(), ast_rtp_ice_start(), ast_srtp_unprotect(), ast_tone_zone_iterator_init(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), authenticate(), authenticate_reply(), build_dialplan_useage_map(), build_format_list_array(), calendar_query_exec(), check_access(), clear_queue(), clear_stats(), cli_console_active(), cli_display_named_acl_list(), cli_fax_show_sessions(), cli_list_devices(), cli_tps_report(), compare_weight(), complete_confbridge_name(), complete_core_id(), complete_core_show_hint(), complete_country(), complete_iax2_peers(), complete_iax2_unregister(), complete_queue(), complete_queue_remove_member(), complete_sip_peer(), complete_sip_registered_peer(), complete_sip_user(), complete_sipch(), complete_userno(), conf_queue_dtmf(), conf_run(), config_hook_exec(), data_filter_find(), data_odbc_provider_handler(), data_provider_print_cli(), data_provider_release_all(), data_result_generate_node(), data_result_manager_output(), delete_profiles(), delete_routes(), delete_users(), destroy_pvts(), dialgroup_read(), do_parking_thread(), dump_queue_members(), extension_state_cb(), fax_session_tab_complete(), find_queue_by_name_rt(), find_ringing_channel(), find_session(), find_session_by_nonce(), free_members(), get_device_state_causing_channels(), get_member_status(), handle_cli_confbridge_list(), handle_cli_iax2_show_callno_limits(), handle_cli_iax2_show_users(), handle_cli_moh_show_classes(), handle_cli_moh_show_files(), handle_cli_odbc_show(), handle_feature_show(), handle_parkedcalls(), handle_presencechange(), handle_show_calendar(), handle_show_calendars(), handle_show_hint(), handle_show_hints(), handle_show_routes(), handle_showmanconn(), handle_skel_show_games(), handle_skel_show_levels(), handle_statechange(), hints_data_provider_get(), iax2_getpeername(), iax2_getpeertrunk(), interface_exists(), internal_ao2_traverse(), jingle_add_google_candidates_to_transport(), jingle_add_ice_udp_candidates_to_transport(), jingle_request(), joint_copy_helper(), local_devicestate(), locals_show(), manager_iax2_show_peer_list(), manager_optimize_away(), manager_parking_status(), manager_parkinglot_list(), manager_queues_status(), manager_queues_summary(), manager_sip_peer_status(), meetme_show_cmd(), moh_rescan_files(), msg_func_write(), num_available_members(), peers_data_provider_get(), poke_all_peers(), pp_each_user_helper(), prune_peers(), prune_users(), purge_sessions(), queue_function_mem_read(), queue_function_qac_dep(), queue_function_queuememberlist(), queues_data_provider_get(), queues_data_provider_get_helper(), reload(), rt_handle_member_record(), set_member_paused(), set_member_value(), sip_keepalive_all_peers(), sip_poke_all_peers(), sip_prune_realtime(), sip_show_channel(), sip_show_history(), sip_show_inuse(), sip_show_tcp(), sip_show_users(), stop_streams(), tps_taskprocessor_tab_complete(), try_calling(), unload_module(), update_queue(), update_realtime_members(), users_data_provider_get(), xmpp_pubsub_create_affiliations(), xmpp_show_buddies(), and xmpp_show_clients().

01450 {
01451    struct ao2_iterator a = {
01452       .c = c,
01453       .flags = flags
01454    };
01455 
01456    ao2_t_ref(c, +1, "Init iterator with container.");
01457 
01458    return a;
01459 }

void ao2_iterator_restart ( struct ao2_iterator iter  ) 

Restart an iteration.

Parameters:
iter the iterator to restart
Note:
A restart is not going to have any effect if the iterator was created with the AO2_ITERATOR_UNLINK flag. Any previous objects returned were removed from the container.
Return values:
none 

Definition at line 1461 of file astobj2.c.

References __ao2_ref(), adjust_lock(), AO2_ITERATOR_DONTLOCK, AO2_LOCK_REQ_MUTEX, AO2_LOCK_REQ_RDLOCK, ao2_rdlock, ao2_unlock, ao2_iterator::c, ao2_iterator::complete, ao2_iterator::flags, and ao2_iterator::last_node.

Referenced by ao2_iterator_destroy().

01462 {
01463    /* Release the last container node reference if we have one. */
01464    if (iter->last_node) {
01465       enum ao2_lock_req orig_lock;
01466 
01467       /*
01468        * Do a read lock in case the container node unref does not
01469        * destroy the node.  If the container node is destroyed then
01470        * the lock will be upgraded to a write lock.
01471        */
01472       if (iter->flags & AO2_ITERATOR_DONTLOCK) {
01473          orig_lock = adjust_lock(iter->c, AO2_LOCK_REQ_RDLOCK, 1);
01474       } else {
01475          orig_lock = AO2_LOCK_REQ_MUTEX;
01476          ao2_rdlock(iter->c);
01477       }
01478 
01479       __ao2_ref(iter->last_node, -1);
01480       iter->last_node = NULL;
01481 
01482       if (iter->flags & AO2_ITERATOR_DONTLOCK) {
01483          adjust_lock(iter->c, orig_lock, 0);
01484       } else {
01485          ao2_unlock(iter->c);
01486       }
01487    }
01488 
01489    /* The iteration is no longer complete. */
01490    iter->complete = 0;
01491 }

int ao2_match_by_addr ( void *  user_data,
void *  arg,
int  flags 
)

A common ao2_callback is one that matches by address.

Definition at line 1091 of file astobj2.c.

References CMP_MATCH, and CMP_STOP.

Referenced by __ao2_unlink(), __ao2_unlink_debug(), load_module(), and load_odbc_config().

01092 {
01093    return (user_data == arg) ? (CMP_MATCH | CMP_STOP) : 0;
01094 }

void* ao2_object_get_lockaddr ( void *  obj  ) 

Return the mutex lock address of an object.

Parameters:
[in] obj A pointer to the object we want.
Returns:
the address of the mutex lock, else NULL.
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.

Since:
1.6.1

Definition at line 404 of file astobj2.c.

References AO2_ALLOC_OPT_LOCK_MASK, AO2_ALLOC_OPT_LOCK_MUTEX, ast_assert, INTERNAL_OBJ(), INTERNAL_OBJ_MUTEX, ao2_lock_priv::lock, astobj2_lock::mutex, __priv_data::options, and astobj2::priv_data.

Referenced by bridge_channel_join_multithreaded(), bridge_channel_join_singlethreaded(), and db_sync_thread().

00405 {
00406    struct astobj2 *obj = INTERNAL_OBJ(user_data);
00407    struct astobj2_lock *obj_mutex;
00408 
00409    if (obj == NULL) {
00410       ast_assert(0);
00411       return NULL;
00412    }
00413 
00414    switch (obj->priv_data.options & AO2_ALLOC_OPT_LOCK_MASK) {
00415    case AO2_ALLOC_OPT_LOCK_MUTEX:
00416       obj_mutex = INTERNAL_OBJ_MUTEX(user_data);
00417       return &obj_mutex->mutex.lock;
00418    default:
00419       break;
00420    }
00421 
00422    return NULL;
00423 }


Generated on Thu Oct 11 06:34:44 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6