mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-29 15:36:13 +00:00 
			
		
		
		
	Minor config updates, add module counts (bug #2593)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3953 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		
							
								
								
									
										2
									
								
								cli.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								cli.c
									
									
									
									
									
								
							| @@ -337,7 +337,7 @@ static int handle_modlist(int fd, int argc, char *argv[]) | |||||||
| 	ast_mutex_lock(&climodentrylock); | 	ast_mutex_lock(&climodentrylock); | ||||||
| 	climodentryfd = fd; | 	climodentryfd = fd; | ||||||
| 	ast_cli(fd, MODLIST_FORMAT2, "Module", "Description", "Use Count"); | 	ast_cli(fd, MODLIST_FORMAT2, "Module", "Description", "Use Count"); | ||||||
| 	ast_update_module_list(modlist_modentry); | 	ast_cli(fd,"%d modules loaded\n",ast_update_module_list(modlist_modentry)); | ||||||
| 	climodentryfd = -1; | 	climodentryfd = -1; | ||||||
| 	ast_mutex_unlock(&climodentrylock); | 	ast_mutex_unlock(&climodentrylock); | ||||||
| 	return RESULT_SUCCESS; | 	return RESULT_SUCCESS; | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								config.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								config.c
									
									
									
									
									
								
							| @@ -431,6 +431,21 @@ struct ast_variable *ast_load_realtime(const char *family, ...) | |||||||
| 	return res; | 	return res; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | struct ast_config *ast_load_realtime_multientry(const char *family, ...) | ||||||
|  | { | ||||||
|  | 	struct ast_config_reg *reg; | ||||||
|  | 	char db[256]=""; | ||||||
|  | 	char table[256]=""; | ||||||
|  | 	struct ast_config *res=NULL; | ||||||
|  | 	va_list ap; | ||||||
|  | 	va_start(ap, family); | ||||||
|  | 	reg = get_ast_cust_config_keyword(family, db, sizeof(db), table, sizeof(table)); | ||||||
|  | 	if (reg && reg->realtime_multi_func)  | ||||||
|  | 		res = reg->realtime_multi_func(db, table, ap); | ||||||
|  | 	va_end(ap); | ||||||
|  | 	return res; | ||||||
|  | } | ||||||
|  |  | ||||||
| int ast_update_realtime(const char *family, const char *keyfield, const char *lookup, ...) | int ast_update_realtime(const char *family, const char *keyfield, const char *lookup, ...) | ||||||
| { | { | ||||||
| 	struct ast_config_reg *reg; | 	struct ast_config_reg *reg; | ||||||
|   | |||||||
| @@ -116,6 +116,19 @@ int ast_category_exist(struct ast_config *config, char *category_name); | |||||||
|  */ |  */ | ||||||
| struct ast_variable *ast_load_realtime(const char *family, ...); | struct ast_variable *ast_load_realtime(const char *family, ...); | ||||||
|  |  | ||||||
|  | //! Retrieve realtime configuration | ||||||
|  | /*! | ||||||
|  |  * \param family which family/config to lookup | ||||||
|  |  * \param keyfield which field to use as the key | ||||||
|  |  * \param lookup which value to look for in the key field to match the entry. | ||||||
|  |  * This will use builtin configuration backends to look up a particular  | ||||||
|  |  * entity in realtime and return a variable list of its parameters. Unlike | ||||||
|  |  * the ast_load_realtime, this function can return more than one entry and | ||||||
|  |  * is thus stored inside a taditional ast_config structure rather than  | ||||||
|  |  * just returning a linked list of variables. | ||||||
|  |  */ | ||||||
|  | struct ast_config *ast_load_realtime_multientry(const char *family, ...); | ||||||
|  |  | ||||||
| //! Update realtime configuration | //! Update realtime configuration | ||||||
| /*! | /*! | ||||||
|  * \param family which family/config to be updated |  * \param family which family/config to be updated | ||||||
|   | |||||||
| @@ -31,6 +31,7 @@ struct ast_config_reg { | |||||||
| 	char name[CONFIG_KEYWORD_STRLEN]; | 	char name[CONFIG_KEYWORD_STRLEN]; | ||||||
| 	struct ast_config *(*static_func)(const char *database, const char *table, const char *, struct ast_config *,struct ast_category **,struct ast_variable **,int); | 	struct ast_config *(*static_func)(const char *database, const char *table, const char *, struct ast_config *,struct ast_category **,struct ast_variable **,int); | ||||||
| 	struct ast_variable *(*realtime_func)(const char *database, const char *table, va_list ap); | 	struct ast_variable *(*realtime_func)(const char *database, const char *table, va_list ap); | ||||||
|  | 	struct ast_config *(*realtime_multi_func)(const char *database, const char *table, va_list ap); | ||||||
| 	int (*update_func)(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap); | 	int (*update_func)(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap); | ||||||
| 	struct ast_config_reg *next; | 	struct ast_config_reg *next; | ||||||
| }; | }; | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								loader.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								loader.c
									
									
									
									
									
								
							| @@ -464,16 +464,18 @@ int ast_update_module_list(int (*modentry)(char *module, char *description, int | |||||||
| { | { | ||||||
| 	struct module *m; | 	struct module *m; | ||||||
| 	int unlock = -1; | 	int unlock = -1; | ||||||
|  | 	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) { | ||||||
| 		modentry(m->resource, m->description(), m->usecount()); | 		modentry(m->resource, m->description(), m->usecount()); | ||||||
| 		m = m->next; | 		m = m->next; | ||||||
|  | 		total_mod_loaded++; | ||||||
| 	} | 	} | ||||||
| 	if (unlock) | 	if (unlock) | ||||||
| 		ast_mutex_unlock(&modlock); | 		ast_mutex_unlock(&modlock); | ||||||
| 	return 0; | 	return total_mod_loaded; | ||||||
| } | } | ||||||
|  |  | ||||||
| int ast_loader_register(int (*v)(void))  | int ast_loader_register(int (*v)(void))  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user