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 |
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_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... | |
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_and_destroy (struct ast_framehook *framehook) |
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.
int ast_framehook_attach | ( | struct ast_channel * | chan, |
struct ast_framehook_interface * | i | ||
) |
Attach an framehook onto a channel for frame interception.
ast_channel,The | channel to attach the hook on to. |
framehook | interface, The framehook's callback functions and stored data. |
On | success, positive id representing this hook on the channel |
On | failure, -1 |
Definition at line 94 of file framehook.c.
References ast_calloc, AST_FRAMEHOOK_EVENT_ATTACHED, AST_FRAMEHOOK_INTERFACE_VERSION, ast_free, ast_frfree, AST_LIST_INSERT_TAIL, ast_log(), ast_framehook::chan, ast_framehook_interface::data, ast_framehook_interface::event_cb, ast_channel::framehooks, ast_framehook::i, ast_framehook::id, ast_framehook_list::id_count, ast_framehook_list::list, LOG_ERROR, and ast_framehook_interface::version.
Referenced by frame_trace_helper().
int ast_framehook_detach | ( | struct ast_channel * | chan, |
int | framehook_id | ||
) |
Detach an framehook from a channel.
The | channel the framehook is attached to |
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 130 of file framehook.c.
References AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_framehook::detach_and_destroy_me, ast_channel::framehooks, ast_framehook::id, and ast_framehook_list::list.
Referenced by frame_trace_helper().
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.
channel | containing the framehook list to destroy. |
0 | success |
-1 | failure |
Definition at line 155 of file framehook.c.
References ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, framehook_detach_and_destroy(), ast_channel::framehooks, and ast_framehook_list::list.
Referenced by destroy_hooks().
int ast_framehook_list_is_empty | ( | struct ast_framehook_list * | framehooks | ) |
Determine if an framehook list is empty or not.
the | framehook list |
0,not | empty |
1,is | empty |
Definition at line 172 of file framehook.c.
References AST_LIST_EMPTY, and ast_framehook_list::list.
Referenced by ast_channel_bridge(), ast_indicate_data(), local_bridge_loop(), and remote_bridge_loop().
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.
framehook | list to push event to. |
frame | being pushed to the framehook list. |
Definition at line 185 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.
framehook | list to push event to. |
frame | being pushed to the framehook list. |
Definition at line 180 of file framehook.c.
References AST_FRAMEHOOK_EVENT_WRITE, and framehook_list_push_event().
Referenced by ast_indicate_data(), and ast_write().
|
static |
Definition at line 56 of file framehook.c.
References AST_FRAMEHOOK_EVENT_DETACHED, ast_free, and ast_frfree.
Referenced by ast_framehook_list_destroy(), and framehook_list_push_event().
|
static |
Definition at line 73 of file framehook.c.
References AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_framehook::chan, ast_framehook_interface::data, ast_framehook::detach_and_destroy_me, ast_framehook_interface::event_cb, framehook_detach_and_destroy(), ast_framehook::i, and ast_framehook_list::list.
Referenced by ast_framehook_list_read_event(), and ast_framehook_list_write_event().