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);
253 snprintf(field,
sizeof(field),
"%s LIKE",
UUID_FIELD);
254 if (
regex[0] ==
'^') {
275 snprintf(field,
sizeof(field),
"%s LIKE",
UUID_FIELD);
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")) {
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_calloc(num, len)
A wrapper for calloc()
#define ao2_link(container, obj)
Add an object to a container.
static const char config[]
static int regex(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
static char prefix[MAX_PREFIX]
char * strsep(char **str, const char *delims)
struct ast_variable * ast_category_detach_variables(struct ast_category *cat)
int ast_store_realtime_fields(const char *family, const struct ast_variable *fields)
Create 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 ast_variable_new(name, value, filename)
int ast_realtime_is_mapping_defined(const char *family)
Determine if a mapping exists for a given family.
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
struct ast_variable * ast_load_realtime_fields(const char *family, const struct ast_variable *fields)
Retrieve realtime configuration.
int ast_update_realtime_fields(const char *family, const char *keyfield, const char *lookup, const struct ast_variable *fields)
Update realtime configuration.
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.
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.
#define ast_debug(level,...)
Log a DEBUG message.
Asterisk module definitions.
@ AST_MODFLAG_GLOBAL_SYMBOLS
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_REALTIME_DRIVER
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
static struct ast_sorcery * sorcery
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 int sorcery_realtime_create(const struct ast_sorcery *sorcery, void *data, void *object)
static struct ast_sorcery_wizard realtime_object_wizard
static void * sorcery_realtime_retrieve_fields(const struct ast_sorcery *sorcery, void *data, const char *type, const struct ast_variable *fields)
static int sorcery_realtime_delete(const struct ast_sorcery *sorcery, void *data, void *object)
static void * sorcery_realtime_open(const char *data)
static int sorcery_realtime_update(const struct ast_sorcery *sorcery, void *data, void *object)
static void * sorcery_realtime_retrieve_id(const struct ast_sorcery *sorcery, void *data, const char *type, const char *id)
static void sorcery_realtime_retrieve_regex(const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const char *regex)
static void sorcery_realtime_close(void *data)
static int load_module(void)
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)
static int unload_module(void)
@ UNQUALIFIED_FETCH_ERROR
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 UUID_FIELD
They key field used to store the unique identifier for the object.
Sorcery Data Access Layer API.
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
int ast_sorcery_wizard_unregister(const struct ast_sorcery_wizard *interface)
Unregister a sorcery wizard.
#define ast_sorcery_objectset_create(sorcery, object)
Create an object set (KVP list) for an object.
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.
#define ast_sorcery_wizard_register(interface)
See __ast_sorcery_wizard_register()
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.
void * ast_sorcery_alloc(const struct ast_sorcery *sorcery, const char *type, const char *id)
Allocate an object.
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 force_inline int attribute_pure ast_strlen_zero(const char *s)
Structure for registered object type.
char name[MAX_OBJECT_TYPE]
Unique name of the object type.
Interface for a sorcery wizard.
const char * name
Name of the wizard.
Full structure for sorcery.
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
Structure for storing configuration file sourced objects.
enum unqualified_fetch fetch
struct ao2_global_obj objects
Objects retrieved from the configuration file.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.