Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
FrameHooks Architecture. More...
#include "asterisk.h"
#include "asterisk/channel.h"
#include "asterisk/linkedlists.h"
#include "asterisk/framehook.h"
#include "asterisk/frame.h"
Go to the source code of this file.
Data Structures | |
struct | ast_framehook |
struct | ast_framehook_list |
Enumerations | |
enum | framehook_detachment_mode { FRAMEHOOK_DETACH_DESTROY = 0 , FRAMEHOOK_DETACH_PRESERVE } |
Functions | |
int | ast_framehook_attach (struct ast_channel *chan, struct ast_framehook_interface *i) |
Attach an framehook onto a channel for frame interception. More... | |
int | ast_framehook_detach (struct ast_channel *chan, int id) |
Detach an framehook from a channel. More... | |
int | ast_framehook_list_contains_no_active (struct ast_framehook_list *framehooks) |
Determine if a framehook list is free of active framehooks or not. More... | |
int | ast_framehook_list_contains_no_active_of_type (struct ast_framehook_list *framehooks, enum ast_frame_type type) |
Determine if a framehook list is free of active framehooks consuming a specific type of frame. More... | |
int | ast_framehook_list_destroy (struct ast_channel *chan) |
This is used by the channel API to detach and destroy all framehooks on a channel during channel destruction. More... | |
void | ast_framehook_list_fixup (struct ast_channel *old_chan, struct ast_channel *new_chan) |
This is used by the channel API during a masquerade operation to move all mobile framehooks from the original channel to the clone channel. More... | |
int | ast_framehook_list_is_empty (struct ast_framehook_list *framehooks) |
Determine if an framehook list is empty or not. More... | |
struct ast_frame * | ast_framehook_list_read_event (struct ast_framehook_list *framehooks, struct ast_frame *frame) |
This is used by the channel API push a frame read event to a channel's framehook list. More... | |
struct ast_frame * | ast_framehook_list_write_event (struct ast_framehook_list *framehooks, struct ast_frame *frame) |
This is used by the channel API push a frame write event to a channel's framehook list. More... | |
static void | framehook_detach (struct ast_framehook *framehook, enum framehook_detachment_mode mode) |
static struct ast_frame * | framehook_list_push_event (struct ast_framehook_list *framehooks, struct ast_frame *frame, enum ast_framehook_event event) |
FrameHooks Architecture.
Definition in file framehook.c.
Definition at line 57 of file framehook.c.
int ast_framehook_attach | ( | struct ast_channel * | chan, |
struct ast_framehook_interface * | i | ||
) |
Attach an framehook onto a channel for frame interception.
chan | ast_channel The channel to attach the hook on to. |
i | framehook interface, The framehook's callback functions and stored data. |
non-negative | success, id representing this hook on the channel |
-1 | failure |
Definition at line 132 of file framehook.c.
References ast_calloc, ast_channel_framehooks(), ast_channel_framehooks_set(), ast_channel_is_bridged(), ast_channel_set_unbridged_nolock(), AST_FRAMEHOOK_EVENT_ATTACHED, AST_FRAMEHOOK_INTERFACE_VERSION, ast_free, ast_frfree, AST_LIST_INSERT_TAIL, ast_log, ast_framehook::chan, ast_framehook_list::count, ast_framehook_interface::data, ast_framehook_interface::event_cb, ast_framehook::i, ast_framehook::id, ast_framehook_list::id_count, LOG_ERROR, NULL, and ast_framehook_interface::version.
Referenced by aoc_attach_framehook(), ast_channel_suppress(), ast_framehook_list_fixup(), ast_jb_create_framehook(), attach_framehook(), dtmfstore_exec(), fax_detect_attach(), fax_gateway_attach(), frame_drop_helper(), frame_trace_helper(), handle_remb_set(), native_rtp_bridge_framehook_attach(), refer_blind_callback(), set_hold_intercept(), and t38_attach_framehook().
int ast_framehook_detach | ( | struct ast_channel * | chan, |
int | framehook_id | ||
) |
Detach an framehook from a channel.
chan | The channel the framehook is attached to |
framehook_id | The framehook's id |
0 | success |
-1 | framehook did not exist on the channel. This means the framehook either never existed on the channel, or was already detached. |
Definition at line 177 of file framehook.c.
References ast_channel_framehooks(), ast_channel_is_bridged(), ast_channel_set_unbridged_nolock(), AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_framehook::chan, ast_framehook::detach_and_destroy_me, ast_framehook::id, and ast_framehook::list.
Referenced by acf_faxopt_write(), ast_channel_suppress(), ast_channel_unsuppress(), ast_framehook_list_fixup(), ast_jb_create_framehook(), fax_detect_framehook(), fax_gateway_detect_t38(), fax_gateway_framehook(), fax_gateway_request_t38(), fixup_callback(), frame_drop_helper(), frame_trace_helper(), handle_remb_set(), native_rtp_bridge_framehook_detach(), refer_blind_callback(), refer_progress_bridge(), refer_progress_framehook(), remove_dtmf_store(), remove_framehook(), remove_hold_intercept(), t38_attach_framehook(), t38_masq(), and transfer_target_framehook_cb().
int ast_framehook_list_contains_no_active | ( | struct ast_framehook_list * | framehooks | ) |
Determine if a framehook list is free of active framehooks or not.
framehooks | the framehook list |
0 | not empty |
1 | is empty (aside from dying framehooks) |
Definition at line 282 of file framehook.c.
References ast_framehook_list_contains_no_active_of_type().
Referenced by ast_channel_has_audio_frame_or_monitor().
int ast_framehook_list_contains_no_active_of_type | ( | struct ast_framehook_list * | framehooks, |
enum ast_frame_type | type | ||
) |
Determine if a framehook list is free of active framehooks consuming a specific type of frame.
framehooks | the framehook list |
type | type of frame |
0 | not empty |
1 | is empty (aside from dying framehooks) |
Definition at line 287 of file framehook.c.
References AST_LIST_EMPTY, AST_LIST_TRAVERSE, ast_framehook_interface::consume_cb, ast_framehook_interface::data, ast_framehook::detach_and_destroy_me, ast_framehook::i, ast_framehook::list, ast_framehook_list::list, and type.
Referenced by ast_channel_has_hook_requiring_audio(), and ast_framehook_list_contains_no_active().
int ast_framehook_list_destroy | ( | struct ast_channel * | chan | ) |
This is used by the channel API to detach and destroy all framehooks on a channel during channel destruction.
chan | channel containing the framehook list to destroy. |
0 | success |
-1 | failure |
Definition at line 206 of file framehook.c.
References ast_channel_framehooks(), ast_channel_framehooks_set(), ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_framehook::chan, framehook_detach(), FRAMEHOOK_DETACH_DESTROY, ast_framehook::list, and NULL.
Referenced by destroy_hooks().
void ast_framehook_list_fixup | ( | struct ast_channel * | old_chan, |
struct ast_channel * | new_chan | ||
) |
This is used by the channel API during a masquerade operation to move all mobile framehooks from the original channel to the clone channel.
old_chan | The channel being cloned from |
new_chan | The channel being cloned to |
Definition at line 223 of file framehook.c.
References ast_channel_framehooks(), ast_channel_is_bridged(), ast_channel_set_unbridged_nolock(), ast_framehook_attach(), ast_framehook_detach(), AST_LIST_EMPTY, AST_LIST_REMOVE_HEAD, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_log, ast_framehook_interface::chan_breakdown_cb, ast_framehook_interface::chan_fixup_cb, ast_framehook_interface::data, ast_framehook_interface::disable_inheritance, framehook_detach(), FRAMEHOOK_DETACH_DESTROY, FRAMEHOOK_DETACH_PRESERVE, ast_framehook::i, ast_framehook::id, ast_framehook::list, and LOG_WARNING.
Referenced by channel_do_masquerade().
int ast_framehook_list_is_empty | ( | struct ast_framehook_list * | framehooks | ) |
Determine if an framehook list is empty or not.
framehooks | the framehook list |
0 | not empty |
1 | is empty |
Definition at line 274 of file framehook.c.
References AST_LIST_EMPTY, and ast_framehook_list::list.
Referenced by ast_indicate_data().
struct ast_frame * ast_framehook_list_read_event | ( | struct ast_framehook_list * | framehooks, |
struct ast_frame * | frame | ||
) |
This is used by the channel API push a frame read event to a channel's framehook list.
After this function completes, the resulting frame that is returned could be anything, even NULL. There is nothing to keep up with after this function. If the frame is modified, the framehook callback is in charge of any memory management associated with that modification.
framehooks | list to push event to. |
frame | being pushed to the framehook list. |
Definition at line 318 of file framehook.c.
References AST_FRAMEHOOK_EVENT_READ, and framehook_list_push_event().
Referenced by __ast_read().
struct ast_frame * ast_framehook_list_write_event | ( | struct ast_framehook_list * | framehooks, |
struct ast_frame * | frame | ||
) |
This is used by the channel API push a frame write event to a channel's framehook list.
After this function completes, the resulting frame that is returned could be anything, even NULL. There is nothing to keep up with after this function. If the frame is modified, the framehook callback is in charge of any memory management associated with that modification.
framehooks | list to push event to. |
frame | being pushed to the framehook list. |
Definition at line 313 of file framehook.c.
References AST_FRAMEHOOK_EVENT_WRITE, and framehook_list_push_event().
Referenced by ast_indicate_data(), and ast_write_stream().
|
static |
Definition at line 66 of file framehook.c.
References AST_FRAMEHOOK_EVENT_DETACHED, ast_free, ast_frfree, ast_framehook::chan, ast_framehook_interface::data, ast_framehook_interface::destroy_cb, ast_framehook_interface::event_cb, FRAMEHOOK_DETACH_DESTROY, ast_framehook::i, and NULL.
Referenced by ast_framehook_list_destroy(), ast_framehook_list_fixup(), and framehook_list_push_event().
|
static |
Definition at line 83 of file framehook.c.
References ast_alloca, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_framehook::chan, ast_framehook_list::count, ast_framehook_interface::data, ast_framehook::detach_and_destroy_me, ast_framehook_interface::event_cb, framehook_detach(), FRAMEHOOK_DETACH_DESTROY, ast_framehook::i, and ast_framehook_list::list.
Referenced by ast_framehook_list_read_event(), and ast_framehook_list_write_event().