#include "asterisk/compat.h"


Go to the source code of this file.
Data Structures | |
| struct | ao2_iterator |
| When we need to walk through a container, we use an ao2_iterator to keep track of the current position. More... | |
| struct | ao2_list |
| Used as return value if the flag OBJ_MULTIPLE is set. More... | |
Defines | |
| #define | ao2_callback_data(arg1, arg2, arg3, arg4, arg5) _ao2_callback_data((arg1), (arg2), (arg3), (arg4), (arg5)) |
| #define | ao2_find(arg1, arg2, arg3) _ao2_find((arg1), (arg2), (arg3)) |
| #define | ao2_iterator_next(arg1) _ao2_iterator_next((arg1)) |
| #define | ao2_t_callback_data(arg1, arg2, arg3, arg4, arg5, arg6) _ao2_callback_data((arg1), (arg2), (arg3), (arg4), (arg5)) |
| 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(arg1, arg2, arg3, arg4) _ao2_find((arg1), (arg2), (arg3)) |
| #define | ao2_t_iterator_next(arg1, arg2) _ao2_iterator_next((arg1)) |
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, const int flags) |
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_iterator_flags { AO2_ITERATOR_DONTLOCK = (1 << 0) } |
| enum | search_flags { OBJ_UNLINK = (1 << 0), OBJ_NODATA = (1 << 1), OBJ_MULTIPLE = (1 << 2), OBJ_POINTER = (1 << 3), OBJ_CONTINUE = (1 << 4) } |
| Flags passed to ao2_callback() and ao2_hash_fn() to modify its 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, char *tag, char *file, int line, const char *funcname) |
| void * | _ao2_find (struct ao2_container *c, void *arg, enum search_flags flags) |
| void * | _ao2_find_debug (struct ao2_container *c, void *arg, enum search_flags flags, char *tag, char *file, int line, const char *funcname) |
| void * | _ao2_iterator_next (struct ao2_iterator *a) |
| void * | _ao2_iterator_next_debug (struct ao2_iterator *a, char *tag, char *file, int line, const char *funcname) |
| int | _ao2_lock (void *a, const char *file, const char *func, int line, const char *var) |
| int | _ao2_trylock (void *a, const char *file, const char *func, int line, const char *var) |
| int | _ao2_unlock (void *a, const char *file, const char *func, int line, const char *var) |
| void | ao2_bt (void) |
| void | ao2_iterator_destroy (struct ao2_iterator *i) |
| Destroy a container iterator. | |
| struct ao2_iterator | ao2_iterator_init (struct ao2_container *c, int flags) |
| Create an iterator for a container. | |
| int | ao2_lock (void *a) |
| Lock an object. | |
| void * | ao2_object_get_lockaddr (void *obj) |
| Return the lock address of an object. | |
| int | ao2_trylock (void *a) |
| Try locking-- (don't block if fail). | |
| int | ao2_unlock (void *a) |
| Unlock an object. | |
Variables | |
| ao2_callback_fn | ao2_match_by_addr |
| a very common callback is one that matches by address. | |
| #define | ao2_alloc(data_size, destructor_fn) _ao2_alloc((data_size), (destructor_fn)) |
| #define | ao2_t_alloc(data_size, destructor_fn, debug_msg) _ao2_alloc((data_size), (destructor_fn)) |
| Allocate and initialize an object. | |
| void * | _ao2_alloc (const size_t data_size, ao2_destructor_fn destructor_fn) |
| void * | _ao2_alloc_debug (const size_t data_size, ao2_destructor_fn destructor_fn, char *tag, const char *file, int line, const char *funcname, 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, char *tag, char *file, int line, const char *funcname) |
Object Containers | |
| Here start declarations of containers. | |
| #define | ao2_container_alloc(arg1, arg2, arg3) _ao2_container_alloc((arg1), (arg2), (arg3)) |
| #define | ao2_t_container_alloc(arg1, arg2, arg3, arg4) _ao2_container_alloc((arg1), (arg2), (arg3)) |
| Allocate and initialize a container with the desired number of buckets. | |
| struct ao2_container * | _ao2_container_alloc (const unsigned int n_buckets, ao2_hash_fn *hash_fn, ao2_callback_fn *cmp_fn) |
| struct ao2_container * | _ao2_container_alloc_debug (const unsigned int n_buckets, ao2_hash_fn *hash_fn, ao2_callback_fn *cmp_fn, char *tag, char *file, int line, const char *funcname, int ref_debug) |
| int | ao2_container_count (struct ao2_container *c) |
| Returns the number of elements in a container. | |
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(arg1, arg2) _ao2_link((arg1), (arg2)) |
| #define | ao2_t_link(arg1, arg2, arg3) _ao2_link((arg1), (arg2)) |
| Add an object to a container. | |
| #define | ao2_t_unlink(arg1, arg2, arg3) _ao2_unlink((arg1), (arg2)) |
| Remove an object from a container. | |
| #define | ao2_unlink(arg1, arg2) _ao2_unlink((arg1), (arg2)) |
| void * | _ao2_link (struct ao2_container *c, void *newobj) |
| void * | _ao2_link_debug (struct ao2_container *c, void *new_obj, char *tag, char *file, int line, const char *funcname) |
| void * | _ao2_unlink (struct ao2_container *c, void *obj) |
| void * | _ao2_unlink_debug (struct ao2_container *c, void *obj, char *tag, char *file, int line, const char *funcname) |
| #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, char *tag, char *file, int line, const char *funcname) |
Definition in file astobj2.h.
| #define ao2_alloc | ( | data_size, | |||
| destructor_fn | ) | _ao2_alloc((data_size), (destructor_fn)) |
Definition at line 418 of file astobj2.h.
Referenced by _moh_class_malloc(), add_calltoken_ignore(), alloc_event_ref(), ast_bridge_new(), ast_odbc_request_obj2(), ast_register_indication(), ast_taskprocessor_get(), ast_tcptls_client_create(), ast_tcptls_server_root(), ast_tone_zone_alloc(), build_callno_limits(), build_device(), build_peer(), build_profile(), build_route(), build_user(), conf_run(), create_callno_pools(), create_parkinglot(), create_queue_member(), dialgroup_write(), get_filestream(), get_lock(), inprocess_count(), join_conference_bridge(), load_config(), load_odbc_config(), multiplexed_bridge_create(), new_iax(), peercnt_add(), proxy_allocate(), pthread_timer_open(), set_fn(), sip_prepare_socket(), sip_tcptls_write(), sip_threadinfo_create(), timerfd_timer_open(), try_calling(), and xml_translate().
| #define ao2_callback | ( | c, | |||
| flags, | |||||
| cb_fn, | |||||
| arg | ) | _ao2_callback((c), (flags), (cb_fn), (arg)) |
Definition at line 913 of file astobj2.h.
Referenced by admin_exec(), ast_event_dump_cache(), ast_event_queue_and_cache(), ast_odbc_request_obj2(), ast_unregister_indication_country(), calltoken_required(), channel_admin_exec(), conf_run(), delete_users(), do_timing(), load_config(), load_indications(), load_module(), multiplexed_bridge_create(), reload_config(), reload_queues(), reload_single_queue(), set_config_destroy(), set_peercnt_limit(), and sip_tcp_locate().
| #define ao2_callback_data | ( | arg1, | |||
| arg2, | |||||
| arg3, | |||||
| arg4, | |||||
| arg5 | ) | _ao2_callback_data((arg1), (arg2), (arg3), (arg4), (arg5)) |
| #define ao2_container_alloc | ( | arg1, | |||
| arg2, | |||||
| arg3 | ) | _ao2_container_alloc((arg1), (arg2), (arg3)) |
Definition at line 729 of file astobj2.h.
Referenced by ast_config_text_file_save(), ast_event_init(), ast_features_init(), ast_indications_init(), ast_tps_init(), build_conf(), create_callno_pools(), dialgroup_write(), get_lock(), init_queue(), load_module(), load_objects(), load_odbc_config(), and xml_translate().
| #define ao2_find | ( | arg1, | |||
| arg2, | |||||
| arg3 | ) | _ao2_find((arg1), (arg2), (arg3)) |
Definition at line 965 of file astobj2.h.
Referenced by __find_callno(), add_calltoken_ignore(), admin_exec(), ast_event_get_cached(), ast_get_indication_zone(), ast_taskprocessor_get(), ast_unregister_indication_country(), authenticate_request(), authenticate_verify(), build_callno_limits(), build_peer(), build_user(), cli_alias_passthrough(), compare_weight(), complete_indications(), conf_run(), dialgroup_read(), dialgroup_write(), find_parkinglot(), find_peer(), find_profile(), find_pvt(), find_timer(), find_user(), get_unused_callno(), handle_cli_iax2_unregister(), handle_cli_indication_show(), iax2_destroy_helper(), inprocess_count(), join_conference_bridge(), meetmemute(), parse_tone_zone(), peercnt_add(), peercnt_modify(), peercnt_remove_by_addr(), phoneprov_callback(), reload_single_member(), remove_from_queue(), sched_delay_remove(), set_fn(), timerfd_timer_close(), timerfd_timer_disable_continuous(), timerfd_timer_enable_continuous(), timerfd_timer_get_event(), timerfd_timer_set_rate(), update_queue(), and xml_translate().
| #define ao2_iterator_next | ( | arg1 | ) | _ao2_iterator_next((arg1)) |
Definition at line 1117 of file astobj2.h.
Referenced by __iax2_show_peers(), __queues_show(), action_meetmelist(), alias_show(), ast_var_indications(), ast_var_indications_table(), authenticate_reply(), check_access(), clear_queue(), cli_console_active(), cli_list_devices(), cli_tps_report(), complete_country(), complete_iax2_peers(), complete_iax2_unregister(), complete_meetmecmd(), complete_queue_remove_member(), complete_sip_user(), conf_queue_dtmf(), delete_profiles(), delete_routes(), delete_users(), destroy_pvts(), dialgroup_read(), do_parking_thread(), dump_queue_members(), find_queue_by_name_rt(), free_members(), get_member_status(), 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_show_routes(), handle_statechange(), iax2_getpeername(), iax2_getpeertrunk(), interface_exists(), manager_iax2_show_peer_list(), manager_parking_status(), manager_queues_status(), manager_queues_summary(), meetme_show_cmd(), num_available_members(), poke_all_peers(), pp_each_user_exec(), prune_peers(), prune_users(), queue_function_qac(), queue_function_qac_dep(), queue_function_queuememberlist(), reload(), rt_handle_member_record(), sip_show_users(), stop_streams(), tps_taskprocessor_tab_complete(), try_calling(), and update_realtime_members().
| #define ao2_link | ( | arg1, | |||
| arg2 | ) | _ao2_link((arg1), (arg2)) |
Definition at line 779 of file astobj2.h.
Referenced by add_calltoken_ignore(), add_to_queue(), ast_event_dup_and_cache(), ast_odbc_request_obj2(), ast_register_indication_country(), ast_taskprocessor_get(), ast_taskprocessor_unreference(), build_callno_limits(), build_device(), build_parkinglot(), build_profile(), build_route(), conf_run(), create_callno_pools(), dialgroup_write(), get_lock(), inprocess_count(), join_conference_bridge(), load_config(), multiplexed_bridge_create(), odbc_register_class(), peercnt_add(), pthread_timer_open(), realtime_peer(), realtime_user(), reload_single_member(), replace_callno(), rt_handle_member_record(), set_config(), set_fn(), store_by_peercallno(), store_by_transfercallno(), timerfd_timer_open(), and xml_translate().
| #define ao2_ref | ( | o, | |||
| delta | ) | _ao2_ref((o), (delta)) |
Definition at line 459 of file astobj2.h.
Referenced by __find_callno(), __queues_show(), __sip_destroy(), __unload_module(), _sip_tcp_helper_thread(), action_meetmelist(), add_calltoken_ignore(), add_to_queue(), admin_exec(), alias_show(), announce_thread(), ao2_iterator_destroy(), ao2_iterator_init(), app_exec(), ast_bridge_destroy(), ast_bridge_impart(), ast_bridge_join(), ast_bridge_merge(), ast_bridge_new(), ast_closestream(), ast_config_text_file_save(), ast_event_dup_and_cache(), ast_event_get_cached(), ast_odbc_request_obj2(), 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(), bridge_channel_join(), bridge_channel_thread(), bridge_thread(), build_callno_limits(), calltoken_required(), channel_admin_exec(), clear_queue(), cli_alias_passthrough(), cli_tps_ping(), cli_tps_report(), compare_weight(), complete_meetmecmd(), complete_queue_remove_member(), conf_free(), conf_queue_dtmf(), conf_run(), copy_socket_data(), create_callno_pools(), destroy_queue(), dialgroup_read(), dialgroup_write(), dialog_ref(), dialog_unref(), do_parking_thread(), dump_queue_members(), end_bridge_callback(), end_bridge_callback_data_fixup(), expire_register(), find_queue_by_name_rt(), free_members(), get_lock(), get_member_penalty(), get_member_status(), group_destroy(), handle_cli_iax2_set_debug(), handle_cli_iax2_show_callno_limits(), handle_cli_odbc_show(), handle_event(), handle_feature_show(), handle_parkedcalls(), handle_statechange(), handle_tcptls_connection(), hangupcalls(), httpd_helper_thread(), iax2_destroy(), inprocess_count(), interface_exists(), join_conference_bridge(), leave_conference_bridge(), load_config(), load_module(), load_objects(), load_odbc_config(), manager_parking_status(), manager_queues_status(), manager_queues_summary(), meetme_show_cmd(), meetmemute(), multiplexed_add_or_remove(), multiplexed_bridge_create(), multiplexed_bridge_destroy(), multiplexed_thread_function(), new_iax(), num_available_members(), odbc_class_destructor(), odbc_obj_destructor(), odbc_release_obj2(), parkinglot_addref(), parkinglot_unref(), parse_moved_contact(), peer_ref(), peer_unref(), peercnt_add(), peercnt_modify(), peercnt_remove_by_addr(), peercnt_remove_cb(), 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(), queue_function_qac(), queue_function_qac_dep(), queue_function_queuememberlist(), queue_ref(), queue_unref(), ref_proxy(), ref_pvt(), reload(), reload_single_member(), remove_from_queue(), replace_callno(), rt_handle_member_record(), sched_delay_remove(), session_do(), set_member_paused(), set_member_penalty(), set_peercnt_limit(), set_socket_transport(), sip_destroy_peer(), sip_prepare_socket(), sip_tcp_locate(), 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(), try_calling(), unload_module(), unref_profile(), unref_pvt(), unref_route(), unref_user(), update_queue(), update_realtime_members(), user_ref(), user_unref(), and xml_translate().
| #define ao2_t_alloc | ( | data_size, | |||
| destructor_fn, | |||||
| debug_msg | ) | _ao2_alloc((data_size), (destructor_fn)) |
Allocate and initialize an object.
| data_size | The sizeof() of the user-defined structure. | |
| destructor_fn | The destructor function (can be NULL) | |
| debug_msg |
Definition at line 417 of file astobj2.h.
Referenced by alloc_queue(), build_peer(), sip_alloc(), and temp_peer().
| #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.
| c | A pointer to the container to operate on. | |
| flags | A set of flags specifying the operation to perform, partially used by the container code, but also passed to the callback.
| |
| cb_fn | A function pointer, that will be called on all objects, to see if they match. This function returns CMP_MATCH if the object is matches the criteria; CMP_STOP if the traversal should immediately stop, or both (via bitwise ORing), if you find a match and want to end the traversal, and 0 if the object is not a match, but the traversal should continue. This is the function that is applied to each object traversed. It's 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. |
Typically, ao2_callback() is used for two purposes:
This function searches through a container and performs operations on objects according on flags passed. XXX describe better The comparison is done calling the compare function set implicitly. The p pointer can be a pointer to an object or to a key, we can say this looking at flags value. If p points to an object we will search for the object pointed by this value, otherwise we serch for a key value. If the key is not uniq we only find the first matching valued. If we use the OBJ_MARK flags, we mark all the objects matching the condition.
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 for _find() is no. to a key (not yet supported) OBJ_POINTER the pointer is an object pointer
In case we return a list, the callee must take care to destroy that list when no longer used.
Definition at line 912 of file astobj2.h.
Referenced by ast_moh_destroy(), do_monitor(), find_call(), get_mohbydigit(), load_moh_classes(), reload_config(), sip_do_reload(), sip_prune_realtime(), sip_show_channels(), sip_show_channelstats(), sip_show_objects(), and unload_module().
| #define ao2_t_callback_data | ( | arg1, | |||
| arg2, | |||||
| arg3, | |||||
| arg4, | |||||
| arg5, | |||||
| arg6 | ) | _ao2_callback_data((arg1), (arg2), (arg3), (arg4), (arg5)) |
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.
Definition at line 944 of file astobj2.h.
Referenced by find_peer().
| #define ao2_t_container_alloc | ( | arg1, | |||
| arg2, | |||||
| arg3, | |||||
| arg4 | ) | _ao2_container_alloc((arg1), (arg2), (arg3)) |
Allocate and initialize a container with the desired number of buckets.
We allocate space for a struct astobj_container, struct container and the buckets[] array.
| n_buckets | Number of buckets for hash | |
| hash_fn | Pointer to a function computing a hash value. | |
| cmp_fn | Pointer to a function comparating key-value with a string. (can be NULL) |
Definition at line 728 of file astobj2.h.
Referenced by load_module().
| #define ao2_t_find | ( | arg1, | |||
| arg2, | |||||
| arg3, | |||||
| arg4 | ) | _ao2_find((arg1), (arg2), (arg3)) |
ao2_find() is a short hand for ao2_callback(c, flags, c->cmp_fn, arg) XXX possibly change order of arguments ?
Definition at line 964 of file astobj2.h.
Referenced by _sip_tcp_helper_thread(), build_peer(), find_call(), find_peer(), find_queue_by_name_rt(), get_member_penalty(), get_sip_pvt_byid_locked(), load_realtime_queue(), queue_function_queuememberlist(), queue_function_queuewaitingcount(), queue_function_var(), reload_queue_members(), reload_single_queue(), remove_from_queue(), sip_prune_realtime(), and sip_tcptls_write().
| #define ao2_t_iterator_next | ( | arg1, | |||
| arg2 | ) | _ao2_iterator_next((arg1)) |
Definition at line 1116 of file astobj2.h.
Referenced by __queues_show(), _sip_show_peers(), clear_stats(), compare_weight(), complete_queue(), complete_queue_remove_member(), complete_sip_peer(), complete_sip_registered_peer(), complete_sipch(), handle_cli_moh_show_classes(), handle_cli_moh_show_files(), handle_request_subscribe(), handle_statechange(), manager_queues_status(), manager_queues_summary(), set_member_paused(), set_member_penalty(), sip_poke_all_peers(), sip_prune_realtime(), sip_show_channel(), sip_show_history(), sip_show_inuse(), sip_show_tcp(), unload_module(), and update_queue().
| #define ao2_t_link | ( | arg1, | |||
| arg2, | |||||
| arg3 | ) | _ao2_link((arg1), (arg2)) |
Add an object to a container.
| c | the container to operate on. | |
| newobj | the object to be added. |
| NULL | on errors | |
| newobj | on success. |
This function automatically increases the reference count to account for the reference that the container now holds to the object.
Definition at line 778 of file astobj2.h.
Referenced by _moh_register(), create_addr_from_peer(), manager_sipnotify(), parse_register_contact(), realtime_peer(), register_verify(), reload_config(), sip_alloc(), sip_cli_notify(), sip_poke_peer(), sip_prune_realtime(), sip_request_call(), sip_send_mwi_to_peer(), and sip_threadinfo_create().
| #define ao2_t_ref | ( | o, | |||
| delta, | |||||
| tag | ) | _ao2_ref((o), (delta)) |
Reference/unreference an object and return the old refcount.
| o | A pointer to the object | |
| delta | Value to add to the reference counter. |
If the refcount goes to zero, the object is destroyed.
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 458 of file astobj2.h.
Referenced by _sip_tcp_helper_thread(), build_peer(), check_peer_ok(), dialog_dump_func(), handle_request_do(), handle_request_subscribe(), local_attended_transfer(), peer_dump_func(), ref_peer(), sip_alloc(), sip_prepare_socket(), sip_show_channel(), sip_show_history(), sip_show_tcp(), sip_tcp_locate(), sip_tcptls_write(), sip_threadinfo_create(), sip_threadinfo_destructor(), temp_peer(), unload_module(), and unref_peer().
| #define ao2_t_unlink | ( | arg1, | |||
| arg2, | |||||
| arg3 | ) | _ao2_unlink((arg1), (arg2)) |
Remove an object from a container.
| c | the container | |
| obj | the object to unlink |
| NULL,always |
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 809 of file astobj2.h.
Referenced by _sip_tcp_helper_thread(), create_addr_from_peer(), dialog_unlink_all(), expire_register(), manager_sipnotify(), parse_register_contact(), sip_cli_notify(), sip_poke_peer(), sip_prepare_socket(), sip_prune_realtime(), sip_request_call(), and sip_send_mwi_to_peer().
| #define ao2_unlink | ( | arg1, | |||
| arg2 | ) | _ao2_unlink((arg1), (arg2)) |
Definition at line 810 of file astobj2.h.
Referenced by ast_taskprocessor_unreference(), ast_unregister_indication_country(), build_user(), conf_run(), delete_profiles(), delete_routes(), delete_users(), destroy_pvts(), dialgroup_write(), find_queue_by_name_rt(), free_members(), get_lock(), handle_cli_iax2_prune_realtime(), leave_conference_bridge(), multiplexed_bridge_destroy(), parkinglot_destroy(), peercnt_remove(), prune_users(), reload(), remove_by_peercallno(), remove_by_transfercallno(), remove_from_queue(), timerfd_timer_close(), unlink_peer(), and update_realtime_members().
| typedef int( ao2_callback_data_fn)(void *obj, void *arg, void *data, int flags) |
Type of a generic callback function.
| obj | pointer to the (user-defined part) of an object. | |
| arg | callback argument from ao2_callback() | |
| data | arbitrary data from ao2_callback() | |
| flags | flags from ao2_callback() |
| typedef int( ao2_callback_fn)(void *obj, void *arg, int flags) |
Type of a generic callback function.
| obj | pointer to the (user-defined part) of an object. | |
| arg | callback argument from ao2_callback() | |
| flags | flags from ao2_callback() |
| typedef void(* ao2_destructor_fn)(void *) |
| typedef int( ao2_hash_fn)(const void *obj, const int flags) |
Type of a generic function to generate a hash value from an object. flags is ignored at the moment. Eventually, it will include the value of OBJ_POINTER passed to ao2_callback().
| enum _cb_results |
| enum ao2_iterator_flags |
Flags that can be passed to ao2_iterator_init() to modify the behavior of the iterator.
| AO2_ITERATOR_DONTLOCK | Prevents ao2_iterator_next() from locking the container while retrieving the next object from it. |
Definition at line 1071 of file astobj2.h.
01071 { 01072 /*! Prevents ao2_iterator_next() from locking the container 01073 * while retrieving the next object from it. 01074 */ 01075 AO2_ITERATOR_DONTLOCK = (1 << 0), 01076 };
| enum search_flags |
Flags passed to ao2_callback() and ao2_hash_fn() to modify its behaviour.
| OBJ_UNLINK | Unlink the object for which the callback function returned CMP_MATCH . This is the only way to extract objects from a container. |
| 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()
|
| OBJ_POINTER | obj is an object of the same type as the one being searched for, so use the object's hash function for optimized searching. The search function is unaffected (i.e. use the one passed as argument, or match_by_addr if none specified). |
| OBJ_CONTINUE |
Continue if a match is not found in the hashed out bucket.
This flag is to be used in combination with OBJ_POINTER. 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. |
Definition at line 657 of file astobj2.h.
00657 { 00658 /*! Unlink the object for which the callback function 00659 * returned CMP_MATCH . This is the only way to extract 00660 * objects from a container. */ 00661 OBJ_UNLINK = (1 << 0), 00662 /*! On match, don't return the object hence do not increase 00663 * its refcount. */ 00664 OBJ_NODATA = (1 << 1), 00665 /*! Don't stop at the first match in ao2_callback() 00666 * \note This is not fully implemented. Using OBJ_MULTIME with OBJ_NODATA 00667 * is perfectly fine. The part that is not implemented is the case where 00668 * multiple objects should be returned by ao2_callback(). 00669 */ 00670 OBJ_MULTIPLE = (1 << 2), 00671 /*! obj is an object of the same type as the one being searched for, 00672 * so use the object's hash function for optimized searching. 00673 * The search function is unaffected (i.e. use the one passed as 00674 * argument, or match_by_addr if none specified). */ 00675 OBJ_POINTER = (1 << 3), 00676 /*! 00677 * \brief Continue if a match is not found in the hashed out bucket 00678 * 00679 * This flag is to be used in combination with OBJ_POINTER. This tells 00680 * the ao2_callback() core to keep searching through the rest of the 00681 * buckets if a match is not found in the starting bucket defined by 00682 * the hash value on the argument. 00683 */ 00684 OBJ_CONTINUE = (1 << 4), 00685 };
| void* _ao2_alloc | ( | const size_t | data_size, | |
| ao2_destructor_fn | destructor_fn | |||
| ) |
Definition at line 401 of file astobj2.c.
References __ao2_alloc().
Referenced by _ao2_container_alloc().
00402 { 00403 return __ao2_alloc(data_size, destructor_fn, __FILE__, __LINE__, __FUNCTION__); 00404 }
| void* _ao2_alloc_debug | ( | const size_t | data_size, | |
| ao2_destructor_fn | destructor_fn, | |||
| char * | tag, | |||
| const char * | file, | |||
| int | line, | |||
| const char * | funcname, | |||
| int | ref_debug | |||
| ) |
Definition at line 380 of file astobj2.c.
References __ao2_alloc(), and REF_FILE.
Referenced by _ao2_container_alloc_debug(), and _moh_class_malloc().
00382 { 00383 /* allocation */ 00384 void *obj; 00385 FILE *refo = ref_debug ? fopen(REF_FILE,"a") : NULL; 00386 00387 obj = __ao2_alloc(data_size, destructor_fn, file, line, funcname); 00388 00389 if (obj == NULL) 00390 return NULL; 00391 00392 if (refo) { 00393 fprintf(refo, "%p =1 %s:%d:%s (%s)\n", obj, file, line, funcname, tag); 00394 fclose(refo); 00395 } 00396 00397 /* return a pointer to the user data */ 00398 return obj; 00399 }
| void* _ao2_callback | ( | struct ao2_container * | c, | |
| enum search_flags | flags, | |||
| ao2_callback_fn * | cb_fn, | |||
| void * | arg | |||
| ) |
Definition at line 786 of file astobj2.c.
References __ao2_callback(), and DEFAULT.
Referenced by _ao2_find(), _ao2_unlink(), and container_destruct().
00788 { 00789 return __ao2_callback(c,flags, cb_fn, arg, NULL, DEFAULT, NULL, NULL, 0, NULL); 00790 }
| 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 800 of file astobj2.c.
References __ao2_callback(), and WITH_DATA.
00802 { 00803 return __ao2_callback(c, flags, cb_fn, arg, data, WITH_DATA, NULL, NULL, 0, NULL); 00804 }
| void* _ao2_callback_data_debug | ( | struct ao2_container * | c, | |
| enum search_flags | flags, | |||
| ao2_callback_data_fn * | cb_fn, | |||
| void * | arg, | |||
| void * | data, | |||
| char * | tag, | |||
| char * | file, | |||
| int | line, | |||
| const char * | funcname | |||
| ) |
Definition at line 792 of file astobj2.c.
References __ao2_callback(), and WITH_DATA.
00796 { 00797 return __ao2_callback(c, flags, cb_fn, arg, data, WITH_DATA, tag, file, line, funcname); 00798 }
| void* _ao2_callback_debug | ( | struct ao2_container * | c, | |
| enum search_flags | flags, | |||
| ao2_callback_fn * | cb_fn, | |||
| void * | arg, | |||
| char * | tag, | |||
| char * | file, | |||
| int | line, | |||
| const char * | funcname | |||
| ) |
Definition at line 778 of file astobj2.c.
References __ao2_callback(), and DEFAULT.
Referenced by _ao2_find_debug(), _ao2_unlink_debug(), and container_destruct_debug().
00782 { 00783 return __ao2_callback(c,flags, cb_fn, arg, NULL, DEFAULT, tag, file, line, funcname); 00784 }
| struct ao2_container* _ao2_container_alloc | ( | const unsigned int | n_buckets, | |
| ao2_hash_fn * | hash_fn, | |||
| ao2_callback_fn * | cmp_fn | |||
| ) | [read] |
Definition at line 501 of file astobj2.c.
References __ao2_container_alloc(), _ao2_alloc(), and container_destruct().
00503 { 00504 /* XXX maybe consistency check on arguments ? */ 00505 /* compute the container size */ 00506 00507 size_t container_size = sizeof(struct ao2_container) + n_buckets * sizeof(struct bucket); 00508 struct ao2_container *c = _ao2_alloc(container_size, container_destruct); 00509 00510 return __ao2_container_alloc(c, n_buckets, hash_fn, cmp_fn); 00511 }
| struct ao2_container* _ao2_container_alloc_debug | ( | const unsigned int | n_buckets, | |
| ao2_hash_fn * | hash_fn, | |||
| ao2_callback_fn * | cmp_fn, | |||
| char * | tag, | |||
| char * | file, | |||
| int | line, | |||
| const char * | funcname, | |||
| int | ref_debug | |||
| ) | [read] |
Definition at line 488 of file astobj2.c.
References __ao2_container_alloc(), _ao2_alloc_debug(), and container_destruct_debug().
00491 { 00492 /* XXX maybe consistency check on arguments ? */ 00493 /* compute the container size */ 00494 size_t container_size = sizeof(struct ao2_container) + n_buckets * sizeof(struct bucket); 00495 struct ao2_container *c = _ao2_alloc_debug(container_size, container_destruct_debug, tag, file, line, funcname, ref_debug); 00496 00497 return __ao2_container_alloc(c, n_buckets, hash_fn, cmp_fn); 00498 }
| void* _ao2_find | ( | struct ao2_container * | c, | |
| void * | arg, | |||
| enum search_flags | flags | |||
| ) |
Definition at line 814 of file astobj2.c.
References _ao2_callback(), and ao2_container::cmp_fn.
Referenced by _get_mohbyname().
00815 { 00816 return _ao2_callback(c, flags, c->cmp_fn, arg); 00817 }
| void* _ao2_find_debug | ( | struct ao2_container * | c, | |
| void * | arg, | |||
| enum search_flags | flags, | |||
| char * | tag, | |||
| char * | file, | |||
| int | line, | |||
| const char * | funcname | |||
| ) |
the find function just invokes the default callback with some reasonable flags.
Definition at line 809 of file astobj2.c.
References _ao2_callback_debug(), and ao2_container::cmp_fn.
Referenced by _get_mohbyname().
00810 { 00811 return _ao2_callback_debug(c, flags, c->cmp_fn, arg, tag, file, line, funcname); 00812 }
| void* _ao2_iterator_next | ( | struct ao2_iterator * | a | ) |
Definition at line 919 of file astobj2.c.
References __ao2_iterator_next(), _ao2_ref(), AO2_ITERATOR_DONTLOCK, ao2_unlock(), ao2_iterator::c, and ao2_iterator::flags.
00920 { 00921 struct bucket_list *p = NULL; 00922 void *ret = NULL; 00923 00924 ret = __ao2_iterator_next(a, &p); 00925 00926 if (p) { 00927 /* inc refcount of returned object */ 00928 _ao2_ref(ret, 1); 00929 } 00930 00931 if (!(a->flags & AO2_ITERATOR_DONTLOCK)) 00932 ao2_unlock(a->c); 00933 00934 return ret; 00935 }
| void* _ao2_iterator_next_debug | ( | struct ao2_iterator * | a, | |
| char * | tag, | |||
| char * | file, | |||
| int | line, | |||
| const char * | funcname | |||
| ) |
Definition at line 901 of file astobj2.c.
References __ao2_iterator_next(), _ao2_ref_debug(), AO2_ITERATOR_DONTLOCK, ao2_unlock(), ao2_iterator::c, and ao2_iterator::flags.
00902 { 00903 struct bucket_list *p; 00904 void *ret = NULL; 00905 00906 ret = __ao2_iterator_next(a, &p); 00907 00908 if (p) { 00909 /* inc refcount of returned object */ 00910 _ao2_ref_debug(ret, 1, tag, file, line, funcname); 00911 } 00912 00913 if (!(a->flags & AO2_ITERATOR_DONTLOCK)) 00914 ao2_unlock(a->c); 00915 00916 return ret; 00917 }
| void* _ao2_link | ( | struct ao2_container * | c, | |
| void * | newobj | |||
| ) |
Definition at line 577 of file astobj2.c.
References __ao2_link(), _ao2_ref(), and ao2_unlock().
00578 { 00579 struct bucket_list *p = __ao2_link(c, user_data, __FILE__, __LINE__, __PRETTY_FUNCTION__); 00580 00581 if (p) { 00582 _ao2_ref(user_data, +1); 00583 ao2_unlock(c); 00584 } 00585 return p; 00586 }
| void* _ao2_link_debug | ( | struct ao2_container * | c, | |
| void * | new_obj, | |||
| char * | tag, | |||
| char * | file, | |||
| int | line, | |||
| const char * | funcname | |||
| ) |
Definition at line 566 of file astobj2.c.
References __ao2_link(), _ao2_ref_debug(), and ao2_unlock().
00567 { 00568 struct bucket_list *p = __ao2_link(c, user_data, file, line, funcname); 00569 00570 if (p) { 00571 _ao2_ref_debug(user_data, +1, tag, file, line, funcname); 00572 ao2_unlock(c); 00573 } 00574 return p; 00575 }
| int _ao2_lock | ( | void * | a, | |
| const char * | file, | |||
| const char * | func, | |||
| int | line, | |||
| const char * | var | |||
| ) |
Definition at line 167 of file astobj2.c.
References ast_atomic_fetchadd_int(), ast_mutex_lock(), INTERNAL_OBJ(), __priv_data::lock, and astobj2::priv_data.
00168 { 00169 struct astobj2 *p = INTERNAL_OBJ(user_data); 00170 00171 if (p == NULL) 00172 return -1; 00173 00174 #ifdef AO2_DEBUG 00175 ast_atomic_fetchadd_int(&ao2.total_locked, 1); 00176 #endif 00177 00178 #ifndef DEBUG_THREADS 00179 return ast_mutex_lock(&p->priv_data.lock); 00180 #else 00181 return __ast_pthread_mutex_lock(file, line, func, var, &p->priv_data.lock); 00182 #endif 00183 }
| int _ao2_ref | ( | void * | o, | |
| int | delta | |||
| ) |
Definition at line 288 of file astobj2.c.
References __ao2_ref(), and INTERNAL_OBJ().
Referenced by __ao2_callback(), _ao2_iterator_next(), _ao2_link(), and cd_cb().
00289 { 00290 struct astobj2 *obj = INTERNAL_OBJ(user_data); 00291 00292 if (obj == NULL) 00293 return -1; 00294 00295 return __ao2_ref(user_data, delta); 00296 }
| int _ao2_ref_debug | ( | void * | o, | |
| int | delta, | |||
| char * | tag, | |||
| char * | file, | |||
| int | line, | |||
| const char * | funcname | |||
| ) |
Definition at line 268 of file astobj2.c.
References __ao2_ref(), __priv_data::destructor_fn, INTERNAL_OBJ(), astobj2::priv_data, __priv_data::ref_counter, and REF_FILE.
Referenced by __ao2_callback(), _ao2_iterator_next_debug(), _ao2_link_debug(), and cd_cb_debug().
00269 { 00270 struct astobj2 *obj = INTERNAL_OBJ(user_data); 00271 00272 if (obj == NULL) 00273 return -1; 00274 00275 if (delta != 0) { 00276 FILE *refo = fopen(REF_FILE,"a"); 00277 fprintf(refo, "%p %s%d %s:%d:%s (%s) [@%d]\n", user_data, (delta<0? "":"+"), delta, file, line, funcname, tag, obj->priv_data.ref_counter); 00278 fclose(refo); 00279 } 00280 if (obj->priv_data.ref_counter + delta == 0 && obj->priv_data.destructor_fn != NULL) { /* this isn't protected with lock; just for o/p */ 00281 FILE *refo = fopen(REF_FILE,"a"); 00282 fprintf(refo, "%p **call destructor** %s:%d:%s (%s)\n", user_data, file, line, funcname, tag); 00283 fclose(refo); 00284 } 00285 return __ao2_ref(user_data, delta); 00286 }
| int _ao2_trylock | ( | void * | a, | |
| const char * | file, | |||
| const char * | func, | |||
| int | line, | |||
| const char * | var | |||
| ) |
Definition at line 233 of file astobj2.c.
References ast_atomic_fetchadd_int(), ast_mutex_trylock(), INTERNAL_OBJ(), __priv_data::lock, and astobj2::priv_data.
00234 { 00235 struct astobj2 *p = INTERNAL_OBJ(user_data); 00236 int ret; 00237 00238 if (p == NULL) 00239 return -1; 00240 #ifndef DEBUG_THREADS 00241 ret = ast_mutex_trylock(&p->priv_data.lock); 00242 #else 00243 ret = __ast_pthread_mutex_trylock(file, line, func, var, &p->priv_data.lock); 00244 #endif 00245 00246 #ifdef AO2_DEBUG 00247 if (!ret) 00248 ast_atomic_fetchadd_int(&ao2.total_locked, 1); 00249 #endif 00250 return ret; 00251 }
| void* _ao2_unlink | ( | struct ao2_container * | c, | |
| void * | obj | |||
| ) |
Definition at line 611 of file astobj2.c.
References _ao2_callback(), ao2_match_by_addr, INTERNAL_OBJ(), OBJ_NODATA, OBJ_POINTER, and OBJ_UNLINK.
00612 { 00613 if (INTERNAL_OBJ(user_data) == NULL) /* safety check on the argument */ 00614 return NULL; 00615 00616 _ao2_callback(c, OBJ_UNLINK | OBJ_POINTER | OBJ_NODATA, ao2_match_by_addr, user_data); 00617 00618 return NULL; 00619 }
| void* _ao2_unlink_debug | ( | struct ao2_container * | c, | |
| void * | obj, | |||
| char * | tag, | |||
| char * | file, | |||
| int | line, | |||
| const char * | funcname | |||
| ) |
Definition at line 600 of file astobj2.c.
References _ao2_callback_debug(), ao2_match_by_addr, INTERNAL_OBJ(), OBJ_NODATA, OBJ_POINTER, and OBJ_UNLINK.
00602 { 00603 if (INTERNAL_OBJ(user_data) == NULL) /* safety check on the argument */ 00604 return NULL; 00605 00606 _ao2_callback_debug(c, OBJ_UNLINK | OBJ_POINTER | OBJ_NODATA, ao2_match_by_addr, user_data, tag, file, line, funcname); 00607 00608 return NULL; 00609 }
| int _ao2_unlock | ( | void * | a, | |
| const char * | file, | |||
| const char * | func, | |||
| int | line, | |||
| const char * | var | |||
| ) |
Definition at line 199 of file astobj2.c.
References ast_atomic_fetchadd_int(), ast_mutex_unlock(), INTERNAL_OBJ(), __priv_data::lock, and astobj2::priv_data.
00200 { 00201 struct astobj2 *p = INTERNAL_OBJ(user_data); 00202 00203 if (p == NULL) 00204 return -1; 00205 00206 #ifdef AO2_DEBUG 00207 ast_atomic_fetchadd_int(&ao2.total_locked, -1); 00208 #endif 00209 00210 #ifndef DEBUG_THREADS 00211 return ast_mutex_unlock(&p->priv_data.lock); 00212 #else 00213 return __ast_pthread_mutex_unlock(file, line, func, var, &p->priv_data.lock); 00214 #endif 00215 }
| void ao2_bt | ( | void | ) |
Definition at line 83 of file astobj2.c.
References ast_verbose, free, and N1.
00084 { 00085 int c, i; 00086 #define N1 20 00087 void *addresses[N1]; 00088 char **strings; 00089 00090 c = backtrace(addresses, N1); 00091 strings = backtrace_symbols(addresses,c); 00092 ast_verbose("backtrace returned: %d\n", c); 00093 for(i = 0; i < c; i++) { 00094 ast_verbose("%d: %p %s\n", i, addresses[i], strings[i]); 00095 } 00096 free(strings); 00097 }
| 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 516 of file astobj2.c.
References ao2_container::elements.
Referenced by __queues_show(), _sip_show_peers(), ast_tone_zone_count(), cli_tps_report(), do_timing(), get_unused_callno(), lock_broker(), pthread_timer_open(), and unload_module().
00517 { 00518 return c->elements; 00519 }
| void ao2_iterator_destroy | ( | struct ao2_iterator * | i | ) |
Destroy a container iterator.
| i | the iterator to destroy |
| none | This function will release the container reference held by the iterator and any other resources it may be holding. |
Definition at line 837 of file astobj2.c.
References ao2_ref, and ao2_iterator::c.
Referenced by __iax2_show_peers(), __queues_show(), _sip_show_peers(), action_meetmelist(), alias_show(), authenticate_reply(), check_access(), clear_queue(), clear_stats(), cli_console_active(), cli_list_devices(), compare_weight(), complete_iax2_peers(), complete_iax2_unregister(), complete_meetmecmd(), complete_queue(), complete_queue_remove_member(), complete_sip_peer(), complete_sip_registered_peer(), complete_sip_user(), complete_sipch(), conf_queue_dtmf(), delete_profiles(), delete_routes(), delete_users(), destroy_pvts(), dialgroup_read(), dump_queue_members(), find_queue_by_name_rt(), free_members(), get_member_status(), 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_request_subscribe(), handle_show_routes(), handle_statechange(), iax2_getpeername(), iax2_getpeertrunk(), interface_exists(), manager_iax2_show_peer_list(), manager_queues_status(), manager_queues_summary(), meetme_show_cmd(), num_available_members(), poke_all_peers(), pp_each_user_exec(), prune_peers(), prune_users(), queue_function_qac(), queue_function_qac_dep(), queue_function_queuememberlist(), reload(), rt_handle_member_record(), set_member_paused(), set_member_penalty(), sip_poke_all_peers(), sip_prune_realtime(), sip_show_channel(), sip_show_history(), sip_show_inuse(), sip_show_tcp(), sip_show_users(), stop_streams(), try_calling(), unload_module(), update_queue(), and update_realtime_members().
| struct ao2_iterator ao2_iterator_init | ( | struct ao2_container * | c, | |
| int | flags | |||
| ) | [read] |
Create an iterator for a container.
| c | the container | |
| flags | one or more flags from ao2_iterator_flags |
| the | constructed iterator |
initialize an iterator so we start from the first object
Definition at line 822 of file astobj2.c.
References ao2_ref, ao2_iterator::c, and ao2_iterator::flags.
Referenced by __iax2_show_peers(), __queues_show(), _sip_show_peers(), action_meetmelist(), alias_show(), ast_tone_zone_iterator_init(), authenticate_reply(), check_access(), clear_queue(), clear_stats(), cli_console_active(), cli_list_devices(), cli_tps_report(), compare_weight(), complete_country(), complete_iax2_peers(), complete_iax2_unregister(), complete_meetmecmd(), complete_queue(), complete_queue_remove_member(), complete_sip_peer(), complete_sip_registered_peer(), complete_sip_user(), complete_sipch(), conf_queue_dtmf(), delete_profiles(), delete_routes(), delete_users(), destroy_pvts(), dialgroup_read(), do_parking_thread(), dump_queue_members(), find_queue_by_name_rt(), free_members(), get_member_status(), 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_request_subscribe(), handle_show_routes(), handle_statechange(), iax2_getpeername(), iax2_getpeertrunk(), interface_exists(), manager_iax2_show_peer_list(), manager_parking_status(), manager_queues_status(), manager_queues_summary(), meetme_show_cmd(), num_available_members(), poke_all_peers(), pp_each_user_exec(), prune_peers(), prune_users(), queue_function_qac(), queue_function_qac_dep(), queue_function_queuememberlist(), reload(), rt_handle_member_record(), set_member_paused(), set_member_penalty(), 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(), and update_realtime_members().
00823 { 00824 struct ao2_iterator a = { 00825 .c = c, 00826 .flags = flags 00827 }; 00828 00829 ao2_ref(c, +1); 00830 00831 return a; 00832 }
| int ao2_lock | ( | void * | a | ) |
Lock an object.
| a | A pointer to the object we want to lock. |
Definition at line 153 of file astobj2.c.
References ast_atomic_fetchadd_int(), ast_mutex_lock(), INTERNAL_OBJ(), __priv_data::lock, and astobj2::priv_data.
Referenced by __ao2_callback(), __ao2_iterator_next(), __ao2_link(), __queues_show(), _sip_show_peers(), _sip_tcp_helper_thread(), add_calltoken_ignore(), add_to_queue(), ast_bridge_depart(), ast_bridge_destroy(), ast_bridge_dtmf_stream(), ast_bridge_merge(), ast_bridge_remove(), ast_bridge_suspend(), ast_bridge_unsuspend(), ast_get_indication_tone(), ast_get_indication_zone(), ast_register_indication_country(), ast_set_indication_country(), ast_taskprocessor_get(), ast_taskprocessor_unreference(), ast_unregister_indication_country(), attended_abort_transfer(), bridge_channel_join(), bridge_channel_join_multithreaded(), bridge_channel_join_singlethreaded(), bridge_thread(), build_callno_limits(), build_parkinglot(), clear_stats(), compare_weight(), complete_queue_remove_member(), complete_sip_user(), conf_run(), end_bridge_callback(), find_call(), find_queue_by_name_rt(), generic_thread_loop(), get_member_penalty(), get_member_status(), get_unused_callno(), handle_request_subscribe(), handle_statechange(), inprocess_count(), is_our_turn(), join_conference_bridge(), join_queue(), leave_conference_bridge(), leave_queue(), load_config(), load_indications(), load_realtime_queue(), manager_queues_status(), manager_queues_summary(), menu_callback(), moh_release(), mohalloc(), monmp3thread(), multiplexed_add_or_remove(), multiplexed_bridge_create(), multiplexed_bridge_destroy(), multiplexed_thread_function(), mwi_event_cb(), peercnt_add(), peercnt_remove(), play_prompt_to_channel(), post_join_marked(), post_join_unmarked(), pthread_timer_ack(), pthread_timer_disable_continuous(), pthread_timer_enable_continuous(), pthread_timer_get_event(), pthread_timer_open(), pthread_timer_set_rate(), queue_function_qac(), queue_function_qac_dep(), queue_function_queuememberlist(), queue_function_queuewaitingcount(), queue_function_var(), recalc_holdtime(), record_abandoned(), reload_queue_members(), reload_queues(), reload_single_queue(), remove_from_queue(), replace_callno(), ring_entry(), run_timer(), set_member_paused(), set_member_penalty(), sip_poke_all_peers(), sip_prune_realtime(), sip_show_inuse(), sip_show_user(), sip_show_users(), sip_tcptls_write(), smart_bridge_operation(), softmix_bridge_thread(), try_calling(), update_call_counter(), update_queue(), and update_realtime_members().
00154 { 00155 struct astobj2 *p = INTERNAL_OBJ(user_data); 00156 00157 if (p == NULL) 00158 return -1; 00159 00160 #ifdef AO2_DEBUG 00161 ast_atomic_fetchadd_int(&ao2.total_locked, 1); 00162 #endif 00163 00164 return ast_mutex_lock(&p->priv_data.lock); 00165 }
| void* ao2_object_get_lockaddr | ( | void * | obj | ) |
Return the lock address of an object.
| [in] | obj | A pointer to the object we want. |
Definition at line 253 of file astobj2.c.
References INTERNAL_OBJ(), __priv_data::lock, and astobj2::priv_data.
00254 { 00255 struct astobj2 *p = INTERNAL_OBJ(obj); 00256 00257 if (p == NULL) 00258 return NULL; 00259 00260 return &p->priv_data.lock; 00261 }
| int ao2_trylock | ( | void * | a | ) |
Try locking-- (don't block if fail).
| a | A pointer to the object we want to lock. |
Definition at line 217 of file astobj2.c.
References ast_atomic_fetchadd_int(), ast_mutex_trylock(), INTERNAL_OBJ(), __priv_data::lock, and astobj2::priv_data.
00218 { 00219 struct astobj2 *p = INTERNAL_OBJ(user_data); 00220 int ret; 00221 00222 if (p == NULL) 00223 return -1; 00224 ret = ast_mutex_trylock(&p->priv_data.lock); 00225 00226 #ifdef AO2_DEBUG 00227 if (!ret) 00228 ast_atomic_fetchadd_int(&ao2.total_locked, 1); 00229 #endif 00230 return ret; 00231 }
| int ao2_unlock | ( | void * | a | ) |
Unlock an object.
| a | A pointer to the object we want unlock. |
Definition at line 185 of file astobj2.c.
References ast_atomic_fetchadd_int(), ast_mutex_unlock(), INTERNAL_OBJ(), __priv_data::lock, and astobj2::priv_data.
Referenced by __ao2_callback(), __queues_show(), _ao2_iterator_next(), _ao2_iterator_next_debug(), _ao2_link(), _ao2_link_debug(), _sip_show_peers(), _sip_tcp_helper_thread(), add_calltoken_ignore(), add_to_queue(), ast_bridge_depart(), ast_bridge_destroy(), ast_bridge_dtmf_stream(), ast_bridge_merge(), ast_bridge_remove(), ast_bridge_suspend(), ast_bridge_unsuspend(), ast_get_indication_tone(), ast_get_indication_zone(), ast_register_indication_country(), ast_set_indication_country(), ast_taskprocessor_get(), ast_taskprocessor_unreference(), ast_unregister_indication_country(), attended_abort_transfer(), bridge_channel_join(), bridge_channel_join_multithreaded(), bridge_channel_join_singlethreaded(), bridge_thread(), build_callno_limits(), build_parkinglot(), clear_stats(), compare_weight(), complete_queue_remove_member(), complete_sip_user(), conf_run(), end_bridge_callback(), find_call(), find_queue_by_name_rt(), generic_thread_loop(), get_member_penalty(), get_member_status(), get_unused_callno(), handle_request_subscribe(), handle_statechange(), inprocess_count(), is_our_turn(), join_conference_bridge(), join_queue(), leave_conference_bridge(), leave_queue(), load_config(), load_indications(), load_realtime_queue(), manager_queues_status(), manager_queues_summary(), menu_callback(), moh_release(), mohalloc(), monmp3thread(), multiplexed_add_or_remove(), multiplexed_bridge_create(), multiplexed_bridge_destroy(), multiplexed_thread_function(), mwi_event_cb(), peercnt_add(), peercnt_remove(), play_prompt_to_channel(), post_join_marked(), post_join_unmarked(), pthread_timer_ack(), pthread_timer_disable_continuous(), pthread_timer_enable_continuous(), pthread_timer_get_event(), pthread_timer_open(), pthread_timer_set_rate(), queue_function_qac(), queue_function_qac_dep(), queue_function_queuememberlist(), queue_function_queuewaitingcount(), queue_function_var(), recalc_holdtime(), record_abandoned(), reload_queue_members(), reload_queues(), reload_single_queue(), remove_from_queue(), replace_callno(), ring_entry(), run_timer(), set_member_paused(), set_member_penalty(), sip_poke_all_peers(), sip_prune_realtime(), sip_show_inuse(), sip_show_user(), sip_show_users(), sip_tcptls_write(), smart_bridge_operation(), softmix_bridge_thread(), try_calling(), update_call_counter(), update_queue(), and update_realtime_members().
00186 { 00187 struct astobj2 *p = INTERNAL_OBJ(user_data); 00188 00189 if (p == NULL) 00190 return -1; 00191 00192 #ifdef AO2_DEBUG 00193 ast_atomic_fetchadd_int(&ao2.total_locked, -1); 00194 #endif 00195 00196 return ast_mutex_unlock(&p->priv_data.lock); 00197 }
| ao2_callback_fn ao2_match_by_addr |
a very common callback is one that matches by address.
Definition at line 643 of file astobj2.h.
Referenced by _ao2_unlink(), _ao2_unlink_debug(), load_module(), and load_odbc_config().
1.5.9