Asterisk - The Open Source Telephony Project  18.5.0
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.

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);

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

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, LOG_WARNING, ast_bridge_technology::mod, ast_bridge_technology::name, ast_bridge_technology::preference, and ast_bridge_technology::write.

215 {
216  struct ast_bridge_technology *current;
217 
218  /* Perform a sanity check to make sure the bridge technology conforms to our needed requirements */
219  if (ast_strlen_zero(technology->name)
220  || !technology->capabilities
221  || !technology->write) {
222  ast_log(LOG_WARNING, "Bridge technology %s failed registration sanity check.\n",
223  technology->name);
224  return -1;
225  }
226 
228 
229  /* Look for duplicate bridge technology already using this name, or already registered */
231  if ((!strcasecmp(current->name, technology->name)) || (current == technology)) {
232  ast_log(LOG_WARNING, "A bridge technology of %s already claims to exist in our world.\n",
233  technology->name);
235  return -1;
236  }
237  }
238 
239  /* Copy module pointer so reference counting can keep the module from unloading */
240  technology->mod = module;
241 
242  /* Find the correct position to insert the technology. */
244  /* Put the highest preference tech's first in the list. */
245  if (technology->preference >= current->preference) {
247 
248  break;
249  }
250  }
252 
253  if (!current) {
254  /* Insert our new bridge technology to the end of the list. */
256  }
257 
259 
260  ast_verb(2, "Registered bridge technology %s\n", technology->name);
261 
262  return 0;
263 }
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
Definition: linkedlists.h:51
#define LOG_WARNING
Definition: logger.h:274
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
Definition: linkedlists.h:150
#define ast_verb(level,...)
Definition: logger.h:463
#define ast_strlen_zero(foo)
Definition: strings.h:52
#define ast_log
Definition: astobj2.c:42
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
#define AST_RWLIST_TRAVERSE
Definition: linkedlists.h:493
#define AST_RWLIST_INSERT_BEFORE_CURRENT
Definition: linkedlists.h:609
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
Definition: linkedlists.h:544
struct ast_module * mod
#define AST_RWLIST_INSERT_TAIL
Definition: linkedlists.h:740
Structure that is the essence of a bridge technology.
Definition: search.h:40
#define AST_RWLIST_TRAVERSE_SAFE_END
Definition: linkedlists.h:616

◆ 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);

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

References ast_bridge_technology::suspended.

Referenced by handle_bridge_technology_suspend(), and handle_manager_bridge_tech_suspend().

3109 {
3110  technology->suspended = 1;
3111 }

◆ 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);

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

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

Referenced by dahdi_native_unload(), and unload_module().

266 {
267  struct ast_bridge_technology *current;
268 
270 
271  /* Ensure the bridge technology is registered before removing it */
273  if (current == technology) {
275  ast_verb(2, "Unregistered bridge technology %s\n", technology->name);
276  break;
277  }
278  }
280 
282 
283  return current ? 0 : -1;
284 }
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
Definition: linkedlists.h:51
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
Definition: linkedlists.h:150
#define ast_verb(level,...)
Definition: logger.h:463
#define AST_RWLIST_REMOVE_CURRENT
Definition: linkedlists.h:569
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
Definition: linkedlists.h:544
Structure that is the essence of a bridge technology.
Definition: search.h:40
#define AST_RWLIST_TRAVERSE_SAFE_END
Definition: linkedlists.h:616

◆ 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);

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

Definition at line 3113 of file bridge.c.

References ast_bridge_technology::suspended.

Referenced by handle_bridge_technology_suspend(), and handle_manager_bridge_tech_suspend().

3114 {
3115  /*
3116  * XXX We may want the act of unsuspending a bridge technology
3117  * to prod all existing bridges to see if they should start
3118  * using it.
3119  */
3120  technology->suspended = 0;
3121 }