aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-14 14:08:19 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-14 14:08:19 +0000
commit3664249356aa4768fcb0b3b8e6cf9365fcbd0c8d (patch)
treeb68f48482e463e9c31126b2e3e24fca1dd2f6c82 /funcs
parentf9d382fc079246930a99640d7835d6ae3e4149db (diff)
This rather large commit changes the way modules are loaded.
As partly documented in loader.c and include/asterisk/module.h, modules are now expected to return all of their methods and flags into a structure 'mod_data', and are normally loaded with RTLD_NOW | RTLD_LOCAL, so symbols are resolved immediately and conflicts should be less likely. Only in a small number of cases (res_*, typically) modules are loaded RTLD_GLOBAL, so they can export symbols. The core of the change is only the two files loader.c and include/asterisk/module.h, all the rest is simply adaptation of the existing modules to the new API, a rather mechanical (but believe me, time and finger-consuming!) process whose detail you can figure out by svn diff'ing any single module. Expect some minor compilation issue after this change, please report it on mantis http://bugs.digium.com/view.php?id=6968 so we collect all the feedback in one place. I am just sorry that this change missed SVN version number 20000! git-svn-id: http://svn.digium.com/svn/asterisk/trunk@20003 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_base64.c18
-rw-r--r--funcs/func_callerid.c15
-rw-r--r--funcs/func_cdr.c15
-rw-r--r--funcs/func_channel.c15
-rw-r--r--funcs/func_curl.c17
-rw-r--r--funcs/func_cut.c17
-rw-r--r--funcs/func_db.c15
-rw-r--r--funcs/func_enum.c18
-rw-r--r--funcs/func_env.c14
-rw-r--r--funcs/func_groupcount.c15
-rw-r--r--funcs/func_language.c15
-rw-r--r--funcs/func_logic.c15
-rw-r--r--funcs/func_math.c16
-rw-r--r--funcs/func_md5.c15
-rw-r--r--funcs/func_moh.c15
-rw-r--r--funcs/func_odbc.c19
-rw-r--r--funcs/func_rand.c14
-rw-r--r--funcs/func_sha1.c15
-rw-r--r--funcs/func_strings.c14
-rw-r--r--funcs/func_timeout.c13
-rw-r--r--funcs/func_uri.c14
21 files changed, 126 insertions, 198 deletions
diff --git a/funcs/func_base64.c b/funcs/func_base64.c
index 872416e96..3353078fa 100644
--- a/funcs/func_base64.c
+++ b/funcs/func_base64.c
@@ -78,31 +78,27 @@ static struct ast_custom_function base64_decode_function = {
.read = base64_decode,
};
-static char *tdesc = "base64 encode/decode dialplan functions";
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_custom_function_unregister(&base64_encode_function) |
ast_custom_function_unregister(&base64_decode_function);
}
-int load_module(void)
+static int load_module(void *mod)
{
return ast_custom_function_register(&base64_encode_function) |
ast_custom_function_register(&base64_decode_function);
}
-const char *description(void)
+static const char *description(void)
{
- return tdesc;
+ return "base64 encode/decode dialplan functions";
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c
index b277df1c5..e87ed11a7 100644
--- a/funcs/func_callerid.c
+++ b/funcs/func_callerid.c
@@ -143,27 +143,24 @@ static struct ast_custom_function callerid_function = {
static char *tdesc = "Caller ID related dialplan function";
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_custom_function_unregister(&callerid_function);
}
-int load_module(void)
+static int load_module(void *mod)
{
return ast_custom_function_register(&callerid_function);
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_cdr.c b/funcs/func_cdr.c
index 20373ec8d..26fb045bd 100644
--- a/funcs/func_cdr.c
+++ b/funcs/func_cdr.c
@@ -124,27 +124,24 @@ static struct ast_custom_function cdr_function = {
static char *tdesc = "CDR dialplan function";
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_custom_function_unregister(&cdr_function);
}
-int load_module(void)
+static int load_module(void *mod)
{
return ast_custom_function_register(&cdr_function);
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_channel.c b/funcs/func_channel.c
index 8d60f4ccd..16aebb4c2 100644
--- a/funcs/func_channel.c
+++ b/funcs/func_channel.c
@@ -138,27 +138,24 @@ static struct ast_custom_function channel_function = {
static char *tdesc = "Channel information dialplan function";
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_custom_function_unregister(&channel_function);
}
-int load_module(void)
+static int load_module(void *mod)
{
return ast_custom_function_register(&channel_function);
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_curl.c b/funcs/func_curl.c
index 0260b9bbe..7d55f9b08 100644
--- a/funcs/func_curl.c
+++ b/funcs/func_curl.c
@@ -155,7 +155,7 @@ struct ast_custom_function acf_curl = {
.read = acf_curl_exec,
};
-int unload_module(void)
+static int unload_module(void *mod)
{
int res;
@@ -166,7 +166,7 @@ int unload_module(void)
return res;
}
-int load_module(void)
+static int load_module(void *mod)
{
int res;
@@ -175,19 +175,14 @@ int load_module(void)
return res;
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_cut.c b/funcs/func_cut.c
index 434a2f940..69f4ac123 100644
--- a/funcs/func_cut.c
+++ b/funcs/func_cut.c
@@ -303,7 +303,7 @@ struct ast_custom_function acf_cut = {
.read = acf_cut_exec,
};
-int unload_module(void)
+static int unload_module(void *mod)
{
int res = 0;
@@ -315,7 +315,7 @@ int unload_module(void)
return res;
}
-int load_module(void)
+static int load_module(void *mod)
{
int res = 0;
@@ -325,19 +325,14 @@ int load_module(void)
return res;
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1, NULL, NULL, NULL);
diff --git a/funcs/func_db.c b/funcs/func_db.c
index 492389e58..f7439302b 100644
--- a/funcs/func_db.c
+++ b/funcs/func_db.c
@@ -161,7 +161,7 @@ static struct ast_custom_function db_exists_function = {
static char *tdesc = "Database (astdb) related dialplan functions";
-int unload_module(void)
+static int unload_module(void *mod)
{
int res = 0;
@@ -171,7 +171,7 @@ int unload_module(void)
return res;
}
-int load_module(void)
+static int load_module(void *mod)
{
int res = 0;
@@ -181,17 +181,14 @@ int load_module(void)
return res;
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_enum.c b/funcs/func_enum.c
index 542eb04e1..2a409ffee 100644
--- a/funcs/func_enum.c
+++ b/funcs/func_enum.c
@@ -173,7 +173,7 @@ static struct ast_custom_function txtcidname_function = {
static char *tdesc = "ENUM related dialplan functions";
-int unload_module(void)
+static int unload_module(void *mod)
{
int res = 0;
@@ -185,7 +185,7 @@ int unload_module(void)
return res;
}
-int load_module(void)
+static int load_module(void *mod)
{
int res = 0;
@@ -195,21 +195,15 @@ int load_module(void)
return res;
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
-
- return res;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1, NULL, NULL, NULL);
diff --git a/funcs/func_env.c b/funcs/func_env.c
index 4d8564803..d89927775 100644
--- a/funcs/func_env.c
+++ b/funcs/func_env.c
@@ -138,7 +138,7 @@ static struct ast_custom_function stat_function = {
static char *tdesc = "Environment/filesystem dialplan functions";
-int unload_module(void)
+static int unload_module(void *mod)
{
int res = 0;
@@ -148,7 +148,7 @@ int unload_module(void)
return res;
}
-int load_module(void)
+static int load_module(void *mod)
{
int res = 0;
@@ -158,17 +158,15 @@ int load_module(void)
return res;
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_groupcount.c b/funcs/func_groupcount.c
index 88bf0572a..d3bf627a5 100644
--- a/funcs/func_groupcount.c
+++ b/funcs/func_groupcount.c
@@ -197,7 +197,7 @@ static struct ast_custom_function group_list_function = {
static char *tdesc = "Channel group dialplan functions";
-int unload_module(void)
+static int unload_module(void *mod)
{
int res = 0;
@@ -209,7 +209,7 @@ int unload_module(void)
return res;
}
-int load_module(void)
+static int load_module(void *mod)
{
int res = 0;
@@ -221,17 +221,14 @@ int load_module(void)
return res;
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_language.c b/funcs/func_language.c
index 268038862..a3a47d5ef 100644
--- a/funcs/func_language.c
+++ b/funcs/func_language.c
@@ -78,27 +78,24 @@ static struct ast_custom_function language_function = {
static char *tdesc = "Channel language dialplan function";
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_custom_function_unregister(&language_function);
}
-int load_module(void)
+static int load_module(void *mod)
{
return ast_custom_function_register(&language_function);
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_logic.c b/funcs/func_logic.c
index 9f3e78cd9..aebcb4c17 100644
--- a/funcs/func_logic.c
+++ b/funcs/func_logic.c
@@ -176,7 +176,7 @@ static struct ast_custom_function if_time_function = {
static char *tdesc = "Logical dialplan functions";
-int unload_module(void)
+static int unload_module(void *mod)
{
int res = 0;
@@ -189,7 +189,7 @@ int unload_module(void)
return res;
}
-int load_module(void)
+static int load_module(void *mod)
{
int res = 0;
@@ -202,17 +202,14 @@ int load_module(void)
return res;
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_math.c b/funcs/func_math.c
index 0928a2da4..3ad32fdac 100644
--- a/funcs/func_math.c
+++ b/funcs/func_math.c
@@ -249,27 +249,25 @@ static struct ast_custom_function math_function = {
static char *tdesc = "Mathematical dialplan function";
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_custom_function_unregister(&math_function);
}
-int load_module(void)
+static int load_module(void *mod)
{
return ast_custom_function_register(&math_function);
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
+
diff --git a/funcs/func_md5.c b/funcs/func_md5.c
index 5455694d8..e05e0141d 100644
--- a/funcs/func_md5.c
+++ b/funcs/func_md5.c
@@ -106,29 +106,26 @@ static struct ast_custom_function checkmd5_function = {
static char *tdesc = "MD5 digest dialplan functions";
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_custom_function_unregister(&md5_function) |
ast_custom_function_unregister(&checkmd5_function);
}
-int load_module(void)
+static int load_module(void *mod)
{
return ast_custom_function_register(&md5_function) |
ast_custom_function_register(&checkmd5_function);
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_moh.c b/funcs/func_moh.c
index 029b715df..61c19bb4a 100644
--- a/funcs/func_moh.c
+++ b/funcs/func_moh.c
@@ -74,27 +74,24 @@ static struct ast_custom_function moh_function = {
static char *tdesc = "Music-on-hold dialplan function";
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_custom_function_unregister(&moh_function);
}
-int load_module(void)
+static int load_module(void *mod)
{
return ast_custom_function_register(&moh_function);
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c
index c76937fb4..56332e970 100644
--- a/funcs/func_odbc.c
+++ b/funcs/func_odbc.c
@@ -646,32 +646,25 @@ reload_out:
return res;
}
-int unload_module(void)
+static int unload_module(void *mod)
{
return odbc_unload_module();
}
-int load_module(void)
+static int load_module(void *mod)
{
return odbc_load_module();
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- if (! ast_mutex_trylock(&query_lock)) {
- ast_mutex_unlock(&query_lock);
- return 0;
- } else {
- return 1;
- }
-}
+/* XXX need to revise usecount - set if query_lock is set */
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+STD_MOD(MOD_1, NULL, NULL, NULL);
diff --git a/funcs/func_rand.c b/funcs/func_rand.c
index 053bcf524..2c0818b3d 100644
--- a/funcs/func_rand.c
+++ b/funcs/func_rand.c
@@ -94,29 +94,27 @@ static struct ast_custom_function acf_rand = {
static char *tdesc = "Random number dialplan function";
-int unload_module(void)
+static int unload_module(void *mod)
{
ast_custom_function_unregister(&acf_rand);
return 0;
}
-int load_module(void)
+static int load_module(void *mod)
{
return ast_custom_function_register(&acf_rand);
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_sha1.c b/funcs/func_sha1.c
index d2b5ad882..8a9fabfd0 100644
--- a/funcs/func_sha1.c
+++ b/funcs/func_sha1.c
@@ -71,27 +71,24 @@ static struct ast_custom_function sha1_function = {
static char *tdesc = "SHA-1 computation dialplan function";
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_custom_function_unregister(&sha1_function);
}
-int load_module(void)
+static int load_module(void *mod)
{
return ast_custom_function_register(&sha1_function);
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_strings.c b/funcs/func_strings.c
index 5da638ce0..7445b64a5 100644
--- a/funcs/func_strings.c
+++ b/funcs/func_strings.c
@@ -424,7 +424,7 @@ static struct ast_custom_function keypadhash_function = {
static char *tdesc = "String handling dialplan functions";
-int unload_module(void)
+static int unload_module(void *mod)
{
int res = 0;
@@ -442,7 +442,7 @@ int unload_module(void)
return res;
}
-int load_module(void)
+static int load_module(void *mod)
{
int res = 0;
@@ -460,17 +460,15 @@ int load_module(void)
return res;
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_timeout.c b/funcs/func_timeout.c
index 75b328e80..e1133865e 100644
--- a/funcs/func_timeout.c
+++ b/funcs/func_timeout.c
@@ -175,27 +175,24 @@ static struct ast_custom_function timeout_function = {
static char *tdesc = "Channel timeout dialplan functions";
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_custom_function_unregister(&timeout_function);
}
-int load_module(void)
+static int load_module(void *mod)
{
return ast_custom_function_register(&timeout_function);
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/funcs/func_uri.c b/funcs/func_uri.c
index e39ee6001..dbef5608d 100644
--- a/funcs/func_uri.c
+++ b/funcs/func_uri.c
@@ -88,29 +88,25 @@ static struct ast_custom_function urlencode_function = {
static char *tdesc = "URI encode/decode dialplan functions";
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_custom_function_unregister(&urldecode_function)
|| ast_custom_function_unregister(&urlencode_function);
}
-int load_module(void)
+static int load_module(void *mod)
{
return ast_custom_function_register(&urldecode_function)
|| ast_custom_function_register(&urlencode_function);
}
-const char *description(void)
+static const char *description(void)
{
return tdesc;
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);