[asterisk-commits] file: branch file/bridging r171836 - in /team/file/bridging: bridges/ include...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jan 28 07:00:39 CST 2009
Author: file
Date: Wed Jan 28 07:00:38 2009
New Revision: 171836
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=171836
Log:
Move bridging technology stuff to a separate header file. Users of the bridging API itself won't need to use any of the stuff in it, but any bridging technologies will.
Added:
team/file/bridging/include/asterisk/bridging_technology.h (with props)
Modified:
team/file/bridging/bridges/bridge_multiplexed.c
team/file/bridging/bridges/bridge_simple.c
team/file/bridging/bridges/bridge_softmix.c
team/file/bridging/include/asterisk/bridging.h
team/file/bridging/main/bridging.c
Modified: team/file/bridging/bridges/bridge_multiplexed.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/bridges/bridge_multiplexed.c?view=diff&rev=171836&r1=171835&r2=171836
==============================================================================
--- team/file/bridging/bridges/bridge_multiplexed.c (original)
+++ team/file/bridging/bridges/bridge_multiplexed.c Wed Jan 28 07:00:38 2009
@@ -39,6 +39,7 @@
#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"
Modified: team/file/bridging/bridges/bridge_simple.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/bridges/bridge_simple.c?view=diff&rev=171836&r1=171835&r2=171836
==============================================================================
--- team/file/bridging/bridges/bridge_simple.c (original)
+++ team/file/bridging/bridges/bridge_simple.c Wed Jan 28 07:00:38 2009
@@ -38,6 +38,7 @@
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/bridging.h"
+#include "asterisk/bridging_technology.h"
#include "asterisk/frame.h"
static int simple_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
Modified: team/file/bridging/bridges/bridge_softmix.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/bridges/bridge_softmix.c?view=diff&rev=171836&r1=171835&r2=171836
==============================================================================
--- team/file/bridging/bridges/bridge_softmix.c (original)
+++ team/file/bridging/bridges/bridge_softmix.c Wed Jan 28 07:00:38 2009
@@ -44,6 +44,7 @@
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/bridging.h"
+#include "asterisk/bridging_technology.h"
#include "asterisk/frame.h"
#include "asterisk/options.h"
#include "asterisk/logger.h"
Modified: team/file/bridging/include/asterisk/bridging.h
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/include/asterisk/bridging.h?view=diff&rev=171836&r1=171835&r2=171836
==============================================================================
--- team/file/bridging/include/asterisk/bridging.h (original)
+++ team/file/bridging/include/asterisk/bridging.h Wed Jan 28 07:00:38 2009
@@ -80,16 +80,6 @@
AST_BRIDGE_CAPABILITY_OPTIMIZE = (1 << 7),
};
-/*! \brief Preference for choosing the bridge technology */
-enum ast_bridge_preference {
- /*! Bridge technology should have high precedence over other bridge technologies */
- AST_BRIDGE_PREFERENCE_HIGH = 0,
- /*! Bridge technology is decent, not the best but should still be considered over low */
- AST_BRIDGE_PREFERENCE_MEDIUM,
- /*! Bridge technology is low, it should not be considered unless it is absolutely needed */
- AST_BRIDGE_PREFERENCE_LOW,
-};
-
/*! \brief State information about a bridged channel */
enum ast_bridge_channel_state {
/*! Waiting for a signal */
@@ -136,45 +126,10 @@
AST_BRIDGE_BUILTIN_END,
};
+struct ast_bridge_technology;
struct ast_bridge;
struct ast_bridge_channel;
struct ast_bridge_features;
-
-/*!
- * \brief Structure that is the essence of a bridge technology
- */
-struct ast_bridge_technology {
- /*! Unique name to this bridge technology */
- const char *name;
- /*! The capabilities that this bridge technology is capable of */
- int capabilities;
- /*! Preference level that should be used when determining whether to use this bridge technology or not */
- enum ast_bridge_preference preference;
- /*! Callback for when a bridge is being created */
- int (*create)(struct ast_bridge *bridge);
- /*! Callback for when a bridge is being destroyed */
- int (*destroy)(struct ast_bridge *bridge);
- /*! Callback for when a channel is being added to a bridge */
- int (*join)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
- /*! Callback for when a channel is leaving a bridge */
- int (*leave)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
- /*! Callback for writing a frame into the bridging technology */
- enum ast_bridge_write_result (*write)(struct ast_bridge *bridge, struct ast_bridge_channel *bridged_channel, struct ast_frame *frame);
- /*! Callback for when a file descriptor trips */
- int (*fd)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, int fd);
- /*! Callback for replacement thread function */
- int (*thread)(struct ast_bridge *bridge);
- /*! Callback for poking a bridge thread */
- int (*poke)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
- /*! Formats that the bridge technology supports */
- int formats;
- /*! Bit to indicate whether the bridge technology is currently suspended or not */
- unsigned int suspended:1;
- /*! Module this bridge technology belongs to. Is used for reference counting when creating/destroying a bridge. */
- struct ast_module *mod;
- /*! Linked list information */
- AST_RWLIST_ENTRY(ast_bridge_technology) entry;
-};
/*!
* \brief Features hook callback type
@@ -280,47 +235,6 @@
AST_LIST_HEAD_NOLOCK(, ast_bridge_channel) channels;
};
-/*! \brief Register a bridge technology for use
- *
- * \param technology The bridge technology to register
- * \param module The module that is registering the bridge technology
- *
- * \retval 0 on success
- * \retval -1 on failure
- *
- * Example usage:
- *
- * \code
- * ast_bridge_technology_register(&simple_bridge_tech);
- * \endcode
- *
- * 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.
- */
-#define ast_bridge_technology_register(technology) __ast_bridge_technology_register(technology, ast_module_info->self)
-
-int __ast_bridge_technology_register(struct ast_bridge_technology *technology, struct ast_module *mod);
-
-/*! \brief Unregister a bridge technology from use
- *
- * \param technology The bridge technology to unregister
- *
- * \retval 0 on success
- * \retval -1 on failure
- *
- * Example usage:
- *
- * \code
- * ast_bridge_technology_unregister(&simple_bridge_tech);
- * \endcode
- *
- * 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.
- */
-int ast_bridge_technology_unregister(struct ast_bridge_technology *technology);
-
/*! \brief Feed notification that a frame is waiting on a channel into the bridging core
*
* \param bridge
@@ -567,38 +481,6 @@
*/
void ast_bridge_change_state(struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_state new_state);
-
-/*! \brief Suspend a bridge technology from consideration
- *
- * \param technology The bridge technology to suspend
- *
- * Example usage:
- *
- * \code
- * ast_bridge_technology_suspend(&simple_bridge_tech);
- * \endcode
- *
- * 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.
- */
-void ast_bridge_technology_suspend(struct ast_bridge_technology *technology);
-
-/*! \brief Unsuspend a bridge technology
- *
- * \param technology The bridge technology to unsuspend
- *
- * Example usage:
- *
- * \code
- * ast_bridge_technology_unsuspend(&simple_bridge_tech);
- * \endcode
- *
- * This makes the bridge technology simple_bridge_tech considered when
- * creating a new bridge again.
- */
-void ast_bridge_technology_unsuspend(struct ast_bridge_technology *technology);
-
/*! \brief Attach a custom hook to a bridge features structure
*
* \param features Bridge features structure
Added: team/file/bridging/include/asterisk/bridging_technology.h
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/include/asterisk/bridging_technology.h?view=auto&rev=171836
==============================================================================
--- team/file/bridging/include/asterisk/bridging_technology.h (added)
+++ team/file/bridging/include/asterisk/bridging_technology.h Wed Jan 28 07:00:38 2009
@@ -1,0 +1,173 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 1999 - 2008, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ * \brief Channel Bridging API
+ * \author Joshua Colp <jcolp at digium.com>
+ */
+
+#ifndef _ASTERISK_BRIDGING_TECHNOLOGY_H
+#define _ASTERISK_BRIDGING_TECHNOLOGY_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/*! \brief Preference for choosing the bridge technology */
+enum ast_bridge_preference {
+ /*! Bridge technology should have high precedence over other bridge technologies */
+ AST_BRIDGE_PREFERENCE_HIGH = 0,
+ /*! Bridge technology is decent, not the best but should still be considered over low */
+ AST_BRIDGE_PREFERENCE_MEDIUM,
+ /*! Bridge technology is low, it should not be considered unless it is absolutely needed */
+ AST_BRIDGE_PREFERENCE_LOW,
+};
+
+/*!
+ * \brief Structure that is the essence of a bridge technology
+ */
+struct ast_bridge_technology {
+ /*! Unique name to this bridge technology */
+ const char *name;
+ /*! The capabilities that this bridge technology is capable of */
+ int capabilities;
+ /*! Preference level that should be used when determining whether to use this bridge technology or not */
+ enum ast_bridge_preference preference;
+ /*! Callback for when a bridge is being created */
+ int (*create)(struct ast_bridge *bridge);
+ /*! Callback for when a bridge is being destroyed */
+ int (*destroy)(struct ast_bridge *bridge);
+ /*! Callback for when a channel is being added to a bridge */
+ int (*join)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
+ /*! Callback for when a channel is leaving a bridge */
+ int (*leave)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
+ /*! Callback for writing a frame into the bridging technology */
+ enum ast_bridge_write_result (*write)(struct ast_bridge *bridge, struct ast_bridge_channel *bridged_channel, struct ast_frame *frame);
+ /*! Callback for when a file descriptor trips */
+ int (*fd)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, int fd);
+ /*! Callback for replacement thread function */
+ int (*thread)(struct ast_bridge *bridge);
+ /*! Callback for poking a bridge thread */
+ int (*poke)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
+ /*! Formats that the bridge technology supports */
+ int formats;
+ /*! Bit to indicate whether the bridge technology is currently suspended or not */
+ unsigned int suspended:1;
+ /*! Module this bridge technology belongs to. Is used for reference counting when creating/destroying a bridge. */
+ struct ast_module *mod;
+ /*! Linked list information */
+ AST_RWLIST_ENTRY(ast_bridge_technology) entry;
+};
+
+/*! \brief Register a bridge technology for use
+ *
+ * \param technology The bridge technology to register
+ * \param module The module that is registering the bridge technology
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * ast_bridge_technology_register(&simple_bridge_tech);
+ * \endcode
+ *
+ * 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.
+ */
+#define ast_bridge_technology_register(technology) __ast_bridge_technology_register(technology, ast_module_info->self)
+
+int __ast_bridge_technology_register(struct ast_bridge_technology *technology, struct ast_module *mod);
+
+/*! \brief Unregister a bridge technology from use
+ *
+ * \param technology The bridge technology to unregister
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * ast_bridge_technology_unregister(&simple_bridge_tech);
+ * \endcode
+ *
+ * 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.
+ */
+int ast_bridge_technology_unregister(struct ast_bridge_technology *technology);
+
+/*! \brief Feed notification that a frame is waiting on a channel into the bridging core
+ *
+ * \param bridge
+ * \param bridge_channel
+ * \param chan
+ * \param outfd
+ *
+ * Example usage:
+ *
+ * \code
+ * ast_bridge_handle_trip(bridge, NULL, chan, -1);
+ * \endcode
+ *
+ * This tells the bridging core that a frame has been received on
+ * the channel pointed to by chan and that it should be read and handled.
+ *
+ * \note This should only be used by bridging technologies.
+ */
+void ast_bridge_handle_trip(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_channel *chan, int outfd);
+
+/*! \brief Suspend a bridge technology from consideration
+ *
+ * \param technology The bridge technology to suspend
+ *
+ * Example usage:
+ *
+ * \code
+ * ast_bridge_technology_suspend(&simple_bridge_tech);
+ * \endcode
+ *
+ * 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.
+ */
+void ast_bridge_technology_suspend(struct ast_bridge_technology *technology);
+
+/*! \brief Unsuspend a bridge technology
+ *
+ * \param technology The bridge technology to unsuspend
+ *
+ * Example usage:
+ *
+ * \code
+ * ast_bridge_technology_unsuspend(&simple_bridge_tech);
+ * \endcode
+ *
+ * This makes the bridge technology simple_bridge_tech considered when
+ * creating a new bridge again.
+ */
+void ast_bridge_technology_unsuspend(struct ast_bridge_technology *technology);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* _ASTERISK_BRIDGING_TECHNOLOGY_H */
Propchange: team/file/bridging/include/asterisk/bridging_technology.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/file/bridging/include/asterisk/bridging_technology.h
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Propchange: team/file/bridging/include/asterisk/bridging_technology.h
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/file/bridging/main/bridging.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/main/bridging.c?view=diff&rev=171836&r1=171835&r2=171836
==============================================================================
--- team/file/bridging/main/bridging.c (original)
+++ team/file/bridging/main/bridging.c Wed Jan 28 07:00:38 2009
@@ -36,6 +36,7 @@
#include "asterisk/lock.h"
#include "asterisk/linkedlists.h"
#include "asterisk/bridging.h"
+#include "asterisk/bridging_technology.h"
#include "asterisk/app.h"
#include "asterisk/file.h"
#include "asterisk/module.h"
More information about the asterisk-commits
mailing list