Internal channel functions for channel.c to use. More...

Go to the source code of this file.
Defines | |
| #define | ast_channel_internal_alloc(destructor) __ast_channel_internal_alloc(destructor, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Functions | |
| struct ast_channel * | __ast_channel_internal_alloc (void(*destructor)(void *obj), const char *file, int line, const char *function) |
| void | ast_channel_internal_cleanup (struct ast_channel *chan) |
| void | ast_channel_internal_finalize (struct ast_channel *chan) |
| int | ast_channel_internal_is_finalized (struct ast_channel *chan) |
Internal channel functions for channel.c to use.
Definition in file channel_internal.h.
| #define ast_channel_internal_alloc | ( | destructor | ) | __ast_channel_internal_alloc(destructor, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Definition at line 21 of file channel_internal.h.
Referenced by __ast_channel_alloc_ap(), and ast_dummy_channel_alloc().
| struct ast_channel* __ast_channel_internal_alloc | ( | void(*)(void *obj) | destructor, |
| const char * | file, | ||
| int | line, | ||
| const char * | function | ||
| ) | [read] |
Definition at line 1334 of file channel_internal_api.c.
References __ao2_alloc_debug(), ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc, ast_channel_unref, ast_string_field_init, ast_channel::dialed_causes, DIALED_CAUSES_BUCKETS, pvt_cause_cmp_fn(), and pvt_cause_hash_fn().
{
struct ast_channel *tmp;
#if defined(REF_DEBUG)
tmp = __ao2_alloc_debug(sizeof(*tmp), destructor,
AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function, 1);
#elif defined(__AST_DEBUG_MALLOC)
tmp = __ao2_alloc_debug(sizeof(*tmp), destructor,
AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function, 0);
#else
tmp = ao2_alloc(sizeof(*tmp), destructor);
#endif
if ((ast_string_field_init(tmp, 128))) {
return ast_channel_unref(tmp);
}
if (!(tmp->dialed_causes = ao2_container_alloc(DIALED_CAUSES_BUCKETS, pvt_cause_hash_fn, pvt_cause_cmp_fn))) {
return ast_channel_unref(tmp);
}
return tmp;
}
| void ast_channel_internal_cleanup | ( | struct ast_channel * | chan | ) |
Definition at line 1358 of file channel_internal_api.c.
References ao2_t_ref, ast_string_field_free_memory, and ast_channel::dialed_causes.
Referenced by ast_channel_destructor(), and ast_dummy_channel_destructor().
{
if (chan->dialed_causes) {
ao2_t_ref(chan->dialed_causes, -1,
"done with dialed causes since the channel is going away");
chan->dialed_causes = NULL;
}
ast_string_field_free_memory(chan);
}
| void ast_channel_internal_finalize | ( | struct ast_channel * | chan | ) |
Definition at line 1369 of file channel_internal_api.c.
References ast_channel::finalized.
Referenced by __ast_channel_alloc_ap().
{
chan->finalized = 1;
}
| int ast_channel_internal_is_finalized | ( | struct ast_channel * | chan | ) |
Definition at line 1374 of file channel_internal_api.c.
References ast_channel::finalized.
Referenced by ast_channel_destructor().
{
return chan->finalized;
}