Asterisk - The Open Source Telephony Project GIT-master-7805f28
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
Data Structures | Macros | Functions | Variables
channelstorage_ao2_legacy.c File Reference
#include "asterisk.h"
#include "asterisk/channel.h"
#include "asterisk/astobj2.h"
#include "channelstorage.h"
#include "channel_private.h"
Include dependency graph for channelstorage_ao2_legacy.c:

Go to the source code of this file.

Data Structures

struct  ast_channel_iterator
 
struct  ast_channelstorage_driver_pvt
 

Macros

#define getdb(driver)   (driver->handle->handle)
 

Functions

static void __startup (void)
 
static int active_channels (struct ast_channelstorage_instance *driver)
 returns number of active/allocated channels More...
 
static int by_exten_cb (void *obj, void *arg, void *data, int flags)
 
static int by_name_cb (void *obj, void *arg, void *data, int flags)
 
static int by_uniqueid_cb (void *obj, void *arg, void *data, int flags)
 
static struct ast_channelcallback (struct ast_channelstorage_instance *driver, ao2_callback_data_fn *cb_fn, void *arg, void *data, int ao2_flags)
 
static int channel_cmp_cb (void *obj_left, void *obj_right, int flags)
 
static void close_instance (struct ast_channelstorage_instance *driver)
 
static int delete_channel (struct ast_channelstorage_instance *driver, struct ast_channel *chan, int lock)
 
static struct ast_channelget_by_exten (struct ast_channelstorage_instance *driver, const char *exten, const char *context)
 
static struct ast_channelget_by_name_prefix (struct ast_channelstorage_instance *driver, const char *name, size_t name_len)
 
static struct ast_channelget_by_uniqueid (struct ast_channelstorage_instance *driver, const char *uniqueid)
 
static struct ast_channelstorage_instanceget_instance (const char *name)
 
static int hash_cb (const void *obj, const int flags)
 
static int insert_channel (struct ast_channelstorage_instance *driver, struct ast_channel *chan, int flags, int lock)
 
static struct ast_channel_iteratoriterator_all_new (struct ast_channelstorage_instance *driver)
 
static struct ast_channel_iteratoriterator_by_exten_new (struct ast_channelstorage_instance *driver, const char *exten, const char *context)
 
static struct ast_channel_iteratoriterator_by_name_new (struct ast_channelstorage_instance *driver, const char *name, size_t name_len)
 
static struct ast_channel_iteratoriterator_destroy (struct ast_channelstorage_instance *driver, struct ast_channel_iterator *i)
 
static struct ast_channeliterator_next (struct ast_channelstorage_instance *driver, struct ast_channel_iterator *i)
 
static void lock_driver (struct ast_channelstorage_instance *driver)
 
static void prnt_channel_key (void *v_obj, void *where, ao2_prnt_fn *prnt)
 
static void unlock_driver (struct ast_channelstorage_instance *driver)
 

Variables

static struct ast_channelstorage_instance channelstorage_instance
 
static struct ast_channelstorage_driver driver_type
 

Macro Definition Documentation

◆ getdb

#define getdb (   driver)    (driver->handle->handle)

Definition at line 30 of file channelstorage_ao2_legacy.c.

Function Documentation

◆ __startup()

static void __startup ( void  )
static

Definition at line 392 of file channelstorage_ao2_legacy.c.

393{
395}
int ast_channelstorage_register_driver(const struct ast_channelstorage_driver *driver_type)
static struct ast_channelstorage_driver driver_type

References ast_channelstorage_register_driver(), and driver_type.

◆ active_channels()

static int active_channels ( struct ast_channelstorage_instance driver)
static

returns number of active/allocated channels

Definition at line 61 of file channelstorage_ao2_legacy.c.

62{
63 return getdb(driver) ? ao2_container_count(getdb(driver)) : 0;
64}
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define getdb(driver)

References ao2_container_count(), and getdb.

Referenced by ast_active_channels(), and really_quit().

◆ by_exten_cb()

static int by_exten_cb ( void *  obj,
void *  arg,
void *  data,
int  flags 
)
static

Definition at line 94 of file channelstorage_ao2_legacy.c.

