summaryrefslogtreecommitdiff
path: root/main/loader.c
diff options
context:
space:
mode:
authorBenjamin Ford <bford@digium.com>2015-06-26 10:57:15 -0500
committerBenjamin Keith Ford <bford@digium.com>2015-07-10 11:17:12 -0500
commit1b7760a8aac5f43ed72849598ada769207c51c13 (patch)
tree0dc68e6c77d634fda5b38a38235d977a6ba6163d /main/loader.c
parent4a25d55416c736431620ce357f2bd9e241d62372 (diff)
ARI: Added new functionality to get all module information.
An http request can be sent to retrieve a list of all existing modules, including the resource name, description, use count, status, and support level. The command "curl -v -u user:pass -X GET 'http://localhost:8088/ari/ asterisk/modules" (or something similar, depending on configuration) can be run in the terminal to access this new functionality. For more information, see: https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource * Added new ARI functionality * Information on modules can now be retrieved Change-Id: I63cbbf0ec0c3544cc45ed2a588dceabe91c5e0b0
Diffstat (limited to 'main/loader.c')
-rw-r--r--main/loader.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/main/loader.c b/main/loader.c
index eb959fa80..99a47b3b4 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -1419,6 +1419,32 @@ int ast_update_module_list(int (*modentry)(const char *module, const char *descr
return total_mod_loaded;
}
+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)
+{
+ struct ast_module *cur;
+ int total_mod_loaded = 0;
+ AST_LIST_HEAD_NOLOCK(, ast_module) alpha_module_list = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
+
+ AST_DLLIST_LOCK(&module_list);
+
+ AST_DLLIST_TRAVERSE(&module_list, cur, entry) {
+ AST_LIST_INSERT_SORTALPHA(&alpha_module_list, cur, list_entry, resource);
+ }
+
+ while ((cur = AST_LIST_REMOVE_HEAD(&alpha_module_list, list_entry))) {
+ total_mod_loaded += modentry(cur->resource, cur->info->description, cur->usecount,
+ cur->flags.running? "Running" : "Not Running", like, cur->info->support_level, data);
+ }
+
+ AST_DLLIST_UNLOCK(&module_list);
+
+ return total_mod_loaded;
+}
+
/*! \brief Check if module exists */
int ast_module_check(const char *name)
{