diff options
author | Matt Jordan <mjordan@digium.com> | 2015-07-10 21:46:38 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2015-07-10 21:46:38 -0500 |
commit | e51d86682a33ab410c3fa0ceb069657614915ef9 (patch) | |
tree | 4aa1c12332edd053ed6ee29bdb7d2aac86310ac3 /main | |
parent | 37e1c479cac3aad5c4e45ec1037a800c157cd010 (diff) | |
parent | 47ea312b2402bf31a0f1ccb9d73a6b8b7d814b09 (diff) |
Merge "ARI: Added new functionality to get all module information." into 13
Diffstat (limited to 'main')
-rw-r--r-- | main/loader.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/main/loader.c b/main/loader.c index 814bb9768..55fed7063 100644 --- a/main/loader.c +++ b/main/loader.c @@ -1425,6 +1425,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) { |