95{
96 struct ast_channel *chan = obj;
97 char *context = arg;
98 char *exten = data;
99 int ret = CMP_MATCH;
100
101 ast_channel_lock(chan);
102 if (strcasecmp(ast_channel_context(chan), context)) {
103 ret = 0; /* Context match failed, continue */
104 } else if (strcasecmp(ast_channel_exten(chan), exten)) {
105 ret = 0; /* Extension match failed, continue */
106 }
107 ast_channel_unlock(chan);
108
109 return ret;
110}
@ CMP_MATCH
Definition: astobj2.h:1027
#define ast_channel_lock(chan)
Definition: channel.h:2972
const char * ast_channel_context(const struct ast_channel *chan)
const char * ast_channel_exten(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
Definition: channel.h:2973
Main Channel structure associated with a channel.
char exten[AST_MAX_EXTENSION]
const char * data

References ast_channel_context(), ast_channel_exten(), ast_channel_lock, ast_channel_unlock, CMP_MATCH, voicemailpwcheck::context, ast_channel::data, and ast_channel::exten.

Referenced by get_by_exten(), and iterator_by_exten_new().

◆ by_name_cb()

static int by_name_cb ( void *  obj,
void *  arg,
void *  data,
int  flags 
)
static

Definition at line 72 of file channelstorage_ao2_legacy.c.

73{
74 struct ast_channel *chan = obj;
75 const char *name = arg;
76 size_t name_len = *(size_t *) data;
77 int ret = 0;
78
79 ast_channel_lock(chan);
80 if (name_len == 0) {
81 if(strcasecmp(ast_channel_name(chan), name) == 0) {
82 ret = CMP_MATCH | ((flags & OBJ_MULTIPLE) ? 0 : CMP_STOP);
83 }
84 } else {
85 if (strncasecmp(ast_channel_name(chan), name, name_len) == 0) {
86 ret = CMP_MATCH | ((flags & OBJ_MULTIPLE) ? 0 : CMP_STOP);
87 }
88 }
90
91 return ret;
92}
@ CMP_STOP
Definition: astobj2.h:1028
@ OBJ_MULTIPLE
Definition: astobj2.h:1049
const char * ast_channel_name(const struct ast_channel *chan)
static const char name[]
Definition: format_mp3.c:68
struct ast_flags flags

References ast_channel_lock, ast_channel_name(), ast_channel_unlock, CMP_MATCH, CMP_STOP, ast_channel::data, ast_channel::flags, name, and OBJ_MULTIPLE.

Referenced by get_by_name_prefix(), and iterator_by_name_new().

◆ by_uniqueid_cb()

static int by_uniqueid_cb ( void *  obj,
void *  arg,
void *  data,
int  flags 
)
static

Definition at line 112 of file channelstorage_ao2_legacy.c.

113{
114 struct ast_channel *chan = obj;
115 char *uniqueid = arg;
116 size_t id_len = *(size_t *) data;
117 int ret = CMP_MATCH;
118
120 ast_log(LOG_ERROR, "BUG! Must supply a uniqueid or partial uniqueid to match!\n");
121 return CMP_STOP;
122 }
123
124 ast_channel_lock(chan);
125 if ((!id_len && strcasecmp(ast_channel_uniqueid(chan), uniqueid))
126 || (id_len && strncasecmp(ast_channel_uniqueid(chan), uniqueid, id_len))) {
127 ret = 0; /* uniqueid match failed, keep looking */
128 }
129 ast_channel_unlock(chan);
130
131 return ret;
132}
#define ast_log
Definition: astobj2.c:42
const char * ast_channel_uniqueid(const struct ast_channel *chan)
#define LOG_ERROR
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
struct ast_channel_id uniqueid

References ast_channel_lock, ast_channel_uniqueid(), ast_channel_unlock, ast_log, ast_strlen_zero(), CMP_MATCH, CMP_STOP, ast_channel::data, LOG_ERROR, and ast_channel::uniqueid.

Referenced by get_by_name_prefix(), and get_by_uniqueid().

◆ callback()

static struct ast_channel * callback ( struct ast_channelstorage_instance driver,
ao2_callback_data_fn cb_fn,
void *  arg,
void *  data,
int  ao2_flags 
)
static

Definition at line 66 of file channelstorage_ao2_legacy.c.

68{
69 return ao2_callback_data(getdb(driver), ao2_flags, cb_fn, arg, data);
70}
#define ao2_callback_data(container, flags, cb_fn, arg, data)
Definition: astobj2.h:1723

References ao2_callback_data, ast_channel::data, and getdb.

