mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	merge new_loader_completion branch, including (at least):
- restructured build tree and makefiles to eliminate recursion problems - support for embedded modules - support for static builds - simpler cross-compilation support - simpler module/loader interface (no exported symbols) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40722 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -9,7 +9,7 @@ | ||||
| # the GNU General Public License | ||||
| # | ||||
|  | ||||
| ifneq ($(wildcard ../menuselect.makeopts),) | ||||
| ifneq ($(wildcard $(ASTTOPDIR)/menuselect.makeopts),) | ||||
|   include ../menuselect.makeopts | ||||
|   include ../menuselect.makedeps | ||||
| endif | ||||
| @@ -17,7 +17,12 @@ endif | ||||
| C_MODS:=$(filter-out $(MENUSELECT_FUNCS),$(patsubst %.c,%,$(wildcard func_*.c))) | ||||
| CC_MODS:=$(filter-out $(MENUSELECT_FUNCS),$(patsubst %.cc,%,$(wildcard func_*.cc))) | ||||
|  | ||||
| SELECTED_MODS:=$(C_MODS) $(CC_MODS) | ||||
| LOADABLE_MODS:=$(C_MODS) $(CC_MODS) | ||||
|  | ||||
| ifneq ($(findstring funcs,$(MENUSELECT_EMBED)),) | ||||
|   EMBEDDED_MODS:=$(LOADABLE_MODS) | ||||
|   LOADABLE_MODS:= | ||||
| endif | ||||
|  | ||||
| all: _all | ||||
|  | ||||
|   | ||||
| @@ -25,6 +25,7 @@ | ||||
|  | ||||
| ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include <sys/types.h> | ||||
| @@ -78,27 +79,16 @@ static struct ast_custom_function base64_decode_function = { | ||||
| 	.read = base64_decode, | ||||
| }; | ||||
|  | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	return ast_custom_function_unregister(&base64_encode_function) | | ||||
| 		ast_custom_function_unregister(&base64_decode_function); | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return ast_custom_function_register(&base64_encode_function) | | ||||
| 		ast_custom_function_register(&base64_decode_function); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return "base64 encode/decode dialplan functions"; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "base64 encode/decode dialplan functions"); | ||||
|   | ||||
| @@ -143,26 +143,14 @@ static struct ast_custom_function callerid_function = { | ||||
| 	.write = callerid_write, | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "Caller ID related dialplan function"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	return ast_custom_function_unregister(&callerid_function); | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return ast_custom_function_register(&callerid_function); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Caller ID related dialplan function"); | ||||
|   | ||||
| @@ -27,6 +27,7 @@ | ||||
|  | ||||
| ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include <sys/types.h> | ||||
| @@ -131,26 +132,14 @@ static struct ast_custom_function cdr_function = { | ||||
| "  integral values.\n", | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "CDR dialplan function"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	return ast_custom_function_unregister(&cdr_function); | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return ast_custom_function_register(&cdr_function); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "CDR dialplan function"); | ||||
|   | ||||
| @@ -171,26 +171,14 @@ static struct ast_custom_function channel_function = { | ||||
| 	.write = func_channel_write, | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "Channel information dialplan function"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	return ast_custom_function_unregister(&channel_function); | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return ast_custom_function_register(&channel_function); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Channel information dialplan function"); | ||||
|   | ||||
| @@ -52,10 +52,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
| #include "asterisk/app.h" | ||||
| #include "asterisk/utils.h" | ||||
|  | ||||
| static char *tdesc = "Load external URL"; | ||||
|  | ||||
| LOCAL_USER_DECL; | ||||
|  | ||||
| struct MemoryStruct { | ||||
| 	char *memory; | ||||
| 	size_t size; | ||||
| @@ -113,7 +109,7 @@ static int curl_internal(struct MemoryStruct *chunk, char *url, char *post) | ||||
|  | ||||
| static int acf_curl_exec(struct ast_channel *chan, char *cmd, char *info, char *buf, size_t len) | ||||
| { | ||||
| 	struct localuser *u; | ||||
| 	struct ast_module_user *u; | ||||
| 	struct MemoryStruct chunk = { NULL, 0 }; | ||||
| 	AST_DECLARE_APP_ARGS(args, | ||||
| 		AST_APP_ARG(url); | ||||
| @@ -127,7 +123,7 @@ static int acf_curl_exec(struct ast_channel *chan, char *cmd, char *info, char * | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	LOCAL_USER_ADD(u); | ||||
| 	u = ast_module_user_add(chan); | ||||
|  | ||||
| 	AST_STANDARD_APP_ARGS(args, info);	 | ||||
| 	 | ||||
| @@ -144,7 +140,7 @@ static int acf_curl_exec(struct ast_channel *chan, char *cmd, char *info, char * | ||||
| 		ast_log(LOG_ERROR, "Cannot allocate curl structure\n"); | ||||
| 	} | ||||
|  | ||||
| 	LOCAL_USER_REMOVE(u); | ||||
| 	ast_module_user_remove(u); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
| @@ -159,18 +155,18 @@ struct ast_custom_function acf_curl = { | ||||
| 	.read = acf_curl_exec, | ||||
| }; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	int res; | ||||
|  | ||||
| 	res = ast_custom_function_unregister(&acf_curl); | ||||
|  | ||||
| 	STANDARD_HANGUP_LOCALUSERS; | ||||
| 	ast_module_user_hangup_all(); | ||||
| 	 | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	int res; | ||||
|  | ||||
| @@ -179,15 +175,5 @@ static int load_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Load external URL"); | ||||
|  | ||||
|   | ||||
| @@ -44,9 +44,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
| /* Maximum length of any variable */ | ||||
| #define MAXRESULT	1024 | ||||
|  | ||||
|  | ||||
| LOCAL_USER_DECL; | ||||
|  | ||||
| struct sortable_keys { | ||||
| 	char *key; | ||||
| 	float value; | ||||
| @@ -213,10 +210,10 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size | ||||
|  | ||||
| static int acf_sort_exec(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) | ||||
| { | ||||
| 	struct localuser *u; | ||||
| 	struct ast_module_user *u; | ||||
| 	int ret = -1; | ||||
|  | ||||
| 	LOCAL_USER_ADD(u); | ||||
| 	u = ast_module_user_add(chan); | ||||
|  | ||||
| 	switch (sort_internal(chan, data, buf, len)) { | ||||
| 	case ERROR_NOARG: | ||||
| @@ -231,7 +228,8 @@ static int acf_sort_exec(struct ast_channel *chan, char *cmd, char *data, char * | ||||
| 	default: | ||||
| 		ast_log(LOG_ERROR, "Unknown internal error\n"); | ||||
| 	} | ||||
| 	LOCAL_USER_REMOVE(u); | ||||
|  | ||||
| 	ast_module_user_remove(u); | ||||
|  | ||||
| 	return ret; | ||||
| } | ||||
| @@ -239,9 +237,9 @@ static int acf_sort_exec(struct ast_channel *chan, char *cmd, char *data, char * | ||||
| static int acf_cut_exec(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) | ||||
| { | ||||
| 	int ret = -1; | ||||
| 	struct localuser *u; | ||||
| 	struct ast_module_user *u; | ||||
|  | ||||
| 	LOCAL_USER_ADD(u); | ||||
| 	u = ast_module_user_add(chan); | ||||
|  | ||||
| 	switch (cut_internal(chan, data, buf, len)) { | ||||
| 	case ERROR_NOARG: | ||||
| @@ -259,7 +257,8 @@ static int acf_cut_exec(struct ast_channel *chan, char *cmd, char *data, char *b | ||||
| 	default: | ||||
| 		ast_log(LOG_ERROR, "Unknown internal error\n"); | ||||
| 	} | ||||
| 	LOCAL_USER_REMOVE(u); | ||||
|  | ||||
| 	ast_module_user_remove(u); | ||||
|  | ||||
| 	return ret; | ||||
| } | ||||
| @@ -288,19 +287,19 @@ struct ast_custom_function acf_cut = { | ||||
| 	.read = acf_cut_exec, | ||||
| }; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| 	res |= ast_custom_function_unregister(&acf_cut); | ||||
| 	res |= ast_custom_function_unregister(&acf_sort); | ||||
|  | ||||
| 	STANDARD_HANGUP_LOCALUSERS; | ||||
| 	ast_module_user_hangup_all(); | ||||
|  | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -310,14 +309,4 @@ static int load_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return "Cut out information from a string"; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Cut out information from a string"); | ||||
|   | ||||
| @@ -29,6 +29,7 @@ | ||||
|  | ||||
| ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include <sys/types.h> | ||||
| @@ -205,9 +206,7 @@ static struct ast_custom_function db_delete_function = { | ||||
| 	.read = function_db_delete, | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "Database (astdb) related dialplan functions"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -218,7 +217,7 @@ static int unload_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -229,14 +228,4 @@ static int load_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Database (astdb) related dialplan functions"); | ||||
|   | ||||
| @@ -50,8 +50,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
|  | ||||
|  static char *synopsis = "Syntax: ENUMLOOKUP(number[|Method-type[|options[|record#[|zone-suffix]]]])\n"; | ||||
|  | ||||
| LOCAL_USER_DECL; | ||||
|  | ||||
| static int function_enum(struct ast_channel *chan, char *cmd, char *data, | ||||
| 			 char *buf, size_t len) | ||||
| { | ||||
| @@ -65,7 +63,7 @@ static int function_enum(struct ast_channel *chan, char *cmd, char *data, | ||||
| 	int res = 0; | ||||
| 	char tech[80]; | ||||
| 	char dest[256] = "", tmp[2] = "", num[AST_MAX_EXTENSION] = ""; | ||||
| 	struct localuser *u; | ||||
| 	struct ast_module_user *u; | ||||
| 	char *s, *p; | ||||
|  | ||||
| 	buf[0] = '\0'; | ||||
| @@ -82,7 +80,7 @@ static int function_enum(struct ast_channel *chan, char *cmd, char *data, | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	LOCAL_USER_ADD(u); | ||||
| 	u = ast_module_user_add(chan); | ||||
|  | ||||
| 	ast_copy_string(tech, args.tech ? args.tech : "sip", sizeof(tech)); | ||||
|  | ||||
| @@ -110,7 +108,7 @@ static int function_enum(struct ast_channel *chan, char *cmd, char *data, | ||||
| 	else | ||||
| 		ast_copy_string(buf, dest, len); | ||||
|  | ||||
| 	LOCAL_USER_REMOVE(u); | ||||
| 	ast_module_user_remove(u); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
| @@ -137,7 +135,7 @@ static int function_txtcidname(struct ast_channel *chan, char *cmd, | ||||
| 	char tech[80]; | ||||
| 	char txt[256] = ""; | ||||
| 	char dest[80]; | ||||
| 	struct localuser *u; | ||||
| 	struct ast_module_user *u; | ||||
|  | ||||
| 	buf[0] = '\0'; | ||||
|  | ||||
| @@ -147,7 +145,7 @@ static int function_txtcidname(struct ast_channel *chan, char *cmd, | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	LOCAL_USER_ADD(u); | ||||
| 	u = ast_module_user_add(chan); | ||||
|  | ||||
| 	res = ast_get_txt(chan, data, dest, sizeof(dest), tech, sizeof(tech), txt, | ||||
| 			  sizeof(txt)); | ||||
| @@ -155,7 +153,7 @@ static int function_txtcidname(struct ast_channel *chan, char *cmd, | ||||
| 	if (!ast_strlen_zero(txt)) | ||||
| 		ast_copy_string(buf, txt, len); | ||||
|  | ||||
| 	LOCAL_USER_REMOVE(u); | ||||
| 	ast_module_user_remove(u); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
| @@ -171,21 +169,19 @@ static struct ast_custom_function txtcidname_function = { | ||||
| 	.read = function_txtcidname, | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "ENUM related dialplan functions"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| 	res |= ast_custom_function_unregister(&enum_function); | ||||
| 	res |= ast_custom_function_unregister(&txtcidname_function); | ||||
|  | ||||
| 	STANDARD_HANGUP_LOCALUSERS; | ||||
| 	ast_module_user_hangup_all(); | ||||
|  | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -195,15 +191,4 @@ static int load_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "ENUM related dialplan functions"); | ||||
|   | ||||
| @@ -135,10 +135,7 @@ static struct ast_custom_function stat_function = { | ||||
| 		"  M - Returns the epoch at which the file was last modified\n", | ||||
| }; | ||||
|  | ||||
|  | ||||
| static char *tdesc = "Environment/filesystem dialplan functions"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -148,7 +145,7 @@ static int unload_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -158,15 +155,4 @@ static int load_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Environment/filesystem dialplan functions"); | ||||
|   | ||||
| @@ -65,9 +65,7 @@ static struct ast_custom_function global_function = { | ||||
| 	.write = global_write, | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "Global variable dialplan functions"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -76,7 +74,7 @@ static int unload_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -85,15 +83,4 @@ static int load_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Global variable dialplan functions"); | ||||
|   | ||||
| @@ -195,9 +195,7 @@ static struct ast_custom_function group_list_function = { | ||||
| 	.write = NULL, | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "Channel group dialplan functions"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -209,7 +207,7 @@ static int unload_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -221,14 +219,4 @@ static int load_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Channel group dialplan functions"); | ||||
|   | ||||
| @@ -24,6 +24,7 @@ | ||||
|  | ||||
| ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include <sys/types.h> | ||||
| @@ -76,26 +77,14 @@ static struct ast_custom_function language_function = { | ||||
| 	.write = language_write, | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "Channel language dialplan function"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	return ast_custom_function_unregister(&language_function); | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return ast_custom_function_register(&language_function); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Channel language dialplan function"); | ||||
|   | ||||
| @@ -26,6 +26,7 @@ | ||||
|  | ||||
| ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include <sys/types.h> | ||||
| @@ -174,9 +175,7 @@ static struct ast_custom_function if_time_function = { | ||||
| 	.read = iftime, | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "Logical dialplan functions"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -189,7 +188,7 @@ static int unload_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -202,14 +201,4 @@ static int load_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Logical dialplan functions"); | ||||
|   | ||||
| @@ -247,27 +247,14 @@ static struct ast_custom_function math_function = { | ||||
| 	.read = math | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "Mathematical dialplan function"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	return ast_custom_function_unregister(&math_function); | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return ast_custom_function_register(&math_function); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
|  | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Mathematical dialplan function"); | ||||
|   | ||||
| @@ -28,6 +28,7 @@ | ||||
|  | ||||
| ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include <sys/types.h> | ||||
| @@ -104,28 +105,16 @@ static struct ast_custom_function checkmd5_function = { | ||||
| 	.read = checkmd5, | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "MD5 digest dialplan functions"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	return ast_custom_function_unregister(&md5_function) | | ||||
| 		ast_custom_function_unregister(&checkmd5_function); | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return ast_custom_function_register(&md5_function) | | ||||
| 		ast_custom_function_register(&checkmd5_function); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "MD5 digest dialplan functions"); | ||||
|   | ||||
| @@ -27,6 +27,7 @@ | ||||
|  | ||||
| ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
|  | ||||
| #include "asterisk/module.h" | ||||
| @@ -72,26 +73,14 @@ static struct ast_custom_function moh_function = { | ||||
| 	.write = moh_write, | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "Music-on-hold dialplan function"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	return ast_custom_function_unregister(&moh_function); | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return ast_custom_function_register(&moh_function); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Music-on-hold dialplan function"); | ||||
|   | ||||
| @@ -49,8 +49,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
| #include "asterisk/res_odbc.h" | ||||
| #include "asterisk/app.h" | ||||
|  | ||||
| static char *tdesc = "ODBC lookups"; | ||||
|  | ||||
| static char *config = "func_odbc.conf"; | ||||
|  | ||||
| enum { | ||||
| @@ -533,7 +531,7 @@ static int odbc_unload_module(void) | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static int reload(void *mod) | ||||
| static int reload(void) | ||||
| { | ||||
| 	int res = 0; | ||||
| 	struct ast_config *cfg; | ||||
| @@ -573,27 +571,21 @@ reload_out: | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	return odbc_unload_module(); | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return odbc_load_module(); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| /* XXX need to revise usecount - set if query_lock is set */ | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1, reload, NULL, NULL); | ||||
| AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "ODBC lookups", | ||||
| 		.load = load_module, | ||||
| 		.unload = unload_module, | ||||
| 		.reload = reload, | ||||
| 	       ); | ||||
|  | ||||
|   | ||||
| @@ -39,19 +39,17 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
| #include "asterisk/utils.h" | ||||
| #include "asterisk/app.h" | ||||
|  | ||||
| LOCAL_USER_DECL; | ||||
|  | ||||
| static int acf_rand_exec(struct ast_channel *chan, char *cmd, | ||||
| 			 char *parse, char *buffer, size_t buflen) | ||||
| { | ||||
| 	struct localuser *u; | ||||
| 	struct ast_module_user *u; | ||||
| 	int min_int, response_int, max_int; | ||||
| 	AST_DECLARE_APP_ARGS(args, | ||||
| 			     AST_APP_ARG(min); | ||||
| 			     AST_APP_ARG(max); | ||||
| 	); | ||||
|  | ||||
| 	LOCAL_USER_ADD(u); | ||||
| 	u = ast_module_user_add(chan); | ||||
|  | ||||
| 	AST_STANDARD_APP_ARGS(args, parse); | ||||
|  | ||||
| @@ -74,7 +72,7 @@ static int acf_rand_exec(struct ast_channel *chan, char *cmd, | ||||
| 		response_int, min_int, max_int); | ||||
| 	snprintf(buffer, buflen, "%d", response_int); | ||||
|  | ||||
| 	LOCAL_USER_REMOVE(u); | ||||
| 	ast_module_user_remove(u); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
| @@ -91,30 +89,16 @@ static struct ast_custom_function acf_rand = { | ||||
| 	.read = acf_rand_exec, | ||||
| }; | ||||
|  | ||||
|  | ||||
| static char *tdesc = "Random number dialplan function"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	ast_custom_function_unregister(&acf_rand); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return ast_custom_function_register(&acf_rand); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Random number dialplan function"); | ||||
|   | ||||
| @@ -43,20 +43,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
| #include "asterisk/lock.h" | ||||
| #include "asterisk/logger.h" | ||||
| #include "asterisk/utils.h" | ||||
| #include "asterisk/module.h" | ||||
| #include "asterisk/app.h" | ||||
|  | ||||
| LOCAL_USER_DECL; | ||||
|  | ||||
| static char *tdesc = "Read/Write values from a RealTime repository"; | ||||
|  | ||||
| static int function_realtime_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)  | ||||
| { | ||||
| 	struct ast_variable *var, *head; | ||||
|         struct localuser *u; | ||||
|         struct ast_module_user *u; | ||||
| 	char *results; | ||||
| 	size_t resultslen = 0; | ||||
|  | ||||
| 	AST_DECLARE_APP_ARGS(args, | ||||
| 		AST_APP_ARG(family); | ||||
| 		AST_APP_ARG(fieldmatch); | ||||
| @@ -70,7 +64,9 @@ static int function_realtime_read(struct ast_channel *chan, char *cmd, char *dat | ||||
| 		ast_log(LOG_WARNING, "Syntax: REALTIME(family|fieldmatch[|value[|delim1[|delim2]]]) - missing argument!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	LOCAL_USER_ADD(u); | ||||
|  | ||||
| 	u = ast_module_user_add(chan); | ||||
|  | ||||
| 	AST_STANDARD_APP_ARGS(args, data); | ||||
|  | ||||
| 	if (!args.delim1) | ||||
| @@ -81,7 +77,7 @@ static int function_realtime_read(struct ast_channel *chan, char *cmd, char *dat | ||||
| 	head = ast_load_realtime(args.family, args.fieldmatch, args.value, NULL); | ||||
|  | ||||
| 	if (!head) { | ||||
| 		LOCAL_USER_REMOVE(u); | ||||
| 		ast_module_user_remove(u); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	for (var = head; var; var = var->next) | ||||
| @@ -92,16 +88,15 @@ static int function_realtime_read(struct ast_channel *chan, char *cmd, char *dat | ||||
| 		ast_build_string(&results, &resultslen, "%s%s%s%s", var->name, args.delim2, var->value, args.delim1); | ||||
| 	ast_copy_string(buf, results, len); | ||||
|  | ||||
| 	LOCAL_USER_REMOVE(u); | ||||
| 	ast_module_user_remove(u); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static int function_realtime_write(struct ast_channel *chan, char *cmd, char *data, const char *value) | ||||
| { | ||||
|         struct localuser *u; | ||||
|         struct ast_module_user *u; | ||||
| 	int res = 0; | ||||
|  | ||||
|  | ||||
| 	AST_DECLARE_APP_ARGS(args, | ||||
| 		AST_APP_ARG(family); | ||||
| 		AST_APP_ARG(fieldmatch); | ||||
| @@ -114,7 +109,8 @@ static int function_realtime_write(struct ast_channel *chan, char *cmd, char *da | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	LOCAL_USER_ADD(u); | ||||
| 	u = ast_module_user_add(chan); | ||||
|  | ||||
| 	AST_STANDARD_APP_ARGS(args, data); | ||||
|  | ||||
| 	res = ast_update_realtime(args.family, args.fieldmatch, args.value, args.field, (char *)value, NULL); | ||||
| @@ -123,7 +119,8 @@ static int function_realtime_write(struct ast_channel *chan, char *cmd, char *da | ||||
| 		ast_log(LOG_WARNING, "Failed to update. Check the debug log for possible data repository related entries.\n"); | ||||
| 	} | ||||
|  | ||||
| 	LOCAL_USER_REMOVE(u); | ||||
| 	ast_module_user_remove(u); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| @@ -145,30 +142,20 @@ struct ast_custom_function realtime_function = { | ||||
| 	.write = function_realtime_write, | ||||
| }; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
|         int res = ast_custom_function_unregister(&realtime_function); | ||||
|  | ||||
| 	STANDARD_HANGUP_LOCALUSERS; | ||||
| 	ast_module_user_hangup_all(); | ||||
|  | ||||
|         return res; | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
|         int res = ast_custom_function_register(&realtime_function); | ||||
|  | ||||
|         return res; | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
|         return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
|         return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Read/Write values from a RealTime repository"); | ||||
|   | ||||
| @@ -26,6 +26,7 @@ | ||||
|  | ||||
| ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include <sys/types.h> | ||||
| @@ -69,26 +70,14 @@ static struct ast_custom_function sha1_function = { | ||||
| 		" which is known as his hash\n", | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "SHA-1 computation dialplan function"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	return ast_custom_function_unregister(&sha1_function); | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return ast_custom_function_register(&sha1_function); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "SHA-1 computation dialplan function"); | ||||
|   | ||||
| @@ -570,9 +570,7 @@ static struct ast_custom_function keypadhash_function = { | ||||
| 	.desc = "Example:  ${KEYPADHASH(Les)} returns \"537\"\n", | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "String handling dialplan functions"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -591,7 +589,7 @@ static int unload_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	int res = 0; | ||||
|  | ||||
| @@ -610,15 +608,4 @@ static int load_module(void *mod) | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
|  | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "String handling dialplan functions"); | ||||
|   | ||||
| @@ -173,26 +173,14 @@ static struct ast_custom_function timeout_function = { | ||||
| 	.write = timeout_write, | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "Channel timeout dialplan functions"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	return ast_custom_function_unregister(&timeout_function); | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return ast_custom_function_register(&timeout_function); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Channel timeout dialplan functions"); | ||||
|   | ||||
| @@ -86,27 +86,16 @@ static struct ast_custom_function urlencode_function = { | ||||
| 	.read = uriencode, | ||||
| }; | ||||
|  | ||||
| static char *tdesc = "URI encode/decode dialplan functions"; | ||||
|  | ||||
| static int unload_module(void *mod) | ||||
| static int unload_module(void) | ||||
| { | ||||
| 	return ast_custom_function_unregister(&urldecode_function) | ||||
| 		|| ast_custom_function_unregister(&urlencode_function); | ||||
| } | ||||
|  | ||||
| static int load_module(void *mod) | ||||
| static int load_module(void) | ||||
| { | ||||
| 	return ast_custom_function_register(&urldecode_function) | ||||
| 		|| ast_custom_function_register(&urlencode_function); | ||||
| } | ||||
|  | ||||
| static const char *description(void) | ||||
| { | ||||
| 	return tdesc; | ||||
| } | ||||
|  | ||||
| static const char *key(void) | ||||
| { | ||||
| 	return ASTERISK_GPL_KEY; | ||||
| } | ||||
| STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL); | ||||
| AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "URI encode/decode dialplan functions"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user