39 #define UUID_FIELD "id" 124 int remove_field = 0;
125 int delete_field = 0;
130 }
else if (object_type &&
132 ast_debug(1,
"Filtering out realtime field '%s' from retrieval\n", field->name);
143 objectset = field->
next;
215 snprintf(field,
sizeof(field),
"%s LIKE",
UUID_FIELD);
216 snprintf(value,
sizeof(value),
"%%");
253 snprintf(field,
sizeof(field),
"%s LIKE",
UUID_FIELD);
254 if (regex[0] ==
'^') {
255 snprintf(value,
sizeof(value),
"%s%%", regex + 1);
257 snprintf(value,
sizeof(value),
"%%%s%%", regex);
275 snprintf(field,
sizeof(field),
"%s LIKE",
UUID_FIELD);
276 snprintf(value,
sizeof(value),
"%.*s%%", (
int) prefix_len, prefix);
317 family =
strsep(&tmp,
",");
323 config =
ast_calloc(1,
sizeof(*config) + strlen(family) + 1);
328 strcpy(config->
family, family);
331 while ((option =
strsep(&tmp,
","))) {
333 char *
value = option;
335 if (!strcasecmp(name,
"allow_unqualified_fetch")) {
338 }
else if (!strcasecmp(value,
"no")) {
340 }
else if (!strcasecmp(value,
"warn")) {
342 }
else if (!strcasecmp(value,
"error")) {
345 ast_log(
LOG_ERROR,
"Unrecognized value in %s:%s: '%s'\n", family, name, value);
static int unload_module(void)
struct ast_variable * next
static void sorcery_realtime_close(void *data)
Asterisk main include file. File version handling, generic pbx functions.
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
static struct ast_sorcery_wizard realtime_object_wizard
static int sorcery_realtime_delete(const struct ast_sorcery *sorcery, void *data, void *object)
static void sorcery_realtime_retrieve_regex(const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const char *regex)
Structure for variables, used for configurations and for channel variables.
struct ast_config * ast_load_realtime_multientry_fields(const char *family, const struct ast_variable *fields)
Retrieve realtime configuration.
static void * sorcery_realtime_retrieve_fields(const struct ast_sorcery *sorcery, void *data, const char *type, const struct ast_variable *fields)
Full structure for sorcery.
enum unqualified_fetch fetch
int ast_sorcery_objectset_apply(const struct ast_sorcery *sorcery, void *object, struct ast_variable *objectset)
Apply an object set (KVP list) to an object.
static struct ast_variable * sorcery_realtime_filter_objectset(struct ast_variable *objectset, struct ast_variable **id, const struct ast_sorcery *sorcery, const char *type)
Internal helper function which returns a filtered objectset.
static void * sorcery_realtime_retrieve_id(const struct ast_sorcery *sorcery, void *data, const char *type, const char *id)
const char * name
Name of the wizard.
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.
static void sorcery_realtime_retrieve_multiple(const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const struct ast_variable *fields)
#define ast_strlen_zero(foo)
#define ast_debug(level,...)
Log a DEBUG message.
static void sorcery_realtime_retrieve_prefix(const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const char *prefix, const size_t prefix_len)
Structure for registered object type.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
int ast_store_realtime_fields(const char *family, const struct ast_variable *fields)
Create realtime configuration.
void ast_config_destroy(struct ast_config *config)
Destroys a config.
#define ast_strdupa(s)
duplicate a string in memory from the stack
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
static int sorcery_realtime_update(const struct ast_sorcery *sorcery, void *data, void *object)
#define ast_variable_new(name, value, filename)
struct ao2_global_obj objects
Objects retrieved from the configuration file.
struct ast_sorcery_object_type * ast_sorcery_get_object_type(const struct ast_sorcery *sorcery, const char *type)
Get the sorcery object type given a type name.
static int sorcery_realtime_create(const struct ast_sorcery *sorcery, void *data, void *object)
Structure for storing configuration file sourced objects.
#define ast_sorcery_wizard_register(interface)
See __ast_sorcery_wizard_register()
static void * sorcery_realtime_open(const char *data)
int ast_sorcery_wizard_unregister(const struct ast_sorcery_wizard *interface)
Unregister a sorcery wizard.
static int load_module(void)
void * ast_sorcery_alloc(const struct ast_sorcery *sorcery, const char *type, const char *id)
Allocate an object.
#define ast_sorcery_objectset_create(sorcery, object)
Create an object set (KVP list) for an object.
int ast_sorcery_is_object_field_registered(const struct ast_sorcery_object_type *object_type, const char *field_name)
Determine if a particular object field has been registered with sorcery.
#define ast_calloc(num, len)
A wrapper for calloc()
static int regex(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
struct ast_variable * ast_category_detach_variables(struct ast_category *cat)
Module has failed to load, may be in an inconsistent state.
int ast_realtime_is_mapping_defined(const char *family)
Determine if a mapping exists for a given family.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
Interface for a sorcery wizard.
char * strsep(char **str, const char *delims)
static struct ast_sorcery * sorcery
struct ast_variable * ast_load_realtime_fields(const char *family, const struct ast_variable *fields)
Retrieve realtime configuration.
#define UUID_FIELD
They key field used to store the unique identifier for the object.
int ast_update_realtime_fields(const char *family, const char *keyfield, const char *lookup, const struct ast_variable *fields)
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.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
char name[MAX_OBJECT_TYPE]
Unique name of the object type.
Sorcery Data Access Layer API.
static char prefix[MAX_PREFIX]
#define ao2_link(container, obj)