Referenced by __stasis_subscribe(), __stasis_subscribe_pool(), application_tuple_alloc(), ast_ari_invoke(), ast_bridge_channel_queue_callback(), ast_bridge_channel_write_callback(), ast_bridge_dtmf_hook(), ast_bridge_features_do(), ast_bridge_features_register(), ast_bridge_features_set_limits(), ast_bridge_hangup_hook(), ast_bridge_interval_hook(), ast_bridge_interval_register(), ast_bridge_join_hook(), ast_bridge_leave_hook(), ast_bridge_move_hook(), ast_bridge_set_after_callback(), ast_bridge_talk_detector_hook(), ast_cc_callback(), ast_channel_callback(), ast_devstate_prov_add(), ast_dial_set_state_callback(), ast_dns_query_set_resolve_async(), ast_dns_resolve_async(), ast_dns_resolve_recurring(), ast_io_add(), ast_io_change(), ast_mwi_subscribe_pool(), ast_netsock_bind(), ast_netsock_bindaddr(), ast_presence_state_prov_add(), ast_sched_add(), ast_sched_add_variable(), ast_sched_replace(), ast_sched_replace_variable(), ast_search_dns(), ast_sip_send_out_of_dialog_request(), ast_sip_send_request(), ast_sip_session_media_add_read_callback(), ast_sip_session_media_set_write_callback(), AST_TEST_DEFINE(), ast_udptl_set_callback(), ast_websocket_add_protocol(), ast_websocket_remove_protocol(), ast_websocket_server_add_protocol(), ast_websocket_server_remove_protocol(), bridge_hook_generic(), bridge_other_hook(), channelstorage_by_exten(), channelstorage_by_uniqueid(), cli_aor_iterate(), cli_channel_iterate(), cli_channelstats_iterate(), cli_contact_iterate(), cli_endpoint_iterate(), cli_iterate(), cli_iterator(), cli_unid_iterate(), command_create(), dahdi_cc_callback(), db_execute_sql(), defer_action(), dns_parse_answer(), dns_query_alloc(), get_by_exten(), get_by_name_prefix(), get_by_uniqueid(), iax2_sched_add(), iax2_sched_replace(), iax_firmware_traverse(), internal_stasis_subscribe(), iterator_by_exten_new(), iterator_by_name_new(), messaging_app_subscribe_endpoint(), payload_helper_cb(), play_message_callerid(), prometheus_callback_register(), prometheus_callback_unregister(), realtime_sqlite3_exec_query(), realtime_sqlite3_exec_query_with_handle(), route_table_add(), scrape_metrics(), send_request_data_alloc(), stasis_message_router_add(), stasis_message_router_add_cache_update(), stasis_message_router_set_default(), stasis_message_router_set_formatters_default(), stasis_state_subscribe_pool(), unload_module(), websocket_add_protocol_internal(), and websocket_remove_protocol_internal().

◆ channel_cmp_cb()

static int channel_cmp_cb ( void *  obj_left,
void *  obj_right,
int  flags 
)
static

Definition at line 326 of file channelstorage_ao2_legacy.c.

327{
328 struct ast_channel *tps_left = obj_left;
329 struct ast_channel *tps_right = obj_right;
330 const char *right_key = obj_right;
331 int cmp;
332
333 switch (flags & OBJ_SEARCH_MASK) {
334 default:
336 right_key = ast_channel_name(tps_right);
337 /* Fall through */
338 case OBJ_SEARCH_KEY:
339 cmp = strcasecmp(ast_channel_name(tps_left), right_key);
340 break;
342 cmp = strncasecmp(ast_channel_name(tps_left), right_key, strlen(right_key));
343 break;
344 }
345 return cmp == 0 ? CMP_MATCH : 0;
346}
@ OBJ_SEARCH_PARTIAL_KEY
The arg parameter is a partial search key similar to OBJ_SEARCH_KEY.
Definition: astobj2.h:1116
@ OBJ_SEARCH_OBJECT
The arg parameter is an object of the same type.
Definition: astobj2.h:1087
@ OBJ_SEARCH_MASK
Search option field mask.
Definition: astobj2.h:1072
@ OBJ_SEARCH_KEY
The arg parameter is a search key, but is not an object.
Definition: astobj2.h:1101

References ast_channel_name(), CMP_MATCH, ast_channel::flags, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and OBJ_SEARCH_PARTIAL_KEY.

Referenced by get_instance().

◆ close_instance()

static void close_instance ( struct ast_channelstorage_instance driver)
static

Definition at line 287 of file channelstorage_ao2_legacy.c.

