Two channel bridging module which groups bridges into batches of threads. More...
#include "asterisk.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/bridging.h"
#include "asterisk/bridging_technology.h"
#include "asterisk/frame.h"
#include "asterisk/astobj2.h"
Go to the source code of this file.
Data Structures | |
struct | multiplexed_thread |
Structure which represents a single thread handling multiple 2 channel bridges. More... | |
Macros | |
#define | MULTIPLEXED_BUCKETS 53 |
Number of buckets our multiplexed thread container can have. More... | |
#define | MULTIPLEXED_MAX_CHANNELS 8 |
Number of channels we handle in a single thread. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static void | destroy_multiplexed_thread (void *obj) |
Destroy callback for a multiplexed thread structure. More... | |
static int | find_multiplexed_thread (void *obj, void *arg, int flags) |
Callback function for finding a free multiplexed thread. More... | |
static int | load_module (void) |
static void | multiplexed_add_or_remove (struct multiplexed_thread *multiplexed_thread, struct ast_channel *chan, int add) |
Helper function which adds or removes a channel and nudges the thread. More... | |
static int | multiplexed_bridge_create (struct ast_bridge *bridge) |
Create function which finds/reserves/references a multiplexed thread structure. More... | |
static int | multiplexed_bridge_destroy (struct ast_bridge *bridge) |
Destroy function which unreserves/unreferences/removes a multiplexed thread structure. More... | |
static int | multiplexed_bridge_join (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
Join function which actually adds the channel into the array to be monitored. More... | |
static int | multiplexed_bridge_leave (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
Leave function which actually removes the channel from the array. More... | |
static void | multiplexed_bridge_suspend (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
Suspend function which means control of the channel is going elsewhere. More... | |
static void | multiplexed_bridge_unsuspend (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
Unsuspend function which means control of the channel is coming back to us. More... | |
static enum ast_bridge_write_result | multiplexed_bridge_write (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) |
Write function for writing frames into the bridge. More... | |
static void | multiplexed_nudge (struct multiplexed_thread *multiplexed_thread) |
Internal function which nudges the thread. More... | |
static void * | multiplexed_thread_function (void *data) |
Thread function that executes for multiplexed threads. More... | |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Multiplexed two channel bridging module" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } |
static struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_bridge_technology | multiplexed_bridge |
static struct ao2_container * | multiplexed_threads |
Container of all operating multiplexed threads. More... | |
Two channel bridging module which groups bridges into batches of threads.
Definition in file bridge_multiplexed.c.
#define MULTIPLEXED_BUCKETS 53 |
Number of buckets our multiplexed thread container can have.
Definition at line 51 of file bridge_multiplexed.c.
Referenced by load_module().
#define MULTIPLEXED_MAX_CHANNELS 8 |
Number of channels we handle in a single thread.
Definition at line 54 of file bridge_multiplexed.c.
Referenced by find_multiplexed_thread(), and multiplexed_add_or_remove().
|
static |
Definition at line 425 of file bridge_multiplexed.c.
|
static |
Definition at line 425 of file bridge_multiplexed.c.
|
static |
Destroy callback for a multiplexed thread structure.
Definition at line 83 of file bridge_multiplexed.c.
References multiplexed_thread::pipe.
Referenced by multiplexed_bridge_create().
|
static |
Callback function for finding a free multiplexed thread.
Definition at line 76 of file bridge_multiplexed.c.
References CMP_MATCH, CMP_STOP, multiplexed_thread::count, and MULTIPLEXED_MAX_CHANNELS.
Referenced by multiplexed_bridge_create().
|
static |
Definition at line 416 of file bridge_multiplexed.c.
References ao2_container_alloc, ast_bridge_technology_register, AST_MODULE_LOAD_DECLINE, and MULTIPLEXED_BUCKETS.
|
static |
Helper function which adds or removes a channel and nudges the thread.
Definition at line 269 of file bridge_multiplexed.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_debug, ast_pthread_create, AST_PTHREADT_NULL, AST_PTHREADT_STOP, multiplexed_thread::chans, MULTIPLEXED_MAX_CHANNELS, multiplexed_nudge(), multiplexed_thread_function(), multiplexed_thread::service_count, multiplexed_thread::thread, and thread.
Referenced by multiplexed_bridge_join(), multiplexed_bridge_leave(), multiplexed_bridge_suspend(), and multiplexed_bridge_unsuspend().
|
static |
Create function which finds/reserves/references a multiplexed thread structure.
Definition at line 98 of file bridge_multiplexed.c.
References ao2_alloc, ao2_callback, ao2_link, ao2_lock, ao2_ref, ao2_unlock, ast_debug, ast_log(), AST_PTHREADT_NULL, ast_bridge::bridge_pvt, multiplexed_thread::count, destroy_multiplexed_thread(), errno, find_multiplexed_thread(), LOG_WARNING, multiplexed_thread::pipe, and multiplexed_thread::thread.
|
static |
Destroy function which unreserves/unreferences/removes a multiplexed thread structure.
Definition at line 181 of file bridge_multiplexed.c.
References ao2_lock, ao2_ref, ao2_unlink, ao2_unlock, ast_debug, ast_bridge::bridge_pvt, multiplexed_thread::count, and multiplexed_nudge().
|
static |
Join function which actually adds the channel into the array to be monitored.
Definition at line 316 of file bridge_multiplexed.c.
References ast_channel_make_compatible(), ast_debug, AST_LIST_FIRST, AST_LIST_LAST, ast_bridge::bridge_pvt, ast_bridge_channel::chan, multiplexed_add_or_remove(), ast_channel::name, ast_channel::nativeformats, ast_channel::readformat, and ast_channel::writeformat.
|
static |
Leave function which actually removes the channel from the array.
Definition at line 338 of file bridge_multiplexed.c.
References ast_debug, ast_bridge::bridge_pvt, ast_bridge_channel::chan, multiplexed_add_or_remove(), and ast_channel::name.
|
static |
Suspend function which means control of the channel is going elsewhere.
Definition at line 350 of file bridge_multiplexed.c.
References ast_debug, ast_bridge::bridge_pvt, ast_bridge_channel::chan, multiplexed_add_or_remove(), and ast_channel::name.
|
static |
Unsuspend function which means control of the channel is coming back to us.
Definition at line 362 of file bridge_multiplexed.c.
References ast_debug, ast_bridge::bridge_pvt, ast_bridge_channel::chan, multiplexed_add_or_remove(), and ast_channel::name.
|
static |
Write function for writing frames into the bridge.
Definition at line 374 of file bridge_multiplexed.c.
References AST_BRIDGE_CHANNEL_STATE_WAIT, AST_BRIDGE_WRITE_FAILED, AST_BRIDGE_WRITE_SUCCESS, AST_LIST_FIRST, AST_LIST_LAST, ast_write(), ast_bridge_channel::chan, and ast_bridge_channel::state.
|
static |
Internal function which nudges the thread.
Definition at line 161 of file bridge_multiplexed.c.
References ast_log(), AST_PTHREADT_NULL, LOG_ERROR, multiplexed_thread::pipe, multiplexed_thread::thread, and multiplexed_thread::waiting.
Referenced by multiplexed_add_or_remove(), and multiplexed_bridge_destroy().
|
static |
Thread function that executes for multiplexed threads.
Definition at line 204 of file bridge_multiplexed.c.
References ao2_lock, ao2_ref, ao2_trylock, ao2_unlock, ast_bridge_handle_trip(), ast_debug, ast_log(), AST_PTHREADT_NULL, AST_PTHREADT_STOP, ast_waitfor_nandfds(), ast_channel::bridge, multiplexed_thread::chans, errno, first, LOG_WARNING, multiplexed_thread::pipe, multiplexed_thread::service_count, stop, multiplexed_thread::thread, and multiplexed_thread::waiting.
Referenced by multiplexed_add_or_remove().
|
static |
Definition at line 407 of file bridge_multiplexed.c.
References ao2_ref, and ast_bridge_technology_unregister().
|
static |
Definition at line 425 of file bridge_multiplexed.c.
|
static |
Definition at line 425 of file bridge_multiplexed.c.
|
static |
Definition at line 393 of file bridge_multiplexed.c.
|
static |
Container of all operating multiplexed threads.
Definition at line 73 of file bridge_multiplexed.c.