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. | |
void | ast_channels_init (void) |
int | ast_cli_perms_init (int reload) |
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_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_plc_reload (void) |
Reload genericplc configuration value from codecs.conf. | |
void | ast_process_pending_reloads (void) |
Process reload requests received during startup. | |
int | ast_ssl_init (void) |
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 | 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 319 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 | ) |
void ast_channels_init | ( | void | ) |
Provided by channel.c
Definition at line 5936 of file channel.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_plc_reload(), and cli_channel.
Referenced by main().
int ast_cli_perms_init | ( | int | reload | ) |
Provided by cli.c
Definition at line 1603 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_device_state_engine_init | ( | void | ) |
Initialize the device state engine in separate thread.
Provided by devicestate.c
Definition at line 725 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 1486 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_RWDLLIST_HEAD_INIT, ast_taskprocessor_get(), container, event_cli, 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))) { return -1; } } if (!(event_dispatcher = ast_taskprocessor_get("core_event_dispatcher", 0))) { return -1; } ast_cli_register_multiple(event_cli, ARRAY_LEN(event_cli)); return 0; }
int ast_features_init | ( | void | ) |
Provided by features.c
Definition at line 5064 of file features.c.
References action_bridge(), ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_devstate_prov_add(), ast_manager_register, ast_manager_register2(), ast_pthread_create, ast_register_application2(), bridge_exec(), do_parking_thread(), EVENT_FLAG_CALL, load_config(), manager_park(), manager_parking_status(), metermaidstate(), park_call_exec(), park_exec(), parkcall, parkedcall, parking_thread, parkinglot_cmp_cb(), parkinglot_hash_cb(), and parkinglots.
Referenced by main().
{ int res; ast_register_application2(app_bridge, bridge_exec, NULL, NULL, NULL); parkinglots = ao2_container_alloc(7, parkinglot_hash_cb, parkinglot_cmp_cb); if ((res = load_config())) return res; ast_cli_register_multiple(cli_features, ARRAY_LEN(cli_features)); ast_pthread_create(&parking_thread, NULL, do_parking_thread, NULL); res = ast_register_application2(parkedcall, park_exec, NULL, NULL, NULL); if (!res) res = ast_register_application2(parkcall, park_call_exec, NULL, NULL, NULL); if (!res) { ast_manager_register("ParkedCalls", 0, manager_parking_status, "List parked calls"); ast_manager_register2("Park", EVENT_FLAG_CALL, manager_park, "Park a channel", mandescr_park); ast_manager_register2("Bridge", EVENT_FLAG_CALL, action_bridge, "Bridge two channels already in the PBX", mandescr_bridge); } res |= ast_devstate_prov_add("Park", metermaidstate); return res; }
int ast_file_init | ( | void | ) |
int ast_http_init | ( | void | ) |
Provided by http.c
Definition at line 1047 of file http.c.
References __ast_http_load(), ARRAY_LEN, ast_cli_register_multiple(), ast_http_uri_link(), cli_http, staticuri, and statusuri.
Referenced by main().
{ ast_http_uri_link(&statusuri); ast_http_uri_link(&staticuri); ast_cli_register_multiple(cli_http, ARRAY_LEN(cli_http)); return __ast_http_load(0); }
int ast_http_reload | ( | void | ) |
Provided by http.c
Definition at line 1038 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 1106 of file indications.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_tone_zone_cmp(), ast_tone_zone_hash(), 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)) { return -1; } ast_cli_register_multiple(cli_indications, ARRAY_LEN(cli_indications)); return 0; }
int ast_indications_reload | ( | void | ) |
Reload indications module.
Provided by indications.c
Definition at line 1123 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 640 of file loader.c.
References ast_fully_booted, ast_lastreloadtime, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log(), ast_mutex_trylock(), ast_mutex_unlock(), ast_tvnow(), ast_verb, ast_verbose(), ast_module::declined, ast_module_info::description, ast_module::flags, ast_module::info, LOG_NOTICE, reload_classes::name, queue_reload_request(), ast_module_info::reload, reload_classes::reload_fn, ast_module::resource, resource_name_match(), and ast_module::running.
Referenced by action_reload(), action_updateconfig(), ast_process_pending_reloads(), 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(); /* Call "predefined" reload here first */ for (i = 0; reload_classes[i].name; i++) { if (!name || !strcasecmp(name, reload_classes[i].name)) { reload_classes[i].reload_fn(); /* XXX should check error ? */ res = 2; /* found and reloaded */ } } if (name && res) { 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 */ 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); info->reload(); } AST_LIST_UNLOCK(&module_list); ast_mutex_unlock(&reloadlock); return res; }
int ast_plc_reload | ( | void | ) |
Reload genericplc configuration value from codecs.conf.
Implementation is in main/channel.c
Definition at line 5920 of file channel.c.
References ast_config_destroy(), ast_config_load2(), 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_load2("codecs.conf", "channel", 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 575 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_ssl_init | ( | void | ) |
Porvided by ssl.c
Definition at line 73 of file ssl.c.
References ast_calloc, and ast_mutex_init().
Referenced by main().
{ #ifdef HAVE_OPENSSL unsigned int i; SSL_library_init(); SSL_load_error_strings(); ERR_load_crypto_strings(); ERR_load_BIO_strings(); OpenSSL_add_all_algorithms(); /* Make OpenSSL thread-safe. */ CRYPTO_set_id_callback(ssl_threadid); 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]); } CRYPTO_set_locking_callback(ssl_lock); #endif /* HAVE_OPENSSL */ return 0; }
int ast_term_init | ( | void | ) |
Provided by term.c
Definition at line 83 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 (!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 889 of file test.c.
References ARRAY_LEN, and ast_cli_register_multiple().
Referenced by main().
{ #ifdef TEST_FRAMEWORK /* Register cli commands */ ast_cli_register_multiple(test_cli, ARRAY_LEN(test_cli)); #endif return 0; }
int ast_timing_init | ( | void | ) |
Provided by timing.c
Definition at line 288 of file timing.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_heap_create(), and timing_holder_cmp().
Referenced by main().
{ if (!(timing_interfaces = ast_heap_create(2, timing_holder_cmp, 0))) { return -1; } return ast_cli_register_multiple(cli_timing, ARRAY_LEN(cli_timing)); }
int ast_tps_init | ( | void | ) |
Provided by taskprocessor.c
Definition at line 122 of file taskprocessor.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_cond_init(), ast_log(), cli_ping_cond, LOG_ERROR, taskprocessor_clis, tps_cmp_cb(), tps_hash_cb(), TPS_MAX_BUCKETS, 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)); return 0; }
int ast_xmldoc_load_documentation | ( | void | ) |
int astdb_init | ( | void | ) |
Provided by db.c
Definition at line 665 of file db.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_manager_register, dbinit(), EVENT_FLAG_REPORTING, EVENT_FLAG_SYSTEM, manager_dbdel(), manager_dbdeltree(), manager_dbget(), and manager_dbput().
Referenced by main().
{ dbinit(); ast_cli_register_multiple(cli_database, ARRAY_LEN(cli_database)); ast_manager_register("DBGet", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_dbget, "Get DB Entry"); ast_manager_register("DBPut", EVENT_FLAG_SYSTEM, manager_dbput, "Put DB Entry"); ast_manager_register("DBDel", EVENT_FLAG_SYSTEM, manager_dbdel, "Delete DB Entry"); ast_manager_register("DBDelTree", EVENT_FLAG_SYSTEM, manager_dbdeltree, "Delete DB Tree"); return 0; }
int astobj2_init | ( | void | ) |
Provided by astobj2.c
Definition at line 1125 of file astobj2.c.
References ARRAY_LEN, and ast_cli_register_multiple().
Referenced by main().
{ #ifdef AO2_DEBUG ast_cli_register_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2)); #endif return 0; }
void close_logger | ( | void | ) |
Provided by logger.c
Definition at line 1059 of file logger.c.
References ast_cond_signal(), AST_LIST_LOCK, AST_LIST_UNLOCK, AST_PTHREADT_NULL, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, close_logger_thread, eventlog, f, logchannel::fileptr, logchannel::list, logcond, logthread, and qlog.
Referenced by quit_handler().
{ struct logchannel *f = NULL; /* 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(&logchannels); if (eventlog) { fclose(eventlog); eventlog = NULL; } if (qlog) { fclose(qlog); qlog = NULL; } AST_RWLIST_TRAVERSE(&logchannels, f, list) { if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) { fclose(f->fileptr); f->fileptr = NULL; } } closelog(); /* syslog */ AST_RWLIST_UNLOCK(&logchannels); return; }
int dnsmgr_init | ( | void | ) |
Provided by dnsmgr.c
Definition at line 352 of file dnsmgr.c.
References ast_cli_register(), ast_log(), cli_refresh, cli_reload, cli_status, do_reload(), LOG_ERROR, and sched_context_create().
Referenced by main().
{ if (!(sched = 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); return do_reload(1); }
int dnsmgr_reload | ( | void | ) |
Provided by dnsmgr.c
Definition at line 364 of file dnsmgr.c.
References do_reload().
{ return do_reload(0); }
void dnsmgr_start_refresh | ( | void | ) |
Provided by dnsmgr.c
Definition at line 246 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 | ) |
Provided by frame.c
Definition at line 968 of file frame.c.
References ARRAY_LEN, and ast_cli_register_multiple().
Referenced by main().
{ ast_cli_register_multiple(my_clis, ARRAY_LEN(my_clis)); return 0; }
int init_logger | ( | void | ) |
Provided by logger.c
Definition at line 1015 of file logger.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_cond_destroy(), ast_cond_init(), ast_config_AST_LOG_DIR, ast_log(), ast_mkdir(), ast_pthread_create, ast_queue_log(), ast_verb, cli_logger, errno, eventlog, EVENTLOG, handle_SIGXFSZ, init_logger_chain(), LOG_ERROR, LOG_EVENT, logcond, logfiles, logger_thread(), logthread, and qlog.
Referenced by main().
{ char tmp[256]; int res = 0; /* auto rotate if sig SIGXFSZ comes a-knockin */ sigaction(SIGXFSZ, &handle_SIGXFSZ, NULL); /* start logger thread */ ast_cond_init(&logcond, NULL); 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 */); /* create the eventlog */ if (logfiles.event_log) { snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG); eventlog = fopen(tmp, "a"); if (eventlog) { ast_log(LOG_EVENT, "Started Asterisk Event Logger\n"); ast_verb(1, "Asterisk Event Logger Started %s\n", tmp); } else { ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno)); res = -1; } } if (logfiles.queue_log) { snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_LOG_DIR, queue_log_name); qlog = fopen(tmp, "a"); ast_queue_log("NONE", "NONE", "NONE", "QUEUESTART", "%s", ""); } return res; }
int load_modules | ( | unsigned | int | ) |
Provided by loader.c
Definition at line 944 of file loader.c.
References add_to_load_order(), ast_config_AST_MODULE_DIR, ast_config_destroy(), ast_config_load2(), 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, dir, embedding, EVENT_FLAG_SYSTEM, find_resource(), ast_module::flags, ast_module::lib, load_resource_list(), LOG_NOTICE, LOG_WARNING, manager_event, ast_variable::name, ast_variable::next, load_order_entry::resource, ast_module::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); } } /* 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; order = add_to_load_order(mod->resource, &load_order); } #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); } 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 */ 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 9378 of file pbx.c.
References __ast_custom_function_register(), ARRAY_LEN, ast_cli_register_multiple(), AST_EVENT_DEVICE_STATE, AST_EVENT_IE_END, ast_event_subscribe(), ast_log(), ast_manager_register2(), ast_register_application2(), ast_taskprocessor_get(), ast_verb, builtins, device_state_cb(), device_state_sub, EVENT_FLAG_CONFIG, EVENT_FLAG_REPORTING, exception_function, LOG_ERROR, LOG_WARNING, manager_show_dialplan(), mandescr_show_dialplan, and pbx_cli.
Referenced by main().
{ int x; /* Initialize the PBX */ ast_verb(1, "Asterisk PBX Core Initializing\n"); if (!(device_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_custom_function_register(&exception_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_register2("ShowDialPlan", EVENT_FLAG_CONFIG | EVENT_FLAG_REPORTING, manager_show_dialplan, "List dialplan", mandescr_show_dialplan); if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, NULL, AST_EVENT_IE_END))) { return -1; } return 0; }
void threadstorage_init | ( | void | ) |
Provided by threadstorage.c
Definition at line 31 of file threadstorage.c.
Referenced by main().
{ }