mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 00:00:09 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@3914 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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);
|
||||
|
||||
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);
|
||||
//! 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, ...);
|
||||
|
||||
//! 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)
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user