135 { 0x87, 0x76, 0x79, 0x35, 0x23, 0xea, 0x3a, 0xd3,
136 0x25, 0x2a, 0xbb, 0x35, 0x87, 0xe4, 0x22, 0x24 };
144 #define STR_APPEND_TEXT(txt, str) \ 145 ast_str_append(str, 0, "%s%s", \ 146 ast_str_strlen(*(str)) > 0 ? ", " : "", \ 156 #if defined(HAVE_PERMANENT_DLOPEN) || defined(AST_XML_DOCS) 160 const char *last_three;
167 len = strlen(resource);
169 last_three = &resource[len-3];
170 if (!strcasecmp(last_three,
".so")) {
194 #if defined(HAVE_PERMANENT_DLOPEN) 195 #define FIRST_DLOPEN 999 199 struct info_list_obj {
205 static struct info_list_obj *info_list_obj_alloc(
const char *
name,
208 struct info_list_obj *new_entry;
216 strcpy(new_entry->name,
name);
217 new_entry->info =
info;
218 new_entry->dlopened = FIRST_DLOPEN;
225 static void manual_mod_reg(
const void *lib,
const char *resource)
227 struct info_list_obj *obj_tmp;
235 if (obj_tmp->dlopened == FIRST_DLOPEN) {
236 obj_tmp->dlopened = 1;
247 static void manual_mod_unreg(
const char *resource)
249 struct info_list_obj *obj_tmp;
275 if (startup_error_builder) {
305 struct ast_vector_string requires;
307 struct ast_vector_string optional_modules;
309 struct ast_vector_string enhances;
317 struct module_vector reffed_deps;
351 #define AST_MODULE_LOAD_UNKNOWN_STRING "Unknown" 393 return a_pri - b_pri;
417 struct ast_vector_const_string *missing)
449 struct ast_module *dep,
struct ast_vector_const_string *missing)
486 struct ast_vector_string *vec,
struct ast_vector_const_string *missing,
487 int ref_enhancers,
int isoptional)
496 if (isoptional && !dep) {
570 struct ast_vector_const_string localdeps;
617 if (!mod || !mod->
info) {
625 int (*updater)(void);
668 fprintf(stderr,
"Allocation failure during startup.\n");
696 resource_being_loaded =
NULL;
714 #if defined(HAVE_PERMANENT_DLOPEN) 716 struct info_list_obj *obj_tmp =
ao2_find(info_list, info->
name,
720 obj_tmp = info_list_obj_alloc(info->
name, info);
778 if (mod->
info == info) {
880 for (pos = 0, x = 0; x < 16; x++)
881 pos += sprintf(buf + pos,
" %02hhx", *d++);
883 ast_debug(1,
"Unexpected signature:%s\n", buf);
888 static int key_matches(
const unsigned char *key1,
const unsigned char *key2)
892 for (x = 0; x < 16; x++) {
893 if (key1[x] != key2[x])
903 unsigned char digest[16];
919 size_t len = strlen(name);
921 if (len > 3 && !strcasecmp(name + len - 3,
".so")) {
934 return strncasecmp(name1, name2, baselen1);
975 S_OR(name,
"unknown"),
S_OR(error,
"Unknown error"));
976 #if defined(HAVE_PERMANENT_DLOPEN) 978 manual_mod_unreg(name);
983 #if defined(HAVE_RTLD_NOLOAD) 999 lib = dlopen(fn, RTLD_LAZY | RTLD_NOLOAD);
1012 #if defined(HAVE_RTLD_NOLOAD) 1033 #if defined(HAVE_RTLD_NOLOAD) 1071 const char *filename,
int flags,
unsigned int suppress_logging)
1077 mod =
ast_calloc(1,
sizeof(*mod) + strlen(resource_in) + strlen(so_ext) + 1);
1082 sprintf(mod->
resource,
"%s%s", resource_in, so_ext);
1084 resource_being_loaded = mod;
1085 mod->
lib = dlopen(filename, flags);
1086 #if defined(HAVE_PERMANENT_DLOPEN) 1089 if (resource_being_loaded) {
1094 resource_being_loaded =
NULL;
1096 module_load_error(
"Module '%s' did not register itself during load\n", resource_in);
1102 if (suppress_logging) {
1106 resource_being_loaded = mod;
1108 #if defined(HAVE_PERMANENT_DLOPEN) 1111 if (resource_being_loaded) {
1112 resource_being_loaded =
NULL;
1128 #ifndef OPTIONAL_API 1135 resource_in, c == 1 ?
"dependency" :
"dependencies",
ast_str_buffer(list));
1159 size_t resource_in_len = strlen(resource_in);
1160 const char *so_ext =
"";
1162 if (resource_in_len < 4 || strcasecmp(resource_in + resource_in_len - 3,
".so")) {
1185 int somethingchanged;
1195 somethingchanged = 0;
1199 ast_debug(1,
"Passing on %s: its use count is %d\n",
1209 somethingchanged = 1;
1212 if (!somethingchanged) {
1217 somethingchanged = 1;
1221 }
while (somethingchanged);
1248 if (!error && (mod->
usecount > 0)) {
1270 ast_log(
LOG_WARNING,
"** Dangerous **: Unloading resource anyway, at user request\n");
1333 char *filename_merged =
NULL;
1341 if (
ast_asprintf(&filename_merged,
"%s/%s", dir_name, filename) < 0) {
1345 filename = filename_merged;
1348 if (!strncasecmp(filename, word->
word, word->
len)) {
1365 .len = strlen(word),
1378 int wordlen = strlen(word);
1397 if (!strncasecmp(word, mod->
resource, wordlen) && ++which > state) {
1415 if (do_full_reload) {
1438 if (do_full_reload) {
1453 if (!strcasecmp(item->
module, module)) {
1458 item =
ast_calloc(1,
sizeof(*item) + strlen(module) + 1);
1464 strcpy(item->
module, module);
1517 for (i = 0; i <
ARRAY_LEN(load_results); i++) {
1518 if (load_results[i].result == result) {
1519 return load_results[i].
name;
1523 ast_log(
LOG_WARNING,
"Failed to find correct load result status. result %d\n", result);
1558 snprintf(res_buffer,
sizeof(res_buffer),
"%u", result);
1570 if (!modules_loaded) {
1573 goto module_reload_exit;
1577 ast_verb(3,
"The previous reload command didn't finish yet\n");
1579 goto module_reload_exit;
1596 goto module_reload_done;
1670 module_load_error(
"Module '%s' was not compiled with the same compile-time options as this version of Asterisk.\n", mod->
resource);
1694 struct module_vector missing;
1764 struct module_vector *module_priorities,
int required,
int preload)
1781 goto prestart_error;
1789 goto prestart_error;
1794 if (module_priorities) {
1796 goto prestart_error;
1907 struct ast_str **printmissing)
1909 struct module_vector missingdeps;
1910 struct ast_vector_const_string localdeps;
1923 if (!*printmissing) {
1925 if (!*printmissing) {
1971 struct module_vector missingdeps;
2018 ast_debug(1,
"%s has %d dependencies\n",
2028 ast_debug(1,
"%s tried to start %s but it's already declined\n",
2061 if (!printmissing) {
2068 struct ast_vector_const_string localdeps;
2078 printmissing ?
ast_str_buffer(printmissing) :
"allocation failure creating list");
2103 struct module_vector module_priorities;
2141 fprintf(stderr,
"*** Failed to load module %s - Required\n", order->
resource);
2172 *mod_count += count;
2234 if (!strncasecmp(v->
name,
"preload", strlen(
"preload"))) {
2236 if (!strcasecmp(v->
name,
"preload")) {
2238 }
else if (!strcasecmp(v->
name,
"preload-require")) {
2244 }
else if (!strcasecmp(v->
name,
"load")) {
2246 }
else if (!strcasecmp(v->
name,
"require")) {
2248 }
else if (!strcasecmp(v->
name,
"noload") || !strcasecmp(v->
name,
"autoload")) {
2269 struct dirent *dirent;
2272 while ((dirent = readdir(dir))) {
2273 int ld = strlen(dirent->d_name);
2280 if (strcasecmp(dirent->d_name + ld - 3,
".so"))
2306 if (strcasecmp(v->
name,
"noload")) {
2319 ast_log(
LOG_ERROR,
"%s is configured with '%s' and 'noload', this is impossible.\n",
2320 v->
value, order->
preload ?
"preload-require" :
"require");
2341 unsigned int load_count;
2344 int modulecount = 0;
2349 char deprecated_in[33];
2350 char removed_in[33];
2351 char replacement[129];
2353 struct timeval start_time =
ast_tvnow();
2354 struct timeval end_time;
2357 ast_verb(1,
"Asterisk Dynamic Loader Starting:\n");
2359 #if defined(HAVE_PERMANENT_DLOPEN) 2361 info_list_obj_cmp_fn);
2363 fprintf(stderr,
"Module info list allocation failure.\n");
2409 char *mod_name =
NULL;
2410 struct ast_xml_xpath_results *results;
2419 if (!warning_msg || !mod_name) {
2426 deprecated_in[0] = removed_in[0] = replacement[0] = 0;
2430 struct ast_xml_node *deprecated_node, *removed_node, *replacement_node;
2434 if (deprecated_node) {
2450 if (replacement_node) {
2464 int already_butted = 0;
2466 ast_str_append(&warning_msg, -1,
"Module '%s' has been loaded", mod_name);
2468 ast_str_append(&warning_msg, -1,
" but %s deprecated in Asterisk version %s",
2474 ast_str_append(&warning_msg, -1,
" %s will be removed in Asterisk version %s", already_butted ?
"and" :
"but", removed_in);
2476 ast_str_append(&warning_msg, -1,
" %s may be removed in a future release", already_butted ?
"and" :
"but");
2482 ast_str_append(&warning_msg, -1,
" Its replacement is '%s'.", replacement);
2493 ast_log(
LOG_WARNING,
"The deprecated module '%s' has been loaded and is running, it may be removed in a future version\n", cur->
resource);
2514 startup_error_builder =
NULL;
2520 ast_debug(1,
"Loader time with AST_XML_DOCS: %ld.%06ld\n", usElapsed / 1000000, usElapsed % 1000000);
2522 ast_debug(1,
"Loader time without AST_XML_DOCS: %ld.%06ld\n", usElapsed / 1000000, usElapsed % 1000000);
2572 int total_mod_loaded = 0;
2573 struct module_vector alpha_module_list;
2591 return total_mod_loaded;
2598 const char *like,
void *data)
2600 int total_mod_loaded = 0;
2601 struct module_vector alpha_module_list;
2619 return total_mod_loaded;
2626 void *data,
const char *condition),
2627 const char *like,
void *data,
const char *condition)
2629 int conditions_met = 0;
2630 struct module_vector alpha_module_list;
2649 return conditions_met;
2662 return (cur !=
NULL);
2695 return cur ? 0 : -1;
2715 const char *
file,
int line,
const char *func)
2757 return support_level_map[support_level];
void ast_module_register(const struct ast_module_info *info)
static void publish_load_message_type(const char *type, const char *name, const char *status)
int ast_update_module_list(int(*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level), const char *like)
Ask for a list of modules, descriptions, use counts and status.
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
struct ast_variable * next
static enum ast_module_load_result start_resource(struct ast_module *mod)
int ast_update_module_list_condition(int(*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level, void *data, const char *condition), const char *like, void *data, const char *condition)
Ask for a list of modules, descriptions, use counts and status.
void ast_std_free(void *ptr)
static unsigned int loader_ready
int ast_load_resource(const char *resource_name)
Load a module.
Main Channel structure associated with a channel.
#define AST_VECTOR_ADD_SORTED(vec, elem, cmp)
Add an element into a sorted vector.
struct ast_json * ast_json_ref(struct ast_json *value)
Increase refcount on value.
struct module_user_list users
#define AST_LIST_LOCK(head)
Locks a list.
void ast_update_use_count(void)
Notify when usecount has been changed.
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
void __ast_module_user_hangup_all(struct ast_module *mod)
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
static int key_matches(const unsigned char *key1, const unsigned char *key2)
static const unsigned char expected_key[]
The arg parameter is a search key, but is not an object.
struct ast_json_payload * ast_json_payload_create(struct ast_json *json)
Create an ao2 object to pass json blobs as data payloads for stasis.
#define ast_test_flag(p, flag)
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
static char * get_name_from_resource(const char *resource)
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
const char * ast_config_AST_MODULE_DIR
#define AST_VECTOR_ELEM_DEFAULT_CMP(elem, value)
Default comparator for AST_VECTOR_REMOVE_ELEM_UNORDERED()
static struct module_list builtin_module_list
ast_module_reload_result
Possible return types for ast_module_reload.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define CONFIG_STATUS_FILEINVALID
#define AST_DLLIST_UNLOCK(head)
Attempts to unlock a list.
static void publish_reload_message(const char *name, enum ast_module_reload_result result)
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
struct ast_config * ast_config_load2(const char *filename, const char *who_asked, struct ast_flags flags)
Load a config file.
Structure for variables, used for configurations and for channel variables.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
static const char * loadresult2str(enum ast_module_load_result result)
struct ast_module_user::@397 entry
void MD5Final(unsigned char digest[16], struct MD5Context *context)
static void module_destroy(struct ast_module *mod)
int ast_str_set_va(struct ast_str **buf, ssize_t max_len, const char *fmt, va_list ap)
Set a dynamic string from a va_list.
#define AST_DLLIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
char * ast_module_helper(const char *line, const char *word, int pos, int state, int rpos, enum ast_module_helper_type type)
Match modules names for the Asterisk cli.
enum ast_module_reload_result ast_module_reload(const char *name)
Reload asterisk modules.
static void publish_unload_message(const char *name, const char *status)
static void publish_load_message(const char *name, enum ast_module_load_result result)
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
static int resource_name_match(const char *name1, size_t baselen1, const char *name2)
struct ast_xml_xpath_results * ast_xmldoc_query(const char *fmt,...)
Execute an XPath query on the loaded XML documentation.
static struct aco_type item
static int copy(char *infile, char *outfile)
Utility function to copy a file.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define AST_DLLIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define ao2_t_alloc_options(data_size, destructor_fn, options, debug_msg)
Allocate and initialize an object.
#define ast_strdup(str)
A wrapper for strdup()
int ast_unlock_path(const char *path)
Unlock a path.
static int module_load_helper_on_file(const char *dir_name, const char *filename, void *obj)
I/O Management (derived from Cheops-NG)
struct ast_module * __ast_module_running_ref(struct ast_module *mod, const char *file, int line, const char *func)
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
list of users found in the config file
static int module_deps_missing_recursive(struct ast_module *mod, struct module_vector *missingdeps)
Recursively find required dependencies that are not running.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
int ast_file_read_dirs(const char *dir_name, ast_file_on_file on_file, void *obj, int max_depth)
Recursively iterate through files and directories up to max_depth.
#define ast_verb(level,...)
void MD5Init(struct MD5Context *context)
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
static int module_post_register(struct ast_module *mod)
const char * enhances
Modules that we provide enhanced functionality for.
static int verify_key(const unsigned char *key)
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
#define ast_module_unref(mod)
Release a reference to the module.
#define ast_strlen_zero(foo)
#define AST_LIST_HEAD_DESTROY(head)
Destroys a list head structure.
#define STR_APPEND_TEXT(txt, str)
static void module_load_error(const char *fmt,...)
enum AST_LOCK_RESULT ast_lock_path(const char *path)
Lock a filesystem path.
Configuration File Parser.
int __ao2_ref(void *o, int delta, const char *tag, const char *file, int line, const char *func)
#define EVENT_FLAG_SYSTEM
#define ast_debug(level,...)
Log a DEBUG message.
#define AST_DLLIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
struct stasis_message_type * ast_manager_get_generic_type(void)
Get the stasis_message_type for generic messages.
struct ast_vector_string enhances
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
const char * optional_modules
Comma-separated list of optionally required modules.
A set of macros to manage doubly-linked lists.
int ast_module_check(const char *name)
Check if module exists.
General Asterisk PBX channel definitions.
void ast_process_pending_reloads(void)
Process reload requests received during startup.
Asterisk file paths, configured in asterisk.conf.
#define ast_mutex_trylock(a)
const struct ast_module_info * info
#define AST_VECTOR_ELEM_CLEANUP_NOOP(elem)
Vector element cleanup that does nothing.
#define AST_DLLIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
int ast_sd_notify(const char *state)
a wrapper for sd_notify(): notify systemd of any state changes.
static int start_resource_list(struct module_vector *resources, int *mod_count)
static int modules_loaded
Internal flag to indicate all modules have been initially loaded.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define ao2_ref(o, delta)
int ast_softhangup(struct ast_channel *chan, int reason)
Softly hangup up a channel.
void ast_config_destroy(struct ast_config *config)
Destroys a config.
struct ast_vector_string optional_modules
#define ast_strdupa(s)
duplicate a string in memory from the stack
struct timeval ast_lastreloadtime
static int module_matches_helper_type(struct ast_module *mod, enum ast_module_helper_type type)
struct ast_xml_node * ast_xml_find_element(struct ast_xml_node *root_node, const char *name, const char *attrname, const char *attrvalue)
Find a node element by name.
#define ast_malloc(len)
A wrapper for malloc()
static int resource_list_recursive_decline(struct module_vector *resources, struct ast_module *mod, struct ast_str **printmissing)
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
const char * ast_module_support_level_to_string(enum ast_module_support_level support_level)
struct ast_channel * chan
#define ast_test_suite_event_notify(s, f,...)
char * term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout)
Colorize a specified string by adding terminal color codes.
static int load_resource_list(struct load_order *load_order, int *mod_count)
void __ast_module_shutdown_ref(struct ast_module *mod, const char *file, int line, const char *func)
static void unload_dynamic_module(struct ast_module *mod)
void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len)
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
int ast_shutdown_final(void)
static void logged_dlclose(const char *name, void *lib)
dlclose(), with failure logging.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
static enum ast_module_load_result start_resource_attempt(struct ast_module *mod, int *count)
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode force)
Unload a module.
struct ast_vector_string requires
const char * ast_config_AST_CONFIG_DIR
static int loader_builtin_init(struct load_order *load_order)
struct stasis_message * stasis_message_create(struct stasis_message_type *type, void *data)
Create a new message.
static int loader_config_init(struct load_order *load_order)
void __ast_module_user_remove(struct ast_module *mod, struct ast_module_user *u)
AST_VECTOR(module_vector, struct ast_module *)
static char buildopt_sum[33]
#define ast_module_shutdown_ref(mod)
Prevent unload of the module before shutdown.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static struct ast_str * startup_error_builder
static struct load_order_entry * add_to_load_order(const char *resource, struct load_order *load_order, int required, int preload, int builtin)
static struct ast_module * find_resource(const char *resource, int do_lock)
#define ao2_alloc(data_size, destructor_fn)
static int module_reffed_deps_add_dep_enhancers(struct ast_module *mod, struct ast_module *dep, struct ast_vector_const_string *missing)
void ast_module_unregister(const struct ast_module_info *info)
int modules_shutdown(void)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
int ast_vector_string_split(struct ast_vector_string *dest, const char *input, const char *delim, int flags, int(*excludes_cmp)(const char *s1, const char *s2))
Append a string vector by splitting a string.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
struct ast_module_user * __ast_module_user_add(struct ast_module *mod, struct ast_channel *chan)
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic's subscribers.
static size_t resource_name_baselen(const char *name)
#define AST_LIST_HEAD_INIT(head)
Initializes a list head structure.
static struct ast_module *volatile resource_being_loaded
#define ast_calloc(num, len)
A wrapper for calloc()
#define AST_VECTOR_RESET(vec, cleanup)
Reset vector.
#define AST_DLLIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
static int module_vector_strcasecmp(struct ast_module *a, struct ast_module *b)
Module could not be loaded properly.
int ast_loader_register(int(*v)(void))
Add a procedure to be run when modules have been updated.
#define AST_DLLIST_EMPTY(head)
Checks whether the specified list contains any entries.
Prototypes for public functions only of internal interest,.
static int do_full_reload
Module has failed to load, may be in an inconsistent state.
Vector container support.
void ast_xml_xpath_results_free(struct ast_xml_xpath_results *results)
Free the XPath results.
#define ao2_find(container, arg, flags)
void * ast_std_calloc(size_t nmemb, size_t size) attribute_malloc
#define AST_VECTOR_GET_CMP(vec, value, cmp)
Get an element from a vector that matches the given comparison.
Structure used to handle boolean flags.
struct stasis_topic * ast_manager_get_topic(void)
Get the Stasis Message Bus API topic for AMI.
#define AST_VECTOR_REMOVE_CMP_ORDERED(vec, value, cmp, cleanup)
Remove an element from a vector that matches the given comparison while maintaining order...
static void queue_reload_request(const char *module)
static void module_load_helper(const char *word)
static ast_mutex_t reloadlock
#define CONFIG_STATUS_FILEMISSING
static struct ast_module * load_dynamic_module(const char *resource_in, unsigned int suppress_logging)
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
#define AST_MODULE_CONFIG
Module configuration file.
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
#define AO2_STRING_FIELD_CMP_FN(stype, field)
Creates a compare function for a structure string field.
#define AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END
Closes a safe loop traversal block.
Standard Command Line Interface.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
const char * ast_module_name(const struct ast_module *mod)
Get the name of a module.
int ast_loader_unregister(int(*v)(void))
Remove a procedure to be run when modules are updated.
const char * ast_xml_get_text(struct ast_xml_node *node)
Get an element content string.
unsigned int keepuntilshutdown
#define AST_MODULE_LOAD_UNKNOWN_STRING
static int module_deps_reference(struct ast_module *mod, struct ast_vector_const_string *missing)
static int load_dlopen_missing(struct ast_str **list, struct ast_vector_string *deps)
static int alpha_module_list_create(struct module_vector *alpha_module_list)
Abstract JSON element (object, array, string, int, ...).
static struct ast_module * load_dlopen(const char *resource_in, const char *so_ext, const char *filename, int flags, unsigned int suppress_logging)
#define AST_DLLIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
void __ast_module_unref(struct ast_module *mod, const char *file, int line, const char *func)
Handy terminal functions for vt* terms.
int error(const char *format,...)
int64_t ast_tvdiff_us(struct timeval end, struct timeval start)
Computes the difference (in microseconds) between two struct timeval instances.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
static struct ast_vector_string startup_errors
struct ast_module * __ast_module_ref(struct ast_module *mod, const char *file, int line, const char *func)
struct ast_module::@398 flags
static int module_reffed_deps_add(struct ast_module *mod, struct ast_module *dep, struct ast_vector_const_string *missing)
int ast_cli_completion_add(char *value)
Add a result to a request for completion options.
enum ast_module_load_result(* load)(void)
static int module_deps_process_reqlist(struct ast_module *mod, struct ast_vector_string *vec, struct ast_vector_const_string *missing, int ref_enhancers, int isoptional)
const char * support_level_map[]
#define AST_VECTOR_REMOVE(vec, idx, preserve_ordered)
Remove an element from a vector by index.
Asterisk module definitions.
static snd_pcm_format_t format
static unsigned int inspect_module(const struct ast_module *mod)
static const struct load_results_map load_results[]
enum ast_module_support_level support_level
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
static int printdigest(const unsigned char *d)
struct ast_xml_node * ast_xml_xpath_get_first_result(struct ast_xml_xpath_results *results)
Return the first result node of an XPath query.
const char buildopt_sum[33]
#define AST_DLLIST_LOCK(head)
Locks a list.
#define ast_opt_lock_confdir
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
#define AST_MUTEX_DEFINE_STATIC(mutex)
void ast_log_ap(int level, const char *file, int line, const char *function, const char *fmt, va_list ap)
struct ast_xml_node * ast_xml_node_get_children(struct ast_xml_node *node)
Get the node's children.
struct module_vector reffed_deps
Vector holding pointers to modules we have a reference to.
static enum ast_module_load_result load_resource(const char *resource_name, unsigned int suppress_logging, struct module_vector *module_priorities, int required, int preload)
#define AST_VECTOR_CALLBACK_VOID(vec, callback,...)
Execute a callback on every element in a vector disregarding callback return.
#define ast_opt_ref_debug
static int is_module_loaded(const char *resource_name)
Check to see if the given resource is loaded.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
#define ast_mutex_unlock(a)
#define AST_DLLIST_ENTRY(type)
Declare previous/forward links inside a list entry.
#define AST_DLLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
int ast_update_module_list_data(int(*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level, void *data), const char *like, void *data)
Ask for a list of modules, descriptions, use counts and status.
#define ast_module_ref(mod)
Hold a reference to the module.
#define ao2_link(container, obj)
static int module_vector_cmp(struct ast_module *a, struct ast_module *b)