288{
289 ast_debug(1, "Closing ao2_container channel storage driver %s\n", driver ? driver->name : "NULL");
290 if (!driver) {
291 return;
292 }
293
294 if (driver->handle) {
295 if (getdb(driver)) {
297 ao2_ref(getdb(driver), -1);
298 getdb(driver) = NULL;
299 }
300 ast_free(driver->handle);
301 driver->handle = NULL;
302 }
303 ast_free(driver);
304}
#define ast_free(a)
Definition: astmm.h:180
void ao2_container_unregister(const char *name)
Unregister a container for CLI stats and integrity check.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
#define ast_debug(level,...)
Log a DEBUG message.
#define NULL
Definition: resample.c:96
struct ast_channelstorage_driver_pvt * handle

References ao2_container_unregister(), ao2_ref, ast_debug, ast_free, getdb, ast_channelstorage_instance::handle, ast_channelstorage_instance::name, and NULL.

Referenced by get_instance().

◆ delete_channel()

static int delete_channel ( struct ast_channelstorage_instance driver,
struct ast_channel chan,
int  lock 
)
static

Definition at line 52 of file channelstorage_ao2_legacy.c.

54{
55 ao2_unlink(getdb(driver), chan);
56 chan->linked_in_container = 0;
57 return 0;
58}
#define ao2_unlink(container, obj)
Remove an object from a container.
Definition: astobj2.h:1578

References ao2_unlink, getdb, and ast_channel::linked_in_container.

◆ get_by_exten()

static struct ast_channel * get_by_exten ( struct ast_channelstorage_instance driver,
const char *  exten,
const char *  context 
)
static

Definition at line 246 of file channelstorage_ao2_legacy.c.

248{
249 char *l_exten = (char *) exten;
250 char *l_context = (char *) context;
251
252 return callback(driver, by_exten_cb, l_context, l_exten, 0);
253}
static int by_exten_cb(void *obj, void *arg, void *data, int flags)
static struct ast_channel * callback(struct ast_channelstorage_instance *driver, ao2_callback_data_fn *cb_fn, void *arg, void *data, int ao2_flags)

References by_exten_cb(), callback(), voicemailpwcheck::context, and ast_channel::exten.

Referenced by ast_channel_get_by_exten().

◆ get_by_name_prefix()

static struct ast_channel * get_by_name_prefix ( struct ast_channelstorage_instance driver,
const char *  name,
size_t  name_len 
)
static

Definition at line 224 of file channelstorage_ao2_legacy.c.

226{
227 struct ast_channel *chan;
228 char *l_name = (char *) name;
229
230 if (ast_strlen_zero(l_name)) {
231 /* We didn't have a name to search for so quit. */
232 return NULL;
233 }
234
235 chan = callback(driver, by_name_cb, l_name, &name_len,
236 (name_len == 0) /* optimize if it is a complete name match */ ? OBJ_KEY : 0);
237 if (chan) {
238 return chan;
239 }
240
241 /* Now try a search for uniqueid. */
242 chan = callback(driver, by_uniqueid_cb, l_name, &name_len, 0);
243 return chan;
244}
#define OBJ_KEY
Definition: astobj2.h:1151
static int by_uniqueid_cb(void *obj, void *arg, void *data, int flags)
static int by_name_cb(void *obj, void *arg, void *data, int flags)

References ast_strlen_zero(), by_name_cb(), by_uniqueid_cb(), callback(), name, NULL, and OBJ_KEY.

Referenced by channelstorage_by_name_prefix_or_uniqueid().

◆ get_by_uniqueid()

static struct ast_channel * get_by_uniqueid ( struct ast_channelstorage_instance driver,
const char *  uniqueid 
)
static

Definition at line 214 of file channelstorage_ao2_legacy.c.

216{
217 char *l_name = (char *) uniqueid;
218 size_t name_len = strlen(uniqueid);
219
220 struct ast_channel *chan = callback(driver, by_uniqueid_cb, l_name, &name_len, 0);
221 return chan;
222}

References by_uniqueid_cb(), callback(), and ast_channel::uniqueid.

Referenced by ast_channel_get_by_uniqueid(), channelstorage_by_name_prefix_or_uniqueid(), and do_ids_conflict().

◆ get_instance()

static struct ast_channelstorage_instance * get_instance ( const char *  name)
static

Definition at line 349 of file channelstorage_ao2_legacy.c.

