|
|
@ -51,6 +51,7 @@ struct module {
|
|
|
|
char *(*description)(void);
|
|
|
|
char *(*description)(void);
|
|
|
|
char *(*key)(void);
|
|
|
|
char *(*key)(void);
|
|
|
|
int (*reload)(void);
|
|
|
|
int (*reload)(void);
|
|
|
|
|
|
|
|
const char *(*version)(void);
|
|
|
|
void *lib;
|
|
|
|
void *lib;
|
|
|
|
char resource[256];
|
|
|
|
char resource[256];
|
|
|
|
struct module *next;
|
|
|
|
struct module *next;
|
|
|
@ -252,6 +253,11 @@ int ast_module_reload(const char *name)
|
|
|
|
return reloaded;
|
|
|
|
return reloaded;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const char *unknown_version(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return "--unknown--";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int __load_resource(const char *resource_name, const struct ast_config *cfg)
|
|
|
|
static int __load_resource(const char *resource_name, const struct ast_config *cfg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
static char fn[256];
|
|
|
|
static char fn[256];
|
|
|
@ -347,9 +353,17 @@ static int __load_resource(const char *resource_name, const struct ast_config *c
|
|
|
|
ast_log(LOG_WARNING, "No key routine in module %s\n", fn);
|
|
|
|
ast_log(LOG_WARNING, "No key routine in module %s\n", fn);
|
|
|
|
errors++;
|
|
|
|
errors++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m->reload = dlsym(m->lib, "reload");
|
|
|
|
m->reload = dlsym(m->lib, "reload");
|
|
|
|
if (m->reload == NULL)
|
|
|
|
if (m->reload == NULL)
|
|
|
|
m->reload = dlsym(m->lib, "_reload");
|
|
|
|
m->reload = dlsym(m->lib, "_reload");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m->version = dlsym(m->lib, "version");
|
|
|
|
|
|
|
|
if (m->version == NULL)
|
|
|
|
|
|
|
|
m->version = dlsym(m->lib, "_version");
|
|
|
|
|
|
|
|
if (m->version == NULL)
|
|
|
|
|
|
|
|
m->version = unknown_version;
|
|
|
|
|
|
|
|
|
|
|
|
if (!m->key || !(key = m->key())) {
|
|
|
|
if (!m->key || !(key = m->key())) {
|
|
|
|
ast_log(LOG_WARNING, "Key routine returned NULL in module %s\n", fn);
|
|
|
|
ast_log(LOG_WARNING, "Key routine returned NULL in module %s\n", fn);
|
|
|
|
key = NULL;
|
|
|
|
key = NULL;
|
|
|
@ -549,20 +563,23 @@ void ast_update_use_count(void)
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ast_update_module_list(int (*modentry)(char *module, char *description, int usecnt, char *like), char *like)
|
|
|
|
int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *version, const char *like),
|
|
|
|
|
|
|
|
const char *like)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
struct module *m;
|
|
|
|
struct module *m;
|
|
|
|
int unlock = -1;
|
|
|
|
int unlock = -1;
|
|
|
|
int total_mod_loaded = 0;
|
|
|
|
int total_mod_loaded = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (ast_mutex_trylock(&modlock))
|
|
|
|
if (ast_mutex_trylock(&modlock))
|
|
|
|
unlock = 0;
|
|
|
|
unlock = 0;
|
|
|
|
m = module_list;
|
|
|
|
m = module_list;
|
|
|
|
while(m) {
|
|
|
|
while (m) {
|
|
|
|
total_mod_loaded += modentry(m->resource, m->description(), m->usecount(), like);
|
|
|
|
total_mod_loaded += modentry(m->resource, m->description(), m->usecount(), m->version(), like);
|
|
|
|
m = m->next;
|
|
|
|
m = m->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (unlock)
|
|
|
|
if (unlock)
|
|
|
|
ast_mutex_unlock(&modlock);
|
|
|
|
ast_mutex_unlock(&modlock);
|
|
|
|
|
|
|
|
|
|
|
|
return total_mod_loaded;
|
|
|
|
return total_mod_loaded;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|