Prototypes for public functions only of internal interest,. More...

Go to the source code of this file.
Functions | |
| void | ast_autoservice_init (void) |
| void | ast_builtins_init (void) |
| initialize the _full_cmd string in * each of the builtins. | |
| int | ast_cel_engine_init (void) |
| int | ast_cel_engine_reload (void) |
| void | ast_channels_init (void) |
| int | ast_cli_perms_init (int reload) |
| int | ast_data_init (void) |
| int | ast_device_state_engine_init (void) |
| Initialize the device state engine in separate thread. | |
| int | ast_event_init (void) |
| int | ast_features_init (void) |
| int | ast_file_init (void) |
| int | ast_format_attr_init (void) |
| Init the ast_format attribute interface register container. | |
| int | ast_format_list_init (void) |
| Init the Asterisk global format list after all format attribute modules have been loaded. | |
| int | ast_http_init (void) |
| int | ast_http_reload (void) |
| int | ast_indications_init (void) |
| Load indications module. | |
| int | ast_indications_reload (void) |
| Reload indications module. | |
| int | ast_module_reload (const char *name) |
| Reload asterisk modules. | |
| int | ast_msg_init (void) |
| void | ast_msg_shutdown (void) |
| int | ast_plc_reload (void) |
| Reload genericplc configuration value from codecs.conf. | |
| void | ast_process_pending_reloads (void) |
| Process reload requests received during startup. | |
| int | ast_rtp_engine_init (void) |
| initializes the rtp engine arrays | |
| int | ast_ssl_init (void) |
| void | ast_stun_init (void) |
| Initialize the STUN system in Asterisk. | |
| int | ast_term_init (void) |
| int | ast_test_init (void) |
| int | ast_timing_init (void) |
| int | ast_tps_init (void) |
| int | ast_xmldoc_load_documentation (void) |
| Load XML documentation. Provided by xmldoc.c. | |
| int | astdb_init (void) |
| int | astobj2_init (void) |
| void | clean_time_zones (void) |
| void | close_logger (void) |
| int | dnsmgr_init (void) |
| int | dnsmgr_reload (void) |
| void | dnsmgr_start_refresh (void) |
| int | init_framer (void) |
| int | init_logger (void) |
| int | load_modules (unsigned int) |
| int | load_pbx (void) |
| void | threadstorage_init (void) |
Prototypes for public functions only of internal interest,.
Definition in file _private.h.
| void ast_autoservice_init | ( | void | ) |
Provided by autoservice.c
Definition at line 340 of file autoservice.c.
References as_cond, and ast_cond_init.
Referenced by main().
{
ast_cond_init(&as_cond, NULL);
}
| void ast_builtins_init | ( | void | ) |
initialize the _full_cmd string in * each of the builtins.
Provided by cli.c
Definition at line 2000 of file cli.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_register_atexit(), and cli_shutdown().
Referenced by main().
| int ast_cel_engine_init | ( | void | ) |
Provided by cel.c
Definition at line 871 of file cel.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_options, app_cmp(), app_hash(), ast_cel_engine_term(), ast_cli_register(), ast_register_atexit(), do_reload(), lid_cmp(), lid_hash(), and NUM_APP_BUCKETS.
Referenced by main().
{
/*
* Accesses to the appset and linkedids containers have to be
* protected by the reload_lock so they don't need a lock of
* their own.
*/
appset = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, NUM_APP_BUCKETS,
app_hash, app_cmp);
if (!appset) {
return -1;
}
linkedids = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, NUM_APP_BUCKETS,
lid_hash, lid_cmp);
if (!linkedids) {
ast_cel_engine_term();
return -1;
}
if (do_reload(0) || ast_cli_register(&cli_status)) {
ast_cel_engine_term();
return -1;
}
ast_register_atexit(ast_cel_engine_term);
return 0;
}
| int ast_cel_engine_reload | ( | void | ) |
Provided by cel.c
Definition at line 900 of file cel.c.
References do_reload().
{
return do_reload(1);
}
| void ast_channels_init | ( | void | ) |
Provided by channel.c
Definition at line 8633 of file channel.c.
References ao2_container_alloc, ARRAY_LEN, ast_channel_cmp_cb(), ast_channel_hash_cb(), ast_cli_register_multiple(), ast_data_register_multiple_core, ast_plc_reload(), ast_register_atexit(), channels, channels_shutdown(), cli_channel, and NUM_CHANNEL_BUCKETS.
Referenced by main().
{
channels = ao2_container_alloc(NUM_CHANNEL_BUCKETS,
ast_channel_hash_cb, ast_channel_cmp_cb);
ast_cli_register_multiple(cli_channel, ARRAY_LEN(cli_channel));
ast_data_register_multiple_core(channel_providers, ARRAY_LEN(channel_providers));
ast_plc_reload();
ast_register_atexit(channels_shutdown);
}
| int ast_cli_perms_init | ( | int | reload | ) |
Provided by cli.c
Definition at line 1872 of file cli.c.
References ast_calloc, ast_category_browse(), ast_config_destroy(), ast_config_load2(), ast_free, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_log(), ast_mutex_trylock, ast_mutex_unlock, AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strdup, ast_strlen_zero(), ast_variable_browse(), cli_perm::command, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEUNCHANGED, destroy_user_perms(), usergroup_cli_perm::gid, LOG_NOTICE, LOG_WARNING, ast_variable::name, ast_variable::next, cli_perm::permit, usergroup_cli_perm::perms, perms_config, usergroup_cli_perm::uid, and ast_variable::value.
Referenced by handle_cli_reload_permissions(), and main().
{
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
struct ast_config *cfg;
char *cat = NULL;
struct ast_variable *v;
struct usergroup_cli_perm *user_group, *cp_entry;
struct cli_perm *perm = NULL;
struct passwd *pw;
struct group *gr;
if (ast_mutex_trylock(&permsconfiglock)) {
ast_log(LOG_NOTICE, "You must wait until last 'cli reload permissions' command finish\n");
return 1;
}
cfg = ast_config_load2(perms_config, "" /* core, can't reload */, config_flags);
if (!cfg) {
ast_mutex_unlock(&permsconfiglock);
return 1;
} else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
ast_mutex_unlock(&permsconfiglock);
return 0;
}
/* free current structures. */
destroy_user_perms();
while ((cat = ast_category_browse(cfg, cat))) {
if (!strcasecmp(cat, "general")) {
/* General options */
for (v = ast_variable_browse(cfg, cat); v; v = v->next) {
if (!strcasecmp(v->name, "default_perm")) {
cli_default_perm = (!strcasecmp(v->value, "permit")) ? 1: 0;
}
}
continue;
}
/* users or groups */
gr = NULL, pw = NULL;
if (cat[0] == '@') {
/* This is a group */
gr = getgrnam(&cat[1]);
if (!gr) {
ast_log (LOG_WARNING, "Unknown group '%s'\n", &cat[1]);
continue;
}
} else {
/* This is a user */
pw = getpwnam(cat);
if (!pw) {
ast_log (LOG_WARNING, "Unknown user '%s'\n", cat);
continue;
}
}
user_group = NULL;
/* Check for duplicates */
AST_RWLIST_WRLOCK(&cli_perms);
AST_LIST_TRAVERSE(&cli_perms, cp_entry, list) {
if ((pw && cp_entry->uid == pw->pw_uid) || (gr && cp_entry->gid == gr->gr_gid)) {
/* if it is duplicated, just added this new settings, to
the current list. */
user_group = cp_entry;
break;
}
}
AST_RWLIST_UNLOCK(&cli_perms);
if (!user_group) {
/* alloc space for the new user config. */
user_group = ast_calloc(1, sizeof(*user_group));
if (!user_group) {
continue;
}
user_group->uid = (pw ? pw->pw_uid : -1);
user_group->gid = (gr ? gr->gr_gid : -1);
user_group->perms = ast_calloc(1, sizeof(*user_group->perms));
if (!user_group->perms) {
ast_free(user_group);
continue;
}
}
for (v = ast_variable_browse(cfg, cat); v; v = v->next) {
if (ast_strlen_zero(v->value)) {
/* we need to check this condition cause it could break security. */
ast_log(LOG_WARNING, "Empty permit/deny option in user '%s'\n", cat);
continue;
}
if (!strcasecmp(v->name, "permit")) {
perm = ast_calloc(1, sizeof(*perm));
if (perm) {
perm->permit = 1;
perm->command = ast_strdup(v->value);
}
} else if (!strcasecmp(v->name, "deny")) {
perm = ast_calloc(1, sizeof(*perm));
if (perm) {
perm->permit = 0;
perm->command = ast_strdup(v->value);
}
} else {
/* up to now, only 'permit' and 'deny' are possible values. */
ast_log(LOG_WARNING, "Unknown '%s' option\n", v->name);
continue;
}
if (perm) {
/* Added the permission to the user's list. */
AST_LIST_INSERT_TAIL(user_group->perms, perm, list);
perm = NULL;
}
}
AST_RWLIST_WRLOCK(&cli_perms);
AST_RWLIST_INSERT_TAIL(&cli_perms, user_group, list);
AST_RWLIST_UNLOCK(&cli_perms);
}
ast_config_destroy(cfg);
ast_mutex_unlock(&permsconfiglock);
return 0;
}
| int ast_data_init | ( | void | ) |
Provided by data.c
Definition at line 3328 of file data.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_manager_register_xml_core, ast_register_atexit(), ast_rwlock_init, AST_TEST_REGISTER, cli_data, data_provider_cmp(), data_provider_hash(), data_shutdown(), manager_data_get(), NUM_DATA_NODE_BUCKETS, and root_data.
Referenced by main().
{
int res = 0;
ast_rwlock_init(&root_data.lock);
if (!(root_data.container = ao2_container_alloc(NUM_DATA_NODE_BUCKETS,
data_provider_hash, data_provider_cmp))) {
return -1;
}
res |= ast_cli_register_multiple(cli_data, ARRAY_LEN(cli_data));
res |= ast_manager_register_xml_core("DataGet", 0, manager_data_get);
AST_TEST_REGISTER(test_data_get);
ast_register_atexit(data_shutdown);
return res;
}
| int ast_device_state_engine_init | ( | void | ) |
Initialize the device state engine in separate thread.
Provided by devicestate.c
Definition at line 747 of file devicestate.c.
References ast_cond_init, ast_log(), ast_pthread_create_background, change_thread, do_devstate_changes(), and LOG_ERROR.
Referenced by main().
{
ast_cond_init(&change_pending, NULL);
if (ast_pthread_create_background(&change_thread, NULL, do_devstate_changes, NULL) < 0) {
ast_log(LOG_ERROR, "Unable to start device state change thread.\n");
return -1;
}
return 0;
}
| int ast_event_init | ( | void | ) |
Provided by event.c
Definition at line 1859 of file event.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_event_cache, ast_event_cmp(), ast_event_hash(), ast_event_subs, AST_EVENT_TOTAL, ast_register_atexit(), AST_RWDLLIST_HEAD_INIT, ast_taskprocessor_get(), container, event_cli, event_shutdown(), hash_fn, and NUM_CACHE_BUCKETS.
Referenced by main().
{
int i;
for (i = 0; i < AST_EVENT_TOTAL; i++) {
AST_RWDLLIST_HEAD_INIT(&ast_event_subs[i]);
}
for (i = 0; i < AST_EVENT_TOTAL; i++) {
if (!ast_event_cache[i].hash_fn) {
/* This event type is not cached. */
continue;
}
if (!(ast_event_cache[i].container = ao2_container_alloc(NUM_CACHE_BUCKETS,
ast_event_hash, ast_event_cmp))) {
goto event_init_cleanup;
}
}
if (!(event_dispatcher = ast_taskprocessor_get("core_event_dispatcher", 0))) {
goto event_init_cleanup;
}
ast_cli_register_multiple(event_cli, ARRAY_LEN(event_cli));
ast_register_atexit(event_shutdown);
return 0;
event_init_cleanup:
event_shutdown();
return -1;
}
| int ast_features_init | ( | void | ) |
Provided by features.c
Definition at line 9070 of file features.c.
References __ast_custom_function_register(), action_bridge(), ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_devstate_prov_add(), ast_manager_register_xml_core, ast_pthread_create, ast_register_application2(), ast_register_atexit(), AST_TEST_REGISTER, bridge_exec(), do_parking_thread(), EVENT_FLAG_CALL, features_shutdown(), load_config(), manager_park(), manager_parking_status(), manager_parkinglot_list(), metermaidstate(), park_call_exec(), parkcall, parked_call_exec(), parking_thread, parkinglot_cmp_cb(), parkinglot_hash_cb(), and parkinglots.
Referenced by main().
{
int res;
parkinglots = ao2_container_alloc(7, parkinglot_hash_cb, parkinglot_cmp_cb);
if (!parkinglots) {
return -1;
}
res = load_config(0);
if (res) {
return res;
}
ast_cli_register_multiple(cli_features, ARRAY_LEN(cli_features));
if (ast_pthread_create(&parking_thread, NULL, do_parking_thread, NULL)) {
return -1;
}
ast_register_application2(app_bridge, bridge_exec, NULL, NULL, NULL);
res = ast_register_application2(parkedcall, parked_call_exec, NULL, NULL, NULL);
if (!res)
res = ast_register_application2(parkcall, park_call_exec, NULL, NULL, NULL);
if (!res) {
ast_manager_register_xml_core("ParkedCalls", 0, manager_parking_status);
ast_manager_register_xml_core("Parkinglots", 0, manager_parkinglot_list);
ast_manager_register_xml_core("Park", EVENT_FLAG_CALL, manager_park);
ast_manager_register_xml_core("Bridge", EVENT_FLAG_CALL, action_bridge);
}
res |= __ast_custom_function_register(&feature_function, NULL);
res |= __ast_custom_function_register(&featuremap_function, NULL);
res |= ast_devstate_prov_add("Park", metermaidstate);
#if defined(TEST_FRAMEWORK)
res |= AST_TEST_REGISTER(features_test);
#endif /* defined(TEST_FRAMEWORK) */
ast_register_atexit(features_shutdown);
return res;
}
| int ast_file_init | ( | void | ) |
Provided by file.c
Definition at line 1594 of file file.c.
Referenced by main().
{
ast_cli_register_multiple(cli_file, ARRAY_LEN(cli_file));
ast_register_atexit(file_shutdown);
return 0;
}
| int ast_format_attr_init | ( | void | ) |
Init the ast_format attribute interface register container.
Definition at line 1122 of file format.c.
References AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_container_alloc_options, ARRAY_LEN, ast_cli_register_multiple(), ast_register_cleanup(), format_attr_shutdown(), interface_cmp_cb(), and interface_hash_cb().
Referenced by main().
{
interfaces = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_RWLOCK,
283, interface_hash_cb, interface_cmp_cb);
if (!interfaces) {
return -1;
}
ast_cli_register_multiple(my_clis, ARRAY_LEN(my_clis));
ast_register_cleanup(format_attr_shutdown);
return 0;
}
| int ast_format_list_init | ( | void | ) |
Init the Asterisk global format list after all format attribute modules have been loaded.
Definition at line 1092 of file format.c.
References ast_register_atexit(), ast_rwlock_init, build_format_list_array(), format_list_init(), and format_list_shutdown().
Referenced by main().
{
if (ast_rwlock_init(&format_list_array_lock)) {
return -1;
}
if (format_list_init()) {
goto init_list_cleanup;
}
if (build_format_list_array()) {
goto init_list_cleanup;
}
ast_register_atexit(format_list_shutdown);
return 0;
init_list_cleanup:
format_list_shutdown();
return -1;
}
| int ast_http_init | ( | void | ) |
Provided by http.c
Definition at line 1265 of file http.c.
References __ast_http_load(), ARRAY_LEN, ast_cli_register_multiple(), ast_http_uri_link(), ast_register_atexit(), cli_http, http_shutdown(), staticuri, and statusuri.
Referenced by main().
| int ast_http_reload | ( | void | ) |
Provided by http.c
Definition at line 1233 of file http.c.
References __ast_http_load().
{
return __ast_http_load(1);
}
| int ast_indications_init | ( | void | ) |
Load indications module.
Provided by indications.c
Definition at line 1173 of file indications.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_register_atexit(), ast_tone_zone_cmp(), ast_tone_zone_hash(), indications_shutdown(), load_indications(), and NUM_TONE_ZONE_BUCKETS.
Referenced by main().
{
if (!(ast_tone_zones = ao2_container_alloc(NUM_TONE_ZONE_BUCKETS,
ast_tone_zone_hash, ast_tone_zone_cmp))) {
return -1;
}
if (load_indications(0)) {
indications_shutdown();
return -1;
}
ast_cli_register_multiple(cli_indications, ARRAY_LEN(cli_indications));
ast_register_atexit(indications_shutdown);
return 0;
}
| int ast_indications_reload | ( | void | ) |
Reload indications module.
Provided by indications.c
Definition at line 1192 of file indications.c.
References load_indications().
{
return load_indications(1);
}
| int ast_module_reload | ( | const char * | name | ) |
Reload asterisk modules.
| name | the name of the module to reload |
This function reloads the specified module, or if no modules are specified, it will reload all loaded modules.
| 1 | if the module was found but cannot be reloaded. |
| -1 | if a reload operation is already in progress. |
| 2 | if the specfied module was found and reloaded. |
Definition at line 726 of file loader.c.
References ast_config_AST_CONFIG_DIR, ast_fully_booted, ast_lastreloadtime, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_lock_path(), AST_LOCK_SUCCESS, AST_LOCK_TIMEOUT, ast_log(), ast_mutex_trylock, ast_mutex_unlock, ast_opt_lock_confdir, ast_test_suite_event_notify, ast_tvnow(), ast_unlock_path(), ast_verb, ast_verbose(), ast_module::declined, ast_module_info::description, ast_module::flags, ast_module::info, LOG_NOTICE, LOG_WARNING, reload_classes::name, queue_reload_request(), ast_module_info::reload, ast_module::resource, resource_name_match(), and ast_module::running.
Referenced by action_reload(), action_updateconfig(), ast_process_pending_reloads(), handle_core_reload(), handle_reload(), manager_moduleload(), and monitor_sig_flags().
{
struct ast_module *cur;
int res = 0; /* return value. 0 = not found, others, see below */
int i;
/* If we aren't fully booted, we just pretend we reloaded but we queue this
up to run once we are booted up. */
if (!ast_fully_booted) {
queue_reload_request(name);
return 0;
}
if (ast_mutex_trylock(&reloadlock)) {
ast_verbose("The previous reload command didn't finish yet\n");
return -1; /* reload already in progress */
}
ast_lastreloadtime = ast_tvnow();
if (ast_opt_lock_confdir) {
int try;
int res;
for (try = 1, res = AST_LOCK_TIMEOUT; try < 6 && (res == AST_LOCK_TIMEOUT); try++) {
res = ast_lock_path(ast_config_AST_CONFIG_DIR);
if (res == AST_LOCK_TIMEOUT) {
ast_log(LOG_WARNING, "Failed to grab lock on %s, try %d\n", ast_config_AST_CONFIG_DIR, try);
}
}
if (res != AST_LOCK_SUCCESS) {
ast_verbose("Cannot grab lock on %s\n", ast_config_AST_CONFIG_DIR);
ast_mutex_unlock(&reloadlock);
return -1;
}
}
/* 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_test_suite_event_notify("MODULE_RELOAD", "Message: %s", name);
}
res = 2; /* found and reloaded */
}
}
if (name && res) {
if (ast_opt_lock_confdir) {
ast_unlock_path(ast_config_AST_CONFIG_DIR);
}
ast_mutex_unlock(&reloadlock);
return res;
}
AST_LIST_LOCK(&module_list);
AST_LIST_TRAVERSE(&module_list, cur, entry) {
const struct ast_module_info *info = cur->info;
if (name && resource_name_match(name, cur->resource))
continue;
if (!cur->flags.running || cur->flags.declined) {
if (!name)
continue;
ast_log(LOG_NOTICE, "The module '%s' was not properly initialized. "
"Before reloading the module, you must run \"module load %s\" "
"and fix whatever is preventing the module from being initialized.\n",
name, name);
res = 2; /* Don't report that the module was not found */
break;
}
if (!info->reload) { /* cannot be reloaded */
/* Nothing to reload, so reload is successful */
ast_test_suite_event_notify("MODULE_RELOAD", "Message: %s", cur->resource);
if (res < 1) /* store result if possible */
res = 1; /* 1 = no reload() method */
continue;
}
res = 2;
ast_verb(3, "Reloading module '%s' (%s)\n", cur->resource, info->description);
if (!info->reload()) {
ast_test_suite_event_notify("MODULE_RELOAD", "Message: %s", cur->resource);
}
}
AST_LIST_UNLOCK(&module_list);
if (ast_opt_lock_confdir) {
ast_unlock_path(ast_config_AST_CONFIG_DIR);
}
ast_mutex_unlock(&reloadlock);
return res;
}
| int ast_msg_init | ( | void | ) |
Provided by message.c
Definition at line 1351 of file message.c.
References __ast_custom_function_register(), action_messagesend(), ao2_container_alloc, ast_manager_register_xml_core, ast_register_application2(), ast_register_atexit(), ast_taskprocessor_get(), EVENT_FLAG_MESSAGE, message_shutdown(), msg_send_exec(), msg_tech_cmp(), msg_tech_hash(), and TPS_REF_DEFAULT.
Referenced by main().
{
int res;
msg_q_tp = ast_taskprocessor_get("ast_msg_queue", TPS_REF_DEFAULT);
if (!msg_q_tp) {
return -1;
}
msg_techs = ao2_container_alloc(17, msg_tech_hash, msg_tech_cmp);
if (!msg_techs) {
return -1;
}
res = __ast_custom_function_register(&msg_function, NULL);
res |= __ast_custom_function_register(&msg_data_function, NULL);
res |= ast_register_application2(app_msg_send, msg_send_exec, NULL, NULL, NULL);
res |= ast_manager_register_xml_core("MessageSend", EVENT_FLAG_MESSAGE, action_messagesend);
ast_register_atexit(message_shutdown);
return res;
}
| void ast_msg_shutdown | ( | void | ) |
Provided by message.c
Definition at line 1317 of file message.c.
References ast_taskprocessor_unreference().
Referenced by can_safely_quit().
{
if (msg_q_tp) {
msg_q_tp = ast_taskprocessor_unreference(msg_q_tp);
}
}
| int ast_plc_reload | ( | void | ) |
Reload genericplc configuration value from codecs.conf.
Implementation is in main/channel.c
Definition at line 8488 of file channel.c.
References ast_config_destroy(), ast_config_load, AST_OPT_FLAG_GENERIC_PLC, ast_options, ast_set2_flag, ast_true(), ast_variable_browse(), CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEMISSING, CONFIG_STATUS_FILEUNCHANGED, ast_variable::name, ast_variable::next, ast_variable::value, and var.
Referenced by ast_channels_init().
{
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;
}
| void ast_process_pending_reloads | ( | void | ) |
Process reload requests received during startup.
This function requests that the loader execute the pending reload requests that were queued during server startup.
Definition at line 661 of file loader.c.
References ast_free, ast_fully_booted, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_log(), ast_module_reload(), do_full_reload, LOG_NOTICE, and reload_queue_item::module.
Referenced by main().
{
struct reload_queue_item *item;
if (!ast_fully_booted) {
return;
}
AST_LIST_LOCK(&reload_queue);
if (do_full_reload) {
do_full_reload = 0;
AST_LIST_UNLOCK(&reload_queue);
ast_log(LOG_NOTICE, "Executing deferred reload request.\n");
ast_module_reload(NULL);
return;
}
while ((item = AST_LIST_REMOVE_HEAD(&reload_queue, entry))) {
ast_log(LOG_NOTICE, "Executing deferred reload request for module '%s'.\n", item->module);
ast_module_reload(item->module);
ast_free(item);
}
AST_LIST_UNLOCK(&reload_queue);
}
| int ast_rtp_engine_init | ( | void | ) |
initializes the rtp engine arrays
Definition at line 2267 of file rtp_engine.c.
References add_static_payload(), AST_FORMAT_ADPCM, AST_FORMAT_ALAW, AST_FORMAT_G719, AST_FORMAT_G722, AST_FORMAT_G723_1, AST_FORMAT_G726, AST_FORMAT_G726_AAL2, AST_FORMAT_G729A, AST_FORMAT_GSM, AST_FORMAT_H261, AST_FORMAT_H263, AST_FORMAT_H263_PLUS, AST_FORMAT_H264, AST_FORMAT_ILBC, AST_FORMAT_JPEG, AST_FORMAT_LPC10, AST_FORMAT_MP4_VIDEO, AST_FORMAT_PNG, ast_format_set(), AST_FORMAT_SIREN14, AST_FORMAT_SIREN7, AST_FORMAT_SLINEAR, AST_FORMAT_SLINEAR16, AST_FORMAT_SPEEX, AST_FORMAT_SPEEX16, AST_FORMAT_SPEEX32, AST_FORMAT_T140, AST_FORMAT_T140RED, AST_FORMAT_ULAW, AST_RTP_CISCO_DTMF, AST_RTP_CN, AST_RTP_DTMF, ast_rwlock_init, and set_next_mime_type().
Referenced by main().
{
struct ast_format tmpfmt;
ast_rwlock_init(&mime_types_lock);
ast_rwlock_init(&static_RTP_PT_lock);
/* Define all the RTP mime types available */
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G723_1, 0), 0, "audio", "G723", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_GSM, 0), 0, "audio", "GSM", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0), 0, "audio", "PCMU", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0), 0, "audio", "G711U", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ALAW, 0), 0, "audio", "PCMA", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ALAW, 0), 0, "audio", "G711A", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G726, 0), 0, "audio", "G726-32", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0, "audio", "DVI4", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0), 0, "audio", "L16", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR16, 0), 0, "audio", "L16", 16000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR16, 0), 0, "audio", "L16-256", 16000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_LPC10, 0), 0, "audio", "LPC", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0, "audio", "G729", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0, "audio", "G729A", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0, "audio", "G.729", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX, 0), 0, "audio", "speex", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX16, 0), 0, "audio", "speex", 16000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX32, 0), 0, "audio", "speex", 32000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ILBC, 0), 0, "audio", "iLBC", 8000);
/* this is the sample rate listed in the RTP profile for the G.722 codec, *NOT* the actual sample rate of the media stream */
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G722, 0), 0, "audio", "G722", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G726_AAL2, 0), 0, "audio", "AAL2-G726-32", 8000);
set_next_mime_type(NULL, AST_RTP_DTMF, "audio", "telephone-event", 8000);
set_next_mime_type(NULL, AST_RTP_CISCO_DTMF, "audio", "cisco-telephone-event", 8000);
set_next_mime_type(NULL, AST_RTP_CN, "audio", "CN", 8000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_JPEG, 0), 0, "video", "JPEG", 90000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_PNG, 0), 0, "video", "PNG", 90000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_H261, 0), 0, "video", "H261", 90000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_H263, 0), 0, "video", "H263", 90000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_H263_PLUS, 0), 0, "video", "h263-1998", 90000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_H264, 0), 0, "video", "H264", 90000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_MP4_VIDEO, 0), 0, "video", "MP4V-ES", 90000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_T140RED, 0), 0, "text", "RED", 1000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_T140, 0), 0, "text", "T140", 1000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SIREN7, 0), 0, "audio", "G7221", 16000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SIREN14, 0), 0, "audio", "G7221", 32000);
set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G719, 0), 0, "audio", "G719", 48000);
/* Define the static rtp payload mappings */
add_static_payload(0, ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0), 0);
#ifdef USE_DEPRECATED_G726
add_static_payload(2, ast_format_set(&tmpfmt, AST_FORMAT_G726, 0), 0);/* Technically this is G.721, but if Cisco can do it, so can we... */
#endif
add_static_payload(3, ast_format_set(&tmpfmt, AST_FORMAT_GSM, 0), 0);
add_static_payload(4, ast_format_set(&tmpfmt, AST_FORMAT_G723_1, 0), 0);
add_static_payload(5, ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0);/* 8 kHz */
add_static_payload(6, ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0); /* 16 kHz */
add_static_payload(7, ast_format_set(&tmpfmt, AST_FORMAT_LPC10, 0), 0);
add_static_payload(8, ast_format_set(&tmpfmt, AST_FORMAT_ALAW, 0), 0);
add_static_payload(9, ast_format_set(&tmpfmt, AST_FORMAT_G722, 0), 0);
add_static_payload(10, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0), 0); /* 2 channels */
add_static_payload(11, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0), 0); /* 1 channel */
add_static_payload(13, NULL, AST_RTP_CN);
add_static_payload(16, ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0); /* 11.025 kHz */
add_static_payload(17, ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0); /* 22.050 kHz */
add_static_payload(18, ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0);
add_static_payload(19, NULL, AST_RTP_CN); /* Also used for CN */
add_static_payload(26, ast_format_set(&tmpfmt, AST_FORMAT_JPEG, 0), 0);
add_static_payload(31, ast_format_set(&tmpfmt, AST_FORMAT_H261, 0), 0);
add_static_payload(34, ast_format_set(&tmpfmt, AST_FORMAT_H263, 0), 0);
add_static_payload(97, ast_format_set(&tmpfmt, AST_FORMAT_ILBC, 0), 0);
add_static_payload(98, ast_format_set(&tmpfmt, AST_FORMAT_H263_PLUS, 0), 0);
add_static_payload(99, ast_format_set(&tmpfmt, AST_FORMAT_H264, 0), 0);
add_static_payload(101, NULL, AST_RTP_DTMF);
add_static_payload(102, ast_format_set(&tmpfmt, AST_FORMAT_SIREN7, 0), 0);
add_static_payload(103, ast_format_set(&tmpfmt, AST_FORMAT_H263_PLUS, 0), 0);
add_static_payload(104, ast_format_set(&tmpfmt, AST_FORMAT_MP4_VIDEO, 0), 0);
add_static_payload(105, ast_format_set(&tmpfmt, AST_FORMAT_T140RED, 0), 0); /* Real time text chat (with redundancy encoding) */
add_static_payload(106, ast_format_set(&tmpfmt, AST_FORMAT_T140, 0), 0); /* Real time text chat */
add_static_payload(110, ast_format_set(&tmpfmt, AST_FORMAT_SPEEX, 0), 0);
add_static_payload(111, ast_format_set(&tmpfmt, AST_FORMAT_G726, 0), 0);
add_static_payload(112, ast_format_set(&tmpfmt, AST_FORMAT_G726_AAL2, 0), 0);
add_static_payload(115, ast_format_set(&tmpfmt, AST_FORMAT_SIREN14, 0), 0);
add_static_payload(116, ast_format_set(&tmpfmt, AST_FORMAT_G719, 0), 0);
add_static_payload(117, ast_format_set(&tmpfmt, AST_FORMAT_SPEEX16, 0), 0);
add_static_payload(118, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR16, 0), 0); /* 16 Khz signed linear */
add_static_payload(119, ast_format_set(&tmpfmt, AST_FORMAT_SPEEX32, 0), 0);
add_static_payload(121, NULL, AST_RTP_CISCO_DTMF); /* Must be type 121 */
return 0;
}
| int ast_ssl_init | ( | void | ) |
Provided by ssl.c
Definition at line 152 of file libasteriskssl.c.
References ast_calloc, ast_debug, ast_mutex_init, CRYPTO_set_id_callback(), CRYPTO_set_locking_callback(), ERR_load_BIO_strings(), ERR_load_SSL_strings(), get_OpenSSL_function, SSL_library_init(), SSL_load_error_strings(), ssl_lock(), ssl_num_locks, and ssl_threadid().
Referenced by main().
{
#ifdef HAVE_OPENSSL
unsigned int i;
int (*real_SSL_library_init)(void);
void (*real_CRYPTO_set_id_callback)(unsigned long (*)(void));
void (*real_CRYPTO_set_locking_callback)(void (*)(int, int, const char *, int));
void (*real_SSL_load_error_strings)(void);
void (*real_ERR_load_SSL_strings)(void);
void (*real_ERR_load_BIO_strings)(void);
const char *errstr;
/* clear any previous dynamic linker errors */
dlerror();
get_OpenSSL_function(SSL_library_init);
if ((errstr = dlerror()) != NULL) {
ast_debug(1, "unable to get real address of SSL_library_init: %s\n", errstr);
/* there is no way to continue in this situation... SSL will
* likely be broken in this process
*/
return -1;
} else {
real_SSL_library_init();
}
/* Make OpenSSL usage thread-safe. */
dlerror();
get_OpenSSL_function(CRYPTO_set_id_callback);
if ((errstr = dlerror()) != NULL) {
ast_debug(1, "unable to get real address of CRYPTO_set_id_callback: %s\n", errstr);
/* there is no way to continue in this situation... SSL will
* likely be broken in this process
*/
return -1;
} else {
real_CRYPTO_set_id_callback(ssl_threadid);
}
dlerror();
get_OpenSSL_function(CRYPTO_set_locking_callback);
if ((errstr = dlerror()) != NULL) {
ast_debug(1, "unable to get real address of CRYPTO_set_locking_callback: %s\n", errstr);
/* there is no way to continue in this situation... SSL will
* likely be broken in this process
*/
return -1;
} else {
ssl_num_locks = CRYPTO_num_locks();
if (!(ssl_locks = ast_calloc(ssl_num_locks, sizeof(ssl_locks[0])))) {
return -1;
}
for (i = 0; i < ssl_num_locks; i++) {
ast_mutex_init(&ssl_locks[i]);
}
real_CRYPTO_set_locking_callback(ssl_lock);
}
/* after this point, we don't check for errors from the dlsym() calls,
* under the assumption that if the ones above were successful, all
* the rest will be too. this assumption holds as long as OpenSSL still
* provides all of these functions.
*/
get_OpenSSL_function(SSL_load_error_strings);
real_SSL_load_error_strings();
get_OpenSSL_function(ERR_load_SSL_strings);
real_ERR_load_SSL_strings();
get_OpenSSL_function(ERR_load_BIO_strings);
real_ERR_load_BIO_strings();
startup_complete = 1;
#endif /* HAVE_OPENSSL */
return 0;
}
| void ast_stun_init | ( | void | ) |
Initialize the STUN system in Asterisk.
Provided by stun.c
Definition at line 513 of file stun.c.
References ast_cli_register_multiple(), ast_register_atexit(), and stun_shutdown().
Referenced by main().
{
ast_cli_register_multiple(cli_stun, sizeof(cli_stun) / sizeof(struct ast_cli_entry));
ast_register_atexit(stun_shutdown);
}
| int ast_term_init | ( | void | ) |
Provided by term.c
Definition at line 87 of file term.c.
References ast_opt_console, ast_opt_force_black_background, ast_opt_light_background, ast_opt_no_color, ATTR_BRIGHT, ATTR_RESET, COLOR_BLACK, COLOR_BROWN, COLOR_WHITE, convshort(), and ESC.
Referenced by main().
{
char *term = getenv("TERM");
char termfile[256] = "";
char buffer[512] = "";
int termfd = -1, parseokay = 0, i;
if (ast_opt_no_color) {
return 0;
}
if (!ast_opt_console) {
/* If any remote console is not compatible, we'll strip the color codes at that point */
vt100compat = 1;
goto end;
}
if (!term) {
return 0;
}
for (i = 0;; i++) {
if (termpath[i] == NULL) {
break;
}
snprintf(termfile, sizeof(termfile), "%s/%c/%s", termpath[i], *term, term);
termfd = open(termfile, O_RDONLY);
if (termfd > -1) {
break;
}
}
if (termfd > -1) {
int actsize = read(termfd, buffer, sizeof(buffer) - 1);
short sz_names = convshort(buffer + 2);
short sz_bools = convshort(buffer + 4);
short n_nums = convshort(buffer + 6);
/* if ((sz_names + sz_bools) & 1)
sz_bools++; */
if (sz_names + sz_bools + n_nums < actsize) {
/* Offset 13 is defined in /usr/include/term.h, though we do not
* include it here, as it conflicts with include/asterisk/term.h */
short max_colors = convshort(buffer + 12 + sz_names + sz_bools + 13 * 2);
if (max_colors > 0) {
vt100compat = 1;
}
parseokay = 1;
}
close(termfd);
}
if (!parseokay) {
/* These comparisons should not be substrings nor case-insensitive, as
* terminal types are very particular about how they treat suffixes and
* capitalization. For example, terminal type 'linux-m' does NOT
* support color, while 'linux' does. Not even all vt100* terminals
* support color, either (e.g. 'vt100+fnkeys'). */
if (!strcmp(term, "linux")) {
vt100compat = 1;
} else if (!strcmp(term, "xterm")) {
vt100compat = 1;
} else if (!strcmp(term, "xterm-color")) {
vt100compat = 1;
} else if (!strcmp(term, "xterm-256color")) {
vt100compat = 1;
} else if (!strncmp(term, "Eterm", 5)) {
/* Both entries which start with Eterm support color */
vt100compat = 1;
} else if (!strcmp(term, "vt100")) {
vt100compat = 1;
} else if (!strncmp(term, "crt", 3)) {
/* Both crt terminals support color */
vt100compat = 1;
}
}
end:
if (vt100compat) {
/* Make commands show up in nice colors */
if (ast_opt_light_background) {
snprintf(prepdata, sizeof(prepdata), "%c[%dm", ESC, COLOR_BROWN);
snprintf(enddata, sizeof(enddata), "%c[%dm", ESC, COLOR_BLACK);
snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC);
} else if (ast_opt_force_black_background) {
snprintf(prepdata, sizeof(prepdata), "%c[%d;%d;%dm", ESC, ATTR_BRIGHT, COLOR_BROWN, COLOR_BLACK + 10);
snprintf(enddata, sizeof(enddata), "%c[%d;%d;%dm", ESC, ATTR_RESET, COLOR_WHITE, COLOR_BLACK + 10);
snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC);
} else {
snprintf(prepdata, sizeof(prepdata), "%c[%d;%dm", ESC, ATTR_BRIGHT, COLOR_BROWN);
snprintf(enddata, sizeof(enddata), "%c[%d;%dm", ESC, ATTR_RESET, COLOR_WHITE);
snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC);
}
}
return 0;
}
| int ast_test_init | ( | void | ) |
Provided by test.c
Definition at line 941 of file test.c.
References ARRAY_LEN, ast_cli_register_multiple(), and ast_register_atexit().
Referenced by main().
{
#ifdef TEST_FRAMEWORK
/* Register cli commands */
ast_cli_register_multiple(test_cli, ARRAY_LEN(test_cli));
ast_register_atexit(test_shutdown);
#endif
return 0;
}
| int ast_timing_init | ( | void | ) |
Provided by timing.c
Definition at line 310 of file timing.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_heap_create(), ast_register_atexit(), timing_holder_cmp(), and timing_shutdown().
Referenced by main().
{
if (!(timing_interfaces = ast_heap_create(2, timing_holder_cmp, 0))) {
return -1;
}
ast_register_atexit(timing_shutdown);
return ast_cli_register_multiple(cli_timing, ARRAY_LEN(cli_timing));
}
| int ast_tps_init | ( | void | ) |
Provided by taskprocessor.c
Definition at line 137 of file taskprocessor.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_cond_init, ast_log(), ast_register_atexit(), cli_ping_cond, LOG_ERROR, taskprocessor_clis, tps_cmp_cb(), tps_hash_cb(), TPS_MAX_BUCKETS, tps_shutdown(), and tps_singletons.
Referenced by main().
{
if (!(tps_singletons = ao2_container_alloc(TPS_MAX_BUCKETS, tps_hash_cb, tps_cmp_cb))) {
ast_log(LOG_ERROR, "taskprocessor container failed to initialize!\n");
return -1;
}
ast_cond_init(&cli_ping_cond, NULL);
ast_cli_register_multiple(taskprocessor_clis, ARRAY_LEN(taskprocessor_clis));
ast_register_atexit(tps_shutdown);
return 0;
}
| int ast_xmldoc_load_documentation | ( | void | ) |
Load XML documentation. Provided by xmldoc.c.
| 1 | on error. |
| 0 | on success. |
Definition at line 2363 of file xmldoc.c.
References ast_asprintf, ast_calloc, ast_config_AST_DATA_DIR, ast_config_destroy(), ast_config_load2(), ast_debug, ast_free, ast_log(), ast_malloc, ast_register_atexit(), AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strdup, ast_strlen_zero(), ast_variable_browse(), ast_xml_close(), ast_xml_get_root(), ast_xml_init(), ast_xml_node_get_name(), ast_xml_open(), CONFIG_STATUS_FILEINVALID, documentation_tree::doc, documentation_tree::filename, GLOB_ABORTED, LOG_ERROR, LOG_WARNING, ast_variable::name, ast_variable::next, ast_variable::value, var, and xmldoc_unload_documentation().
Referenced by main().
| int astdb_init | ( | void | ) |
Provided by db.c
Definition at line 1011 of file db.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_cond_init, ast_manager_register_xml_core, ast_pthread_create_background, ast_register_atexit(), astdb_atexit(), db_init(), db_sync_thread(), EVENT_FLAG_REPORTING, EVENT_FLAG_SYSTEM, manager_dbdel(), manager_dbdeltree(), manager_dbget(), and manager_dbput().
Referenced by main().
{
if (db_init()) {
return -1;
}
ast_cond_init(&dbcond, NULL);
if (ast_pthread_create_background(&syncthread, NULL, db_sync_thread, NULL)) {
return -1;
}
ast_register_atexit(astdb_atexit);
ast_cli_register_multiple(cli_database, ARRAY_LEN(cli_database));
ast_manager_register_xml_core("DBGet", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_dbget);
ast_manager_register_xml_core("DBPut", EVENT_FLAG_SYSTEM, manager_dbput);
ast_manager_register_xml_core("DBDel", EVENT_FLAG_SYSTEM, manager_dbdel);
ast_manager_register_xml_core("DBDelTree", EVENT_FLAG_SYSTEM, manager_dbdeltree);
return 0;
}
| int astobj2_init | ( | void | ) |
Provided by astobj2.c
Definition at line 1721 of file astobj2.c.
References ARRAY_LEN, ast_cli_register_multiple(), and ast_register_atexit().
Referenced by main().
{
#ifdef AO2_DEBUG
ast_cli_register_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2));
ast_register_atexit(astobj2_cleanup);
#endif
return 0;
}
| void clean_time_zones | ( | void | ) |
Provided by localtime.c
Definition at line 1440 of file localtime.c.
References ast_free, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, and AST_LIST_UNLOCK.
Referenced by really_quit().
{
struct state *sp;
AST_LIST_LOCK(&zonelist);
while ((sp = AST_LIST_REMOVE_HEAD(&zonelist, list))) {
ast_free(sp);
}
AST_LIST_UNLOCK(&zonelist);
}
| void close_logger | ( | void | ) |
Provided by logger.c
Definition at line 1269 of file logger.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), ast_cond_signal, ast_free, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, AST_PTHREADT_NULL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, cli_logger, close_logger_thread, f, logchannel::fileptr, logchannel::list, logcond, logthread, and qlog.
Referenced by really_quit().
{
struct logchannel *f = NULL;
struct verb *cur = NULL;
ast_cli_unregister_multiple(cli_logger, ARRAY_LEN(cli_logger));
logger_initialized = 0;
/* Stop logger thread */
AST_LIST_LOCK(&logmsgs);
close_logger_thread = 1;
ast_cond_signal(&logcond);
AST_LIST_UNLOCK(&logmsgs);
if (logthread != AST_PTHREADT_NULL)
pthread_join(logthread, NULL);
AST_RWLIST_WRLOCK(&verbosers);
while ((cur = AST_LIST_REMOVE_HEAD(&verbosers, list))) {
ast_free(cur);
}
AST_RWLIST_UNLOCK(&verbosers);
AST_RWLIST_WRLOCK(&logchannels);
if (qlog) {
fclose(qlog);
qlog = NULL;
}
while ((f = AST_LIST_REMOVE_HEAD(&logchannels, list))) {
if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) {
fclose(f->fileptr);
f->fileptr = NULL;
}
ast_free(f);
}
closelog(); /* syslog */
AST_RWLIST_UNLOCK(&logchannels);
}
| int dnsmgr_init | ( | void | ) |
Provided by dnsmgr.c
Definition at line 420 of file dnsmgr.c.
References ast_cli_register(), ast_log(), ast_register_atexit(), ast_sched_context_create(), cli_refresh, cli_reload, cli_status, dnsmgr_shutdown(), do_reload(), and LOG_ERROR.
Referenced by main().
{
if (!(sched = ast_sched_context_create())) {
ast_log(LOG_ERROR, "Unable to create schedule context.\n");
return -1;
}
ast_cli_register(&cli_reload);
ast_cli_register(&cli_status);
ast_cli_register(&cli_refresh);
ast_register_atexit(dnsmgr_shutdown);
return do_reload(1);
}
| int dnsmgr_reload | ( | void | ) |
Provided by dnsmgr.c
Definition at line 435 of file dnsmgr.c.
References do_reload().
{
return do_reload(0);
}
| void dnsmgr_start_refresh | ( | void | ) |
Provided by dnsmgr.c
Definition at line 292 of file dnsmgr.c.
References ast_sched_add_variable(), AST_SCHED_DEL, master_refresh_info, and refresh_list().
Referenced by main().
{
if (refresh_sched > -1) {
AST_SCHED_DEL(sched, refresh_sched);
refresh_sched = ast_sched_add_variable(sched, 100, refresh_list, &master_refresh_info, 1);
}
}
| int init_framer | ( | void | ) |
| int init_logger | ( | void | ) |
Provided by logger.c
Definition at line 1235 of file logger.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_cond_destroy, ast_cond_init, ast_config_AST_LOG_DIR, ast_mkdir(), ast_mutex_destroy, ast_mutex_init, ast_pthread_create, ast_verb_update(), cli_logger, handle_SIGXFSZ, init_logger_chain(), logmsgs::lock, logcond, logger_thread(), and logthread.
Referenced by main().
{
/* auto rotate if sig SIGXFSZ comes a-knockin */
sigaction(SIGXFSZ, &handle_SIGXFSZ, NULL);
/* Re-initialize the logmsgs mutex. The recursive mutex can be accessed prior
* to Asterisk being forked into the background, which can cause the thread
* ID tracked by the underlying pthread mutex to be different than the ID of
* the thread that unlocks the mutex. Since init_logger is called after the
* fork, it is safe to initialize the mutex here for future accesses.
*/
ast_mutex_destroy(&logmsgs.lock);
ast_mutex_init(&logmsgs.lock);
ast_cond_init(&logcond, NULL);
/* start logger thread */
if (ast_pthread_create(&logthread, NULL, logger_thread, NULL) < 0) {
ast_cond_destroy(&logcond);
return -1;
}
/* register the logger cli commands */
ast_cli_register_multiple(cli_logger, ARRAY_LEN(cli_logger));
ast_mkdir(ast_config_AST_LOG_DIR, 0777);
/* create log channels */
init_logger_chain(0 /* locked */, NULL);
ast_verb_update();
logger_initialized = 1;
return 0;
}
| int load_modules | ( | unsigned | int | ) |
Provided by loader.c
Definition at line 1086 of file loader.c.
References add_to_load_order(), ast_config_AST_MODULE_DIR, ast_config_destroy(), ast_config_load2(), ast_debug, ast_free, AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_REMOVE_HEAD, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_log(), AST_MODULE_CONFIG, ast_opt_quiet, ast_true(), ast_variable_browse(), ast_variable_retrieve(), ast_verb, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEMISSING, embedded_module_list, embedding, EVENT_FLAG_SYSTEM, find_resource(), module_list::first, ast_module::flags, module_list::last, ast_module::lib, load_resource_list(), LOG_NOTICE, LOG_WARNING, manager_event, ast_variable::name, ast_variable::next, ast_module::resource, load_order_entry::resource, resource_name_match(), ast_module::running, and ast_variable::value.
Referenced by main().
{
struct ast_config *cfg;
struct ast_module *mod;
struct load_order_entry *order;
struct ast_variable *v;
unsigned int load_count;
struct load_order load_order;
int res = 0;
struct ast_flags config_flags = { 0 };
int modulecount = 0;
#ifdef LOADABLE_MODULES
struct dirent *dirent;
DIR *dir;
#endif
/* all embedded modules have registered themselves by now */
embedding = 0;
ast_verb(1, "Asterisk Dynamic Loader Starting:\n");
AST_LIST_HEAD_INIT_NOLOCK(&load_order);
AST_LIST_LOCK(&module_list);
if (embedded_module_list.first) {
module_list.first = embedded_module_list.first;
module_list.last = embedded_module_list.last;
embedded_module_list.first = NULL;
}
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);
goto done;
}
/* first, find all the modules we have been explicitly requested to load */
for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {
if (!strcasecmp(v->name, preload_only ? "preload" : "load")) {
add_to_load_order(v->value, &load_order, 0);
}
if (!strcasecmp(v->name, preload_only ? "preload-require" : "require")) {
/* Add the module to the list and make sure it's required */
add_to_load_order(v->value, &load_order, 1);
ast_debug(2, "Adding module to required list: %s (%s)\n", v->value, v->name);
}
}
/* check if 'autoload' is on */
if (!preload_only && ast_true(ast_variable_retrieve(cfg, "modules", "autoload"))) {
/* if so, first add all the embedded modules that are not already running to the load order */
AST_LIST_TRAVERSE(&module_list, mod, entry) {
/* if it's not embedded, skip it */
if (mod->lib)
continue;
if (mod->flags.running)
continue;
add_to_load_order(mod->resource, &load_order, 0);
}
#ifdef LOADABLE_MODULES
/* if we are allowed to load dynamic modules, scan the directory for
for all available modules and add them as well */
if ((dir = opendir(ast_config_AST_MODULE_DIR))) {
while ((dirent = readdir(dir))) {
int ld = strlen(dirent->d_name);
/* Must end in .so to load it. */
if (ld < 4)
continue;
if (strcasecmp(dirent->d_name + ld - 3, ".so"))
continue;
/* if there is already a module by this name in the module_list,
skip this file */
if (find_resource(dirent->d_name, 0))
continue;
add_to_load_order(dirent->d_name, &load_order, 0);
}
closedir(dir);
} else {
if (!ast_opt_quiet)
ast_log(LOG_WARNING, "Unable to open modules directory '%s'.\n",
ast_config_AST_MODULE_DIR);
}
#endif
}
/* now scan the config for any modules we are prohibited from loading and
remove them from the load order */
for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {
if (strcasecmp(v->name, "noload"))
continue;
AST_LIST_TRAVERSE_SAFE_BEGIN(&load_order, order, entry) {
if (!resource_name_match(order->resource, v->value)) {
AST_LIST_REMOVE_CURRENT(entry);
ast_free(order->resource);
ast_free(order);
}
}
AST_LIST_TRAVERSE_SAFE_END;
}
/* we are done with the config now, all the information we need is in the
load_order list */
ast_config_destroy(cfg);
load_count = 0;
AST_LIST_TRAVERSE(&load_order, order, entry)
load_count++;
if (load_count)
ast_log(LOG_NOTICE, "%d modules will be loaded.\n", load_count);
/* first, load only modules that provide global symbols */
if ((res = load_resource_list(&load_order, 1, &modulecount)) < 0) {
goto done;
}
/* now load everything else */
if ((res = load_resource_list(&load_order, 0, &modulecount)) < 0) {
goto done;
}
done:
while ((order = AST_LIST_REMOVE_HEAD(&load_order, entry))) {
ast_free(order->resource);
ast_free(order);
}
AST_LIST_UNLOCK(&module_list);
/* Tell manager clients that are aggressive at logging in that we're done
loading modules. If there's a DNS problem in chan_sip, we might not
even reach this */
/*** DOCUMENTATION
<managerEventInstance>
<synopsis>Raised when all dynamic modules have finished their initial loading.</synopsis>
<syntax>
<parameter name="ModuleSelection">
<enumlist>
<enum name="Preload"/>
<enum name="All"/>
</enumlist>
</parameter>
</syntax>
</managerEventInstance>
***/
manager_event(EVENT_FLAG_SYSTEM, "ModuleLoadReport", "ModuleLoadStatus: Done\r\nModuleSelection: %s\r\nModuleCount: %d\r\n", preload_only ? "Preload" : "All", modulecount);
return res;
}
| int load_pbx | ( | void | ) |
Provided by pbx.c
Definition at line 12013 of file pbx.c.
References __ast_custom_function_register(), ARRAY_LEN, ast_cli_register_multiple(), ast_data_register_multiple_core, AST_EVENT_DEVICE_STATE, AST_EVENT_IE_END, AST_EVENT_PRESENCE_STATE, ast_event_subscribe(), ast_log(), ast_manager_register_xml_core, ast_register_application2(), ast_register_atexit(), ast_taskprocessor_get(), ast_verb, builtins, device_state_cb(), EVENT_FLAG_CONFIG, EVENT_FLAG_REPORTING, exception_function, LOG_ERROR, LOG_WARNING, manager_show_dialplan(), pbx_cli, pbx_data_providers, presence_state_cb(), testtime_function, and unload_pbx().
Referenced by main().
{
int x;
ast_register_atexit(unload_pbx);
/* Initialize the PBX */
ast_verb(1, "Asterisk PBX Core Initializing\n");
if (!(extension_state_tps = ast_taskprocessor_get("pbx-core", 0))) {
ast_log(LOG_WARNING, "failed to create pbx-core taskprocessor\n");
}
ast_verb(1, "Registering builtin applications:\n");
ast_cli_register_multiple(pbx_cli, ARRAY_LEN(pbx_cli));
ast_data_register_multiple_core(pbx_data_providers, ARRAY_LEN(pbx_data_providers));
__ast_custom_function_register(&exception_function, NULL);
__ast_custom_function_register(&testtime_function, NULL);
/* Register builtin applications */
for (x = 0; x < ARRAY_LEN(builtins); x++) {
ast_verb(1, "[%s]\n", builtins[x].name);
if (ast_register_application2(builtins[x].name, builtins[x].execute, NULL, NULL, NULL)) {
ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name);
return -1;
}
}
/* Register manager application */
ast_manager_register_xml_core("ShowDialPlan", EVENT_FLAG_CONFIG | EVENT_FLAG_REPORTING, manager_show_dialplan);
if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, "pbx Device State Change", NULL,
AST_EVENT_IE_END))) {
return -1;
}
if (!(presence_state_sub = ast_event_subscribe(AST_EVENT_PRESENCE_STATE, presence_state_cb, "pbx Presence State Change", NULL,
AST_EVENT_IE_END))) {
return -1;
}
return 0;
}
| void threadstorage_init | ( | void | ) |
Provided by threadstorage.c
Definition at line 35 of file threadstorage.c.
Referenced by main().
{
}