diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-10-05 06:46:11 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-10-05 06:46:11 +0000 |
commit | 89e09dcdf85d029417888df4f5ad88979f9bfb97 (patch) | |
tree | 1f9acecb29a22d0f2906c87338b105289ddef857 /include/asterisk | |
parent | 5d45bd2ea597a9e6d27f7f0af79ceb98cf765bc6 (diff) |
Major changes to res_config to support centralized config, eliminate configuration of res_config_odbc, update config examples, integrate with iax2, remove mysql friends from iax2, put on flame retardant vest...
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3914 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk')
-rwxr-xr-x | include/asterisk/config.h | 36 | ||||
-rwxr-xr-x | include/asterisk/config_pvt.h | 29 | ||||
-rwxr-xr-x | include/asterisk/res_odbc.h | 2 | ||||
-rwxr-xr-x | include/asterisk/utils.h | 2 |
4 files changed, 38 insertions, 31 deletions
diff --git a/include/asterisk/config.h b/include/asterisk/config.h index e98df700f..89e66437b 100755 --- a/include/asterisk/config.h +++ b/include/asterisk/config.h @@ -34,6 +34,7 @@ struct ast_variable { struct ast_comment *precomments; struct ast_comment *sameline; struct ast_variable *next; + char stuff[0]; }; //! Load a config file @@ -103,12 +104,37 @@ int ast_false(char *val); * Browse config structure and check for category duplicity Return non-zero if found */ int ast_category_exist(struct ast_config *config, char *category_name); -/* These are only in the config engine at this point */ -struct ast_variable *ast_variable_append_modify(struct ast_config *cfg, char *category, char *variable, char *newvalue, int newcat, int newvar, int move); +//! 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. Note + * that unlike the variables in ast_config, the resulting list of variables + * MUST be fred with ast_free_runtime() as there is no container. + */ +struct ast_variable *ast_load_realtime(const char *family, const char *keyfield, const char *lookup); + +//! Update realtime configuration +/*! + * \param family which family/config to be updated + * \param keyfield which field to use as the key + * \param lookup which value to look for in the key field to match the entry. + * \param variable which variable should be updated in the config, NULL to end list + * \param value the value to be assigned to that variable in the given entity. + * This function is used to update a parameter in realtime configuration space. + * + */ +int ast_update_realtime(const char *family, const char *keyfield, const char *lookup, ...); -int ast_category_delete(struct ast_config *cfg, char *category); -int ast_variable_delete(struct ast_config *cfg, char *category, char *variable, char *value); -int ast_save(char *filename, struct ast_config *cfg, char *generator); +//! Free realtime configuration +/*! + * \param var the linked list of variables to free + * This command free's a list of variables and should ONLY be used + * in conjunction with ast_load_realtime and not with the regular ast_load. + */ +void ast_destroy_realtime(struct ast_variable *var); #if defined(__cplusplus) || defined(c_plusplus) } diff --git a/include/asterisk/config_pvt.h b/include/asterisk/config_pvt.h index f87189d31..e33d92de9 100755 --- a/include/asterisk/config_pvt.h +++ b/include/asterisk/config_pvt.h @@ -4,6 +4,7 @@ extern "C" { #endif +#include <stdarg.h> #define CONFIG_KEYWORD_STRLEN 128 #define CONFIG_KEYWORD_ARRAYLEN 512 #include <asterisk/config.h> @@ -14,10 +15,6 @@ struct ast_category { char name[80]; struct ast_variable *root; struct ast_category *next; -#ifdef PRESERVE_COMMENTS - struct ast_comment *precomments; - struct ast_comment *sameline; -#endif }; struct ast_config { @@ -25,43 +22,25 @@ struct ast_config { for now */ struct ast_category *root; struct ast_category *prev; -#ifdef PRESERVE_COMMENTS - struct ast_comment *trailingcomments; -#endif }; -#ifdef PRESERVE_COMMENTS -struct ast_comment_struct -{ - struct ast_comment *root; - struct ast_comment *prev; -}; -#endif struct ast_category; struct ast_config_reg { char name[CONFIG_KEYWORD_STRLEN]; - struct ast_config *(*func)(char *, struct ast_config *,struct ast_category **,struct ast_variable **,int -#ifdef PRESERVE_COMMENTS -,struct ast_comment_struct * -#endif -); - char keywords[CONFIG_KEYWORD_STRLEN][CONFIG_KEYWORD_ARRAYLEN]; - int keycount; + 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, const char *keyfield, const char *entity); + int (*update_func)(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap); struct ast_config_reg *next; }; - int ast_config_register(struct ast_config_reg *new); int ast_config_deregister(struct ast_config_reg *del); void ast_cust_config_on(void); void ast_cust_config_off(void); int ast_cust_config_active(void); -struct ast_config_reg *get_config_registrations(void); -struct ast_config_reg *get_ast_cust_config(char *name); -struct ast_config_reg *get_ast_cust_config_keyword(char *name); void ast_config_destroy_all(void); diff --git a/include/asterisk/res_odbc.h b/include/asterisk/res_odbc.h index 1a68acb98..9b0f71abe 100755 --- a/include/asterisk/res_odbc.h +++ b/include/asterisk/res_odbc.h @@ -45,7 +45,7 @@ odbc_status odbc_obj_connect(odbc_obj *obj); odbc_status odbc_obj_disconnect(odbc_obj *obj); void destroy_obdc_obj(odbc_obj **obj); int register_odbc_obj(char *name,odbc_obj *obj); -odbc_obj *fetch_odbc_obj(char *name); +odbc_obj *fetch_odbc_obj(const char *name); int odbc_dump_fd(int fd,odbc_obj *obj); #endif diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h index bfbdd951c..4543cd498 100755 --- a/include/asterisk/utils.h +++ b/include/asterisk/utils.h @@ -26,6 +26,8 @@ struct ast_hostent { char buf[1024]; }; + +extern char *ast_strip(char *buf); extern struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp); extern int ast_base64encode(char *dst, unsigned char *src, int srclen, int max); extern int ast_base64decode(unsigned char *dst, char *src, int max); |