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);
833#define ast_category_new_dynamic(name) ast_category_new(name, "", -1)
838#define ast_category_new_anonymous() ast_category_new_dynamic("")
915#define ast_variable_new(name, value, filename) _ast_variable_new(name, value, filename, __FILE__, __PRETTY_FUNCTION__, __LINE__)
950#define ast_variable_list_append(head, new_var) ast_variable_list_append_hint(head, NULL, new_var)
1007 const char *name_value_separator,
const char *quote_char,
struct ast_str **
str);
1024 const char *name_value_separator);
1044 const char *name_value_separator,
const char *quote_str);
1058 const char *
value,
const char *
match,
unsigned int object);
1132 const char *filename,
1169 PARSE_INT16 = 0x0004,
1170 PARSE_UINT16 = 0x0005,
1256 void *p_result, ...);
1278#define CV_START(__in_var, __in_val) \
1280 const char *__var = __in_var; \
1281 const char *__val = __in_val;
1284#define CV_END } while (0)
1287#define CV_F(__pattern, __body) if (!strcasecmp((__var), __pattern)) { __body; break; }
1293#define CV_BOOL(__x, __dst) CV_F(__x, (__dst) = ast_true(__val) )
1294#define CV_UINT(__x, __dst) CV_F(__x, (__dst) = strtoul(__val, NULL, 0) )
1295#define CV_STR(__x, __dst) CV_F(__x, ast_copy_string(__dst, __val, sizeof(__dst)))
1296#define CV_DSTR(__x, __dst) CV_F(__x, ast_free(__dst); __dst = ast_strdup(__val))
1297#define CV_STRFIELD(__x, __obj, __field) CV_F(__x, ast_string_field_set(__obj, __field, __val))
1402#if defined(__cplusplus) || defined(c_plusplus)
static int input(yyscan_t yyscanner)
static int match(struct ast_sockaddr *addr, unsigned short callno, unsigned short dcallno, const struct chan_iax2_pvt *cur, int check_dcallno)
static const char config[]
#define attribute_sentinel
static int filter(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
void ast_include_rename(struct ast_config *conf, const char *from_file, const char *to_file)
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_category_inherit(struct ast_category *existing, const struct ast_category *base)
Applies base (template) to category.
struct ast_variable * ast_variable_list_from_quoted_string(const char *input, const char *item_separator, const char *name_value_separator, const char *quote_str)
Parse a string into an ast_variable list. The reverse of ast_variable_list_join.
const char * ast_category_get_name(const struct ast_category *category)
Return the name of the category.
struct ast_category * ast_category_new_template(const char *name, const char *in_file, int lineno)
Create a category making it a template.
struct ast_variable * ast_category_detach_variables(struct ast_category *cat)
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.
struct ast_config * ast_config_load2(const char *filename, const char *who_asked, struct ast_flags flags)
Load a config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
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_category * ast_category_delete(struct ast_config *cfg, struct ast_category *cat)
Delete a category.
int ast_store_realtime_fields(const char *family, const struct ast_variable *fields)
Create realtime configuration.
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 realtime_unload(const char *database, const char *table)
Function pointer called to clear the database cache and free resources used for such.
struct ast_variable * ast_load_realtime_all(const char *family,...) attribute_sentinel
void ast_category_rename(struct ast_category *cat, const char *name)
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_update2_realtime(const char *family,...) attribute_sentinel
Update realtime configuration.
int ast_destroy_realtime_fields(const char *family, const char *keyfield, const char *lookup, const struct ast_variable *fields)
Destroy realtime configuration.
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.
int ast_variable_delete(struct ast_category *category, const char *variable, const char *match, const char *line)
struct ast_config * ast_config_new(void)
Create a new base configuration structure.
void ast_config_hook_unregister(const char *name)
Unregister a config hook.
int ast_category_insert(struct ast_config *config, struct ast_category *cat, const char *match)
Inserts new category.
int ast_realtime_require_field(const char *family,...) attribute_sentinel
Inform realtime what fields that may be stored.
struct ast_config * ast_load_realtime_multientry(const char *family,...) attribute_sentinel
Retrieve realtime configuration.
char * ast_realtime_encode_chunk(struct ast_str **dest, ssize_t maxlen, const char *chunk)
Encodes a chunk of data for realtime.
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.
struct ast_variable * ast_variable_list_from_string(const char *input, const char *item_separator, const char *name_value_separator)
Parse a string into an ast_variable list. The reverse of ast_variable_list_join.
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_category_append(struct ast_config *config, struct ast_category *category)
Appends a category to a config.
void ast_variable_append(struct ast_category *category, struct ast_variable *variable)
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_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_variables_reverse(struct ast_variable *var)
Reverse a variable list.
int ast_realtime_enabled(void)
Check if there's any realtime engines loaded.
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.
struct ast_category * ast_category_new(const char *name, const char *in_file, int lineno)
Create 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)
struct ast_str * ast_category_get_templates(const struct ast_category *category)
Return the template names this category inherits from.
int ast_config_engine_deregister(struct ast_config_engine *del)
Deregister config engine.
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_variable_list_replace_variable(struct ast_variable **head, struct ast_variable *oldvar, struct ast_variable *newvar)
Replace a variable in the given list with a new variable.
struct ast_variable * ast_variable_browse_filtered(const struct ast_config *config, const char *category_name, const char *filter)
Browse variables.
int ast_realtime_is_mapping_defined(const char *family)
Determine if a mapping exists for a given family.
struct ast_category * ast_config_get_current_category(const struct ast_config *cfg)
Retrieve the current category name being built.
struct ast_config * realtime_multi_get(const char *database, const char *table, const struct ast_variable *fields)
char * ast_realtime_decode_chunk(char *chunk)
Remove standard encoding from realtime values, which ensures that a semicolon embedded within a singl...
@ CONFIG_SAVE_FLAG_PRESERVE_EFFECTIVE_CONTEXT
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *p_result,...)
The argument parsing routine.
int ast_check_realtime(const char *family)
Check if realtime engine is configured for family.
struct ast_variable * ast_load_realtime_all_fields(const char *family, const struct ast_variable *fields)
struct ast_variable * ast_variables_dup(struct ast_variable *var)
Duplicate variable list.
struct ast_variable * ast_category_root(struct ast_config *config, char *cat)
returns the root ast_variable of a config
int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Destroy realtime configuration.
void ast_category_destroy(struct ast_category *cat)
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
int ast_category_empty(struct ast_category *category)
Removes and destroys all variables in a category.
int ast_category_is_template(const struct ast_category *category)
Check if category is a template.
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.
struct ast_str * ast_variable_list_join(const struct ast_variable *head, const char *item_separator, const char *name_value_separator, const char *quote_char, struct ast_str **str)
Join an ast_variable list with specified separators and quoted values.
struct ast_config_include * ast_include_find(struct ast_config *conf, const char *included_file)
struct ast_variable * ast_load_realtime_fields(const char *family, const struct ast_variable *fields)
Retrieve realtime configuration.
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_rq_is_int(require_type type)
Check if require type is an integer type.
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
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 ast_update_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Update realtime configuration.
int ast_update_realtime_fields(const char *family, const char *keyfield, const char *lookup, const struct ast_variable *fields)
Update realtime configuration.
require_type
Types used in ast_realtime_require_field.
int ast_store_realtime(const char *family,...) attribute_sentinel
Create realtime configuration.
struct ast_variable * ast_category_first(struct ast_category *cat)
given a pointer to a category, return the root variable.
const char * ast_config_option(struct ast_config *cfg, const char *cat, const char *var)
Retrieve a configuration variable within the configuration set.
int realtime_update(const char *database, const char *table, const char *keyfield, const char *entity, const struct ast_variable *fields)
int realtime_update2(const char *database, const char *table, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields)
int ast_category_exist(const struct ast_config *config, const char *category_name, const char *filter)
Check for category duplicates.
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)
struct ast_variable * ast_load_realtime(const char *family,...) attribute_sentinel
void ast_variable_insert(struct ast_category *category, struct ast_variable *variable, const char *line)
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.
ast_parse_flags
Support code to parse config file arguments.
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.
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
struct ast_config * ast_load_realtime_multientry_fields(const char *family, const struct ast_variable *fields)
Retrieve realtime configuration.
int(* config_hook_cb)(struct ast_config *cfg)
Callback when configuration is updated.
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.
int realtime_destroy(const char *database, const char *table, const char *keyfield, const char *entity, const struct ast_variable *fields)
int ast_update2_realtime_fields(const char *family, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields)
Update realtime configuration.
config_hook_flags
Flags that affect the behaviour of config hooks.
struct ast_config * ast_config_copy(const struct ast_config *orig)
Copies the contents of one ast_config into another.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
int ast_config_engine_register(struct ast_config_engine *newconfig)
Register config engine.
int realtime_store(const char *database, const char *table, const struct ast_variable *fields)
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_category * ast_category_get(const struct ast_config *config, const char *category_name, const char *filter)
Retrieve a category if it exists.
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)
@ CONFIG_FLAG_WITHCOMMENTS
@ CONFIG_FLAG_FILEUNCHANGED
int register_config_cli(void)
Exposed initialization method for core process.
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.
Inlinable API function macro.
#define AST_INLINE_API(hdr, body)
static int ast_realtime_append_mapping(const char *name, const char *driver, const char *database, const char *table, int priority)
struct ast_category * prev
Configuration engine structure, used to define realtime drivers.
realtime_var_get * realtime_func
struct ast_config_engine * next
realtime_destroy * destroy_func
realtime_unload * unload_func
realtime_store * store_func
realtime_multi_get * realtime_multi_func
config_load_func * load_func
realtime_update * update_func
realtime_update2 * update2_func
realtime_require * require_func
char * exec_file
if it's an exec, you'll have both the /var/tmp to read, and the original script
char * included_file
file name included
Structure used to handle boolean flags.
Support for dynamic strings.
Structure for variables, used for configurations and for channel variables.
char stuff[0]
Contents of file, name, and value in that order stuffed here.
struct ast_comment * precomments
struct ast_comment * trailing
struct ast_comment * sameline
struct ast_variable * next
All configuration options for http media cache.