summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorBenjamin Ford <bford@digium.com>2015-07-13 10:54:51 -0500
committerBenjamin Ford <bford@digium.com>2015-07-13 14:27:40 -0500
commit73e35d20deb57281874939f553fea9fdced2e260 (patch)
treedcc9e909115d4d97759a30a416ca275a826db29c /main
parent5c491a629586ab7036107ae79935a39bcf793a0a (diff)
ARI: Added new functionality to get information on a single module.
An http request can be sent to retrieve information on a single module, 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/{moduleName}'" (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 a single module can now be retrieved ASTERISK-25173 Change-Id: Ibce5a94e70ecdf4e90329cf0ba66c33a62d37463
Diffstat (limited to 'main')
-rw-r--r--main/loader.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/main/loader.c b/main/loader.c
index 55fed7063..940b53edb 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -1451,6 +1451,34 @@ int ast_update_module_list_data(int (*modentry)(const char *module, const char *
return total_mod_loaded;
}
+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)
+{
+ struct ast_module *cur;
+ int conditions_met = 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))) {
+ conditions_met += modentry(cur->resource, cur->info->description, cur->usecount,
+ cur->flags.running? "Running" : "Not Running", like, cur->info->support_level, data,
+ condition);
+ }
+
+ AST_DLLIST_UNLOCK(&module_list);
+
+ return conditions_met;
+}
+
/*! \brief Check if module exists */
int ast_module_check(const char *name)
{