summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2009-06-15 16:07:23 +0000
committerKevin P. Fleming <kpfleming@digium.com>2009-06-15 16:07:23 +0000
commit6c5987811c7c3decff795e46f5b371fa931475fe (patch)
tree890da581f24a2e3e5d3947988627e6a294bed01d /res
parentd224f78dd552131c387d1ccb8dae33d7883ea3a6 (diff)
Redesigned 'optional API' support.
This patch provides a new implementation of the optional API support defined in asterisk/optional_api.h; this new version provides solves compatibility issues with the use of linker version scripts for suppressing global symbols. In addition, there is now a functional (and tested!) implementation for Mac OS/X, so module writers no longer need to use special tests before calling optional API functions. All future implementations must provide these same semantics, so that module writers can rely on them. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_agi.c10
-rw-r--r--res/res_agi.exports7
-rw-r--r--res/res_monitor.c14
-rw-r--r--res/res_monitor.exports12
-rw-r--r--res/res_smdi.c26
-rw-r--r--res/res_smdi.exports26
6 files changed, 49 insertions, 46 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index 6c6e88290..dff477e09 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -927,7 +927,7 @@ static agi_command *find_command(const char * const cmds[], int exact);
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;
@@ -2925,7 +2925,7 @@ static char *help_workhorse(int fd, const char * const match[])
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];
@@ -2956,7 +2956,7 @@ int ast_agi_register(struct ast_module *mod, agi_command *cmd)
}
}
-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;
@@ -2995,7 +2995,7 @@ int ast_agi_unregister(struct ast_module *mod, agi_command *cmd)
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;
@@ -3025,7 +3025,7 @@ int ast_agi_register_multiple(struct ast_module *mod, struct agi_command *cmd, u
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;
diff --git a/res/res_agi.exports b/res/res_agi.exports
index e1b11968f..a305cf2b9 100644
--- a/res/res_agi.exports
+++ b/res/res_agi.exports
@@ -1,7 +1,10 @@
{
global:
- ast_agi_register;
- ast_agi_unregister;
+ *ast_agi_register;
+ *ast_agi_unregister;
+ *ast_agi_register_multiple;
+ *ast_agi_unregister_multiple;
+ *ast_agi_send;
local:
*;
};
diff --git a/res/res_monitor.c b/res/res_monitor.c
index 5f25d8dce..f296cf612 100644
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -283,8 +283,8 @@ static int ast_monitor_set_state(struct ast_channel *chan, int state)
* \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;
@@ -423,7 +423,7 @@ static const char *get_soxmix_format(const char *format)
* 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;
@@ -516,13 +516,13 @@ int ast_monitor_stop(struct ast_channel *chan, int need_lock)
/*! \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);
}
@@ -547,7 +547,7 @@ static int unpause_monitor_exec(struct ast_channel *chan, const char *data)
* \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);
@@ -808,7 +808,7 @@ static int change_monitor_action(struct mansession *s, const struct message *m)
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;
diff --git a/res/res_monitor.exports b/res/res_monitor.exports
index 4352dc8b6..0c97f6a80 100644
--- a/res/res_monitor.exports
+++ b/res/res_monitor.exports
@@ -1,11 +1,11 @@
{
global:
- ast_monitor_change_fname;
- ast_monitor_pause;
- ast_monitor_setjoinfiles;
- ast_monitor_start;
- ast_monitor_stop;
- ast_monitor_unpause;
+ *ast_monitor_change_fname;
+ *ast_monitor_pause;
+ *ast_monitor_setjoinfiles;
+ *ast_monitor_start;
+ *ast_monitor_stop;
+ *ast_monitor_unpause;
local:
*;
};
diff --git a/res/res_smdi.c b/res/res_smdi.c
index e6cf8b4f6..3f7149926 100644
--- a/res/res_smdi.c
+++ b/res/res_smdi.c
@@ -251,7 +251,7 @@ static void ast_smdi_interface_destroy(struct ast_smdi_interface *iface)
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);
}
@@ -311,17 +311,17 @@ static int smdi_toggle_mwi(struct ast_smdi_interface *iface, const char *mailbox
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);
@@ -329,7 +329,7 @@ void ast_smdi_md_message_putback(struct ast_smdi_interface *iface, struct ast_sm
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);
@@ -590,36 +590,36 @@ static void *smdi_message_wait(struct ast_smdi_interface *iface, int timeout,
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));
}
@@ -816,12 +816,12 @@ static void *smdi_read(void *iface_p)
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);
}
diff --git a/res/res_smdi.exports b/res/res_smdi.exports
index 7fe3edff3..e140aba9f 100644
--- a/res/res_smdi.exports
+++ b/res/res_smdi.exports
@@ -1,18 +1,18 @@
{
global:
- ast_smdi_interface_find;
- ast_smdi_interface_unref;
- ast_smdi_md_message_destroy;
- ast_smdi_md_message_pop;
- ast_smdi_md_message_putback;
- ast_smdi_md_message_wait;
- ast_smdi_mwi_message_destroy;
- ast_smdi_mwi_message_pop;
- ast_smdi_mwi_message_putback;
- ast_smdi_mwi_message_wait;
- ast_smdi_mwi_message_wait_station;
- ast_smdi_mwi_set;
- ast_smdi_mwi_unset;
+ *ast_smdi_interface_find;
+ *ast_smdi_interface_unref;
+ *ast_smdi_md_message_destroy;
+ *ast_smdi_md_message_pop;
+ *ast_smdi_md_message_putback;
+ *ast_smdi_md_message_wait;
+ *ast_smdi_mwi_message_destroy;
+ *ast_smdi_mwi_message_pop;
+ *ast_smdi_mwi_message_putback;
+ *ast_smdi_mwi_message_wait;
+ *ast_smdi_mwi_message_wait_station;
+ *ast_smdi_mwi_set;
+ *ast_smdi_mwi_unset;
local:
*;
};