23 #ifndef _ASTERISK_CONFIG_H
24 #define _ASTERISK_CONFIG_H
26 #if defined(__cplusplus) || defined(c_plusplus)
50 #define CONFIG_STATUS_FILEMISSING (void *)0
51 #define CONFIG_STATUS_FILEUNCHANGED (void *)-1
52 #define CONFIG_STATUS_FILEINVALID (void *)-2
170 #define ast_config_load(filename, flags) ast_config_load2(filename, AST_MODULE, flags)
384 int ast_update_realtime(const
char *family, const
char *keyfield, const
char *lookup, ...) attribute_sentinel;
440 int ast_destroy_realtime(const
char *family, const
char *keyfield, const
char *lookup, ...) attribute_sentinel;
575 struct ast_variable *_ast_variable_new(
const char *name,
const char *
value,
const char *filename,
const char *
file,
const char *
function,
int lineno);
576 #define ast_variable_new(a, b, c) _ast_variable_new(a, b, c, __FILE__, __PRETTY_FUNCTION__, __LINE__)
599 const char *
value,
const char *match,
unsigned int object);
630 PARSE_INT16 = 0x0004,
631 PARSE_UINT16 = 0x0005,
727 #define CV_START(__in_var, __in_val) \
729 const char *__var = __in_var; \
730 const char *__val = __in_val;
733 #define CV_END } while (0)
736 #define CV_F(__pattern, __body) if (!strcasecmp((__var), __pattern)) { __body; break; }
742 #define CV_BOOL(__x, __dst) CV_F(__x, (__dst) = ast_true(__val) )
743 #define CV_UINT(__x, __dst) CV_F(__x, (__dst) = strtoul(__val, NULL, 0) )
744 #define CV_STR(__x, __dst) CV_F(__x, ast_copy_string(__dst, __val, sizeof(__dst)))
745 #define CV_DSTR(__x, __dst) CV_F(__x, ast_free(__dst); __dst = ast_strdup(__val))
746 #define CV_STRFIELD(__x, __obj, __field) CV_F(__x, ast_string_field_set(__obj, __field, __val))
791 #if defined(__cplusplus) || defined(c_plusplus)
int realtime_store(const char *database, const char *table, va_list ap)
int ast_variable_delete(struct ast_category *category, const char *variable, const char *match, const char *line)
struct ast_config_engine * next
struct ast_comment * precomments
char * exec_file
if it's an exec, you'll have both the /var/tmp to read, and the original script
int ast_store_realtime(const char *family,...) attribute_sentinel
Create realtime configuration.
int ast_category_delete(struct ast_config *cfg, const char *category)
realtime_destroy * destroy_func
const char * ast_variable_retrieve(const struct ast_config *config, const char *category, const char *variable)
Gets a variable.
static const char config[]
int ast_realtime_enabled(void)
Check if there's any realtime engines loaded.
realtime_update * update_func
struct ast_config_include * ast_include_find(struct ast_config *conf, const char *included_file)
struct ast_variable * ast_category_detach_variables(struct ast_category *cat)
struct ast_variable * ast_category_first(struct ast_category *cat)
given a pointer to a category, return the root variable.
int ast_unload_realtime(const char *family)
Release any resources cached for a realtime family.
int ast_update2_realtime(const char *family,...) attribute_sentinel
Update realtime configuration.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category)
Goes through variables.
realtime_store * store_func
int ast_category_insert(struct ast_config *config, struct ast_category *cat, const char *match)
Inserts new category.
struct ast_category * ast_config_get_current_category(const struct ast_config *cfg)
Retrieve the current category name being built.
struct ast_variable * ast_load_realtime_all(const char *family,...) attribute_sentinel
Structure for variables, used for configurations and for channel variables.
void ast_include_rename(struct ast_config *conf, const char *from_file, const char *to_file)
int ast_config_text_file_save(const char *filename, const struct ast_config *cfg, const char *generator)
struct ast_variable * ast_load_realtime(const char *family,...) attribute_sentinel
Retrieve realtime configuration.
int realtime_require(const char *database, const char *table, va_list ap)
Function pointer called to ensure database schema is properly configured for realtime use...
ast_parse_flags
Support code to parse config file arguments.
const char * ast_config_option(struct ast_config *cfg, const char *cat, const char *var)
Retrieve a configuration variable within the configuration set.
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
realtime_unload * unload_func
char stuff[0]
Contents of file, name, and value in that order stuffed here.
struct ast_config * ast_config_load2(const char *filename, const char *who_asked, struct ast_flags flags)
Load a config file.
char * included_file
file name included
void ast_config_destroy(struct ast_config *config)
Destroys a config.
Configuration engine structure, used to define realtime drivers.
struct ast_category * ast_category_new(const char *name, const char *in_file, int lineno)
Create a category structure.
#define attribute_sentinel
struct ast_comment * trailing
struct ast_category * ast_category_get(const struct ast_config *config, const char *category_name)
Retrieve a category if it exists.
int ast_update_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Update realtime configuration.
int ast_category_exist(const struct ast_config *config, const char *category_name)
Check for category duplicates.
struct ast_variable * ast_variables_reverse(struct ast_variable *var)
Reverse a variable list.
void ast_category_destroy(struct ast_category *cat)
int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Destroy realtime configuration.
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *result,...)
The argument parsing routine.
char * ast_realtime_encode_chunk(struct ast_str **dest, ssize_t maxlen, const char *chunk)
Encodes a chunk of data for realtime.
Inlinable API function macro.
config_load_func * load_func
char * ast_category_browse(struct ast_config *config, const char *prev)
Goes through categories.
char * ast_realtime_decode_chunk(char *chunk)
Remove standard encoding from realtime values, which ensures that a semicolon embedded within a singl...
realtime_require * require_func
int realtime_unload(const char *database, const char *table)
Function pointer called to clear the database cache and free resources used for such.
int config_text_file_save(const char *filename, const struct ast_config *cfg, const char *generator)
struct ast_variable * realtime_var_get(const char *database, const char *table, va_list ap)
int register_config_cli(void)
Exposed initialization method for core process.
struct ast_variable * ast_category_root(struct ast_config *config, char *cat)
returns the root ast_variable of a config
struct ast_config_include * ast_include_new(struct ast_config *conf, const char *from_file, const char *included_file, int is_exec, const char *exec_file, int from_lineno, char *real_included_file_name, int real_included_file_name_size)
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static struct ast_generator generator
void ast_variable_append(struct ast_category *category, struct ast_variable *variable)
struct ast_config * config_load_func(const char *database, const char *table, const char *configfile, struct ast_config *config, struct ast_flags flags, const char *suggested_include_file, const char *who_asked)
int ast_config_engine_register(struct ast_config_engine *newconfig)
Register config engine.
struct ast_config * ast_config_new(void)
Create a new base configuration structure.
struct ast_variable * ast_variables_dup(struct ast_variable *var)
Duplicate variable list.
int realtime_destroy(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap)
int ast_variable_update(struct ast_category *category, const char *variable, const char *value, const char *match, unsigned int object)
Update variable value within a config.
struct ast_config * realtime_multi_get(const char *database, const char *table, va_list ap)
Structure used to handle boolean flags.
int ast_realtime_require_field(const char *family,...) attribute_sentinel
Inform realtime what fields that may be stored.
realtime_update2 * update2_func
int realtime_update2(const char *database, const char *table, va_list ap)
int ast_rq_is_int(require_type type)
Check if require type is an integer type.
realtime_multi_get * realtime_multi_func
struct ast_comment * sameline
struct ast_variable * next
void ast_category_append(struct ast_config *config, struct ast_category *cat)
void ast_variable_insert(struct ast_category *category, struct ast_variable *variable, const char *line)
struct ast_config * ast_config_internal_load(const char *configfile, struct ast_config *cfg, struct ast_flags flags, const char *suggested_incl_file, const char *who_asked)
void ast_category_rename(struct ast_category *cat, const char *name)
require_type
Types used in ast_realtime_require_field.
void ast_config_set_current_category(struct ast_config *cfg, const struct ast_category *cat)
Set the category within the configuration as being current.
static int match(struct sockaddr_in *sin, unsigned short callno, unsigned short dcallno, const struct chan_iax2_pvt *cur, int check_dcallno)
int ast_category_empty(struct ast_config *cfg, const char *category)
Removes and destroys all variables within a category.
struct ast_variable * ast_variable_new(const char *name, const char *value, const char *filename)
struct ast_config * ast_load_realtime_multientry(const char *family,...) attribute_sentinel
Retrieve realtime configuration.
int ast_config_engine_deregister(struct ast_config_engine *del)
Deregister config engine.
realtime_var_get * realtime_func
int ast_check_realtime(const char *family)
Check if realtime engine is configured for family.
int read_config_maps(void)
Exposed re-initialization method for core process.
#define AST_INLINE_API(hdr, body)
int realtime_update(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap)