Asterisk - The Open Source Telephony Project GIT-master-55f4e6d
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 212 of file bridge.c.

213{
215
216 /* Perform a sanity check to make sure the bridge technology conforms to our needed requirements */
217 if (ast_strlen_zero(technology->name)
218 || !technology->capabilities
219 || !technology->write) {
220 ast_log(LOG_WARNING, "Bridge technology %s failed registration sanity check.\n",
221 technology->name);
222 return -1;
223 }
224
226
227 /* Look for duplicate bridge technology already using this name, or already registered */
229 if ((!strcasecmp(current->name, technology->name)) || (current == technology)) {
230 ast_log(LOG_WARNING, "A bridge technology of %s already claims to exist in our world.\n",
231 technology->name);
233 return -1;
234 }
235 }
236
237 /* Copy module pointer so reference counting can keep the module from unloading */
238 technology->mod = module;
239
240 /* Find the correct position to insert the technology. */
242 /* Put the highest preference tech's first in the list. */
243 if (technology->preference >= current->preference) {
245
246 break;
247 }
248 }
250
251 if (!current) {
252 /* Insert our new bridge technology to the end of the list. */
254 }
255
257
258 ast_verb(5, "Registered bridge technology %s\n", technology->name);
259
260 return 0;
261}
#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
Definition: search.h:40

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:3047

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 3047 of file bridge.c.

3048{
3049 technology->suspended = 1;
3050}

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:263

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 263 of file bridge.c.

264{
266
268
269 /* Ensure the bridge technology is registered before removing it */
271 if (current == technology) {
273 ast_verb(5, "Unregistered bridge technology %s\n", technology->name);
274 break;
275 }
276 }
278
280
281 return current ? 0 : -1;
282}
#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:3052

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

Definition at line 3052 of file bridge.c.

3053{
3054 /*
3055 * XXX We may want the act of unsuspending a bridge technology
3056 * to prod all existing bridges to see if they should start
3057 * using it.
3058 */
3059 technology->suspended = 0;
3060}

References ast_bridge_technology::suspended.

Referenced by handle_bridge_technology_suspend(), and handle_manager_bridge_tech_suspend().