[asterisk-commits] kpfleming: branch kpfleming/new_optional_api r197341 - in /team/kpfleming/new...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 27 18:11:54 CDT 2009
Author: kpfleming
Date: Wed May 27 18:11:49 2009
New Revision: 197341
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=197341
Log:
Branch to hold a new implementation of optional API support. This version does
not get broken by the use of linker version scripts to hide symbols (as the old
one did), and it also provides proper stub function support on Darwin, making
use of the optional APIs by consumer modules no different that non-optional
APIs. Testing so far has only been done on Linux, so testing help is welcome.
Added:
team/kpfleming/new_optional_api/
- copied from r197340, trunk/
Modified:
team/kpfleming/new_optional_api/apps/app_queue.c
team/kpfleming/new_optional_api/apps/app_stack.c
team/kpfleming/new_optional_api/apps/app_voicemail.c
team/kpfleming/new_optional_api/configure
team/kpfleming/new_optional_api/configure.ac
team/kpfleming/new_optional_api/include/asterisk/autoconfig.h.in
team/kpfleming/new_optional_api/include/asterisk/compiler.h
team/kpfleming/new_optional_api/include/asterisk/optional_api.h
team/kpfleming/new_optional_api/res/res_agi.c
team/kpfleming/new_optional_api/res/res_agi.exports
team/kpfleming/new_optional_api/res/res_monitor.c
team/kpfleming/new_optional_api/res/res_smdi.c
Modified: team/kpfleming/new_optional_api/apps/app_queue.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/new_optional_api/apps/app_queue.c?view=diff&rev=197341&r1=197340&r2=197341
==============================================================================
--- team/kpfleming/new_optional_api/apps/app_queue.c (original)
+++ team/kpfleming/new_optional_api/apps/app_queue.c Wed May 27 18:11:49 2009
@@ -4246,18 +4246,16 @@
else
which = peer;
ast_channel_unlock(qe->chan);
- if (ast_monitor_start) {
- if (monitorfilename) {
- ast_monitor_start(which, qe->parent->monfmt, monitorfilename, 1, X_REC_IN | X_REC_OUT);
- } else if (qe->chan->cdr && ast_monitor_start) {
- ast_monitor_start(which, qe->parent->monfmt, qe->chan->cdr->uniqueid, 1, X_REC_IN | X_REC_OUT);
- } else if (ast_monitor_start) {
- /* Last ditch effort -- no CDR, make up something */
- snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random());
- ast_monitor_start(which, qe->parent->monfmt, tmpid, 1, X_REC_IN | X_REC_OUT);
- }
+ if (monitorfilename) {
+ ast_monitor_start(which, qe->parent->monfmt, monitorfilename, 1, X_REC_IN | X_REC_OUT);
+ } else if (qe->chan->cdr) {
+ ast_monitor_start(which, qe->parent->monfmt, qe->chan->cdr->uniqueid, 1, X_REC_IN | X_REC_OUT);
+ } else {
+ /* Last ditch effort -- no CDR, make up something */
+ snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random());
+ ast_monitor_start(which, qe->parent->monfmt, tmpid, 1, X_REC_IN | X_REC_OUT);
}
- if (!ast_strlen_zero(monexec) && ast_monitor_setjoinfiles) {
+ if (!ast_strlen_zero(monexec)) {
ast_monitor_setjoinfiles(which, 1);
}
} else {
Modified: team/kpfleming/new_optional_api/apps/app_stack.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/new_optional_api/apps/app_stack.c?view=diff&rev=197341&r1=197340&r2=197341
==============================================================================
--- team/kpfleming/new_optional_api/apps/app_stack.c (original)
+++ team/kpfleming/new_optional_api/apps/app_stack.c Wed May 27 18:11:49 2009
@@ -637,9 +637,7 @@
static int unload_module(void)
{
- if (ast_agi_unregister) {
- ast_agi_unregister(ast_module_info->self, &gosub_agi_command);
- }
+ ast_agi_unregister(ast_module_info->self, &gosub_agi_command);
ast_unregister_application(app_return);
ast_unregister_application(app_pop);
@@ -653,9 +651,7 @@
static int load_module(void)
{
- if (ast_agi_register) {
- ast_agi_register(ast_module_info->self, &gosub_agi_command);
- }
+ ast_agi_register(ast_module_info->self, &gosub_agi_command);
ast_register_application_xml(app_pop, pop_exec);
ast_register_application_xml(app_return, return_exec);
Modified: team/kpfleming/new_optional_api/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/new_optional_api/apps/app_voicemail.c?view=diff&rev=197341&r1=197340&r2=197341
==============================================================================
--- team/kpfleming/new_optional_api/apps/app_voicemail.c (original)
+++ team/kpfleming/new_optional_api/apps/app_voicemail.c Wed May 27 18:11:49 2009
@@ -10699,10 +10699,10 @@
if ((val = ast_variable_retrieve(cfg, "general", "smdienable")) && ast_true(val)) {
ast_debug(1, "Enabled SMDI voicemail notification\n");
if ((val = ast_variable_retrieve(cfg, "general", "smdiport"))) {
- smdi_iface = ast_smdi_interface_find ? ast_smdi_interface_find(val) : NULL;
+ smdi_iface = ast_smdi_interface_find(val);
} else {
ast_debug(1, "No SMDI interface set, trying default (/dev/ttyS0)\n");
- smdi_iface = ast_smdi_interface_find ? ast_smdi_interface_find("/dev/ttyS0") : NULL;
+ smdi_iface = ast_smdi_interface_find("/dev/ttyS0");
}
if (!smdi_iface) {
ast_log(AST_LOG_ERROR, "No valid SMDI interface specfied, disabling SMDI voicemail notification\n");
Modified: team/kpfleming/new_optional_api/configure.ac
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/new_optional_api/configure.ac?view=diff&rev=197341&r1=197340&r2=197341
==============================================================================
--- team/kpfleming/new_optional_api/configure.ac (original)
+++ team/kpfleming/new_optional_api/configure.ac Wed May 27 18:11:49 2009
@@ -512,9 +512,8 @@
AST_GCC_ATTRIBUTE(deprecated)
AST_GCC_ATTRIBUTE(sentinel)
AST_GCC_ATTRIBUTE(warn_unused_result)
-AST_GCC_ATTRIBUTE(weak)
+AST_GCC_ATTRIBUTE(weakref, [weakref("foo")])
AST_GCC_ATTRIBUTE(weak_import)
-AST_GCC_ATTRIBUTE(alias, [alias("foo")])
AC_MSG_CHECKING(for -ffunction-sections support)
saved_CFLAGS="${CFLAGS}"
Modified: team/kpfleming/new_optional_api/include/asterisk/autoconfig.h.in
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/new_optional_api/include/asterisk/autoconfig.h.in?view=diff&rev=197341&r1=197340&r2=197341
==============================================================================
--- team/kpfleming/new_optional_api/include/asterisk/autoconfig.h.in (original)
+++ team/kpfleming/new_optional_api/include/asterisk/autoconfig.h.in Wed May 27 18:11:49 2009
@@ -94,9 +94,6 @@
/* Define to 1 if you have the `atexit' function. */
#undef HAVE_ATEXIT
-/* Define to 1 if your GCC C compiler supports the 'alias' attribute. */
-#undef HAVE_ATTRIBUTE_alias
-
/* Define to 1 if your GCC C compiler supports the 'always_inline' attribute.
*/
#undef HAVE_ATTRIBUTE_always_inline
@@ -123,11 +120,11 @@
attribute. */
#undef HAVE_ATTRIBUTE_warn_unused_result
-/* Define to 1 if your GCC C compiler supports the 'weak' attribute. */
-#undef HAVE_ATTRIBUTE_weak
-
/* Define to 1 if your GCC C compiler supports the 'weak_import' attribute. */
#undef HAVE_ATTRIBUTE_weak_import
+
+/* Define to 1 if your GCC C compiler supports the 'weakref' attribute. */
+#undef HAVE_ATTRIBUTE_weakref
/* Define this to indicate the ${BKTR_DESCRIP} library */
#undef HAVE_BKTR
@@ -1205,9 +1202,6 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
-/* Define to 1 if the C compiler supports function prototypes. */
-#undef PROTOTYPES
-
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#undef PTHREAD_CREATE_JOINABLE
@@ -1223,11 +1217,6 @@
/* Define to the type of arg 5 for `select'. */
#undef SELECT_TYPE_ARG5
-
-/* Define to 1 if the `setvbuf' function takes the buffering type as its
- second argument and the buffer pointer as the third, as on System V before
- release 3. */
-#undef SETVBUF_REVERSED
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
@@ -1249,20 +1238,30 @@
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
-/* Define to 1 if on AIX 3.
- System headers sometimes define this.
- We just want to avoid a redefinition error message. */
+/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
#undef _LARGEFILE_SOURCE
@@ -1279,20 +1278,6 @@
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
-
-/* Enable extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
-
-/* Define like PROTOTYPES; this can be used by system headers. */
-#undef __PROTOTYPES
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
Modified: team/kpfleming/new_optional_api/include/asterisk/compiler.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/new_optional_api/include/asterisk/compiler.h?view=diff&rev=197341&r1=197340&r2=197341
==============================================================================
--- team/kpfleming/new_optional_api/include/asterisk/compiler.h (original)
+++ team/kpfleming/new_optional_api/include/asterisk/compiler.h Wed May 27 18:11:49 2009
@@ -68,16 +68,4 @@
/* Some older version of GNU gcc (3.3.5 on OpenBSD 4.3 for example) dont like 'NULL' as sentinel */
#define SENTINEL ((char *)NULL)
-#ifdef HAVE_ATTRIBUTE_weak
-#define attribute_weak __attribute__((weak))
-#else
-#define attribute_weak
-#endif
-
-#ifdef HAVE_ATTRIBUTE_weak_import
-#define attribute_weak_import __attribute__((weak_import))
-#else
-#define attribute_weak_import
-#endif
-
#endif /* _ASTERISK_COMPILER_H */
Modified: team/kpfleming/new_optional_api/include/asterisk/optional_api.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/new_optional_api/include/asterisk/optional_api.h?view=diff&rev=197341&r1=197340&r2=197341
==============================================================================
--- team/kpfleming/new_optional_api/include/asterisk/optional_api.h (original)
+++ team/kpfleming/new_optional_api/include/asterisk/optional_api.h Wed May 27 18:11:49 2009
@@ -57,13 +57,25 @@
* safely know that the API is not available, and to avoid using any
* other APIs from the not-present provider.
*
+ * In addition to this declaration in the header file, the actual definition of
+ * the API function must use the AST_OPTIONAL_API_NAME macro to (possibly)
+ * modify the real name of the API function, depending on the specific
+ * implementation requirements. The corresponding example from res_agi.c:
+ *
+ * \code
+ * int AST_OPTIONAL_API_NAME(ast_agi_register)(struct ast_module *mod, agi_command *cmd)
+ * {
+ * ...
+ * }
+ * \endcode
+ *
* In the module providing the API, the AST_OPTIONAL_API macro must
* be informed that it should not build the hidden stub function or
* apply special aliases to the function prototype; this can be done
* by defining AST_API_MODULE just before including the header file
* containing the AST_OPTIONAL_API macro calls.
*
- * \note If the GCC 'weak' and 'alias' attributes are not available,
+ * \note If the platform does not provide adequate resources,
* then the AST_OPTIONAL_API macro will result in a non-optional function
* definition; this means that any consumers of the API functions so
* defined will require that the provider of the API functions be
@@ -83,17 +95,115 @@
*/
#define AST_OPTIONAL_API_UNAVAILABLE INT_MIN
-#if defined(HAVE_ATTRIBUTE_weak_import) && !defined(AST_API_MODULE)
-#define AST_OPTIONAL_API(result, name, proto, stub) result name proto __attribute__((weak_import));
-#define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub) result name proto __attribute__((weak_import,attr));
-#elif defined(HAVE_ATTRIBUTE_weak) && defined(HAVE_ATTRIBUTE_alias) && !defined(AST_API_MODULE) && !defined(HAVE_ATTRIBUTE_weak_import)
-#define AST_OPTIONAL_API(result, name, proto, stub) \
- static result __##name proto stub; \
- result __attribute__((weak, alias("__" __stringify(name)))) name proto;
-#define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub) \
- static result __attribute__((attr)) __##name proto stub; \
- result __attribute__((weak, alias("__" __stringify(name)), attr)) name proto;
+
+#if defined(HAVE_ATTRIBUTE_weak_import)
+
+/*
+ * This is the Darwin (Mac OS/X) implementation, that only provides the
+ * 'weak_import' compiler attribute for weak symbols. On this platform,
+ *
+ * - The module providing the API will only provide a '__' prefixed version
+ * of the API function to other modules (this will be hidden from the other
+ * modules by the macros), so any modules compiled against older versions
+ * of the module that provided a non-prefixed version of the API function
+ * will fail to link at runtime.
+ * - In the API module itself, access to the API function without using a
+ * prefixed name is provided by a static pointer variable that holds the
+ * function address.
+ * - 'Consumer' modules of the API will use a combination of a weak_import
+ * symbol, a local stub function, a pointer variable and a constructor function
+ * (which initializes that pointer variable as the module is being loaded)
+ * to provide safe, optional access to the API function without any special
+ * code being required.
+ */
+
+#define AST_OPTIONAL_API_NAME(name) __##name
+
+#if defined(AST_API_MODULE)
+
+#define AST_OPTIONAL_API(result, name, proto, stub) \
+ result AST_OPTIONAL_API_NAME(name) proto; \
+ static attribute_unused typeof(AST_OPTIONAL_API_NAME(name)) * name = AST_OPTIONAL_API_NAME(name);
+
+#define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub) \
+ result __attribute__((attr)) AST_OPTIONAL_API_NAME(name) proto; \
+ static attribute_unused typeof(AST_OPTIONAL_API_NAME(name)) * name = AST_OPTIONAL_API_NAME(name);
+
#else
+
+#define AST_OPTIONAL_API(result, name, proto, stub) \
+ static result __stub__##name proto stub; \
+ static __attribute__((weak_import)) typeof(__stub__##name) __##name; \
+ static attribute_unused typeof(__stub__##name) * name; \
+ static void __attribute__((constructor)) __init__##name(void) { name = __##name ? : __stub__##name; }
+
+#define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub) \
+ static __attribute__((attr)) result __stub__##name proto stub; \
+ static __attribute__((attr, weak_import)) typeof(__stub__##name) __##name; \
+ static attribute_unused __attribute__((attr)) typeof(__stub__##name) * name; \
+ static void __attribute__((constructor)) __init__##name(void) { name = __##name ? : __stub__##name; }
+
+
+#endif
+
+/* End of Darwin (Mac OS/X) implementation */
+
+#elif defined(HAVE_ATTRIBUTE_weakref)
+
+/*
+ * This is the generic GCC implementation, used when the 'weakref'
+ * compiler attribute is available. On these platforms:
+ *
+ * - The module providing the API will provide a '__' prefixed version
+ * of the API function to other modules (this will be hidden from the other
+ * modules by the macros), and also a non-prefixed alias so that modules
+ * compiled against older versions of the module that provided a non-prefixed
+ * version of the API function will continue to link properly.
+ * - In the API module itself, access to the API function without using a
+ * prefixed name is provided by the non-prefixed alias described above.
+ * - 'Consumer' modules of the API will use a combination of a weakref
+ * symbol, a local stub function, a pointer variable and a constructor function
+ * (which initializes that pointer variable as the module is being loaded)
+ * to provide safe, optional access to the API function without any special
+ * code being required.
+ */
+
+#define AST_OPTIONAL_API_NAME(name) __##name
+
+#if defined(AST_API_MODULE)
+
+#define AST_OPTIONAL_API(result, name, proto, stub) \
+ result AST_OPTIONAL_API_NAME(name) proto; \
+ __attribute__((alias(__stringify(AST_OPTIONAL_API_NAME(name))))) typeof(AST_OPTIONAL_API_NAME(name)) name;
+
+#define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub) \
+ result __attribute__((attr)) AST_OPTIONAL_API_NAME(name) proto; \
+ __attribute__((alias(__stringify(AST_OPTIONAL_API_NAME(name))))) typeof(AST_OPTIONAL_API_NAME(name)) name;
+
+#else
+
+#define AST_OPTIONAL_API(result, name, proto, stub) \
+ static result __stub__##name proto stub; \
+ static __attribute__((weakref(__stringify(AST_OPTIONAL_API_NAME(name))))) typeof(__stub__##name) __ref__##name; \
+ static attribute_unused typeof(__stub__##name) * name; \
+ static void __attribute__((constructor)) __init__##name(void) { name = __ref__##name ? : __stub__##name; }
+
+#define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub) \
+ static __attribute__((attr)) result __stub__##name proto stub; \
+ static __attribute__((attr, weakref(__stringify(AST_OPTIONAL_API_NAME(name))))) typeof(__stub__##name) __ref__##name; \
+ static attribute_unused __attribute__((attr)) typeof(__stub__##name) * name; \
+ static void __attribute__((constructor)) __init__##name(void) { name = __ref__##name ? : __stub__##name; }
+
+#endif
+
+/* End of GCC implementation */
+
+#else
+
+/* This is the non-optional implementation. */
+
+#define AST_OPTIONAL_API_NAME(name) name
+
/*!
* \brief Define an optional API function
*
@@ -108,7 +218,8 @@
* { return AST_OPTIONAL_API_UNAVAILABLE; });
* \endcode
*/
-#define AST_OPTIONAL_API(result, name, proto, stub) result name proto;
+#define AST_OPTIONAL_API(result, name, proto, stub) result AST_OPTIONAL_API_NAME(name) proto
+
/*!
* \brief Define an optional API function with compiler attributes
*
@@ -118,7 +229,10 @@
* \param proto The prototype (arguments) of the function
* \param stub The code block that will be used by the hidden stub when needed
*/
-#define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub) result __attribute__((attr)) name proto;
+#define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub) result __attribute__((attr)) AST_OPTIONAL_API_NAME(name) proto
+
+/* End of non-optional implementation */
+
#endif
#undef AST_API_MODULE
Modified: team/kpfleming/new_optional_api/res/res_agi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/new_optional_api/res/res_agi.c?view=diff&rev=197341&r1=197340&r2=197341
==============================================================================
--- team/kpfleming/new_optional_api/res/res_agi.c (original)
+++ team/kpfleming/new_optional_api/res/res_agi.c Wed May 27 18:11:49 2009
@@ -850,7 +850,7 @@
AST_THREADSTORAGE(agi_buf);
#define AGI_BUF_INITSIZE 256
-int ast_agi_send(int fd, struct ast_channel *chan, char *fmt, ...)
+int AST_OPTIONAL_API_NAME(ast_agi_send)(int fd, struct ast_channel *chan, char *fmt, ...)
{
int res = 0;
va_list ap;
@@ -2856,7 +2856,7 @@
return CLI_SUCCESS;
}
-int ast_agi_register(struct ast_module *mod, agi_command *cmd)
+int AST_OPTIONAL_API_NAME(ast_agi_register)(struct ast_module *mod, agi_command *cmd)
{
char fullcmd[MAX_CMD_LEN];
@@ -2887,7 +2887,7 @@
}
}
-int ast_agi_unregister(struct ast_module *mod, agi_command *cmd)
+int AST_OPTIONAL_API_NAME(ast_agi_unregister)(struct ast_module *mod, agi_command *cmd)
{
struct agi_command *e;
int unregistered = 0;
@@ -2926,7 +2926,7 @@
return unregistered;
}
-int ast_agi_register_multiple(struct ast_module *mod, struct agi_command *cmd, unsigned int len)
+int AST_OPTIONAL_API_NAME(ast_agi_register_multiple)(struct ast_module *mod, struct agi_command *cmd, unsigned int len)
{
unsigned int i, x = 0;
@@ -2956,7 +2956,7 @@
return 0;
}
-int ast_agi_unregister_multiple(struct ast_module *mod, struct agi_command *cmd, unsigned int len)
+int AST_OPTIONAL_API_NAME(ast_agi_unregister_multiple)(struct ast_module *mod, struct agi_command *cmd, unsigned int len)
{
unsigned int i;
int res = 0;
Modified: team/kpfleming/new_optional_api/res/res_agi.exports
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/new_optional_api/res/res_agi.exports?view=diff&rev=197341&r1=197340&r2=197341
==============================================================================
--- team/kpfleming/new_optional_api/res/res_agi.exports (original)
+++ team/kpfleming/new_optional_api/res/res_agi.exports Wed May 27 18:11:49 2009
@@ -2,6 +2,14 @@
global:
ast_agi_register;
ast_agi_unregister;
+ ast_agi_register_multiple;
+ ast_agi_unregister_multiple;
+ ast_agi_send;
+ __ast_agi_register;
+ __ast_agi_unregister;
+ __ast_agi_register_multiple;
+ __ast_agi_unregister_multiple;
+ __ast_agi_send;
local:
*;
};
Modified: team/kpfleming/new_optional_api/res/res_monitor.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/new_optional_api/res/res_monitor.c?view=diff&rev=197341&r1=197340&r2=197341
==============================================================================
--- team/kpfleming/new_optional_api/res/res_monitor.c (original)
+++ team/kpfleming/new_optional_api/res/res_monitor.c Wed May 27 18:11:49 2009
@@ -145,8 +145,8 @@
* \retval 0 on success
* \retval -1 on failure
*/
-int ast_monitor_start( struct ast_channel *chan, const char *format_spec,
- const char *fname_base, int need_lock, int stream_action)
+int AST_OPTIONAL_API_NAME(ast_monitor_start)(struct ast_channel *chan, const char *format_spec,
+ const char *fname_base, int need_lock, int stream_action)
{
int res = 0;
@@ -285,7 +285,7 @@
* Stop the recording, close any open streams, mix in/out channels if required
* \return Always 0
*/
-int ast_monitor_stop(struct ast_channel *chan, int need_lock)
+int AST_OPTIONAL_API_NAME(ast_monitor_stop)(struct ast_channel *chan, int need_lock)
{
int delfiles = 0;
@@ -378,13 +378,13 @@
/*! \brief Pause monitoring of channel */
-int ast_monitor_pause(struct ast_channel *chan)
+int AST_OPTIONAL_API_NAME(ast_monitor_pause)(struct ast_channel *chan)
{
return ast_monitor_set_state(chan, AST_MONITOR_PAUSED);
}
/*! \brief Unpause monitoring of channel */
-int ast_monitor_unpause(struct ast_channel *chan)
+int AST_OPTIONAL_API_NAME(ast_monitor_unpause)(struct ast_channel *chan)
{
return ast_monitor_set_state(chan, AST_MONITOR_RUNNING);
}
@@ -409,7 +409,7 @@
* \retval 0 on success.
* \retval -1 on failure.
*/
-int ast_monitor_change_fname(struct ast_channel *chan, const char *fname_base, int need_lock)
+int AST_OPTIONAL_API_NAME(ast_monitor_change_fname)(struct ast_channel *chan, const char *fname_base, int need_lock)
{
if (ast_strlen_zero(fname_base)) {
ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to null\n", chan->name);
@@ -697,7 +697,7 @@
return 0;
}
-void ast_monitor_setjoinfiles(struct ast_channel *chan, int turnon)
+void AST_OPTIONAL_API_NAME(ast_monitor_setjoinfiles)(struct ast_channel *chan, int turnon)
{
if (chan->monitor)
chan->monitor->joinfiles = turnon;
Modified: team/kpfleming/new_optional_api/res/res_smdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/new_optional_api/res/res_smdi.c?view=diff&rev=197341&r1=197340&r2=197341
==============================================================================
--- team/kpfleming/new_optional_api/res/res_smdi.c (original)
+++ team/kpfleming/new_optional_api/res/res_smdi.c Wed May 27 18:11:49 2009
@@ -157,7 +157,7 @@
ast_module_unref(ast_module_info->self);
}
-void ast_smdi_interface_unref(struct ast_smdi_interface *iface)
+void AST_OPTIONAL_API_NAME(ast_smdi_interface_unref)(struct ast_smdi_interface *iface)
{
ASTOBJ_UNREF(iface, ast_smdi_interface_destroy);
}
@@ -217,17 +217,17 @@
return 0;
}
-int ast_smdi_mwi_set(struct ast_smdi_interface *iface, const char *mailbox)
+int AST_OPTIONAL_API_NAME(ast_smdi_mwi_set)(struct ast_smdi_interface *iface, const char *mailbox)
{
return smdi_toggle_mwi(iface, mailbox, 1);
}
-int ast_smdi_mwi_unset(struct ast_smdi_interface *iface, const char *mailbox)
+int AST_OPTIONAL_API_NAME(ast_smdi_mwi_unset)(struct ast_smdi_interface *iface, const char *mailbox)
{
return smdi_toggle_mwi(iface, mailbox, 0);
}
-void ast_smdi_md_message_putback(struct ast_smdi_interface *iface, struct ast_smdi_md_message *md_msg)
+void AST_OPTIONAL_API_NAME(ast_smdi_md_message_putback)(struct ast_smdi_interface *iface, struct ast_smdi_md_message *md_msg)
{
ast_mutex_lock(&iface->md_q_lock);
ASTOBJ_CONTAINER_LINK_START(&iface->md_q, md_msg);
@@ -235,7 +235,7 @@
ast_mutex_unlock(&iface->md_q_lock);
}
-void ast_smdi_mwi_message_putback(struct ast_smdi_interface *iface, struct ast_smdi_mwi_message *mwi_msg)
+void AST_OPTIONAL_API_NAME(ast_smdi_mwi_message_putback)(struct ast_smdi_interface *iface, struct ast_smdi_mwi_message *mwi_msg)
{
ast_mutex_lock(&iface->mwi_q_lock);
ASTOBJ_CONTAINER_LINK_START(&iface->mwi_q, mwi_msg);
@@ -494,36 +494,36 @@
return NULL;
}
-struct ast_smdi_md_message *ast_smdi_md_message_pop(struct ast_smdi_interface *iface)
+struct ast_smdi_md_message * AST_OPTIONAL_API_NAME(ast_smdi_md_message_pop)(struct ast_smdi_interface *iface)
{
return smdi_msg_pop(iface, SMDI_MD);
}
-struct ast_smdi_md_message *ast_smdi_md_message_wait(struct ast_smdi_interface *iface, int timeout)
+struct ast_smdi_md_message * AST_OPTIONAL_API_NAME(ast_smdi_md_message_wait)(struct ast_smdi_interface *iface, int timeout)
{
struct ast_flags options = { 0 };
return smdi_message_wait(iface, timeout, SMDI_MD, NULL, options);
}
-struct ast_smdi_mwi_message *ast_smdi_mwi_message_pop(struct ast_smdi_interface *iface)
+struct ast_smdi_mwi_message * AST_OPTIONAL_API_NAME(ast_smdi_mwi_message_pop)(struct ast_smdi_interface *iface)
{
return smdi_msg_pop(iface, SMDI_MWI);
}
-struct ast_smdi_mwi_message *ast_smdi_mwi_message_wait(struct ast_smdi_interface *iface, int timeout)
+struct ast_smdi_mwi_message * AST_OPTIONAL_API_NAME(ast_smdi_mwi_message_wait)(struct ast_smdi_interface *iface, int timeout)
{
struct ast_flags options = { 0 };
return smdi_message_wait(iface, timeout, SMDI_MWI, NULL, options);
}
-struct ast_smdi_mwi_message *ast_smdi_mwi_message_wait_station(struct ast_smdi_interface *iface, int timeout,
+struct ast_smdi_mwi_message * AST_OPTIONAL_API_NAME(ast_smdi_mwi_message_wait_station)(struct ast_smdi_interface *iface, int timeout,
const char *station)
{
struct ast_flags options = { 0 };
return smdi_message_wait(iface, timeout, SMDI_MWI, station, options);
}
-struct ast_smdi_interface *ast_smdi_interface_find(const char *iface_name)
+struct ast_smdi_interface * AST_OPTIONAL_API_NAME(ast_smdi_interface_find)(const char *iface_name)
{
return (ASTOBJ_CONTAINER_FIND(&smdi_ifaces, iface_name));
}
@@ -720,12 +720,12 @@
return NULL;
}
-void ast_smdi_md_message_destroy(struct ast_smdi_md_message *msg)
+void AST_OPTIONAL_API_NAME(ast_smdi_md_message_destroy)(struct ast_smdi_md_message *msg)
{
ast_free(msg);
}
-void ast_smdi_mwi_message_destroy(struct ast_smdi_mwi_message *msg)
+void AST_OPTIONAL_API_NAME(ast_smdi_mwi_message_destroy)(struct ast_smdi_mwi_message *msg)
{
ast_free(msg);
}
More information about the asterisk-commits
mailing list