350{
351 const char *_name = name ? name : "default";
352 struct ast_channelstorage_instance* driver = ast_calloc(1,
353 sizeof(*driver) + strlen(_name) + 1);
354
355 ast_debug(1, "Opening channel storage driver %s\n", _name);
356
357 if (!driver) {
358 ast_log(LOG_ERROR, "Failed to allocate memory for channel storage driver %s\n",
359 _name);
360 return NULL;
361 }
362 memcpy(driver, &channelstorage_instance, sizeof(*driver));
363 strcpy(driver->name, _name); /* Safe */
364 driver->handle = ast_calloc(1, sizeof(*driver->handle));
365 if (!driver->handle) {
366 close_instance(driver);
367 ast_log(LOG_ERROR, "Failed to allocate memory for channel storage driver %s\n",
368 _name);
369 return NULL;
370 }
371
374 if (!driver->handle) {
375 ast_log(LOG_ERROR, "Failed to create channel storage driver %s\n",
376 _name);
377 close_instance(driver);
378 return NULL;
379 }
381 ast_debug(1, "Opened channel storage driver %s. driver: %p container: %p\n",
382 _name, driver, driver->handle);
383
384 return driver;
385}
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:202
@ AO2_ALLOC_OPT_LOCK_MUTEX
Definition: astobj2.h:363
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.
#define 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.
Definition: astobj2.h:1303
#define AST_NUM_CHANNEL_BUCKETS
Definition: channel.h:157
static void close_instance(struct ast_channelstorage_instance *driver)
static int channel_cmp_cb(void *obj_left, void *obj_right, int flags)
static struct ast_channelstorage_instance channelstorage_instance
static void prnt_channel_key(void *v_obj, void *where, ao2_prnt_fn *prnt)
static int hash_cb(const void *obj, const int flags)

References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_container_register(), ast_calloc, ast_debug, ast_log, AST_NUM_CHANNEL_BUCKETS, channel_cmp_cb(), channelstorage_instance, close_instance(), getdb, ast_channelstorage_instance::handle, hash_cb(), LOG_ERROR, ast_channelstorage_instance::name, name, NULL, and prnt_channel_key().

◆ hash_cb()

static int hash_cb ( const void *  obj,
const int  flags 
)
static

Definition at line 255 of file channelstorage_ao2_legacy.c.

256{
257 const char *name = (flags & OBJ_KEY) ? obj : ast_channel_name((struct ast_channel *) obj);
258
259 /* If the name isn't set, return 0 so that the ao2_find() search will
260 * start in the first bucket. */
261 if (ast_strlen_zero(name)) {
262 return 0;
263 }
264
265 return ast_str_case_hash(name);
266}
static force_inline int attribute_pure ast_str_case_hash(const char *str)
Compute a hash value on a case-insensitive string.
Definition: strings.h:1303

References ast_channel_name(), ast_str_case_hash(), ast_strlen_zero(), ast_channel::flags, name, and OBJ_KEY.

Referenced by get_instance().

◆ insert_channel()

static int insert_channel ( struct ast_channelstorage_instance driver,
struct ast_channel chan,
int  flags,
int  lock 
)
static

Definition at line 42 of file channelstorage_ao2_legacy.c.

44{
45 int ret = ao2_link_flags(getdb(driver), chan, flags);
46 if (ret == 1) {
47 chan->linked_in_container = 1;
48 }
49 return ret ? 0 : -1;
50}
#define ao2_link_flags(container, obj, flags)
Add an object to a container.
Definition: astobj2.h:1554

References ao2_link_flags, getdb, and ast_channel::linked_in_container.

◆ iterator_all_new()

static struct ast_channel_iterator * iterator_all_new ( struct ast_channelstorage_instance driver)
static

Definition at line 194 of file channelstorage_ao2_legacy.c.

195{
196 struct ast_channel_iterator *i;
197
198 if (!(i = ast_calloc(1, sizeof(*i)))) {
199 return NULL;
200 }
201
202 i->simple_iterator = ao2_iterator_init(getdb(driver), 0);
204
205 return i;
206}
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
struct ao2_iterator simple_iterator
struct ao2_iterator * active_iterator

References ast_channel_iterator::active_iterator, ao2_iterator_init(), ast_calloc, getdb, NULL, and ast_channel_iterator::simple_iterator.

Referenced by ast_channel_iterator_all_new().

◆ iterator_by_exten_new()

static struct ast_channel_iterator * iterator_by_exten_new ( struct ast_channelstorage_instance driver,
const char *  exten,
const char *  context 
)
static

