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...

Defines

#define ast_bridge_technology_register(technology)   __ast_bridge_technology_register(technology, ast_module_info->self)
 See __ast_bridge_technology_register().

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.
void ast_bridge_technology_suspend (struct ast_bridge_technology *technology)
 Suspend a bridge technology from consideration.
int ast_bridge_technology_unregister (struct ast_bridge_technology *technology)
 Unregister a bridge technology from use.
void ast_bridge_technology_unsuspend (struct ast_bridge_technology *technology)
 Unsuspend a bridge technology.


Detailed Description

Channel Bridging API.

Author:
Joshua Colp <jcolp@digium.com>

Definition in file bridge_technology.h.


Define Documentation

#define ast_bridge_technology_register ( technology   )     __ast_bridge_technology_register(technology, ast_module_info->self)

See __ast_bridge_technology_register().

Definition at line 185 of file bridge_technology.h.

Referenced by load_module().


Enumeration Type Documentation

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

int __ast_bridge_technology_register ( struct ast_bridge_technology technology,
struct ast_module mod 
)

Register a bridge technology for use.

Parameters:
technology The bridge technology to register
mod The module that is registering the bridge technology
Return values:
0 on success
-1 on 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 199 of file bridge.c.

References ast_log, AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE, 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, and ast_bridge_technology::write.

Referenced by dahdi_native_load().

00200 {
00201    struct ast_bridge_technology *current;
00202 
00203    /* Perform a sanity check to make sure the bridge technology conforms to our needed requirements */
00204    if (ast_strlen_zero(technology->name)
00205       || !technology->capabilities
00206       || !technology->write) {
00207       ast_log(LOG_WARNING, "Bridge technology %s failed registration sanity check.\n",
00208          technology->name);
00209       return -1;
00210    }
00211 
00212    AST_RWLIST_WRLOCK(&bridge_technologies);
00213 
00214    /* Look for duplicate bridge technology already using this name, or already registered */
00215    AST_RWLIST_TRAVERSE(&bridge_technologies, current, entry) {
00216       if ((!strcasecmp(current->name, technology->name)) || (current == technology)) {
00217          ast_log(LOG_WARNING, "A bridge technology of %s already claims to exist in our world.\n",
00218             technology->name);
00219          AST_RWLIST_UNLOCK(&bridge_technologies);
00220          return -1;
00221       }
00222    }
00223 
00224    /* Copy module pointer so reference counting can keep the module from unloading */
00225    technology->mod = module;
00226 
00227    /* Insert our new bridge technology into the list and print out a pretty message */
00228    AST_RWLIST_INSERT_TAIL(&bridge_technologies, technology, entry);
00229 
00230    AST_RWLIST_UNLOCK(&bridge_technologies);
00231 
00232    ast_verb(2, "Registered bridge technology %s\n", technology->name);
00233 
00234    return 0;
00235 }

void ast_bridge_technology_suspend ( struct ast_bridge_technology technology  ) 

Suspend a bridge technology from consideration.

Parameters:
technology The 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 2877 of file bridge.c.

References ast_bridge_technology::suspended.

Referenced by handle_bridge_technology_suspend(), and handle_manager_bridge_tech_suspend().

02878 {
02879    technology->suspended = 1;
02880 }

int ast_bridge_technology_unregister ( struct ast_bridge_technology technology  ) 

Unregister a bridge technology from use.

Parameters:
technology The bridge technology to unregister
Return values:
0 on success
-1 on 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 237 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().

00238 {
00239    struct ast_bridge_technology *current;
00240 
00241    AST_RWLIST_WRLOCK(&bridge_technologies);
00242 
00243    /* Ensure the bridge technology is registered before removing it */
00244    AST_RWLIST_TRAVERSE_SAFE_BEGIN(&bridge_technologies, current, entry) {
00245       if (current == technology) {
00246          AST_RWLIST_REMOVE_CURRENT(entry);
00247          ast_verb(2, "Unregistered bridge technology %s\n", technology->name);
00248          break;
00249       }
00250    }
00251    AST_RWLIST_TRAVERSE_SAFE_END;
00252 
00253    AST_RWLIST_UNLOCK(&bridge_technologies);
00254 
00255    return current ? 0 : -1;
00256 }

void ast_bridge_technology_unsuspend ( struct ast_bridge_technology technology  ) 

Unsuspend a bridge technology.

Parameters:
technology The 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 2882 of file bridge.c.

References ast_bridge_technology::suspended.

Referenced by handle_bridge_technology_suspend(), and handle_manager_bridge_tech_suspend().

02883 {
02884    /*
02885     * XXX We may want the act of unsuspending a bridge technology
02886     * to prod all existing bridges to see if they should start
02887     * using it.
02888     */
02889    technology->suspended = 0;
02890 }


Generated on Thu Apr 16 06:29:14 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6