Asterisk - The Open Source Telephony Project
21.4.1
|
Functions implementing astobj2 objects. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/astobj2.h"
#include "astobj2_private.h"
#include "astobj2_container_private.h"
#include "asterisk/cli.h"
Go to the source code of this file.
Functions | |
void * | __ao2_callback (struct ao2_container *c, enum search_flags flags, ao2_callback_fn *cb_fn, void *arg, const char *tag, const char *file, int line, const char *func) |
void * | __ao2_callback_data (struct ao2_container *c, enum search_flags flags, ao2_callback_data_fn *cb_fn, void *arg, void *data, const char *tag, const char *file, int line, const char *func) |
struct ao2_container * | __ao2_container_clone (struct ao2_container *orig, enum search_flags flags, const char *tag, const char *file, int line, const char *func) |
void * | __ao2_find (struct ao2_container *c, const void *arg, enum search_flags flags, const char *tag, const char *file, int line, const char *func) |
void * | __ao2_iterator_next (struct ao2_iterator *iter, const char *tag, const char *file, int line, const char *func) |
int | __ao2_link (struct ao2_container *self, void *obj_new, int flags, const char *tag, const char *file, int line, const char *func) |
void * | __ao2_unlink (struct ao2_container *c, void *user_data, int flags, const char *tag, const char *file, int line, const char *func) |
void * | __ao2_weakproxy_find (struct ao2_container *c, const void *arg, enum search_flags flags, const char *tag, const char *file, int line, const char *func) |
int | __container_unlink_node_debug (struct ao2_container_node *node, uint32_t flags, const char *tag, const char *file, int line, const char *func) |
int | ao2_container_check (struct ao2_container *self, enum search_flags flags) |
Perform an integrity check on the specified container. More... | |
int | ao2_container_count (struct ao2_container *c) |
Returns the number of elements in a container. More... | |
void | ao2_container_dump (struct ao2_container *self, enum search_flags flags, const char *name, void *where, ao2_prnt_fn *prnt, ao2_prnt_obj_fn *prnt_obj) |
Display contents of the specified container. More... | |
int | ao2_container_dup (struct ao2_container *dest, struct ao2_container *src, enum search_flags flags) |
Copy all object references in the src container into the dest container. More... | |
int | ao2_container_dup_weakproxy_objs (struct ao2_container *dest, struct ao2_container *src, enum search_flags flags) |
Copy object references associated with src container weakproxies into the dest container. More... | |
int | ao2_container_register (const char *name, struct ao2_container *self, ao2_prnt_obj_fn *prnt_obj) |
Register a container for CLI stats and integrity check. More... | |
void | ao2_container_stats (struct ao2_container *self, enum search_flags flags, const char *name, void *where, ao2_prnt_fn *prnt) |
Display statistics of the specified container. More... | |
void | ao2_container_unregister (const char *name) |
Unregister a container for CLI stats and integrity check. More... | |
void | ao2_iterator_cleanup (struct ao2_iterator *iter) |
int | ao2_iterator_count (struct ao2_iterator *iter) |
Get a count of the iterated container objects. More... | |
void | ao2_iterator_destroy (struct ao2_iterator *iter) |
Destroy a container iterator. More... | |
struct ao2_iterator | ao2_iterator_init (struct ao2_container *c, int flags) |
Create an iterator for a container. More... | |
void | ao2_iterator_restart (struct ao2_iterator *iter) |
Restart an iteration. More... | |
int | ao2_match_by_addr (void *user_data, void *arg, int flags) |
another convenience function is a callback that matches on address More... | |
static int | cb_true (void *user_data, void *arg, int flags) |
special callback that matches all | |
static int | cb_true_data (void *user_data, void *arg, void *data, int flags) |
similar to cb_true, but is an ao2_callback_data_fn instead | |
void | container_destruct (void *_c) |
int | container_init (void) |
static int | dup_obj_cb (void *obj, void *arg, int flags) |
static int | dup_weakproxy_cb (void *proxy, void *arg, int flags) |
Copy obj associated with a weakproxy into the arg container. More... | |
static void * | internal_ao2_traverse (struct ao2_container *self, enum search_flags flags, void *cb_fn, void *arg, void *data, enum ao2_callback_type type, const char *tag, const char *file, int line, const char *func) |
Functions implementing astobj2 objects.
Definition in file astobj2_container.c.
void* __ao2_find | ( | struct ao2_container * | c, |
const void * | arg, | ||
enum search_flags | flags, | ||
const char * | tag, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
the find function just invokes the default callback with some reasonable flags.
Definition at line 427 of file astobj2_container.c.
References ao2_container::cmp_fn.
int ao2_container_check | ( | struct ao2_container * | self, |
enum search_flags | flags | ||
) |
Perform an integrity check on the specified container.
self | Container to check integrity. |
flags | OBJ_NOLOCK if a lock is already held on the container. |
0 | on success. |
-1 | on error. |
Definition at line 856 of file astobj2_container.c.
int ao2_container_count | ( | struct ao2_container * | c | ) |
Returns the number of elements in a container.
return the number of elements in the container
Definition at line 34 of file astobj2_container.c.
References ast_atomic_fetchadd_int(), and ao2_container::elements.
Referenced by ao2_iterator_count(), app_is_finished(), ast_active_channels(), ast_ari_applications_list(), ast_bridge_transfer_attended(), ast_bridge_transfer_blind(), ast_endpoint_snapshot_create(), ast_get_namedgroups(), ast_merge_contexts_and_delete(), ast_namedgroups_intersect(), ast_rtp_ice_add_remote_candidate(), ast_rtp_ice_start(), ast_sorcery_create(), ast_sorcery_delete(), ast_sorcery_retrieve_by_fields(), ast_sorcery_retrieve_by_prefix(), ast_sorcery_retrieve_by_regex(), ast_sorcery_update(), ast_tone_zone_count(), calc_metric(), cli_fax_show_sessions(), control_command_count(), control_wait(), create_sound_blob(), handle_cli_sound_show(), handle_show_hint(), handle_show_hints(), locals_show(), object_type_loaded_observer(), one_protocol(), parking_lot_remove_if_unused(), pjsip_acf_dial_contacts_read(), print_queue(), process_config(), queue_exec(), queue_function_mem_read(), stasis_app_set_global_debug(), stasis_app_to_cli(), test_cel_peer_strings_match(), and unload_module().
void ao2_container_dump | ( | struct ao2_container * | self, |
enum search_flags | flags, | ||
const char * | name, | ||
void * | where, | ||
ao2_prnt_fn * | prnt, | ||
ao2_prnt_obj_fn * | prnt_obj | ||
) |
Display contents of the specified container.
self | Container to dump. |
flags | OBJ_NOLOCK if a lock is already held on the container. |
name | Container name. (NULL if anonymous) |
where | User data needed by prnt to determine where to put output. |
prnt | Print output callback function to use. |
prnt_obj | Callback function to print the given object's key. (NULL if not available) |
Definition at line 792 of file astobj2_container.c.
Referenced by test_traversal_sorted().
int ao2_container_dup | ( | struct ao2_container * | dest, |
struct ao2_container * | src, | ||
enum search_flags | flags | ||
) |
Copy all object references in the src container into the dest container.
dest | Container to copy src object references into. |
src | Container to copy all object references from. |
flags | OBJ_NOLOCK if a lock is already held on both containers. Otherwise, the src container is locked first. |
0 | on success. |
-1 | on error. |
Definition at line 673 of file astobj2_container.c.
References ao2_callback, and OBJ_MULTIPLE.
Referenced by __queues_show(), and handle_cli_sounds_show().
int ao2_container_dup_weakproxy_objs | ( | struct ao2_container * | dest, |
struct ao2_container * | src, | ||
enum search_flags | flags | ||
) |
Copy object references associated with src container weakproxies into the dest container.
dest | Container to copy src strong object references into. |
src | Container to copy all weak object references from. |
flags | OBJ_NOLOCK if a lock is already held on both containers. Otherwise, the src container is locked first. |
src
with no associated object is ignored.0 | on success. |
-1 | on error. |
Definition at line 726 of file astobj2_container.c.
References ao2_callback, dup_weakproxy_cb(), and OBJ_MULTIPLE.
int ao2_container_register | ( | const char * | name, |
struct ao2_container * | self, | ||
ao2_prnt_obj_fn * | prnt_obj | ||
) |
Register a container for CLI stats and integrity check.
name | Name to register the container under. |
self | Container to register. |
prnt_obj | Callback function to print the given object's key. (NULL if not available) |
0 | on success. |
-1 | on error. |
Definition at line 958 of file astobj2_container.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, and ao2_t_alloc_options.
Referenced by ast_bridging_init(), ast_channels_init(), ast_pbx_init(), load_module(), stasis_caching_topic_create(), stasis_state_manager_create(), and stasis_topic_pool_create().
void ao2_container_stats | ( | struct ao2_container * | self, |
enum search_flags | flags, | ||
const char * | name, | ||
void * | where, | ||
ao2_prnt_fn * | prnt | ||
) |
Display statistics of the specified container.
self | Container to display statistics. |
flags | OBJ_NOLOCK if a lock is already held on the container. |
name | Container name. (NULL if anonymous) |
where | User data needed by prnt to determine where to put output. |
prnt | Print output callback function to use. |
Definition at line 819 of file astobj2_container.c.
Referenced by test_traversal_sorted().
void ao2_container_unregister | ( | const char * | name | ) |
Unregister a container for CLI stats and integrity check.
name | Name the container is registered under. |
Definition at line 985 of file astobj2_container.c.
References ao2_t_find, and OBJ_SEARCH_KEY.
Referenced by load_module().
int ao2_iterator_count | ( | struct ao2_iterator * | iter | ) |
Get a count of the iterated container objects.
iter | the iterator to query |
Definition at line 630 of file astobj2_container.c.
References ao2_container_count(), and ao2_iterator::c.
void ao2_iterator_destroy | ( | struct ao2_iterator * | iter | ) |
Destroy a container iterator.
iter | the iterator to destroy |
This function will release the container reference held by the iterator and any other resources it may be holding.
Definition at line 534 of file astobj2_container.c.
References AO2_ITERATOR_MALLOCD, ao2_iterator_restart(), ao2_iterator::c, and ao2_iterator::flags.
Referenced by __queues_show(), aco_set_defaults(), action_coreshowchannelmap(), action_coreshowchannels(), add_ice_to_stream(), alias_show(), app_to_json(), ast_add_hint(), ast_ari_bridges_list(), ast_ari_channels_list(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_recordings_list_stored(), ast_bridge_channel_kick(), ast_bucket_file_json(), ast_bucket_json(), ast_cdr_setvar(), ast_channel_iterator_destroy(), ast_complete_channels(), ast_endpoint_snapshot_create(), ast_format_cache_get_by_codec(), ast_merge_contexts_and_delete(), ast_msg_var_iterator_destroy(), ast_multi_channel_blob_get_channels(), ast_pickup_find_by_group(), ast_print_namedgroups(), ast_refer_var_iterator_destroy(), ast_rtp_ice_start(), ast_sorcery_objectset_create2(), ast_sorcery_objectset_json_create(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), authenticate_reply(), bridge_app_subscribed_involved(), clear_stats(), cli_complete_show(), cli_fax_show_sessions(), complete_core_show_hint(), complete_mohclass_realtime(), complete_queue(), control_dispatch_all(), control_flush_queue(), control_prestart_dispatch_all(), coreshowchannelmap_add_connected_channels(), device_state_cb(), dump_queue_members(), event_session_shutdown(), fax_session_tab_complete(), find_queue_by_name_rt(), find_session(), find_session_by_nonce(), free_members(), get_member_status(), handle_bridge_pairings(), handle_cli_sound_show(), handle_kickmanconn(), handle_show_calendars(), handle_show_hint(), handle_show_hints(), handle_show_named_acl_cmd(), handle_showmanconn(), handle_voicemail_show_aliases(), jingle_add_google_candidates_to_transport(), jingle_add_ice_udp_candidates_to_transport(), jingle_request(), load_users(), local_devicestate(), locals_show(), manager_iax2_show_peer_list(), manager_queues_status(), manager_queues_summary(), num_available_members(), parking_lot_get_space(), pjsip_acf_dial_contacts_read(), print_queue(), purge_sessions(), queue_function_mem_read(), queue_function_qac_dep(), queue_function_queuememberlist(), qupd_exec(), reload_single_queue(), rt_handle_member_record(), rtp_add_candidates_to_ice(), set_config(), sla_calc_station_delays(), sla_queue_event_conf(), stasis_app_mailboxes_to_json(), stasis_app_to_cli(), update_queue(), and xmpp_pubsub_create_affiliations().
struct ao2_iterator ao2_iterator_init | ( | struct ao2_container * | c, |
int | flags | ||
) |
Create an iterator for a container.
initialize an iterator so we start from the first object
Definition at line 485 of file astobj2_container.c.
References ao2_iterator::c.
Referenced by __queues_show(), aco_set_defaults(), action_coreshowchannelmap(), action_coreshowchannels(), add_ice_to_stream(), alias_show(), app_to_json(), ast_add_hint(), ast_ari_bridges_list(), ast_ari_channels_list(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_recordings_list_stored(), ast_bridge_channel_kick(), ast_bucket_file_json(), ast_bucket_json(), ast_channel_iterator_all_new(), ast_complete_channels(), ast_endpoint_snapshot_create(), ast_format_cache_get_by_codec(), ast_merge_contexts_and_delete(), ast_msg_var_iterator_init(), ast_pickup_find_by_group(), ast_print_namedgroups(), ast_refer_var_iterator_init(), ast_rtp_ice_start(), ast_sorcery_objectset_create2(), ast_sorcery_objectset_json_create(), ast_tone_zone_iterator_init(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), authenticate_reply(), bridge_app_subscribed_involved(), clear_stats(), cli_complete_show(), cli_fax_show_sessions(), complete_core_show_hint(), complete_mohclass_realtime(), complete_queue(), control_dispatch_all(), control_flush_queue(), control_prestart_dispatch_all(), coreshowchannelmap_add_connected_channels(), device_state_cb(), dump_queue_members(), event_session_shutdown(), fax_session_tab_complete(), find_queue_by_name_rt(), find_session(), find_session_by_nonce(), free_members(), get_member_status(), handle_bridge_pairings(), handle_cli_sound_show(), handle_kickmanconn(), handle_show_calendars(), handle_show_hint(), handle_show_hints(), handle_show_named_acl_cmd(), handle_showmanconn(), handle_voicemail_show_aliases(), jingle_add_google_candidates_to_transport(), jingle_add_ice_udp_candidates_to_transport(), jingle_request(), load_users(), local_devicestate(), locals_show(), manager_iax2_show_peer_list(), manager_queues_status(), manager_queues_summary(), num_available_members(), parking_lot_get_space(), pjsip_acf_dial_contacts_read(), print_queue(), purge_sessions(), queue_function_mem_read(), queue_function_qac_dep(), queue_function_queuememberlist(), qupd_exec(), reload_single_queue(), rt_handle_member_record(), rtp_add_candidates_to_ice(), set_config(), sla_calc_station_delays(), sla_queue_event_conf(), stasis_app_mailboxes_to_json(), stasis_app_set_global_debug(), update_queue(), and xmpp_pubsub_create_affiliations().
void ao2_iterator_restart | ( | struct ao2_iterator * | iter | ) |
Restart an iteration.
iter | the iterator to restart |
Definition at line 497 of file astobj2_container.c.
References AO2_ITERATOR_DONTLOCK, AO2_LOCK_REQ_MUTEX, AO2_LOCK_REQ_RDLOCK, ao2_ref, ao2_iterator::c, ao2_iterator::complete, ao2_iterator::flags, and ao2_iterator::last_node.
Referenced by ao2_iterator_destroy().
int ao2_match_by_addr | ( | void * | user_data, |
void * | arg, | ||
int | flags | ||
) |
another convenience function is a callback that matches on address
A common ao2_callback is one that matches by address.
Definition at line 166 of file astobj2_container.c.
References CMP_MATCH, and CMP_STOP.
|
static |
Copy obj associated with a weakproxy into the arg container.
proxy | pointer to the weakproxy. |
arg | callback argument from ao2_callback() |
flags | flags from ao2_callback() |
0 | on success. |
CMP_STOP|CMP_MATCH | on error. |
Definition at line 710 of file astobj2_container.c.
References ao2_link_flags, ao2_ref, ao2_weakproxy_get_object, CMP_MATCH, and CMP_STOP.
Referenced by ao2_container_dup_weakproxy_objs().