19#ifndef GEOLOC_PRIVATE_H_
20#define GEOLOC_PRIVATE_H_
28#define CONFIG_STR_TO_ENUM(_stem) \
29int ast_geoloc_ ## _stem ## _str_to_enum(const char *str) \
32 for (i = 0; i < ARRAY_LEN(_stem ## _names); i++) { \
33 if (ast_strings_equal(str, _stem ## _names[i])) { \
40#define CONFIG_ENUM_HANDLER(_object, _stem) \
41static int _object ## _ ## _stem ## _handler(const struct aco_option *opt, struct ast_variable *var, void *obj) \
43 struct ast_geoloc_ ## _object *_thisobject = obj; \
44 int enumval = ast_geoloc_ ## _stem ## _str_to_enum(var->value); \
45 if (enumval == -1) { \
48 _thisobject->_stem = enumval; \
53#define GEOLOC_ENUM_TO_NAME(_stem) \
54const char * ast_geoloc_ ## _stem ## _to_name(int ix) \
56 if (!ARRAY_IN_BOUNDS(ix, _stem ## _names)) { \
59 return _stem ## _names[ix]; \
63#define CONFIG_ENUM_TO_STR(_object, _stem) \
64static int _object ## _ ## _stem ## _to_str(const void *obj, const intptr_t *args, char **buf) \
66 const struct ast_geoloc_ ## _object *_thisobject = obj; \
67 if (!ARRAY_IN_BOUNDS(_thisobject->_stem, _stem ## _names)) { \
68 *buf = ast_strdup("none"); \
70 *buf = ast_strdup(_stem ## _names[_thisobject->_stem]); \
75#define CONFIG_ENUM(_object, _stem) \
76CONFIG_STR_TO_ENUM(_stem) \
77GEOLOC_ENUM_TO_NAME(_stem) \
78CONFIG_ENUM_HANDLER(_object, _stem) \
79CONFIG_ENUM_TO_STR(_object, _stem)
81#define CONFIG_VAR_LIST_HANDLER(_object, _stem) \
82static int _object ## _ ## _stem ## _handler(const struct aco_option *opt, struct ast_variable *var, void *obj) \
84 struct ast_geoloc_ ## _object *_thisobject = obj; \
85 struct ast_variable *new_var; \
86 char *item_string, *item, *item_name, *item_value; \
88 if (ast_strlen_zero(var->value)) { return 0; } \
89 item_string = ast_strdupa(var->value); \
90 while ((item = ast_strsep(&item_string, ',', AST_STRSEP_ALL))) { \
91 item_name = ast_strsep(&item, '=', AST_STRSEP_ALL); \
92 item_value = ast_strsep(&item, '=', AST_STRSEP_ALL); \
93 new_var = ast_variable_new(item_name, S_OR(item_value, ""), ""); \
98 ast_variable_list_append(&_thisobject->_stem, new_var); \
103#define CONFIG_VAR_LIST_DUP(_object, _stem) \
104static int _object ## _ ## _stem ## _dup(const void *obj, struct ast_variable **fields) \
106 const struct ast_geoloc_ ## _object *_thisobject = obj; \
107 if (_thisobject->_stem) { \
108 *fields = ast_variables_dup(_thisobject->_stem); \
113#define CONFIG_VAR_LIST_TO_STR(_object, _stem) \
114static int _object ## _ ## _stem ## _to_str(const void *obj, const intptr_t *args, char **buf) \
116 const struct ast_geoloc_ ## _object *_thisobject = obj; \
117 struct ast_str *str = ast_variable_list_join(_thisobject->_stem, ",", "=", "\"", NULL); \
118 *buf = ast_strdup(ast_str_buffer(str)); \
123#define CONFIG_VAR_LIST(_object, _stem) \
124CONFIG_VAR_LIST_HANDLER(_object, _stem) \
125CONFIG_VAR_LIST_DUP(_object, _stem) \
126CONFIG_VAR_LIST_TO_STR(_object, _stem)
133 const char *ref_string);
139 const char *ref_string);
int geoloc_channel_reload(void)
struct ast_variable * geoloc_eprofile_resolve_varlist(struct ast_variable *source, struct ast_variable *variables, struct ast_channel *chan)
int geoloc_eprofile_reload(void)
struct ast_xml_node * geoloc_civicaddr_list_to_xml(const struct ast_variable *resolved_location, const char *ref_string)
int geoloc_eprofile_unload(void)
int geoloc_dialplan_reload(void)
int geoloc_dialplan_unload(void)
int geoloc_config_reload(void)
int geoloc_channel_load(void)
int geoloc_config_unload(void)
int geoloc_dialplan_load(void)
int geoloc_config_load(void)
int geoloc_civicaddr_reload(void)
int geoloc_eprofile_load(void)
int geoloc_gml_reload(void)
int geoloc_civicaddr_load(void)
struct ast_sorcery * geoloc_get_sorcery(void)
int geoloc_channel_unload(void)
int geoloc_gml_unload(void)
struct ast_xml_node * geoloc_gml_list_to_xml(const struct ast_variable *resolved_location, const char *ref_string)
int geoloc_gml_load(void)
int geoloc_civicaddr_unload(void)
Configuration File Parser.
Asterisk locking-related definitions:
Asterisk module definitions.
Sorcery Data Access Layer API.
Main Channel structure associated with a channel.
Full structure for sorcery.
Structure for variables, used for configurations and for channel variables.