24 #ifndef _ASTERISK_CONFIG_OPTIONS_H 25 #define _ASTERISK_CONFIG_OPTIONS_H 27 #if defined(__cplusplus) || defined(c_plusplus) 76 typedef void *(*aco_type_item_alloc)(
const char *category);
84 typedef void *(*aco_type_item_find)(
struct ao2_container *newcontainer,
const char *category);
158 typedef void *(*aco_snapshot_alloc)(void);
181 #define ACO_TYPES(...) { __VA_ARGS__, NULL, } 182 #define ACO_FILES(...) { __VA_ARGS__, NULL, } 213 #define CONFIG_INFO_STANDARD(name, arr, alloc, ...) \ 214 static struct aco_info name = { \ 215 .module = AST_MODULE, \ 216 .global_obj = &arr, \ 217 .snapshot_alloc = alloc, \ 221 #define CONFIG_INFO_CORE(mod, name, arr, alloc, ...) \ 222 static struct aco_info name = { \ 224 .global_obj = &arr, \ 225 .snapshot_alloc = alloc, \ 229 #define CONFIG_INFO_TEST(name, arr, alloc, ...) \ 230 static struct aco_info name = { \ 231 .module = AST_MODULE, \ 232 .global_obj = &arr, \ 233 .snapshot_alloc = alloc, \ 623 #define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags, ...) \ 624 __aco_option_register(info, name, matchtype, types, default_val, opt_type, NULL, flags, 0, VA_NARGS(__VA_ARGS__), __VA_ARGS__); 638 #define aco_option_register_custom(info, name, matchtype, types, default_val, handler, flags) \ 639 __aco_option_register(info, name, matchtype, types, default_val, OPT_CUSTOM_T, handler, flags, 0, 0); 656 #define aco_option_register_custom_nodoc(info, name, matchtype, types, default_val, handler, flags) \ 657 __aco_option_register(info, name, matchtype, types, default_val, OPT_CUSTOM_T, handler, flags, 1, 0); 738 #define ARGMAP(func, func_arg, x, ...) ARGMAP_(VA_NARGS(x, ##__VA_ARGS__), func, func_arg, x, __VA_ARGS__) 744 #define ARGMAP_(N, func, func_arg, x, ...) PASTE(ARGMAP_, N)(func, func_arg, N, x, __VA_ARGS__) 750 #define PASTE(arg1, arg2) PASTE1(arg1, arg2) 751 #define PASTE1(arg1, arg2) arg1##arg2 754 #define ARGIFY(...) __VA_ARGS__ 763 #define ARGMAP_1(func, func_arg, in, x, ...) ARGIFY(in, func(func_arg, x)) 764 #define ARGMAP_2(func, func_arg, in, x, ...)\ 765 ARGMAP_1(func, func_arg, ARGIFY(in, func(func_arg, x)), __VA_ARGS__) 766 #define ARGMAP_3(func, func_arg, in, x, ...)\ 767 ARGMAP_2(func, func_arg, ARGIFY(in, func(func_arg, x)), __VA_ARGS__) 768 #define ARGMAP_4(func, func_arg, in, x, ...)\ 769 ARGMAP_3(func, func_arg, ARGIFY(in, func(func_arg, x)), __VA_ARGS__) 770 #define ARGMAP_5(func, func_arg, in, x, ...)\ 771 ARGMAP_4(func, func_arg, ARGIFY(in, func(func_arg, x)), __VA_ARGS__) 772 #define ARGMAP_6(func, func_arg, in, x, ...)\ 773 ARGMAP_5(func, func_arg, ARGIFY(in, func(func_arg, x)), __VA_ARGS__) 774 #define ARGMAP_7(func, func_arg, in, x, ...)\ 775 ARGMAP_6(func, func_arg, ARGIFY(in, func(func_arg, x)), __VA_ARGS__) 776 #define ARGMAP_8(func, func_arg, in, x, ...)\ 777 ARGMAP_7(func, func_arg, ARGIFY(in, func(func_arg, x)), __VA_ARGS__) 797 #define VA_NARGS(...) VA_NARGS1(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0) 798 #define VA_NARGS1(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N 816 #define FLDSET(type, ...) FLDSET1(type, ##__VA_ARGS__) 817 #define FLDSET1(type, ...) POPPED(ARGMAP(offsetof, type, ##__VA_ARGS__)) 827 #define STRFLDSET(type, ...) FLDSET(type, __VA_ARGS__, __field_mgr_pool, __field_mgr) 835 #define CHARFLDSET(type, field) ARGIFY(offsetof(type, field), sizeof(((type *)0)->field)) 848 #define POPPED(...) POPPED1(__VA_ARGS__) 849 #define POPPED1(x, ...) __VA_ARGS__ 851 #if defined(__cplusplus) || defined(c_plusplus) aco_type_item_pre_process item_pre_process
Type for default handler for ast_sockaddrs.
Type for default option handler for format capabilities.
int(* aco_option_handler)(const struct aco_option *opt, struct ast_variable *var, void *obj)
A callback function for handling a particular option.
aco_pre_apply_config pre_apply_config
aco_type_item_find item_find
struct ao2_global_obj * global_obj
void(* aco_post_apply_config)(void)
A callback function called only if config changes have been applied.
int(* aco_pre_apply_config)(void)
A callback function to run just prior to applying config changes.
unsigned int aco_option_get_flags(const struct aco_option *option)
Read the flags of a config option - useful when using a custom callback for a config option...
void *(* aco_snapshot_alloc)(void)
A callback function for allocating an object to hold all config objects.
struct ao2_container * aco_option_container_alloc(void)
Allocate a container to hold config options.
Structure for variables, used for configurations and for channel variables.
aco_type_prelink item_prelink
Type for a default handler that should do nothing.
enum aco_process_status aco_process_config(struct aco_info *info, int reload)
Process a config info via the options registered with an aco_info.
Type for default option handler for bools (ast_true/ast_false) that are stored in a flag...
The representation of a single configuration file to be processed.
Bits of aco_info that shouldn't be assigned outside this file.
aco_matchtype
What kind of matching should be done on an option name.
Type for a custom (user-defined) option handler.
Type for default option handler for character array strings.
Type for default option handler for bools (ast_true/ast_false)
Configuration File Parser.
int aco_info_init(struct aco_info *info)
Initialize an aco_info structure.
void *(* aco_type_item_alloc)(const char *category)
Allocate a configurable ao2 object.
void * aco_pending_config(struct aco_info *info)
Get pending config changes.
Type for default option handler for unsigned integers.
int(* aco_matchvalue_func)(const char *text)
A function for determining whether the value for the matchfield in an aco_type is sufficient for a ma...
aco_process_status
Return values for the aco_process functions.
int __aco_option_register(struct aco_info *info, const char *name, enum aco_matchtype match_type, struct aco_type **types, const char *default_val, enum aco_option_type type, aco_option_handler handler, unsigned int flags, unsigned int no_doc, size_t argc,...)
register a config option
aco_type_item_alloc item_alloc
int aco_option_register_deprecated(struct aco_info *info, const char *name, struct aco_type **types, const char *aliased_to)
Register a deprecated (and aliased) config option.
enum aco_category_op category_match
aco_option_type
The option types.
The config had not been edited and no changes applied.
Their was an error and no changes were applied.
aco_post_apply_config post_apply_config
void aco_info_destroy(struct aco_info *info)
Destroy an initialized aco_info struct.
Type for default option handler for bools (ast_true/ast_false)
int aco_process_category_options(struct aco_type *type, struct ast_config *cfg, const char *cat, void *obj)
Parse each option defined in a config category.
Type for default option handler for ACLs.
enum aco_process_status aco_process_ast_config(struct aco_info *info, struct aco_file *file, struct ast_config *cfg)
Process config info from an ast_config via options registered with an aco_info.
Type for default option handler for doubles.
int aco_set_defaults(struct aco_type *type, const char *category, void *obj)
Set all default options of obj.
The config was processed and applied.
const char * skip_category
int(* aco_type_item_pre_process)(void *newitem)
Callback function that is called after a config object is initialized with defaults.
Type for default option handler for time length signed integers.
Type information about a category-level configurable object.
aco_snapshot_alloc snapshot_alloc
static void handler(const char *name, int response_code, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
intptr_t aco_option_get_argument(const struct aco_option *option, unsigned int position)
Get the offset position for an argument within a config option.
Type for default option handler for stringfields.
Type for default option handler for signed integers.
int aco_process_var(struct aco_type *type, const char *cat, struct ast_variable *var, void *obj)
Parse a single ast_variable and apply it to an object.
aco_matchvalue_func matchfunc
void *(* aco_type_item_find)(struct ao2_container *newcontainer, const char *category)
Find a item given a category and container of items.
int(* aco_type_prelink)(void *newitem)
Callback function that is called after config processing, but before linking.