Definition at line 152 of file channelstorage_ao2_legacy.c.

154{
155 struct ast_channel_iterator *i;
156 char *l_exten = (char *) exten;
157 char *l_context = (char *) context;
158
159 if (!(i = ast_calloc(1, sizeof(*i)))) {
160 return NULL;
161 }
162
163 i->active_iterator = (void *) callback(driver, by_exten_cb,
164 l_context, l_exten, OBJ_MULTIPLE);
165 if (!i->active_iterator) {
166 ast_free(i);
167 return NULL;
168 }
169
170 return i;
171}

References ast_channel_iterator::active_iterator, ast_calloc, ast_free, by_exten_cb(), callback(), voicemailpwcheck::context, NULL, and OBJ_MULTIPLE.

Referenced by ast_channel_iterator_by_exten_new().

◆ iterator_by_name_new()

static struct ast_channel_iterator * iterator_by_name_new ( struct ast_channelstorage_instance driver,
const char *  name,
size_t  name_len 
)
static

Definition at line 173 of file channelstorage_ao2_legacy.c.

175{
176 struct ast_channel_iterator *i;
177 char *l_name = (char *) name;
178
179 if (!(i = ast_calloc(1, sizeof(*i)))) {
180 return NULL;
181 }
182
183 i->active_iterator = (void *) callback(driver, by_name_cb,
184 l_name, &name_len,
185 OBJ_MULTIPLE | (name_len == 0 /* match the whole word, so optimize */ ? OBJ_KEY : 0));
186 if (!i->active_iterator) {
187 ast_free(i);
188 return NULL;
189 }
190
191 return i;
192}

References ast_channel_iterator::active_iterator, ast_calloc, ast_free, by_name_cb(), callback(), name, NULL, OBJ_KEY, and OBJ_MULTIPLE.

Referenced by ast_channel_iterator_by_name_new().

◆ iterator_destroy()

static struct ast_channel_iterator * iterator_destroy ( struct ast_channelstorage_instance driver,
struct ast_channel_iterator i 
)
static

Definition at line 143 of file channelstorage_ao2_legacy.c.

145{
147 ast_free(i);
148
149 return NULL;
150}
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.

References ast_channel_iterator::active_iterator, ao2_iterator_destroy(), ast_free, and NULL.

Referenced by ast_channel_iterator_destroy().

◆ iterator_next()

static struct ast_channel * iterator_next ( struct ast_channelstorage_instance driver,
struct ast_channel_iterator i 
)
static

Definition at line 208 of file channelstorage_ao2_legacy.c.

210{
212}
#define ao2_iterator_next(iter)
Definition: astobj2.h:1911

References ast_channel_iterator::active_iterator, and ao2_iterator_next.

Referenced by ast_channel_iterator_next().

◆ lock_driver()

static void lock_driver ( struct ast_channelstorage_instance driver)
static

Definition at line 32 of file channelstorage_ao2_legacy.c.

33{
34 ao2_lock(getdb(driver));
35}
#define ao2_lock(a)
Definition: astobj2.h:717

References ao2_lock, and getdb.

◆ prnt_channel_key()

static void prnt_channel_key ( void *  v_obj,
void *  where,
ao2_prnt_fn prnt 
)
static

Definition at line 277 of file channelstorage_ao2_legacy.c.

278{
279 struct ast_channel *chan = v_obj;
280
281 if (!chan) {
282 return;
283 }
284 prnt(where, "%s", ast_channel_name(chan));
285}

References ast_channel_name().

Referenced by get_instance().

◆ unlock_driver()

static void unlock_driver ( struct ast_channelstorage_instance driver)
static

Definition at line 37 of file channelstorage_ao2_legacy.c.

38{
39 ao2_unlock(getdb(driver));
40}
#define ao2_unlock(a)
Definition: astobj2.h:729

References ao2_unlock, and getdb.

Variable Documentation

◆ channelstorage_instance

struct ast_channelstorage_instance channelstorage_instance
static

Definition at line 306 of file channelstorage_ao2_legacy.c.

Referenced by get_instance().

◆ driver_type

struct ast_channelstorage_driver driver_type
static
Initial value:
= {
.driver_name = "ao2_legacy",
.open = get_instance,
}
static struct ast_channelstorage_instance * get_instance(const char *name)

Definition at line 387 of file channelstorage_ao2_legacy.c.

Referenced by __startup(), and ast_channelstorage_register_driver().