diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-21 02:11:39 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-21 02:11:39 +0000 |
commit | 8b0c007ad990aa27d9868da49215fd1076ac77cc (patch) | |
tree | 270b9c46c1e644483d6d2a35b509f43218ba3252 /pbx | |
parent | a42edc84034f91932a3e12d503e07f76a6eb498a (diff) |
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: http://svn.digium.com/svn/asterisk/trunk@40722 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r-- | pbx/Makefile | 15 | ||||
-rw-r--r-- | pbx/pbx_ael.c | 37 | ||||
-rw-r--r-- | pbx/pbx_config.c | 23 | ||||
-rw-r--r-- | pbx/pbx_dundi.c | 33 | ||||
-rw-r--r-- | pbx/pbx_loopback.c | 19 | ||||
-rw-r--r-- | pbx/pbx_realtime.c | 18 | ||||
-rw-r--r-- | pbx/pbx_spool.c | 16 |
7 files changed, 55 insertions, 106 deletions
diff --git a/pbx/Makefile b/pbx/Makefile index 395702090..ee50fc72a 100644 --- a/pbx/Makefile +++ b/pbx/Makefile @@ -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_PBX),$(patsubst %.c,%,$(wildcard pbx_*.c))) CC_MODS:=$(filter-out $(MENUSELECT_PBX),$(patsubst %.cc,%,$(wildcard pbx_*.cc))) -SELECTED_MODS:=$(C_MODS) $(CC_MODS) +LOADABLE_MODS:=$(C_MODS) $(CC_MODS) + +ifneq ($(findstring pbx,$(MENUSELECT_EMBED)),) + EMBEDDED_MODS:=$(LOADABLE_MODS) + LOADABLE_MODS:= +endif all: _all @@ -32,7 +37,7 @@ ael/aelflex.o: CFLAGS+=-I. $(eval $(call ast_make_o_c,ael/aelbison.o,ael/ael.tab.c ael/ael.tab.h ../include/asterisk/ael_structs.h)) ael/aelbison.o: CFLAGS+=-I. -pbx_ael.so: ael/aelbison.o ael/aelflex.o +$(pbx_ael): ael/aelbison.o ael/aelflex.o ael/ael_lex.c: (cd ael; flex ael.flex; sed -i -e "/begin standard C headers/i#include \"asterisk.h\"" ael_lex.c) @@ -40,7 +45,7 @@ ael/ael_lex.c: ael/ael.tab.c ael/ael.tab.h: (cd ael; bison -v -d ael.y) -$(eval $(call ast_make_o_c,dundi-parser.o,dundi-parser.c dundi-parser.h)) +dundi-parser.o: dundi-parser.h dundi-parser.o: CFLAGS+=-I. -pbx_dundi.so: dundi-parser.o +$(pbx_dundi): dundi-parser.o diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c index f7a5f6c54..0fd06414b 100644 --- a/pbx/pbx_ael.c +++ b/pbx/pbx_ael.c @@ -56,9 +56,6 @@ static char expr_output[2096]; #define DEBUG_MACROS (1 << 2) #define DEBUG_CONTEXTS (1 << 3) -static int aeldebug = 0; - -static char *dtext = "Asterisk Extension Language Compiler v2"; static char *config = "extensions.ael"; static char *registrar = "pbx_ael"; @@ -112,8 +109,6 @@ int is_empty(char *arg); static pval *current_db; static pval *current_context; static pval *current_extension; -static const char *description(void); -static const char *key(void); static const char *match_context; static const char *match_exten; @@ -2576,6 +2571,7 @@ void check_pval(pval *item, struct argapp *apps, int in_globals) } } +#ifndef STANDALONE_AEL static void ael2_semantic_check(pval *item, int *arg_errs, int *arg_warns, int *arg_notes) { @@ -2606,6 +2602,7 @@ static void ael2_semantic_check(pval *item, int *arg_errs, int *arg_warns, int * *arg_warns = warns; *arg_notes = notes; } +#endif /* =============================================================================================== */ /* "CODE" GENERATOR -- Convert the AEL representation to asterisk extension language */ @@ -3735,6 +3732,9 @@ void ast_compile_ael2(struct ast_context **local_contexts, struct pval *root) } +#ifndef STANDALONE_AEL +static int aeldebug = 0; + /* interface stuff */ static int pbx_load_module(void) @@ -3820,40 +3820,31 @@ static struct ast_cli_entry ael_cli[] = { { { "ael", "no", "debug", NULL }, ael2_no_debug, "Disable AEL debug messages"}, }; -/* - * Standard module functions ... - */ -static int unload_module(void *mod) +static int unload_module(void) { ast_context_destroy(NULL, registrar); ast_cli_unregister_multiple(ael_cli, sizeof(ael_cli)/ sizeof(ael_cli[0])); return 0; } - -static int load_module(void *mod) +static int load_module(void) { ast_cli_register_multiple(ael_cli, sizeof(ael_cli)/ sizeof(ael_cli[0])); return (pbx_load_module()); } -static int reload(void *mod) +static int reload(void) { ast_context_destroy(NULL, registrar); return pbx_load_module(); } -static const char *description(void) -{ - return dtext; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1 | NO_USECOUNT, reload, NULL, NULL); +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk Extension Language Compiler", + .load = load_module, + .unload = unload_module, + .reload = reload, + ); +#endif /* DESTROY the PVAL tree ============================================================================ */ diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index c74c4c105..6d612eff9 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1314,7 +1314,7 @@ static struct ast_cli_entry reload_extensions_cli = /*! * Standard module functions ... */ -static int unload_module(void *mod) +static int unload_module(void) { ast_cli_unregister(&context_add_extension_cli); if (static_config && !write_protect_config) @@ -1501,7 +1501,7 @@ static int pbx_load_module(void) return 0; } -static int load_module(void *mod) +static int load_module(void) { if (pbx_load_module()) return -1; @@ -1519,7 +1519,7 @@ static int load_module(void *mod) return 0; } -static int reload(void *mod) +static int reload(void) { if (clearglobalvars_config) pbx_builtin_clear_globals(); @@ -1527,15 +1527,8 @@ static int reload(void *mod) return 0; } -static const char *description(void) -{ - return "Text Extension Configuration"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -/* XXX really no usecount ? */ -STD_MOD(MOD_1 | NO_USECOUNT, reload, NULL, NULL); +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Text Extension Configuration", + .load = load_module, + .unload = unload_module, + .reload = reload, + ); diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 20b7844cd..190779c7c 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -2722,8 +2722,6 @@ static struct ast_cli_entry cli_precache = static struct ast_cli_entry cli_queryeid = { { "dundi", "query", NULL }, dundi_do_query, "Query a DUNDi EID", query_usage }; -LOCAL_USER_DECL; - static struct dundi_transaction *create_transaction(struct dundi_peer *p) { struct dundi_transaction *trans; @@ -3713,7 +3711,7 @@ static int dundifunc_read(struct ast_channel *chan, char *cmd, char *num, char * int results; int x; int bypass = 0; - struct localuser *u; + struct ast_module_user *u; struct dundi_result dr[MAX_RESULTS]; buf[0] = '\0'; @@ -3723,7 +3721,7 @@ static int dundifunc_read(struct ast_channel *chan, char *cmd, char *num, char * return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); context = strchr(num, '|'); if (context) { @@ -3750,7 +3748,7 @@ static int dundifunc_read(struct ast_channel *chan, char *cmd, char *num, char * } } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -4436,9 +4434,9 @@ static int set_config(char *config_file, struct sockaddr_in* sin) return 0; } -static int unload_module(void *mod) +static int unload_module(void) { - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); ast_cli_unregister(&cli_debug); ast_cli_unregister(&cli_store_history); @@ -4462,19 +4460,18 @@ static int unload_module(void *mod) return 0; } -static int reload(void *mod) +static int reload(void) { struct sockaddr_in sin; set_config("dundi.conf",&sin); return 0; } -static int load_module(void *mod) +static int load_module(void) { int res = 0; struct sockaddr_in sin; - __mod_desc = mod; dundi_set_output(dundi_debug_output); dundi_set_error(dundi_error_output); @@ -4542,15 +4539,9 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return "Distributed Universal Number Discovery (DUNDi)"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1 | NO_USECOUNT | NO_UNLOAD, reload, NULL, NULL); +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Distributed Universal Number Discovery (DUNDi)", + .load = load_module, + .unload = unload_module, + .reload = reload, + ); diff --git a/pbx/pbx_loopback.c b/pbx/pbx_loopback.c index e125885f8..dcbef909b 100644 --- a/pbx/pbx_loopback.c +++ b/pbx/pbx_loopback.c @@ -161,34 +161,23 @@ static int loopback_matchmore(struct ast_channel *chan, const char *context, con static struct ast_switch loopback_switch = { name: "Loopback", - description: "Loopback Dialplan Switch", + description: "Loopback Dialplan Switch", exists: loopback_exists, canmatch: loopback_canmatch, exec: loopback_exec, matchmore: loopback_matchmore, }; -static const char *description(void) -{ - return "Loopback Switch"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -static int unload_module(void *mod) +static int unload_module(void) { ast_unregister_switch(&loopback_switch); return 0; } -static int load_module(void *mod) +static int load_module(void) { ast_register_switch(&loopback_switch); return 0; } -/* XXX really no unload ? */ -STD_MOD(MOD_1 | NO_USECOUNT | NO_UNLOAD, NULL, NULL, NULL); +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Loopback Switch"); diff --git a/pbx/pbx_realtime.c b/pbx/pbx_realtime.c index db7da2729..31abe065f 100644 --- a/pbx/pbx_realtime.c +++ b/pbx/pbx_realtime.c @@ -234,33 +234,23 @@ static int realtime_matchmore(struct ast_channel *chan, const char *context, con static struct ast_switch realtime_switch = { name: "Realtime", - description: "Realtime Dialplan Switch", + description: "Realtime Dialplan Switch", exists: realtime_exists, canmatch: realtime_canmatch, exec: realtime_exec, matchmore: realtime_matchmore, }; -static const char *description(void) -{ - return "Realtime Switch"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -static int unload_module(void *mod) +static int unload_module(void) { ast_unregister_switch(&realtime_switch); return 0; } -static int load_module(void *mod) +static int load_module(void) { ast_register_switch(&realtime_switch); return 0; } -STD_MOD(MOD_1 | NO_USECOUNT | NO_UNLOAD, NULL, NULL, NULL); +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Realtime Switch"); diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c index eb40500dd..c4714a09d 100644 --- a/pbx/pbx_spool.c +++ b/pbx/pbx_spool.c @@ -477,12 +477,12 @@ static void *scan_thread(void *unused) return NULL; } -static int unload_module(void *mod) +static int unload_module(void) { return -1; } -static int load_module(void *mod) +static int load_module(void) { pthread_t thread; pthread_attr_t attr; @@ -502,14 +502,4 @@ static int load_module(void *mod) return 0; } -static const char *description(void) -{ - return "Outgoing Spool Support"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1 | NO_USECOUNT | NO_UNLOAD, NULL, NULL, NULL); +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Outgoing Spool Support"); |