23 #ifndef _ASTERISK_CONFIG_H 24 #define _ASTERISK_CONFIG_H 26 #if defined(__cplusplus) || defined(c_plusplus) 58 #define CONFIG_STATUS_FILEMISSING (void *)0 59 #define CONFIG_STATUS_FILEUNCHANGED (void *)-1 60 #define CONFIG_STATUS_FILEINVALID (void *)-2 179 #define ast_config_load(filename, flags) ast_config_load2(filename, AST_MODULE, flags) 276 const char *category_name,
const char *
filter);
278 const char *category_name);
305 const char *category,
const char *variable,
const char *
filter);
307 const char *category,
const char *variable);
388 const char *category_name,
const char *
filter);
595 int ast_update_realtime(const
char *family, const
char *keyfield, const
char *lookup, ...) attribute_sentinel;
702 int ast_destroy_realtime(const
char *family, const
char *keyfield, const
char *lookup, ...) attribute_sentinel;
765 #ifdef TEST_FRAMEWORK 832 #define ast_category_new_dynamic(name) ast_category_new(name, "", -1) 837 #define ast_category_new_anonymous() ast_category_new_dynamic("") 914 #define ast_variable_new(name, value, filename) _ast_variable_new(name, value, filename, __FILE__, __PRETTY_FUNCTION__, __LINE__) 949 #define ast_variable_list_append(head, new_var) ast_variable_list_append_hint(head, NULL, new_var) 981 const char *
value,
const char *
match,
unsigned int object);
1053 const char *filename,
1090 PARSE_INT16 = 0x0004,
1091 PARSE_UINT16 = 0x0005,
1199 #define CV_START(__in_var, __in_val) \ 1201 const char *__var = __in_var; \ 1202 const char *__val = __in_val; 1205 #define CV_END } while (0) 1208 #define CV_F(__pattern, __body) if (!strcasecmp((__var), __pattern)) { __body; break; } 1214 #define CV_BOOL(__x, __dst) CV_F(__x, (__dst) = ast_true(__val) ) 1215 #define CV_UINT(__x, __dst) CV_F(__x, (__dst) = strtoul(__val, NULL, 0) ) 1216 #define CV_STR(__x, __dst) CV_F(__x, ast_copy_string(__dst, __val, sizeof(__dst))) 1217 #define CV_DSTR(__x, __dst) CV_F(__x, ast_free(__dst); __dst = ast_strdup(__val)) 1218 #define CV_STRFIELD(__x, __obj, __field) CV_F(__x, ast_string_field_set(__obj, __field, __val)) 1323 #if defined(__cplusplus) || defined(c_plusplus) int ast_category_is_template(const struct ast_category *category)
Check if category is a template.
struct ast_category * ast_category_new(const char *name, const char *in_file, int lineno)
Create a category.
struct ast_variable * ast_load_realtime(const char *family,...) attribute_sentinel
struct ast_variable * next
struct ast_variable * ast_variables_reverse(struct ast_variable *var)
Reverse a variable list.
require_type
Types used in ast_realtime_require_field.
char * ast_realtime_decode_chunk(char *chunk)
Remove standard encoding from realtime values, which ensures that a semicolon embedded within a singl...
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)
struct ast_variable * ast_variable_list_sort(struct ast_variable *head)
Performs an in-place sort on the variable list by ascending name.
int ast_config_text_file_save(const char *filename, const struct ast_config *cfg, const char *generator)
Save a config text file preserving the pre 13.2 behavior.
realtime_destroy * destroy_func
void ast_variable_insert(struct ast_category *category, struct ast_variable *variable, const char *line)
struct ast_variable * _ast_variable_new(const char *name, const char *value, const char *filename, const char *file, const char *function, int lineno)
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
int ast_variable_delete(struct ast_category *category, const char *variable, const char *match, const char *line)
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
int register_config_cli(void)
Exposed initialization method for core process.
struct ast_category * ast_category_delete(struct ast_config *cfg, struct ast_category *category)
Delete a category.
int ast_unload_realtime(const char *family)
Release any resources cached for a realtime family.
struct ast_variable * realtime_var_get(const char *database, const char *table, const struct ast_variable *fields)
realtime_store * store_func
int ast_config_text_file_save2(const char *filename, const struct ast_config *cfg, const char *generator, uint32_t flags)
Save a config text file.
int ast_check_realtime(const char *family)
Check if realtime engine is configured for family.
struct ast_config * ast_config_load2(const char *filename, const char *who_asked, struct ast_flags flags)
Load a config file.
Structure for variables, used for configurations and for channel variables.
struct ast_comment * sameline
struct ast_config * ast_load_realtime_multientry_fields(const char *family, const struct ast_variable *fields)
Retrieve realtime configuration.
int ast_category_exist(const struct ast_config *config, const char *category_name, const char *filter)
Check for category duplicates.
int ast_config_engine_deregister(struct ast_config_engine *del)
Deregister config engine.
realtime_multi_get * realtime_multi_func
struct ast_category * ast_config_get_current_category(const struct ast_config *cfg)
Retrieve the current category name being built.
struct ast_category * prev
int ast_config_engine_register(struct ast_config_engine *newconfig)
Register config engine.
int(* config_hook_cb)(struct ast_config *cfg)
static int match(struct ast_sockaddr *addr, unsigned short callno, unsigned short dcallno, const struct chan_iax2_pvt *cur, int check_dcallno)
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
realtime_unload * unload_func
int realtime_update2(const char *database, const char *table, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields)
realtime_update * update_func
void ast_category_destroy(struct ast_category *cat)
realtime_var_get * realtime_func
const char * ast_variable_find_last_in_list(const struct ast_variable *list, const char *variable)
Gets the value of the LAST occurrence of a variable from a variable list.
char * exec_file
if it's an exec, you'll have both the /var/tmp to read, and the original script
int ast_update_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Update realtime configuration.
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)
int realtime_unload(const char *database, const char *table)
Function pointer called to clear the database cache and free resources used for such.
struct ast_category * ast_category_browse_filtered(struct ast_config *config, const char *category_name, struct ast_category *prev, const char *filter)
Browse categories with filters.
struct ast_str * ast_category_get_templates(const struct ast_category *category)
Return the template names this category inherits from.
Configuration engine structure, used to define realtime drivers.
int ast_category_inherit(struct ast_category *existing, const struct ast_category *base)
Applies base (template) to category.
struct ast_config_engine * next
const char * ast_variable_retrieve_filtered(struct ast_config *config, const char *category, const char *variable, const char *filter)
Gets a variable by context and variable names.
int realtime_destroy(const char *database, const char *table, const char *keyfield, const char *entity, const struct ast_variable *fields)
int ast_realtime_enabled(void)
Check if there's any realtime engines loaded.
int ast_update2_realtime(const char *family,...) attribute_sentinel
Update realtime configuration.
All configuration options for statsd client.
#define attribute_sentinel
struct ast_comment * trailing
void ast_config_hook_unregister(const char *name)
Unregister a config hook.
void ast_category_rename(struct ast_category *cat, const char *name)
struct ast_variable * ast_category_root(struct ast_config *config, char *cat)
returns the root ast_variable of a config
int ast_store_realtime(const char *family,...) attribute_sentinel
Create realtime configuration.
int ast_realtime_require_field(const char *family,...) attribute_sentinel
Inform realtime what fields that may be stored.
int ast_variable_list_replace(struct ast_variable **head, struct ast_variable *replacement)
Replace a variable in the given list with a new value.
int ast_config_hook_register(const char *name, const char *filename, const char *module, enum config_hook_flags flags, config_hook_cb hook)
Register a config hook for a particular file and module.
Inlinable API function macro.
int ast_store_realtime_fields(const char *family, const struct ast_variable *fields)
Create realtime configuration.
char * included_file
file name included
struct ast_variable * ast_category_first(struct ast_category *cat)
given a pointer to a category, return the root 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)
void ast_config_destroy(struct ast_config *config)
Destroys a config.
const char * ast_variable_find_in_list(const struct ast_variable *list, const char *variable)
Gets the value of a variable from a variable list by name.
realtime_require * require_func
char stuff[0]
Contents of file, name, and value in that order stuffed here.
struct ast_config * ast_config_new(void)
Create a new base configuration structure.
struct ast_variable * ast_variable_list_append_hint(struct ast_variable **head, struct ast_variable *search_hint, struct ast_variable *new_var)
Appends a variable list to the end of another list.
int ast_realtime_append_mapping(const char *name, const char *driver, const char *database, const char *table, int priority)
Add an explicit mapping for a family.
char * ast_realtime_encode_chunk(struct ast_str **dest, ssize_t maxlen, const char *chunk)
Encodes a chunk of data for realtime.
struct ast_config * ast_load_realtime_multientry(const char *family,...) attribute_sentinel
Retrieve realtime configuration.
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_config_set_current_category(struct ast_config *cfg, const struct ast_category *cat)
Set the category within the configuration as being current.
int ast_category_insert(struct ast_config *config, struct ast_category *cat, const char *match)
Inserts new category.
struct ast_comment * precomments
void ast_include_rename(struct ast_config *conf, const char *from_file, const char *to_file)
struct ast_config * ast_config_copy(const struct ast_config *orig)
Copies the contents of one ast_config into another.
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *result,...)
The argument parsing routine.
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.
const char * ast_variable_find(const struct ast_category *category, const char *variable)
Gets a variable value from a specific category structure by name.
struct ast_variable * ast_category_detach_variables(struct ast_category *cat)
int ast_realtime_is_mapping_defined(const char *family)
Determine if a mapping exists for a given family.
Structure used to handle boolean flags.
config_hook_flags
Flags that affect the behaviour of config hooks.
void ast_variable_append(struct ast_category *category, struct ast_variable *variable)
struct ast_variable * ast_load_realtime_all_fields(const char *family, const struct ast_variable *fields)
void ast_category_append(struct ast_config *config, struct ast_category *cat)
Appends a category to a config.
struct ast_config * realtime_multi_get(const char *database, const char *table, const struct ast_variable *fields)
struct ast_category * ast_category_new_template(const char *name, const char *in_file, int lineno)
Create a category making it a template.
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
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...
int ast_category_empty(struct ast_category *category)
Removes and destroys all variables in a category.
realtime_update2 * update2_func
int ast_variable_lists_match(const struct ast_variable *left, const struct ast_variable *right, int exact_match)
Tests 2 variable lists to see if they match.
void ast_config_sort_categories(struct ast_config *config, int descending, int(*comparator)(struct ast_category *p, struct ast_category *q))
Sorts categories in a config in the order of a numerical value contained within them.
int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Destroy realtime configuration.
struct ast_variable * ast_variable_browse_filtered(const struct ast_config *config, const char *category_name, const char *filter)
Browse variables.
struct ast_variable * ast_load_realtime_fields(const char *family, const struct ast_variable *fields)
Retrieve realtime configuration.
config_load_func * load_func
const struct ast_variable * ast_variable_find_variable_in_list(const struct ast_variable *list, const char *variable_name)
Gets a variable from a variable list by name.
const char * ast_config_option(struct ast_config *cfg, const char *cat, const char *var)
Retrieve a configuration variable within the configuration set.
int ast_variables_match(const struct ast_variable *left, const struct ast_variable *right)
Tests 2 variable values to see if they match.
struct ast_config_include * ast_include_find(struct ast_config *conf, const char *included_file)
ast_parse_flags
Support code to parse config file arguments.
int ast_update_realtime_fields(const char *family, const char *keyfield, const char *lookup, const struct ast_variable *fields)
Update realtime configuration.
static int filter(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
struct ast_category * ast_category_get(const struct ast_config *config, const char *category_name, const char *filter)
Retrieve a category if it exists.
int ast_rq_is_int(require_type type)
Check if require type is an integer type.
int ast_destroy_realtime_fields(const char *family, const char *keyfield, const char *lookup, const struct ast_variable *fields)
Destroy realtime configuration.
struct ast_variable * ast_variables_dup(struct ast_variable *var)
Duplicate variable list.
struct ast_variable * ast_load_realtime_all(const char *family,...) attribute_sentinel
int realtime_update(const char *database, const char *table, const char *keyfield, const char *entity, const struct ast_variable *fields)
const char * ast_category_get_name(const struct ast_category *category)
Return the name of the category.
int ast_update2_realtime_fields(const char *family, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields)
Update realtime configuration.
int realtime_store(const char *database, const char *table, const struct ast_variable *fields)
#define AST_INLINE_API(hdr, body)