Add module support level to ast_module_info structure. Print it in CLI "module show" .

ASTERISK-23919 #close
Reported by Malcolm Davenport

Review: https://reviewboard.asterisk.org/r/3802



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Michelson
2014-07-25 16:47:17 +00:00
parent 355dc3d2ad
commit dcf1ad14da
241 changed files with 386 additions and 77 deletions

View File

@@ -1350,8 +1350,10 @@ void ast_update_use_count(void)
AST_LIST_UNLOCK(&updaters);
}
int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like),
const char *like)
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)
{
struct ast_module *cur;
int unlock = -1;
@@ -1368,7 +1370,7 @@ int ast_update_module_list(int (*modentry)(const char *module, const char *descr
AST_LIST_TRAVERSE(&alpha_module_list, cur, list_entry) {
total_mod_loaded += modentry(cur->resource, cur->info->description, cur->usecount,
cur->flags.running ? "Running" : "Not Running", like);
cur->flags.running ? "Running" : "Not Running", like, cur->info->support_level);
}
if (unlock) {
@@ -1445,3 +1447,15 @@ void ast_module_unref(struct ast_module *mod)
ast_atomic_fetchadd_int(&mod->usecount, -1);
ast_update_use_count();
}
const char *support_level_map [] = {
[AST_MODULE_SUPPORT_UNKNOWN] = "unknown",
[AST_MODULE_SUPPORT_CORE] = "core",
[AST_MODULE_SUPPORT_EXTENDED] = "extended",
[AST_MODULE_SUPPORT_DEPRECATED] = "deprecated",
};
const char *ast_module_support_level_to_string(enum ast_module_support_level support_level)
{
return support_level_map[support_level];
}