Asterisk - The Open Source Telephony Project GIT-master-66c01d8
Data Structures | Macros | Enumerations | Functions
bridge_technology.h File Reference

Channel Bridging API. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ast_bridge_tech_optimizations
 Structure specific to bridge technologies capable of performing talking optimizations. More...
 
struct  ast_bridge_technology
 Structure that is the essence of a bridge technology. More...
 

Macros

#define ast_bridge_technology_register(technology)   __ast_bridge_technology_register(technology, AST_MODULE_SELF)
 See __ast_bridge_technology_register() More...
 

Enumerations

enum  ast_bridge_preference {
  AST_BRIDGE_PREFERENCE_BASE_HOLDING = 50 , AST_BRIDGE_PREFERENCE_BASE_EARLY = 100 , AST_BRIDGE_PREFERENCE_BASE_NATIVE = 90 , AST_BRIDGE_PREFERENCE_BASE_1TO1MIX = 50 ,
  AST_BRIDGE_PREFERENCE_BASE_MULTIMIX = 10
}
 Base preference values for choosing a bridge technology. More...
 

Functions

int __ast_bridge_technology_register (struct ast_bridge_technology *technology, struct ast_module *mod)
 Register a bridge technology for use. More...
 
void ast_bridge_technology_suspend (struct ast_bridge_technology *technology)
 Suspend a bridge technology from consideration. More...
 
int ast_bridge_technology_unregister (struct ast_bridge_technology *technology)
 Unregister a bridge technology from use. More...
 
void ast_bridge_technology_unsuspend (struct ast_bridge_technology *technology)
 Unsuspend a bridge technology. More...
 

Detailed Description

Channel Bridging API.

Author
Joshua Colp jcolp.nosp@m.@dig.nosp@m.ium.c.nosp@m.om

Definition in file bridge_technology.h.

Macro Definition Documentation

◆ ast_bridge_technology_register

#define ast_bridge_technology_register (   technology)    __ast_bridge_technology_register(technology, AST_MODULE_SELF)

Enumeration Type Documentation

◆ ast_bridge_preference

Base preference values for choosing a bridge technology.

Note
Higher is more preference.
Enumerator
AST_BRIDGE_PREFERENCE_BASE_HOLDING 
AST_BRIDGE_PREFERENCE_BASE_EARLY 
AST_BRIDGE_PREFERENCE_BASE_NATIVE 
AST_BRIDGE_PREFERENCE_BASE_1TO1MIX 
AST_BRIDGE_PREFERENCE_BASE_MULTIMIX 

Definition at line 36 of file bridge_technology.h.

36 {
42};
@ AST_BRIDGE_PREFERENCE_BASE_HOLDING
@ AST_BRIDGE_PREFERENCE_BASE_MULTIMIX
@ AST_BRIDGE_PREFERENCE_BASE_NATIVE
@ AST_BRIDGE_PREFERENCE_BASE_1TO1MIX
@ AST_BRIDGE_PREFERENCE_BASE_EARLY

Function Documentation

◆ __ast_bridge_technology_register()

int __ast_bridge_technology_register ( struct ast_bridge_technology technology,
struct ast_module mod 
)

Register a bridge technology for use.

Parameters
technologyThe bridge technology to register
modThe module that is registering the bridge technology
Return values
0on success
-1on failure

Example usage:

ast_bridge_technology_register(&simple_bridge_tech);
#define ast_bridge_technology_register(technology)
See __ast_bridge_technology_register()

This registers a bridge technology declared as the structure simple_bridge_tech with the bridging core and makes it available for use when creating bridges.

Definition at line 223 of file bridge.c.

