diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/Makefile | 6 | ||||
-rw-r--r-- | main/asterisk.c | 34 | ||||
-rw-r--r-- | main/bridge.c | 102 | ||||
-rw-r--r-- | main/ccss.c | 27 | ||||
-rw-r--r-- | main/cdr.c | 53 | ||||
-rw-r--r-- | main/cel.c | 39 | ||||
-rw-r--r-- | main/channel.c | 18 | ||||
-rw-r--r-- | main/config.c | 53 | ||||
-rw-r--r-- | main/config_options.c | 79 | ||||
-rw-r--r-- | main/dnsmgr.c | 23 | ||||
-rw-r--r-- | main/dsp.c | 32 | ||||
-rw-r--r-- | main/enum.c | 20 | ||||
-rw-r--r-- | main/features.c | 26 | ||||
-rw-r--r-- | main/features_config.c | 8 | ||||
-rw-r--r-- | main/features_config.h | 28 | ||||
-rw-r--r-- | main/http.c | 21 | ||||
-rw-r--r-- | main/indications.c | 23 | ||||
-rw-r--r-- | main/loader.c | 89 | ||||
-rw-r--r-- | main/logger.c | 35 | ||||
-rw-r--r-- | main/manager.c | 28 | ||||
-rw-r--r-- | main/named_acl.c | 87 | ||||
-rw-r--r-- | main/plc.c | 42 | ||||
-rw-r--r-- | main/sounds.c | 34 | ||||
-rw-r--r-- | main/stringfields.c | 34 | ||||
-rw-r--r-- | main/taskprocessor.c | 17 | ||||
-rw-r--r-- | main/translate.c | 18 | ||||
-rw-r--r-- | main/udptl.c | 22 |
27 files changed, 554 insertions, 444 deletions
diff --git a/main/Makefile b/main/Makefile index ba7491d0e..cd5c08c02 100644 --- a/main/Makefile +++ b/main/Makefile @@ -17,9 +17,9 @@ all: asterisk include $(ASTTOPDIR)/Makefile.moddir_rules -# Can the MODSRC list be automated without needing built-in modules to be -# in a different directory? Would a different directory be better? -MOD_SRC:= +MOD_SRC:=cdr.c cel.c config.c ccss.c dnsmgr.c dsp.c enum.c features.c http.c indications.c logger.c manager.c named_acl.c plc.c sounds.c udptl.c +# Allow deletion of built-in modules without needing to modify this source. +MOD_SRC:=$(wildcard $(MOD_SRC)) MOD_OBJS:=$(sort $(MOD_SRC:.c=.o)) # Must include the extra ast_expr2.c, ast_expr2f.c, in case they need to be regenerated (because to force regeneration, we delete them) diff --git a/main/asterisk.c b/main/asterisk.c index 1607bf40e..7a4424d22 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -199,7 +199,6 @@ int daemon(int, int); /* defined in libresolv of all places */ #include "asterisk/channel.h" #include "asterisk/translate.h" #include "asterisk/pickup.h" -#include "asterisk/features.h" #include "asterisk/acl.h" #include "asterisk/ulaw.h" #include "asterisk/alaw.h" @@ -209,11 +208,7 @@ int daemon(int, int); /* defined in libresolv of all places */ #include "asterisk/term.h" #include "asterisk/manager.h" #include "asterisk/cdr.h" -#include "asterisk/cel.h" #include "asterisk/pbx.h" -#include "asterisk/enum.h" -#include "asterisk/http.h" -#include "asterisk/udptl.h" #include "asterisk/app.h" #include "asterisk/lock.h" #include "asterisk/utils.h" @@ -225,11 +220,9 @@ int daemon(int, int); /* defined in libresolv of all places */ #include "asterisk/devicestate.h" #include "asterisk/presencestate.h" #include "asterisk/module.h" -#include "asterisk/dsp.h" #include "asterisk/buildinfo.h" #include "asterisk/xmldoc.h" #include "asterisk/poll-compat.h" -#include "asterisk/ccss.h" #include "asterisk/test.h" #include "asterisk/rtp_engine.h" #include "asterisk/format.h" @@ -4444,12 +4437,7 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou print_intro_message(runuser, rungroup); - if (ast_opt_console) { - ast_verb(0, "[ Initializing Custom Configuration Options ]\n"); - } - /* custom config setup */ register_config_cli(); - read_config_maps(); check_init(astobj2_init(), "AO2"); check_init(ast_named_locks_init(), "Named Locks"); @@ -4564,32 +4552,10 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou /* We should avoid most config loads before this point as they can't use realtime. */ check_init(load_modules(1), "Module Preload"); - /* Initialize core modules that have config files. These should be converted to - * built-in modules with load priority after realtime, that way users will not - * need to 'preload' realtime modules. */ - check_init(ast_features_init(), "Call Features"); - check_init(dnsmgr_init(), "DNS manager"); - check_init(ast_named_acl_init(), "Named ACL system"); - ast_http_init(); - check_init(ast_indications_init(), "Indication Tone Handling"); - check_init(ast_cdr_engine_init(), "CDR Engine"); - ast_dsp_init(); - ast_udptl_init(); - check_init(ast_cel_engine_init(), "CEL Engine"); - check_init(init_manager(), "Asterisk Manager Interface"); - check_init(ast_enum_init(), "ENUM Support"); - check_init(ast_cc_init(), "Call Completion Supplementary Services"); - /* Load remaining modules */ check_init(load_modules(0), "Module"); /* - * This is initialized after the dynamic modules load to avoid repeatedly - * reindexing sounds for every format module load. - */ - check_init(ast_sounds_index_init(), "Sounds Indexer"); - - /* * This has to load after the dynamic modules load, as items in the media * cache can't be constructed from items in the AstDB without their * bucket backends. diff --git a/main/bridge.c b/main/bridge.c index 4f79852cb..1109c4b76 100644 --- a/main/bridge.c +++ b/main/bridge.c @@ -5027,46 +5027,29 @@ struct ast_bridge *ast_bridge_find_by_id(const char *bridge_id) return ao2_find(bridges, bridge_id, OBJ_SEARCH_KEY); } -struct bridge_complete { - /*! Nth match to return. */ - int state; - /*! Which match currently on. */ - int which; -}; - -static int complete_bridge_live_search(void *obj, void *arg, void *data, int flags) +static int complete_bridge_live_search(void *obj, void *arg, int flags) { - struct bridge_complete *search = data; + struct ast_bridge *bridge = obj; - if (++search->which > search->state) { - return CMP_MATCH; + if (ast_cli_completion_add(ast_strdup(bridge->uniqueid))) { + return CMP_STOP; } + return 0; } -static char *complete_bridge_live(const char *word, int state) +static char *complete_bridge_live(const char *word) { - char *ret; - struct ast_bridge *bridge; - struct bridge_complete search = { - .state = state, - }; + ao2_callback(bridges, ast_strlen_zero(word) ? 0 : OBJ_PARTIAL_KEY, + complete_bridge_live_search, (char *) word); - bridge = ao2_callback_data(bridges, ast_strlen_zero(word) ? 0 : OBJ_PARTIAL_KEY, - complete_bridge_live_search, (char *) word, &search); - if (!bridge) { - return NULL; - } - ret = ast_strdup(bridge->uniqueid); - ao2_ref(bridge, -1); - return ret; + return NULL; } -static char *complete_bridge_stasis(const char *word, int state) +static char *complete_bridge_stasis(const char *word) { - char *ret = NULL; - int wordlen = strlen(word), which = 0; - RAII_VAR(struct ao2_container *, cached_bridges, NULL, ao2_cleanup); + int wordlen = strlen(word); + struct ao2_container *cached_bridges; struct ao2_iterator iter; struct stasis_message *msg; @@ -5079,15 +5062,17 @@ static char *complete_bridge_stasis(const char *word, int state) for (; (msg = ao2_iterator_next(&iter)); ao2_ref(msg, -1)) { struct ast_bridge_snapshot *snapshot = stasis_message_data(msg); - if (!strncasecmp(word, snapshot->uniqueid, wordlen) && (++which > state)) { - ret = ast_strdup(snapshot->uniqueid); - ao2_ref(msg, -1); - break; + if (!strncasecmp(word, snapshot->uniqueid, wordlen)) { + if (ast_cli_completion_add(ast_strdup(snapshot->uniqueid))) { + ao2_ref(msg, -1); + break; + } } } ao2_iterator_destroy(&iter); + ao2_ref(cached_bridges, -1); - return ret; + return NULL; } static char *handle_bridge_show_all(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) @@ -5168,7 +5153,7 @@ static char *handle_bridge_show_specific(struct ast_cli_entry *e, int cmd, struc return NULL; case CLI_GENERATE: if (a->pos == 2) { - return complete_bridge_stasis(a->word, a->n); + return complete_bridge_stasis(a->word); } return NULL; } @@ -5207,7 +5192,7 @@ static char *handle_bridge_destroy_specific(struct ast_cli_entry *e, int cmd, st return NULL; case CLI_GENERATE: if (a->pos == 2) { - return complete_bridge_live(a->word, a->n); + return complete_bridge_live(a->word); } return NULL; } @@ -5229,11 +5214,10 @@ static char *handle_bridge_destroy_specific(struct ast_cli_entry *e, int cmd, st } #endif -static char *complete_bridge_participant(const char *bridge_name, const char *line, const char *word, int pos, int state) +static char *complete_bridge_participant(const char *bridge_name, const char *word) { struct ast_bridge *bridge; struct ast_bridge_channel *bridge_channel; - int which; int wordlen; bridge = ast_bridge_find_by_id(bridge_name); @@ -5241,19 +5225,17 @@ static char *complete_bridge_participant(const char *bridge_name, const char *li return NULL; } - { - SCOPED_LOCK(bridge_lock, bridge, ast_bridge_lock, ast_bridge_unlock); + wordlen = strlen(word); - which = 0; - wordlen = strlen(word); - AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, entry) { - if (!strncasecmp(ast_channel_name(bridge_channel->chan), word, wordlen) - && ++which > state) { - ao2_ref(bridge, -1); - return ast_strdup(ast_channel_name(bridge_channel->chan)); + ast_bridge_lock(bridge); + AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, entry) { + if (!strncasecmp(ast_channel_name(bridge_channel->chan), word, wordlen)) { + if (ast_cli_completion_add(ast_strdup(ast_channel_name(bridge_channel->chan)))) { + break; } } } + ast_bridge_unlock(bridge); ao2_ref(bridge, -1); @@ -5263,7 +5245,6 @@ static char *complete_bridge_participant(const char *bridge_name, const char *li static char *handle_bridge_kick_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { static const char * const completions[] = { "all", NULL }; - char *complete; struct ast_bridge *bridge; switch (cmd) { @@ -5277,14 +5258,11 @@ static char *handle_bridge_kick_channel(struct ast_cli_entry *e, int cmd, struct return NULL; case CLI_GENERATE: if (a->pos == 2) { - return complete_bridge_live(a->word, a->n); + return complete_bridge_live(a->word); } if (a->pos == 3) { - complete = ast_cli_complete(a->word, completions, a->n); - if (!complete) { - complete = complete_bridge_participant(a->argv[2], a->line, a->word, a->pos, a->n - 1); - } - return complete; + ast_cli_complete(a->word, completions, -1); + return complete_bridge_participant(a->argv[2], a->word); } return NULL; } @@ -5385,24 +5363,22 @@ static char *handle_bridge_technology_show(struct ast_cli_entry *e, int cmd, str #undef FORMAT } -static char *complete_bridge_technology(const char *word, int state) +static char *complete_bridge_technology(const char *word) { struct ast_bridge_technology *cur; - char *res; - int which; int wordlen; - which = 0; wordlen = strlen(word); AST_RWLIST_RDLOCK(&bridge_technologies); AST_RWLIST_TRAVERSE(&bridge_technologies, cur, entry) { - if (!strncasecmp(cur->name, word, wordlen) && ++which > state) { - res = ast_strdup(cur->name); - AST_RWLIST_UNLOCK(&bridge_technologies); - return res; + if (!strncasecmp(cur->name, word, wordlen)) { + if (ast_cli_completion_add(ast_strdup(cur->name))) { + break; + } } } AST_RWLIST_UNLOCK(&bridge_technologies); + return NULL; } @@ -5421,7 +5397,7 @@ static char *handle_bridge_technology_suspend(struct ast_cli_entry *e, int cmd, return NULL; case CLI_GENERATE: if (a->pos == 3) { - return complete_bridge_technology(a->word, a->n); + return complete_bridge_technology(a->word); } return NULL; } diff --git a/main/ccss.c b/main/ccss.c index fa569aaa0..9cf16e34d 100644 --- a/main/ccss.c +++ b/main/ccss.c @@ -4615,7 +4615,7 @@ static struct ast_cli_entry cc_cli[] = { AST_CLI_DEFINE(handle_cc_kill, "Kill a CC transaction"), }; -static void cc_shutdown(void) +static int unload_module(void) { ast_devstate_prov_del("ccss"); ast_cc_agent_unregister(&generic_agent_callbacks); @@ -4641,30 +4641,32 @@ static void cc_shutdown(void) ao2_t_ref(generic_monitors, -1, "Unref generic_monitor container in cc_shutdown"); generic_monitors = NULL; } + + return 0; } -int ast_cc_init(void) +static int load_module(void) { int res; if (!(cc_core_instances = ao2_t_container_alloc(CC_CORE_INSTANCES_BUCKETS, cc_core_instance_hash_fn, cc_core_instance_cmp_fn, "Create core instance container"))) { - return -1; + return AST_MODULE_LOAD_FAILURE; } if (!(generic_monitors = ao2_t_container_alloc(CC_CORE_INSTANCES_BUCKETS, generic_monitor_instance_list_hash_fn, generic_monitor_instance_list_cmp_fn, "Create generic monitor container"))) { - return -1; + return AST_MODULE_LOAD_FAILURE; } if (!(cc_core_taskprocessor = ast_taskprocessor_get("CCSS_core", TPS_REF_DEFAULT))) { - return -1; + return AST_MODULE_LOAD_FAILURE; } if (!(cc_sched_context = ast_sched_context_create())) { - return -1; + return AST_MODULE_LOAD_FAILURE; } if (ast_sched_start_thread(cc_sched_context)) { - return -1; + return AST_MODULE_LOAD_FAILURE; } res = ast_register_application2(ccreq_app, ccreq_exec, NULL, NULL, NULL); res |= ast_register_application2(cccancel_app, cccancel_exec, NULL, NULL, NULL); @@ -4680,7 +4682,12 @@ int ast_cc_init(void) initialize_cc_devstate_map(); res |= ast_devstate_prov_add("ccss", ccss_device_state); - ast_register_cleanup(cc_shutdown); - - return res; + return res ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS; } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Call Completion Supplementary Services", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .load_pri = AST_MODPRI_CORE, +); diff --git a/main/cdr.c b/main/cdr.c index 4acadf975..528673311 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -53,6 +53,7 @@ #include "asterisk/cdr.h" #include "asterisk/callerid.h" #include "asterisk/manager.h" +#include "asterisk/module.h" #include "asterisk/causes.h" #include "asterisk/linkedlists.h" #include "asterisk/utils.h" @@ -3950,18 +3951,14 @@ static char *handle_cli_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_a /*! \brief Complete user input for 'cdr show' */ static char *cli_complete_show(struct ast_cli_args *a) { - char *result = NULL; int wordlen = strlen(a->word); - int which = 0; struct ao2_iterator it_cdrs; struct cdr_object *cdr; it_cdrs = ao2_iterator_init(active_cdrs_master, 0); while ((cdr = ao2_iterator_next(&it_cdrs))) { - if (!strncasecmp(a->word, cdr->party_a.snapshot->name, wordlen) && - (++which > a->n)) { - result = ast_strdup(cdr->party_a.snapshot->name); - if (result) { + if (!strncasecmp(a->word, cdr->party_a.snapshot->name, wordlen)) { + if (ast_cli_completion_add(ast_strdup(cdr->party_a.snapshot->name))) { ao2_ref(cdr, -1); break; } @@ -3969,7 +3966,8 @@ static char *cli_complete_show(struct ast_cli_args *a) ao2_ref(cdr, -1); } ao2_iterator_destroy(&it_cdrs); - return result; + + return NULL; } static void cli_show_channels(struct ast_cli_args *a) @@ -4366,11 +4364,6 @@ static int process_config(int reload) return 0; } -static void cdr_engine_cleanup(void) -{ - destroy_subscriptions(); -} - static void cdr_engine_shutdown(void) { stasis_message_router_unsubscribe_and_join(stasis_router); @@ -4503,26 +4496,33 @@ static int cdr_toggle_runtime_options(void) return mod_cfg ? 0 : -1; } -int ast_cdr_engine_init(void) +static int unload_module(void) +{ + destroy_subscriptions(); + + return 0; +} + +static int load_module(void) { if (process_config(0)) { - return -1; + return AST_MODULE_LOAD_FAILURE; } cdr_topic = stasis_topic_create("cdr_engine"); if (!cdr_topic) { - return -1; + return AST_MODULE_LOAD_FAILURE; } stasis_router = stasis_message_router_create(cdr_topic); if (!stasis_router) { - return -1; + return AST_MODULE_LOAD_FAILURE; } stasis_message_router_set_congestion_limits(stasis_router, -1, 10 * AST_TASKPROCESSOR_HIGH_WATER_LEVEL); if (STASIS_MESSAGE_TYPE_INIT(cdr_sync_message_type)) { - return -1; + return AST_MODULE_LOAD_FAILURE; } stasis_message_router_add_cache_update(stasis_router, ast_channel_snapshot_type(), handle_channel_cache_message, NULL); @@ -4535,28 +4535,27 @@ int ast_cdr_engine_init(void) active_cdrs_master = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NUM_CDR_BUCKETS, cdr_master_hash_fn, NULL, cdr_master_cmp_fn); if (!active_cdrs_master) { - return -1; + return AST_MODULE_LOAD_FAILURE; } ao2_container_register("cdrs_master", active_cdrs_master, cdr_master_print_fn); active_cdrs_all = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NUM_CDR_BUCKETS, cdr_all_hash_fn, NULL, cdr_all_cmp_fn); if (!active_cdrs_all) { - return -1; + return AST_MODULE_LOAD_FAILURE; } ao2_container_register("cdrs_all", active_cdrs_all, cdr_all_print_fn); sched = ast_sched_context_create(); if (!sched) { ast_log(LOG_ERROR, "Unable to create schedule context.\n"); - return -1; + return AST_MODULE_LOAD_FAILURE; } ast_cli_register_multiple(cli_commands, ARRAY_LEN(cli_commands)); - ast_register_cleanup(cdr_engine_cleanup); ast_register_atexit(cdr_engine_shutdown); - return cdr_toggle_runtime_options(); + return cdr_toggle_runtime_options() ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS; } void ast_cdr_engine_term(void) @@ -4599,7 +4598,7 @@ void ast_cdr_engine_term(void) } } -int ast_cdr_engine_reload(void) +static int reload_module(void) { struct module_config *old_mod_cfg; struct module_config *mod_cfg; @@ -4625,3 +4624,11 @@ int ast_cdr_engine_reload(void) ao2_cleanup(old_mod_cfg); return cdr_toggle_runtime_options(); } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "CDR Engine", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = AST_MODPRI_CORE, +); diff --git a/main/cel.c b/main/cel.c index 2813e60c4..91c625a3c 100644 --- a/main/cel.c +++ b/main/cel.c @@ -38,7 +38,7 @@ #include "asterisk.h" -#include "asterisk/_private.h" +#include "asterisk/module.h" #include "asterisk/channel.h" #include "asterisk/pbx.h" @@ -1421,7 +1421,7 @@ static void destroy_subscriptions(void) cel_cel_forwarder = stasis_forward_cancel(cel_cel_forwarder); } -static void cel_engine_cleanup(void) +static int unload_module(void) { destroy_routes(); destroy_subscriptions(); @@ -1433,6 +1433,8 @@ static void cel_engine_cleanup(void) ao2_global_obj_release(cel_dialstatus_store); ao2_global_obj_release(cel_linkedids); ao2_global_obj_release(cel_backends); + + return 0; } /*! @@ -1555,7 +1557,7 @@ static int create_routes(void) AO2_STRING_FIELD_HASH_FN(cel_linkedid, id) AO2_STRING_FIELD_CMP_FN(cel_linkedid, id) -int ast_cel_engine_init(void) +static int load_module(void) { struct ao2_container *container; @@ -1563,7 +1565,7 @@ int ast_cel_engine_init(void) ao2_global_obj_replace_unref(cel_linkedids, container); ao2_cleanup(container); if (!container) { - return -1; + return AST_MODULE_LOAD_FAILURE; } container = ao2_container_alloc(NUM_DIALSTATUS_BUCKETS, @@ -1571,26 +1573,26 @@ int ast_cel_engine_init(void) ao2_global_obj_replace_unref(cel_dialstatus_store, container); ao2_cleanup(container); if (!container) { - return -1; + return AST_MODULE_LOAD_FAILURE; } if (STASIS_MESSAGE_TYPE_INIT(cel_generic_type)) { - return -1; + return AST_MODULE_LOAD_FAILURE; } if (ast_cli_register(&cli_status)) { - return -1; + return AST_MODULE_LOAD_FAILURE; } container = ao2_container_alloc(BACKEND_BUCKETS, cel_backend_hash_fn, cel_backend_cmp_fn); ao2_global_obj_replace_unref(cel_backends, container); ao2_cleanup(container); if (!container) { - return -1; + return AST_MODULE_LOAD_FAILURE; } if (aco_info_init(&cel_cfg_info)) { - return -1; + return AST_MODULE_LOAD_FAILURE; } aco_option_register(&cel_cfg_info, "enable", ACO_EXACT, general_options, "no", OPT_BOOL_T, 1, FLDSET(struct ast_cel_general_config, enable)); @@ -1602,7 +1604,7 @@ int ast_cel_engine_init(void) struct cel_config *cel_cfg = cel_config_alloc(); if (!cel_cfg) { - return -1; + return AST_MODULE_LOAD_FAILURE; } /* We couldn't process the configuration so create a default config. */ @@ -1614,18 +1616,17 @@ int ast_cel_engine_init(void) } if (create_subscriptions()) { - return -1; + return AST_MODULE_LOAD_FAILURE; } if (ast_cel_check_enabled() && create_routes()) { - return -1; + return AST_MODULE_LOAD_FAILURE; } - ast_register_cleanup(cel_engine_cleanup); - return 0; + return AST_MODULE_LOAD_SUCCESS; } -int ast_cel_engine_reload(void) +static int reload_module(void) { unsigned int was_enabled = ast_cel_check_enabled(); unsigned int is_enabled; @@ -1745,3 +1746,11 @@ int ast_cel_backend_register(const char *name, ast_cel_backend_cb backend_callba ao2_ref(backend, -1); return 0; } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "CEL Engine", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = AST_MODPRI_CORE, +); diff --git a/main/channel.c b/main/channel.c index 304fae18a..c7847cbd4 100644 --- a/main/channel.c +++ b/main/channel.c @@ -7581,22 +7581,6 @@ static int ast_channel_hash_cb(const void *obj, const int flags) return ast_str_case_hash(name); } -int ast_plc_reload(void) -{ - struct ast_variable *var; - struct ast_flags config_flags = { 0 }; - struct ast_config *cfg = ast_config_load("codecs.conf", config_flags); - if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) - return 0; - for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) { - if (!strcasecmp(var->name, "genericplc")) { - ast_set2_flag(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC); - } - } - ast_config_destroy(cfg); - return 0; -} - /*! * \internal * \brief Print channel object key (name). @@ -7820,8 +7804,6 @@ int ast_channels_init(void) ast_cli_register_multiple(cli_channel, ARRAY_LEN(cli_channel)); - ast_plc_reload(); - ast_register_cleanup(channels_shutdown); AST_RWLIST_HEAD_INIT(&ami_vars); diff --git a/main/config.c b/main/config.c index dfa6f0923..5adcb2386 100644 --- a/main/config.c +++ b/main/config.c @@ -30,6 +30,11 @@ <support_level>core</support_level> ***/ +/* This maintains the original "module reload extconfig" CLI command instead + * of replacing it with "module reload config". */ +#undef AST_MODULE +#define AST_MODULE "extconfig" + #include "asterisk.h" #include "asterisk/paths.h" /* use ast_config_AST_CONFIG_DIR */ @@ -54,6 +59,7 @@ #include "asterisk/astobj2.h" #include "asterisk/strings.h" /* for the ast_str_*() API */ #include "asterisk/netsock2.h" +#include "asterisk/module.h" #define MAX_NESTED_COMMENTS 128 #define COMMENT_START ";--" @@ -2875,7 +2881,7 @@ static int ast_realtime_append_mapping(const char *name, const char *driver, con return 0; } -int read_config_maps(void) +static int reload_module(void) { struct ast_config *config, *configtmp; struct ast_variable *v; @@ -3924,8 +3930,8 @@ static char *handle_cli_core_show_config_mappings(struct ast_cli_entry *e, int c static char *handle_cli_config_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { struct cache_file_mtime *cfmtime; - char *prev = "", *completion_value = NULL; - int wordlen, which = 0; + char *prev = ""; + int wordlen; switch (cmd) { case CLI_INIT: @@ -3943,19 +3949,20 @@ static char *handle_cli_config_reload(struct ast_cli_entry *e, int cmd, struct a AST_LIST_LOCK(&cfmtime_head); AST_LIST_TRAVERSE(&cfmtime_head, cfmtime, list) { - /* Skip duplicates - this only works because the list is sorted by filename */ - if (strcmp(cfmtime->filename, prev) == 0) { + /* Core configs cannot be reloaded */ + if (ast_strlen_zero(cfmtime->who_asked)) { continue; } - /* Core configs cannot be reloaded */ - if (ast_strlen_zero(cfmtime->who_asked)) { + /* Skip duplicates - this only works because the list is sorted by filename */ + if (!strcmp(cfmtime->filename, prev)) { continue; } - if (++which > a->n && strncmp(cfmtime->filename, a->word, wordlen) == 0) { - completion_value = ast_strdup(cfmtime->filename); - break; + if (!strncmp(cfmtime->filename, a->word, wordlen)) { + if (ast_cli_completion_add(ast_strdup(cfmtime->filename))) { + break; + } } /* Otherwise save that we've seen this filename */ @@ -3963,7 +3970,7 @@ static char *handle_cli_config_reload(struct ast_cli_entry *e, int cmd, struct a } AST_LIST_UNLOCK(&cfmtime_head); - return completion_value; + return NULL; } if (a->argc != 3) { @@ -4034,6 +4041,7 @@ static void config_shutdown(void) int register_config_cli(void) { ast_cli_register_multiple(cli_config, ARRAY_LEN(cli_config)); + /* This is separate from the module load so cleanup can happen very late. */ ast_register_cleanup(config_shutdown); return 0; } @@ -4120,3 +4128,26 @@ int ast_config_hook_register(const char *name, ao2_ref(hook, -1); return 0; } + +static int unload_module(void) +{ + return 0; +} + +static int load_module(void) +{ + if (ast_opt_console) { + ast_verb(0, "[ Initializing Custom Configuration Options ]\n"); + } + + return reload_module() ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS; +} + +/* This module explicitly loads before realtime drivers. */ +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Configuration", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = 0, +); diff --git a/main/config_options.c b/main/config_options.c index 3aa00f921..41c8b222c 100644 --- a/main/config_options.c +++ b/main/config_options.c @@ -958,88 +958,79 @@ int aco_set_defaults(struct aco_type *type, const char *category, void *obj) /*! \internal * \brief Complete the name of the module the user is looking for */ -static char *complete_config_module(const char *word, int pos, int state) +static char *complete_config_module(const char *word) { - char *c = NULL; size_t wordlen = strlen(word); - int which = 0; struct ao2_iterator i; struct ast_xml_doc_item *cur; - if (pos != 3) { - return NULL; - } - i = ao2_iterator_init(xmldocs, 0); while ((cur = ao2_iterator_next(&i))) { - if (!strncasecmp(word, cur->name, wordlen) && ++which > state) { - c = ast_strdup(cur->name); - ao2_ref(cur, -1); - break; + if (!strncasecmp(word, cur->name, wordlen)) { + if (ast_cli_completion_add(ast_strdup(cur->name))) { + ao2_ref(cur, -1); + break; + } } ao2_ref(cur, -1); } ao2_iterator_destroy(&i); - return c; + return NULL; } /*! \internal * \brief Complete the name of the configuration type the user is looking for */ -static char *complete_config_type(const char *module, const char *word, int pos, int state) +static char *complete_config_type(const char *module, const char *word) { - char *c = NULL; size_t wordlen = strlen(word); - int which = 0; - RAII_VAR(struct ast_xml_doc_item *, info, NULL, ao2_cleanup); + struct ast_xml_doc_item *info; struct ast_xml_doc_item *cur; - if (pos != 4) { - return NULL; - } - - if (!(info = ao2_find(xmldocs, module, OBJ_KEY))) { + info = ao2_find(xmldocs, module, OBJ_KEY); + if (!info) { return NULL; } cur = info; while ((cur = AST_LIST_NEXT(cur, next))) { - if (!strcasecmp(cur->type, "configObject") && !strncasecmp(word, cur->name, wordlen) && ++which > state) { - c = ast_strdup(cur->name); - break; + if (!strcasecmp(cur->type, "configObject") && !strncasecmp(word, cur->name, wordlen)) { + if (ast_cli_completion_add(ast_strdup(cur->name))) { + break; + } } } - return c; + ao2_ref(info, -1); + + return NULL; } /*! \internal * \brief Complete the name of the configuration option the user is looking for */ -static char *complete_config_option(const char *module, const char *option, const char *word, int pos, int state) +static char *complete_config_option(const char *module, const char *option, const char *word) { - char *c = NULL; size_t wordlen = strlen(word); - int which = 0; - RAII_VAR(struct ast_xml_doc_item *, info, NULL, ao2_cleanup); + struct ast_xml_doc_item *info; struct ast_xml_doc_item *cur; - if (pos != 5) { - return NULL; - } - - if (!(info = ao2_find(xmldocs, module, OBJ_KEY))) { + info = ao2_find(xmldocs, module, OBJ_KEY); + if (!info) { return NULL; } cur = info; while ((cur = AST_LIST_NEXT(cur, next))) { - if (!strcasecmp(cur->type, "configOption") && !strcasecmp(cur->ref, option) && !strncasecmp(word, cur->name, wordlen) && ++which > state) { - c = ast_strdup(cur->name); - break; + if (!strcasecmp(cur->type, "configOption") && !strcasecmp(cur->ref, option) && !strncasecmp(word, cur->name, wordlen)) { + if (ast_cli_completion_add(ast_strdup(cur->name))) { + break; + } } } - return c; + ao2_ref(info, -1); + + return NULL; } /* Define as 0 if we want to allow configurations to be registered without @@ -1340,10 +1331,14 @@ static char *cli_show_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args return NULL; case CLI_GENERATE: switch(a->pos) { - case 3: return complete_config_module(a->word, a->pos, a->n); - case 4: return complete_config_type(a->argv[3], a->word, a->pos, a->n); - case 5: return complete_config_option(a->argv[3], a->argv[4], a->word, a->pos, a->n); - default: return NULL; + case 3: + return complete_config_module(a->word); + case 4: + return complete_config_type(a->argv[3], a->word); + case 5: + return complete_config_option(a->argv[3], a->argv[4], a->word); + default: + return NULL; } } diff --git a/main/dnsmgr.c b/main/dnsmgr.c index 0e5efd6da..c25b601b3 100644 --- a/main/dnsmgr.c +++ b/main/dnsmgr.c @@ -49,6 +49,7 @@ #include <regex.h> #include <signal.h> +#include "asterisk/module.h" #include "asterisk/dnsmgr.h" #include "asterisk/linkedlists.h" #include "asterisk/utils.h" @@ -406,7 +407,7 @@ static struct ast_cli_entry cli_reload = AST_CLI_DEFINE(handle_cli_reload, "Relo static struct ast_cli_entry cli_refresh = AST_CLI_DEFINE(handle_cli_refresh, "Performs an immediate refresh"); static struct ast_cli_entry cli_status = AST_CLI_DEFINE(handle_cli_status, "Display the DNS manager status"); -static void dnsmgr_shutdown(void) +static int unload_module(void) { ast_cli_unregister(&cli_reload); ast_cli_unregister(&cli_status); @@ -424,24 +425,24 @@ static void dnsmgr_shutdown(void) ast_mutex_unlock(&refresh_lock); ast_sched_context_destroy(sched); + + return 0; } -int dnsmgr_init(void) +static int load_module(void) { if (!(sched = ast_sched_context_create())) { ast_log(LOG_ERROR, "Unable to create schedule context.\n"); - return -1; + return AST_MODULE_LOAD_FAILURE; } ast_cli_register(&cli_reload); ast_cli_register(&cli_status); ast_cli_register(&cli_refresh); - ast_register_cleanup(dnsmgr_shutdown); - - return do_reload(1); + return do_reload(1) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS; } -int dnsmgr_reload(void) +static int reload_module(void) { return do_reload(0); } @@ -515,3 +516,11 @@ static int do_reload(int loading) return 0; } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "DNS Manager", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = AST_MODPRI_CORE, +); diff --git a/main/dsp.c b/main/dsp.c index 66d95adc2..ea653d857 100644 --- a/main/dsp.c +++ b/main/dsp.c @@ -57,6 +57,7 @@ #include <math.h> +#include "asterisk/module.h" #include "asterisk/frame.h" #include "asterisk/format_cache.h" #include "asterisk/channel.h" @@ -1331,10 +1332,11 @@ int ast_dsp_busydetect(struct ast_dsp *dsp) #ifndef BUSYDETECT_TONEONLY if ((hittone >= dsp->busycount - 1) && (hitsilence >= dsp->busycount - 1) && (avgtone >= BUSY_MIN && avgtone <= BUSY_MAX) && - (avgsilence >= BUSY_MIN && avgsilence <= BUSY_MAX)) { + (avgsilence >= BUSY_MIN && avgsilence <= BUSY_MAX)) #else - if ((hittone >= dsp->busycount - 1) && (avgtone >= BUSY_MIN && avgtone <= BUSY_MAX)) { + if ((hittone >= dsp->busycount - 1) && (avgtone >= BUSY_MIN && avgtone <= BUSY_MAX)) #endif + { #ifdef BUSYDETECT_COMPARE_TONE_AND_SILENCE if (avgtone > avgsilence) { if (avgtone - avgtone*BUSY_PERCENT/100 <= avgsilence) { @@ -2392,31 +2394,35 @@ AST_TEST_DEFINE(test_dsp_dtmf_detect) } #endif -#ifdef TEST_FRAMEWORK -static void test_dsp_shutdown(void) +static int unload_module(void) { AST_TEST_UNREGISTER(test_dsp_fax_detect); AST_TEST_UNREGISTER(test_dsp_dtmf_detect); + + return 0; } -#endif -int ast_dsp_init(void) +static int load_module(void) { if (_dsp_init(0)) { - return -1; + return AST_MODULE_LOAD_FAILURE; } -#ifdef TEST_FRAMEWORK AST_TEST_REGISTER(test_dsp_fax_detect); AST_TEST_REGISTER(test_dsp_dtmf_detect); - ast_register_cleanup(test_dsp_shutdown); -#endif - - return 0; + return AST_MODULE_LOAD_SUCCESS; } -int ast_dsp_reload(void) +static int reload_module(void) { return _dsp_init(1); } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "DSP", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = AST_MODPRI_CORE, +); diff --git a/main/enum.c b/main/enum.c index 5c217c43c..a44a60cbe 100644 --- a/main/enum.c +++ b/main/enum.c @@ -70,6 +70,7 @@ #include <ctype.h> #include <regex.h> +#include "asterisk/module.h" #include "asterisk/enum.h" #include "asterisk/dns.h" #include "asterisk/channel.h" @@ -1008,12 +1009,25 @@ static int private_enum_init(int reload) return 0; } -int ast_enum_init(void) +static int load_module(void) { - return private_enum_init(0); + return private_enum_init(0) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS; } -int ast_enum_reload(void) +static int unload_module(void) +{ + return 0; +} + +static int reload_module(void) { return private_enum_init(1); } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "ENUM Support", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = AST_MODPRI_CORE, +); diff --git a/main/features.c b/main/features.c index 35039e0fa..3db6d397b 100644 --- a/main/features.c +++ b/main/features.c @@ -40,6 +40,7 @@ #include "asterisk.h" #include "asterisk/_private.h" +#include "features_config.h" #include <pthread.h> #include <signal.h> @@ -1145,29 +1146,32 @@ done: return 0; } -/*! - * \internal - * \brief Clean up resources on Asterisk shutdown - */ -static void features_shutdown(void) +static int unload_module(void) { - ast_features_config_shutdown(); + unload_features_config(); ast_manager_unregister("Bridge"); ast_unregister_application(app_bridge); + return 0; } -int ast_features_init(void) +static int load_module(void) { int res; - res = ast_features_config_init(); + res = load_features_config(); res |= ast_register_application2(app_bridge, bridge_exec, NULL, NULL, NULL); res |= ast_manager_register_xml_core("Bridge", EVENT_FLAG_CALL, action_bridge); - ast_register_cleanup(features_shutdown); - - return res; + return res ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS; } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Call Features", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_features_config, + .load_pri = AST_MODPRI_CORE, +); diff --git a/main/features_config.c b/main/features_config.c index 195fbaceb..f116e89d5 100644 --- a/main/features_config.c +++ b/main/features_config.c @@ -26,6 +26,8 @@ #include "asterisk/app.h" #include "asterisk/cli.h" +#include "features_config.h" + /*** DOCUMENTATION <configInfo name="features" language="en_US"> <synopsis>Features Configuration</synopsis> @@ -1971,7 +1973,7 @@ static struct ast_cli_entry cli_features_config[] = { AST_CLI_DEFINE(handle_feature_show, "Lists configured features"), }; -void ast_features_config_shutdown(void) +void unload_features_config(void) { ast_custom_function_unregister(&featuremap_function); ast_custom_function_unregister(&feature_function); @@ -1980,7 +1982,7 @@ void ast_features_config_shutdown(void) ao2_global_obj_release(globals); } -int ast_features_config_reload(void) +int reload_features_config(void) { /* Rearm the parking config options have moved warning. */ parking_warning = 0; @@ -1991,7 +1993,7 @@ int ast_features_config_reload(void) return 0; } -int ast_features_config_init(void) +int load_features_config(void) { int res; diff --git a/main/features_config.h b/main/features_config.h new file mode 100644 index 000000000..8e9e4acb3 --- /dev/null +++ b/main/features_config.h @@ -0,0 +1,28 @@ +/* +* Asterisk -- An open source telephony toolkit. +* +* Copyright (C) 2018, CFWare, LLC. +* +* Corey Farrell <git@cfware.com> +* +* See http://www.asterisk.org for more information about +* the Asterisk project. Please do not directly contact +* any of the maintainers of this project for assistance; +* the project provides a web site, mailing lists and IRC +* channels for your use. +* +* This program is free software, distributed under the terms of +* the GNU General Public License Version 2. See the LICENSE file +* at the top of the source tree. +*/ + +#ifndef FEATURES_CONFIG_H_ +#define FEATURES_CONFIG_H_ + +int load_features_config(void); + +int reload_features_config(void); + +void unload_features_config(void); + +#endif /* FEATURES_CONFIG_H_ */ diff --git a/main/http.c b/main/http.c index 30b2fe2c4..55d10290b 100644 --- a/main/http.c +++ b/main/http.c @@ -60,7 +60,7 @@ #include "asterisk/stringfields.h" #include "asterisk/ast_version.h" #include "asterisk/manager.h" -#include "asterisk/_private.h" +#include "asterisk/module.h" #include "asterisk/astobj2.h" #include "asterisk/netsock2.h" #include "asterisk/json.h" @@ -2264,7 +2264,7 @@ static char *handle_show_http(struct ast_cli_entry *e, int cmd, struct ast_cli_a return CLI_SUCCESS; } -int ast_http_reload(void) +static int reload_module(void) { return __ast_http_load(1); } @@ -2273,7 +2273,7 @@ static struct ast_cli_entry cli_http[] = { AST_CLI_DEFINE(handle_show_http, "Display HTTP server status"), }; -static void http_shutdown(void) +static int unload_module(void) { struct http_uri_redirect *redirect; ast_cli_unregister_multiple(cli_http, ARRAY_LEN(cli_http)); @@ -2295,14 +2295,23 @@ static void http_shutdown(void) ast_free(redirect); } AST_RWLIST_UNLOCK(&uri_redirects); + + return 0; } -int ast_http_init(void) +static int load_module(void) { ast_http_uri_link(&statusuri); ast_http_uri_link(&staticuri); ast_cli_register_multiple(cli_http, ARRAY_LEN(cli_http)); - ast_register_cleanup(http_shutdown); - return __ast_http_load(0); + return __ast_http_load(0) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS; } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Built-in HTTP Server", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = AST_MODPRI_CORE, +); diff --git a/main/indications.c b/main/indications.c index 89710584b..9b0976809 100644 --- a/main/indications.c +++ b/main/indications.c @@ -1114,7 +1114,7 @@ static int ast_tone_zone_cmp(void *obj, void *arg, int flags) * \internal * \brief Clean up resources on Asterisk shutdown */ -static void indications_shutdown(void) +static int unload_module(void) { ast_cli_unregister_multiple(cli_indications, ARRAY_LEN(cli_indications)); if (default_tone_zone) { @@ -1125,29 +1125,38 @@ static void indications_shutdown(void) ao2_ref(ast_tone_zones, -1); ast_tone_zones = NULL; } + + return 0; } /*! \brief Load indications module */ -int ast_indications_init(void) +static int load_module(void) { ast_tone_zones = ao2_container_alloc(NUM_TONE_ZONE_BUCKETS, ast_tone_zone_hash, ast_tone_zone_cmp); if (!ast_tone_zones) { - return -1; + return AST_MODULE_LOAD_FAILURE; } if (load_indications(0)) { - return -1; + return AST_MODULE_LOAD_FAILURE; } ast_cli_register_multiple(cli_indications, ARRAY_LEN(cli_indications)); - ast_register_cleanup(indications_shutdown); - return 0; + return AST_MODULE_LOAD_SUCCESS; } /*! \brief Reload indications module */ -int ast_indications_reload(void) +static int reload_module(void) { return load_indications(1); } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Indication Tone Handling", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = AST_MODPRI_CORE, +); diff --git a/main/loader.c b/main/loader.c index 08d9552ff..bc7896205 100644 --- a/main/loader.c +++ b/main/loader.c @@ -42,19 +42,12 @@ #include "asterisk/config.h" #include "asterisk/channel.h" #include "asterisk/term.h" -#include "asterisk/acl.h" #include "asterisk/manager.h" -#include "asterisk/cdr.h" -#include "asterisk/enum.h" -#include "asterisk/http.h" +#include "asterisk/io.h" #include "asterisk/lock.h" -#include "asterisk/features_config.h" -#include "asterisk/dsp.h" -#include "asterisk/udptl.h" #include "asterisk/vector.h" #include "asterisk/app.h" #include "asterisk/test.h" -#include "asterisk/sounds_index.h" #include "asterisk/cli.h" #include <dlfcn.h> @@ -513,10 +506,11 @@ void ast_module_register(const struct ast_module_info *info) struct ast_module *mod; if (!loader_ready) { - mod = ast_calloc(1, sizeof(*mod) + strlen(info->name) + 1); + mod = ast_std_calloc(1, sizeof(*mod) + strlen(info->name) + 1); if (!mod) { /* We haven't even reached main() yet, if we can't * allocate memory at this point just give up. */ + fprintf(stderr, "Allocation failure during startup.\n"); exit(2); } strcpy(mod->resource, info->name); /* safe */ @@ -580,7 +574,11 @@ static void module_destroy(struct ast_module *mod) AST_LIST_HEAD_DESTROY(&mod->users); ao2_cleanup(mod->ref_debug); - ast_free(mod); + if (mod->flags.builtin) { + ast_std_free(mod); + } else { + ast_free(mod); + } } void ast_module_unregister(const struct ast_module_info *info) @@ -690,33 +688,6 @@ void __ast_module_user_hangup_all(struct ast_module *mod) ast_update_use_count(); } -/*! \note - * In addition to modules, the reload command handles some extra keywords - * which are listed here together with the corresponding handlers. - * This table is also used by the command completion code. - */ -static struct reload_classes { - const char *name; - int (*reload_fn)(void); -} reload_classes[] = { /* list in alpha order, longest match first for cli completion */ - { "acl", ast_named_acl_reload }, - { "cdr", ast_cdr_engine_reload }, - { "cel", ast_cel_engine_reload }, - { "dnsmgr", dnsmgr_reload }, - { "dsp", ast_dsp_reload}, - { "extconfig", read_config_maps }, - { "enum", ast_enum_reload }, - { "features", ast_features_config_reload }, - { "http", ast_http_reload }, - { "indications", ast_indications_reload }, - { "logger", logger_reload }, - { "manager", reload_manager }, - { "plc", ast_plc_reload }, - { "sounds", ast_sounds_reindex }, - { "udptl", ast_udptl_reload }, - { NULL, NULL } -}; - static int printdigest(const unsigned char *d) { int x, pos; @@ -1160,16 +1131,6 @@ char *ast_module_helper(const char *line, const char *word, int pos, int state, return NULL; } - if (type == AST_MODULE_HELPER_RELOAD) { - int idx; - - for (idx = 0; reload_classes[idx].name; idx++) { - if (!strncasecmp(word, reload_classes[idx].name, wordlen) && ++which > state) { - return ast_strdup(reload_classes[idx].name); - } - } - } - AST_DLLIST_LOCK(&module_list); AST_DLLIST_TRAVERSE(&module_list, mod, entry) { if (!module_matches_helper_type(mod, type)) { @@ -1345,7 +1306,6 @@ enum ast_module_reload_result ast_module_reload(const char *name) { struct ast_module *cur; enum ast_module_reload_result res = AST_MODULE_RELOAD_NOT_FOUND; - int i; size_t name_baselen = name ? resource_name_baselen(name) : 0; /* If we aren't fully booted, we just pretend we reloaded but we queue this @@ -1380,22 +1340,6 @@ enum ast_module_reload_result ast_module_reload(const char *name) } } - /* Call "predefined" reload here first */ - for (i = 0; reload_classes[i].name; i++) { - if (!name || !strcasecmp(name, reload_classes[i].name)) { - if (reload_classes[i].reload_fn() == AST_MODULE_LOAD_SUCCESS) { - res = AST_MODULE_RELOAD_SUCCESS; - } - } - } - - if (name && res == AST_MODULE_RELOAD_SUCCESS) { - if (ast_opt_lock_confdir) { - ast_unlock_path(ast_config_AST_CONFIG_DIR); - } - goto module_reload_done; - } - AST_DLLIST_LOCK(&module_list); AST_DLLIST_TRAVERSE(&module_list, cur, entry) { const struct ast_module_info *info = cur->info; @@ -1516,6 +1460,10 @@ static enum ast_module_load_result start_resource(struct ast_module *mod) } mod->flags.running = 1; + if (mod->flags.builtin) { + /* Built-in modules cannot be unloaded. */ + ast_module_shutdown_ref(mod); + } ast_update_use_count(); break; @@ -1881,6 +1829,19 @@ int load_modules(unsigned int preload_only) ast_module_register(resource_being_loaded->info); } + if (!preload_only) { + struct ast_module *mod; + + /* Add all built-in modules to the load order. */ + AST_DLLIST_TRAVERSE(&module_list, mod, entry) { + if (!mod->flags.builtin) { + continue; + } + + add_to_load_order(mod->resource, &load_order, 0); + } + } + cfg = ast_config_load2(AST_MODULE_CONFIG, "" /* core, can't reload */, config_flags); if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEINVALID) { ast_log(LOG_WARNING, "No '%s' found, no modules will be loaded.\n", AST_MODULE_CONFIG); diff --git a/main/logger.c b/main/logger.c index 6060b3c4d..46d61ed33 100644 --- a/main/logger.c +++ b/main/logger.c @@ -49,6 +49,7 @@ #include <fcntl.h> #include "asterisk/_private.h" +#include "asterisk/module.h" #include "asterisk/paths.h" /* use ast_config_AST_LOG_DIR */ #include "asterisk/logger.h" #include "asterisk/lock.h" @@ -1125,16 +1126,6 @@ static int reload_logger(int rotate, const char *altconf) return res; } -/*! \brief Reload the logger module without rotating log files (also used from loader.c during - a full Asterisk reload) */ -int logger_reload(void) -{ - if (reload_logger(0, NULL)) { - return RESULT_FAILURE; - } - return RESULT_SUCCESS; -} - static char *handle_logger_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -2369,3 +2360,27 @@ int ast_logger_get_queue_limit(void) { return logger_queue_limit; } + +static int reload_module(void) +{ + return reload_logger(0, NULL); +} + +static int unload_module(void) +{ + return 0; +} + +static int load_module(void) +{ + return AST_MODULE_LOAD_SUCCESS; +} + +/* Logger is initialized separate from the module loader, only reload_module does anything. */ +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Logger", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = 0, +); diff --git a/main/manager.c b/main/manager.c index b698702af..64b07d319 100644 --- a/main/manager.c +++ b/main/manager.c @@ -2710,6 +2710,8 @@ static char *handle_showmaneventq(struct ast_cli_entry *e, int cmd, struct ast_c return CLI_SUCCESS; } +static int reload_module(void); + /*! \brief CLI command manager reload */ static char *handle_manager_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { @@ -2726,7 +2728,7 @@ static char *handle_manager_reload(struct ast_cli_entry *e, int cmd, struct ast_ if (a->argc > 2) { return CLI_SHOWUSAGE; } - reload_manager(); + reload_module(); return CLI_SUCCESS; } @@ -8971,8 +8973,6 @@ static int __init_manager(int reload, int by_external_config) #endif int res; - ast_register_cleanup(manager_shutdown); - res = STASIS_MESSAGE_TYPE_INIT(ast_manager_get_generic_type); if (res != 0) { return -1; @@ -9455,12 +9455,19 @@ static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, __init_manager(1, 1); } -int init_manager(void) +static int unload_module(void) +{ + return 0; +} + +static int load_module(void) { - return __init_manager(0, 0); + ast_register_cleanup(manager_shutdown); + + return __init_manager(0, 0) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS; } -int reload_manager(void) +static int reload_module(void) { return __init_manager(1, 0); } @@ -9557,3 +9564,12 @@ ast_manager_event_blob_create( return ev; } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Asterisk Manager Interface", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = AST_MODPRI_CORE, + .requires = "http", +); diff --git a/main/named_acl.c b/main/named_acl.c index 3a4c45401..4f2069a75 100644 --- a/main/named_acl.c +++ b/main/named_acl.c @@ -27,6 +27,11 @@ * Olle E. Johansson <oej@edvina.net> */ +/* This maintains the original "module reload acl" CLI command instead + * of replacing it with "module reload named_acl". */ +#undef AST_MODULE +#define AST_MODULE "acl" + #include "asterisk.h" #include "asterisk/config.h" @@ -397,36 +402,6 @@ publish_failure: /*! * \internal - * \brief reload configuration for named ACLs - * - * \param fd file descriptor for CLI client - */ -int ast_named_acl_reload(void) -{ - enum aco_process_status status; - - status = aco_process_config(&cfg_info, 1); - - if (status == ACO_PROCESS_ERROR) { - ast_log(LOG_WARNING, "Could not reload ACL config\n"); - return 0; - } - - if (status == ACO_PROCESS_UNCHANGED) { - /* We don't actually log anything if the config was unchanged, - * but we don't need to send a config change event either. - */ - return 0; - } - - /* We need to push an ACL change event with no ACL name so that all subscribers update with all ACLs */ - publish_acl_change(""); - - return 0; -} - -/*! - * \internal * \brief secondary handler for the 'acl show <name>' command (with arg) * * \param fd file descriptor of the cli @@ -552,32 +527,64 @@ static struct ast_cli_entry cli_named_acl[] = { AST_CLI_DEFINE(handle_show_named_acl_cmd, "Show a named ACL or list all named ACLs"), }; -static void named_acl_cleanup(void) +static int reload_module(void) +{ + enum aco_process_status status; + + status = aco_process_config(&cfg_info, 1); + + if (status == ACO_PROCESS_ERROR) { + ast_log(LOG_WARNING, "Could not reload ACL config\n"); + return 0; + } + + if (status == ACO_PROCESS_UNCHANGED) { + /* We don't actually log anything if the config was unchanged, + * but we don't need to send a config change event either. + */ + return 0; + } + + /* We need to push an ACL change event with no ACL name so that all subscribers update with all ACLs */ + publish_acl_change(""); + + return 0; +} + +static int unload_module(void) { ast_cli_unregister_multiple(cli_named_acl, ARRAY_LEN(cli_named_acl)); STASIS_MESSAGE_TYPE_CLEANUP(ast_named_acl_change_type); aco_info_destroy(&cfg_info); ao2_global_obj_release(globals); + + return 0; } -int ast_named_acl_init() +static int load_module(void) { - ast_cli_register_multiple(cli_named_acl, ARRAY_LEN(cli_named_acl)); - - STASIS_MESSAGE_TYPE_INIT(ast_named_acl_change_type); - - ast_register_cleanup(named_acl_cleanup); - if (aco_info_init(&cfg_info)) { - return 0; + return AST_MODULE_LOAD_FAILURE; } + STASIS_MESSAGE_TYPE_INIT(ast_named_acl_change_type); + /* Register the per level options. */ aco_option_register(&cfg_info, "permit", ACO_EXACT, named_acl_types, NULL, OPT_ACL_T, 1, FLDSET(struct named_acl, ha)); aco_option_register(&cfg_info, "deny", ACO_EXACT, named_acl_types, NULL, OPT_ACL_T, 0, FLDSET(struct named_acl, ha)); aco_process_config(&cfg_info, 0); - return 0; + ast_cli_register_multiple(cli_named_acl, ARRAY_LEN(cli_named_acl)); + + return AST_MODULE_LOAD_SUCCESS; } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Named ACL system", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = AST_MODPRI_CORE, +); diff --git a/main/plc.c b/main/plc.c index 2a8279f46..847ce65b0 100644 --- a/main/plc.c +++ b/main/plc.c @@ -38,6 +38,8 @@ #include <math.h> +#include "asterisk/config.h" +#include "asterisk/module.h" #include "asterisk/plc.h" #if !defined(FALSE) @@ -246,3 +248,43 @@ plc_state_t *plc_init(plc_state_t *s) } /*- End of function --------------------------------------------------------*/ /*- End of file ------------------------------------------------------------*/ + +static int reload_module(void) +{ + struct ast_variable *var; + struct ast_flags config_flags = { 0 }; + struct ast_config *cfg = ast_config_load("codecs.conf", config_flags); + + if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) { + return 0; + } + + for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) { + if (!strcasecmp(var->name, "genericplc")) { + ast_set2_flag(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC); + } + } + ast_config_destroy(cfg); + + return 0; +} + +static int load_module(void) +{ + reload_module(); + + return AST_MODULE_LOAD_SUCCESS; +} + +static int unload_module(void) +{ + return 0; +} + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "PLC", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = AST_MODPRI_CORE, +); diff --git a/main/sounds.c b/main/sounds.c index c792c1bbd..08e29275e 100644 --- a/main/sounds.c +++ b/main/sounds.c @@ -34,7 +34,7 @@ #include "asterisk/sounds_index.h" #include "asterisk/file.h" #include "asterisk/cli.h" -#include "asterisk/_private.h" +#include "asterisk/module.h" #include "asterisk/stasis_message_router.h" #include "asterisk/stasis_system.h" @@ -111,7 +111,7 @@ static int update_index_cb(void *obj, void *arg, int flags) AST_MUTEX_DEFINE_STATIC(reload_lock); -int ast_sounds_reindex(void) +static int reload_module(void) { RAII_VAR(struct ast_str *, sounds_dir, NULL, ast_free); RAII_VAR(struct ao2_container *, languages, NULL, ao2_cleanup); @@ -273,13 +273,15 @@ static struct ast_cli_entry cli_sounds[] = { AST_CLI_DEFINE(handle_cli_sound_show, "Shows details about a specific sound"), }; -static void sounds_cleanup(void) +static int unload_module(void) { stasis_message_router_unsubscribe_and_join(sounds_system_router); sounds_system_router = NULL; ast_cli_unregister_multiple(cli_sounds, ARRAY_LEN(cli_sounds)); ao2_cleanup(sounds_index); sounds_index = NULL; + + return 0; } static void format_update_cb(void *data, struct stasis_subscription *sub, @@ -287,21 +289,21 @@ static void format_update_cb(void *data, struct stasis_subscription *sub, { /* Reindexing during shutdown is pointless. */ if (!ast_shutting_down()) { - ast_sounds_reindex(); + reload_module(); } } -int ast_sounds_index_init(void) +static int load_module(void) { int res = 0; - if (ast_sounds_reindex()) { - return -1; + if (reload_module()) { + return AST_MODULE_LOAD_FAILURE; } res |= ast_cli_register_multiple(cli_sounds, ARRAY_LEN(cli_sounds)); sounds_system_router = stasis_message_router_create(ast_system_topic()); if (!sounds_system_router) { - return -1; + return AST_MODULE_LOAD_FAILURE; } if (ast_format_register_type()) { @@ -320,15 +322,19 @@ int ast_sounds_index_init(void) NULL); } - if (res) { - return -1; - } - - ast_register_cleanup(sounds_cleanup); - return 0; + return res ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS; } struct ast_media_index *ast_sounds_get_index(void) { return ao2_bump(sounds_index); } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Sounds Index", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + /* Load after the format modules to reduce processing during startup. */ + .load_pri = AST_MODPRI_APP_DEPEND + 1, +); diff --git a/main/stringfields.c b/main/stringfields.c index 30aa8cddd..0a9e59903 100644 --- a/main/stringfields.c +++ b/main/stringfields.c @@ -179,11 +179,6 @@ int __ast_string_field_init(struct ast_string_field_mgr *mgr, struct ast_string_ } mgr->last_alloc = NULL; - /* v-- MALLOC_DEBUG information */ - mgr->owner_file = file; - mgr->owner_func = func; - mgr->owner_line = lineno; - /* ^-- MALLOC_DEBUG information */ if (AST_VECTOR_INIT(&mgr->string_fields, initial_vector_size)) { return -1; @@ -205,7 +200,8 @@ int __ast_string_field_init(struct ast_string_field_mgr *mgr, struct ast_string_ } ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr, - struct ast_string_field_pool **pool_head, size_t needed) + struct ast_string_field_pool **pool_head, size_t needed, + const char *file, int lineno, const char *func) { char *result = NULL; size_t space = (*pool_head)->size - (*pool_head)->used; @@ -222,8 +218,7 @@ ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr new_size *= 2; } - if (add_string_pool(mgr, pool_head, new_size, - mgr->owner_file, mgr->owner_line, mgr->owner_func)) { + if (add_string_pool(mgr, pool_head, new_size, file, lineno, func)) { return NULL; } } @@ -290,7 +285,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head, void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, ast_string_field *ptr, - const char *format, va_list ap) + const char *format, va_list ap, + const char *file, int lineno, const char *func) { size_t needed; size_t available; @@ -342,7 +338,8 @@ void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr, (if it has one), or the space available in the pool (if it does not). allocate space for it, adding a new string pool if necessary. */ - if (!(target = (char *) __ast_string_field_alloc_space(mgr, pool_head, needed))) { + target = (char *) __ast_string_field_alloc_space(mgr, pool_head, needed, file, lineno, func); + if (!target) { return; } vsprintf(target, format, ap); @@ -369,13 +366,14 @@ void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr, } } -void __ast_string_field_ptr_build(struct ast_string_field_mgr *mgr, +void __ast_string_field_ptr_build(const char *file, int lineno, const char *func, + struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, ast_string_field *ptr, const char *format, ...) { va_list ap; va_start(ap, format); - __ast_string_field_ptr_build_va(mgr, pool_head, ptr, format, ap); + __ast_string_field_ptr_build_va(mgr, pool_head, ptr, format, ap, file, lineno, func); va_end(ap); } @@ -419,11 +417,6 @@ void *__ast_calloc_with_stringfields(unsigned int num_structs, size_t struct_siz mgr->embedded_pool = pool; *pool_head = pool; pool->size = size_to_alloc - struct_size - sizeof(*pool); - /* v-- MALLOC_DEBUG information */ - mgr->owner_file = file; - mgr->owner_func = func; - mgr->owner_line = lineno; - /* ^-- MALLOC_DEBUG information */ return allocation; } @@ -446,7 +439,8 @@ int __ast_string_fields_cmp(struct ast_string_field_vector *left, } int __ast_string_fields_copy(struct ast_string_field_pool *copy_pool, - struct ast_string_field_mgr *copy_mgr, struct ast_string_field_mgr *orig_mgr) + struct ast_string_field_mgr *copy_mgr, struct ast_string_field_mgr *orig_mgr, + const char *file, int lineno, const char *func) { int i; struct ast_string_field_vector *dest = &(copy_mgr->string_fields); @@ -460,8 +454,8 @@ int __ast_string_fields_copy(struct ast_string_field_pool *copy_pool, } for (i = 0; i < AST_VECTOR_SIZE(dest); i++) { - if (ast_string_field_ptr_set_by_fields(copy_pool, *copy_mgr, AST_VECTOR_GET(dest, i), - *AST_VECTOR_GET(src, i))) { + if (__ast_string_field_ptr_set_by_fields(copy_pool, *copy_mgr, AST_VECTOR_GET(dest, i), + *AST_VECTOR_GET(src, i), file, lineno, func)) { return -1; } } diff --git a/main/taskprocessor.c b/main/taskprocessor.c index cf82efff2..91eb7d993 100644 --- a/main/taskprocessor.c +++ b/main/taskprocessor.c @@ -341,26 +341,27 @@ static void *tps_task_free(struct tps_task *task) static char *tps_taskprocessor_tab_complete(struct ast_cli_args *a) { int tklen; - int wordnum = 0; struct ast_taskprocessor *p; - char *name = NULL; struct ao2_iterator i; - if (a->pos != 3) + if (a->pos != 3) { return NULL; + } tklen = strlen(a->word); i = ao2_iterator_init(tps_singletons, 0); while ((p = ao2_iterator_next(&i))) { - if (!strncasecmp(a->word, p->name, tklen) && ++wordnum > a->n) { - name = ast_strdup(p->name); - ast_taskprocessor_unreference(p); - break; + if (!strncasecmp(a->word, p->name, tklen)) { + if (ast_cli_completion_add(ast_strdup(p->name))) { + ast_taskprocessor_unreference(p); + break; + } } ast_taskprocessor_unreference(p); } ao2_iterator_destroy(&i); - return name; + + return NULL; } /* ping task handling function */ diff --git a/main/translate.c b/main/translate.c index 226d0985d..396c5522e 100644 --- a/main/translate.c +++ b/main/translate.c @@ -900,9 +900,9 @@ const char *ast_translate_path_to_str(struct ast_trans_pvt *p, struct ast_str ** return ast_str_buffer(*str); } -static char *complete_trans_path_choice(const char *line, const char *word, int pos, int state) +static char *complete_trans_path_choice(const char *word) { - int i = 1, which = 0; + int i = 1; int wordlen = strlen(word); struct ast_codec *codec; @@ -912,13 +912,15 @@ static char *complete_trans_path_choice(const char *line, const char *word, int ao2_ref(codec, -1); continue; } - if (!strncasecmp(word, codec->name, wordlen) && ++which > state) { - char *res = ast_strdup(codec->name); - ao2_ref(codec, -1); - return res; + if (!strncasecmp(word, codec->name, wordlen)) { + if (ast_cli_completion_add(ast_strdup(codec->name))) { + ao2_ref(codec, -1); + break; + } } ao2_ref(codec, -1); } + return NULL; } @@ -1138,10 +1140,10 @@ static char *handle_cli_core_show_translation(struct ast_cli_entry *e, int cmd, return NULL; case CLI_GENERATE: if (a->pos == 3) { - return ast_cli_complete(a->word, option, a->n); + return ast_cli_complete(a->word, option, -1); } if (a->pos == 4 && !strcasecmp(a->argv[3], option[1])) { - return complete_trans_path_choice(a->line, a->word, a->pos, a->n); + return complete_trans_path_choice(a->word); } /* BUGBUG - add tab completion for sample rates */ return NULL; diff --git a/main/udptl.c b/main/udptl.c index 5a491e65c..f6cd3b90a 100644 --- a/main/udptl.c +++ b/main/udptl.c @@ -67,6 +67,7 @@ #include <signal.h> #include <fcntl.h> +#include "asterisk/module.h" #include "asterisk/udptl.h" #include "asterisk/frame.h" #include "asterisk/channel.h" @@ -1355,9 +1356,10 @@ static int udptl_pre_apply_config(void) { return 0; } -int ast_udptl_reload(void) +static int reload_module(void) { __ast_udptl_reload(1); + return 0; } @@ -1365,17 +1367,19 @@ int ast_udptl_reload(void) * \internal * \brief Clean up resources on Asterisk shutdown */ -static void udptl_shutdown(void) +static int unload_module(void) { ast_cli_unregister_multiple(cli_udptl, ARRAY_LEN(cli_udptl)); ao2_t_global_obj_release(globals, "Unref udptl global container in shutdown"); aco_info_destroy(&cfg_info); + + return 0; } -void ast_udptl_init(void) +static int load_module(void) { if (aco_info_init(&cfg_info)) { - return; + return AST_MODULE_LOAD_FAILURE; } aco_option_register(&cfg_info, "udptlstart", ACO_EXACT, general_options, __stringify(DEFAULT_UDPTLSTART), @@ -1407,5 +1411,13 @@ void ast_udptl_init(void) ast_cli_register_multiple(cli_udptl, ARRAY_LEN(cli_udptl)); - ast_register_cleanup(udptl_shutdown); + return AST_MODULE_LOAD_SUCCESS; } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "UDPTL", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = AST_MODPRI_CORE, +); |