224{
226
227 /* Perform a sanity check to make sure the bridge technology conforms to our needed requirements */
228 if (ast_strlen_zero(technology->name)
229 || !technology->capabilities
230 || !technology->write) {
231 ast_log(LOG_WARNING, "Bridge technology %s failed registration sanity check.\n",
232 technology->name);
233 return -1;
234 }
235
237
238 /* Look for duplicate bridge technology already using this name, or already registered */
240 if ((!strcasecmp(current->name, technology->name)) || (current == technology)) {
241 ast_log(LOG_WARNING, "A bridge technology of %s already claims to exist in our world.\n",
242 technology->name);
244 return -1;
245 }
246 }
247
248 /* Copy module pointer so reference counting can keep the module from unloading */
249 technology->mod = module;
250
251 /* Find the correct position to insert the technology. */
253 /* Put the highest preference tech's first in the list. */
254 if (technology->preference >= current->preference) {
255 AST_RWLIST_INSERT_BEFORE_CURRENT(technology, entry);
256
257 break;
258 }
259 }
261
262 if (!current) {
263 /* Insert our new bridge technology to the end of the list. */
264 AST_RWLIST_INSERT_TAIL(&bridge_technologies, technology, entry);
265 }
266
268
269 ast_verb(5, "Registered bridge technology %s\n", technology->name);
270
271 return 0;
272}
#define ast_log
Definition: astobj2.c:42
#define ast_verb(level,...)
#define LOG_WARNING
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
Definition: linkedlists.h:545
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
Definition: linkedlists.h:52
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
Definition: linkedlists.h:151
#define AST_RWLIST_TRAVERSE_SAFE_END
Definition: linkedlists.h:617
#define AST_RWLIST_TRAVERSE
Definition: linkedlists.h:494
#define AST_RWLIST_INSERT_TAIL
Definition: linkedlists.h:741
#define AST_RWLIST_INSERT_BEFORE_CURRENT
Definition: linkedlists.h:610
size_t current
Definition: main/cli.c:113
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
Structure that is the essence of a bridge technology.
struct ast_module * mod
int(* write)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
Write a frame into the bridging technology instance for a bridge.
enum ast_bridge_preference preference

References ast_log, AST_RWLIST_INSERT_BEFORE_CURRENT, AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero(), ast_verb, ast_bridge_technology::capabilities, current, LOG_WARNING, ast_bridge_technology::mod, ast_bridge_technology::name, ast_bridge_technology::preference, and ast_bridge_technology::write.

◆ ast_bridge_technology_suspend()

void ast_bridge_technology_suspend ( struct ast_bridge_technology technology)

Suspend a bridge technology from consideration.

Parameters
technologyThe bridge technology to suspend

Example usage:

ast_bridge_technology_suspend(&simple_bridge_tech);
void ast_bridge_technology_suspend(struct ast_bridge_technology *technology)
Suspend a bridge technology from consideration.
Definition: bridge.c:3116

This suspends the bridge technology simple_bridge_tech from being considered when creating a new bridge. Existing bridges using the bridge technology are not affected.

Definition at line 3116 of file bridge.c.

3117{
3118 technology->suspended = 1;
3119}

References ast_bridge_technology::suspended.

Referenced by handle_bridge_technology_suspend(), and handle_manager_bridge_tech_suspend().

◆ ast_bridge_technology_unregister()

int ast_bridge_technology_unregister ( struct ast_bridge_technology technology)

Unregister a bridge technology from use.

Parameters
technologyThe bridge technology to unregister
Return values
0on success
-1on failure

Example usage:

ast_bridge_technology_unregister(&simple_bridge_tech);
int ast_bridge_technology_unregister(struct ast_bridge_technology *technology)
Unregister a bridge technology from use.
Definition: bridge.c:274

This unregisters a bridge technlogy declared as the structure simple_bridge_tech with the bridging core. It will no longer be considered when creating a new bridge.

Definition at line 274 of file bridge.c.

275{
277
279
280 /* Ensure the bridge technology is registered before removing it */
282 if (current == technology) {
284 ast_verb(5, "Unregistered bridge technology %s\n", technology->name);
285 break;
286 }
287 }
289
291
292 return current ? 0 : -1;
293}
#define AST_RWLIST_REMOVE_CURRENT
Definition: linkedlists.h:570

References AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, current, and ast_bridge_technology::name.

Referenced by dahdi_native_unload(), and unload_module().

◆ ast_bridge_technology_unsuspend()

void ast_bridge_technology_unsuspend ( struct ast_bridge_technology technology)

Unsuspend a bridge technology.

Parameters
technologyThe bridge technology to unsuspend

Example usage:

ast_bridge_technology_unsuspend(&simple_bridge_tech);
void ast_bridge_technology_unsuspend(struct ast_bridge_technology *technology)
Unsuspend a bridge technology.
Definition: bridge.c:3121

This makes the bridge technology simple_bridge_tech considered when creating a new bridge again.

Definition at line 3121 of file bridge.c.

3122{
3123 /*
3124 * XXX We may want the act of unsuspending a bridge technology
3125 * to prod all existing bridges to see if they should start
3126 * using it.
3127 */
3128 technology->suspended = 0;
3129}

References ast_bridge_technology::suspended.

Referenced by handle_bridge_technology_suspend(), and handle_manager_bridge_tech_suspend().