Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Sorcery Data Access Layer API. More...
#include "asterisk.h"
#include "asterisk/logger.h"
#include "asterisk/sorcery.h"
#include "asterisk/astobj2.h"
#include "asterisk/format.h"
#include "asterisk/format_cap.h"
#include "asterisk/strings.h"
#include "asterisk/config_options.h"
#include "asterisk/netsock2.h"
#include "asterisk/module.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/threadpool.h"
#include "asterisk/json.h"
#include "asterisk/vector.h"
Go to the source code of this file.
Data Structures | |
struct | ast_sorcery |
Full structure for sorcery. More... | |
struct | ast_sorcery_internal_wizard |
Structure for an internal wizard instance. More... | |
struct | ast_sorcery_object |
Structure for internal sorcery object information. More... | |
struct | ast_sorcery_object_field |
Structure for registered object field. More... | |
struct | ast_sorcery_object_type |
Structure for registered object type. More... | |
struct | ast_sorcery_object_type_observer |
Structure for registered object type observer. More... | |
struct | ast_sorcery_object_wizard |
Structure for a wizard instance which operates on objects. More... | |
struct | sorcery_details |
Structure used when calling create, update, or delete. More... | |
struct | sorcery_global_observer |
A global observer wrapper. More... | |
struct | sorcery_instance_observer |
An instance observer wrapper. More... | |
struct | sorcery_load_details |
Structure for passing load/reload details. More... | |
struct | sorcery_observer_invocation |
Structure used for observer invocations. More... | |
struct | sorcery_proxy |
Proxy object for sorcery. More... | |
struct | sorcery_wizard_observer |
A wizard observer wrapper. More... | |
Macros | |
#define | INITIAL_WIZARD_VECTOR_SIZE 5 |
#define | INSTANCE_BUCKETS 17 |
Number of buckets for instances (should be prime for performance reasons) More... | |
#define | MAX_REGEX_ERROR_LEN 128 |
#define | NOTIFY_GENERIC_OBSERVERS(container, type, callback, ...) |
#define | NOTIFY_GLOBAL_OBSERVERS(container, callback, ...) NOTIFY_GENERIC_OBSERVERS(container, sorcery_global_observer, callback, __VA_ARGS__) |
#define | NOTIFY_INSTANCE_OBSERVERS(container, callback, ...) NOTIFY_GENERIC_OBSERVERS(container, sorcery_instance_observer, callback, __VA_ARGS__) |
#define | NOTIFY_WIZARD_OBSERVERS(container, callback, ...) NOTIFY_GENERIC_OBSERVERS(container, sorcery_wizard_observer, callback, __VA_ARGS__) |
#define | OBJECT_FIELD_BUCKETS 29 |
Number of buckets for object fields (should be prime for performance reasons) More... | |
#define | TYPE_BUCKETS 53 |
Number of buckets for types (should be prime for performance reasons) More... | |
#define | WIZARD_BUCKETS 7 |
Number of buckets for wizards (should be prime for performance reasons) More... | |
#define | WIZARD_COMPARE(a, b) ((a)->wizard == (b)) |
#define | WIZARD_NAME_COMPARE(a, b) (strcmp((a)->wizard->callbacks.name, (b)) == 0) |
Functions | |
enum ast_sorcery_apply_result | __ast_sorcery_apply_config (struct ast_sorcery *sorcery, const char *name, const char *module) |
Apply configured wizard mappings. More... | |
enum ast_sorcery_apply_result | __ast_sorcery_apply_default (struct ast_sorcery *sorcery, const char *type, const char *module, const char *name, const char *data) |
Apply default object wizard mappings. More... | |
enum ast_sorcery_apply_result | __ast_sorcery_apply_wizard_mapping (struct ast_sorcery *sorcery, const char *type, const char *module, const char *name, const char *data, unsigned int caching) |
Internal function which creates an object type and adds a wizard mapping. More... | |
enum ast_sorcery_apply_result | __ast_sorcery_insert_wizard_mapping (struct ast_sorcery *sorcery, const char *type, const char *module, const char *name, const char *data, unsigned int caching, int position) |
Internal function which creates an object type and inserts a wizard mapping. More... | |
int | __ast_sorcery_object_field_register (struct ast_sorcery *sorcery, const char *type, const char *name, const char *default_val, enum aco_option_type opt_type, aco_option_handler config_handler, sorcery_field_handler sorcery_handler, sorcery_fields_handler multiple_handler, unsigned int flags, unsigned int no_doc, unsigned int alias, size_t argc,...) |
Register a field within an object. More... | |
int | __ast_sorcery_object_register (struct ast_sorcery *sorcery, const char *type, unsigned int hidden, unsigned int reloadable, aco_type_item_alloc alloc, sorcery_transform_handler transform, sorcery_apply_handler apply) |
Register an object type. More... | |
enum ast_sorcery_apply_result | __ast_sorcery_object_type_insert_wizard (struct ast_sorcery *sorcery, const char *object_type_name, const char *module, const char *wizard_type_name, const char *wizard_args, enum ast_sorcery_wizard_apply_flags flags, int position, struct ast_sorcery_wizard **wizard, void **wizard_data) |
Insert an additional object wizard mapping at a specific position in the wizard list returning wizard information. More... | |
int | __ast_sorcery_object_type_remove_wizard (struct ast_sorcery *sorcery, const char *object_type_name, const char *module, const char *wizard_type_name, const char *wizard_args) |
Remove an object wizard mapping. More... | |
struct ast_sorcery * | __ast_sorcery_open (const char *module_name, const char *file, int line, const char *func) |
int | __ast_sorcery_remove_wizard_mapping (struct ast_sorcery *sorcery, const char *type, const char *module, const char *name) |
Internal function removes a wizard mapping. More... | |
int | __ast_sorcery_wizard_register (const struct ast_sorcery_wizard *interface, struct ast_module *module) |
Register a sorcery wizard. More... | |
void * | ast_sorcery_alloc (const struct ast_sorcery *sorcery, const char *type, const char *id) |
Allocate an object. More... | |
int | ast_sorcery_changeset_create (const struct ast_variable *original, const struct ast_variable *modified, struct ast_variable **changes) |
Create a changeset given two object sets. More... | |
void * | ast_sorcery_copy (const struct ast_sorcery *sorcery, const void *object) |
Create a copy of an object. More... | |
int | ast_sorcery_create (const struct ast_sorcery *sorcery, void *object) |
Create and potentially persist an object using an available wizard. More... | |
int | ast_sorcery_delete (const struct ast_sorcery *sorcery, void *object) |
Delete an object. More... | |
int | ast_sorcery_diff (const struct ast_sorcery *sorcery, const void *original, const void *modified, struct ast_variable **changes) |
Create a changeset of two objects. More... | |
void | ast_sorcery_force_reload (const struct ast_sorcery *sorcery) |
Inform any wizards to reload persistent objects, even if no changes determined. More... | |
void | ast_sorcery_force_reload_object (const struct ast_sorcery *sorcery, const char *type) |
Inform any wizards of a specific object type to reload persistent objects even if no changes determined. More... | |
void * | ast_sorcery_generic_alloc (size_t size, ao2_destructor_fn destructor) |
Allocate a generic sorcery capable object. More... | |
const char * | ast_sorcery_get_module (const struct ast_sorcery *sorcery) |
Get the module that has opened the provided sorcery instance. More... | |
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. More... | |
int | ast_sorcery_get_wizard_mapping (struct ast_sorcery *sorcery, const char *type, int index, struct ast_sorcery_wizard **wizard, void **data) |
By index, return a wizard mapped to an object type. More... | |
int | ast_sorcery_get_wizard_mapping_count (struct ast_sorcery *sorcery, const char *type) |
Return the number of wizards mapped to an object type. More... | |
int | ast_sorcery_global_observer_add (const struct ast_sorcery_global_observer *callbacks) |
Add a global observer to sorcery. More... | |
void | ast_sorcery_global_observer_remove (const struct ast_sorcery_global_observer *callbacks) |
Remove a global observer from sorcery. More... | |
int | ast_sorcery_init (void) |
Compare function for sorcery instances. More... | |
int | ast_sorcery_instance_observer_add (struct ast_sorcery *sorcery, const struct ast_sorcery_instance_observer *callbacks) |
Add an observer to a sorcery instance. More... | |
void | ast_sorcery_instance_observer_remove (struct ast_sorcery *sorcery, const struct ast_sorcery_instance_observer *callbacks) |
Remove an observer from a sorcery instance. More... | |
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. More... | |
int | ast_sorcery_is_stale (const struct ast_sorcery *sorcery, void *object) |
Determine if a sorcery object is stale with respect to its backing datastore. More... | |
void | ast_sorcery_load (const struct ast_sorcery *sorcery) |
Inform any wizards to load persistent objects. More... | |
void | ast_sorcery_load_object (const struct ast_sorcery *sorcery, const char *type) |
Inform any wizards of a specific object type to load persistent objects. More... | |
void * | ast_sorcery_lockable_alloc (size_t size, ao2_destructor_fn destructor, void *lockobj) |
Allocate a generic sorcery capable object with locking. More... | |
int | ast_sorcery_object_fields_register (struct ast_sorcery *sorcery, const char *type, const char *regex, aco_option_handler config_handler, sorcery_fields_handler sorcery_handler) |
Register a regex for multiple fields within an object. More... | |
const struct timeval | ast_sorcery_object_get_created (const void *object) |
Get when the sorcery object was created. More... | |
const char * | ast_sorcery_object_get_extended (const void *object, const char *name) |
Get an extended field value from a sorcery object. More... | |
const char * | ast_sorcery_object_get_id (const void *object) |
Get the unique identifier of a sorcery object. More... | |
const char * | ast_sorcery_object_get_type (const void *object) |
Get the type of a sorcery object. More... | |
unsigned int | ast_sorcery_object_has_dynamic_contents (const void *object) |
Get whether an object contains dynamic contents or not. More... | |
int | ast_sorcery_object_id_compare (void *obj, void *arg, int flags) |
ao2 object comparator based on sorcery id. More... | |
int | ast_sorcery_object_id_hash (const void *obj, int flags) |
ao2 object hasher based on sorcery id. More... | |
int | ast_sorcery_object_id_sort (const void *obj, const void *arg, int flags) |
ao2 object sorter based on sorcery id. More... | |
int | ast_sorcery_object_set_congestion_levels (struct ast_sorcery *sorcery, const char *type, long low_water, long high_water) |
Set the high and low alert water marks of the sorcery object type. More... | |
void | ast_sorcery_object_set_copy_handler (struct ast_sorcery *sorcery, const char *type, sorcery_copy_handler copy) |
Set the copy handler for an object type. More... | |
void | ast_sorcery_object_set_diff_handler (struct ast_sorcery *sorcery, const char *type, sorcery_diff_handler diff) |
Set the diff handler for an object type. More... | |
int | ast_sorcery_object_set_extended (const void *object, const char *name, const char *value) |
Set an extended field value on a sorcery object. More... | |
void | ast_sorcery_object_set_has_dynamic_contents (const void *object) |
Set the dynamic contents flag on a sorcery object. More... | |
int | ast_sorcery_object_unregister (struct ast_sorcery *sorcery, const char *type) |
Unregister an object type. More... | |
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. More... | |
struct ast_variable * | ast_sorcery_objectset_create2 (const struct ast_sorcery *sorcery, const void *object, enum ast_sorcery_field_handler_flags flags) |
Create an object set (KVP list) for an object. More... | |
struct ast_json * | ast_sorcery_objectset_json_create (const struct ast_sorcery *sorcery, const void *object) |
Create an object set in JSON format for an object. More... | |
int | ast_sorcery_observer_add (const struct ast_sorcery *sorcery, const char *type, const struct ast_sorcery_observer *callbacks) |
Add an observer to a specific object type. More... | |
void | ast_sorcery_observer_remove (const struct ast_sorcery *sorcery, const char *type, const struct ast_sorcery_observer *callbacks) |
Remove an observer from a specific object type. More... | |
void | ast_sorcery_ref (struct ast_sorcery *sorcery) |
Increase the reference count of a sorcery structure. More... | |
void | ast_sorcery_reload (const struct ast_sorcery *sorcery) |
Inform any wizards to reload persistent objects. More... | |
void | ast_sorcery_reload_object (const struct ast_sorcery *sorcery, const char *type) |
Inform any wizards of a specific object type to reload persistent objects. More... | |
void * | ast_sorcery_retrieve_by_fields (const struct ast_sorcery *sorcery, const char *type, unsigned int flags, struct ast_variable *fields) |
Retrieve an object or multiple objects using specific fields. More... | |
void * | ast_sorcery_retrieve_by_id (const struct ast_sorcery *sorcery, const char *type, const char *id) |
Retrieve an object using its unique identifier. More... | |
struct ast_sorcery * | ast_sorcery_retrieve_by_module_name (const char *module_name) |
Search function for sorcery instances. More... | |
struct ao2_container * | ast_sorcery_retrieve_by_prefix (const struct ast_sorcery *sorcery, const char *type, const char *prefix, const size_t prefix_len) |
Retrieve multiple objects whose id begins with the specified prefix. More... | |
struct ao2_container * | ast_sorcery_retrieve_by_regex (const struct ast_sorcery *sorcery, const char *type, const char *regex) |
Retrieve multiple objects using a regular expression on their id. More... | |
int | ast_sorcery_update (const struct ast_sorcery *sorcery, void *object) |
Update an object. More... | |
int | ast_sorcery_wizard_observer_add (struct ast_sorcery_wizard *interface, const struct ast_sorcery_wizard_observer *callbacks) |
Add an observer to a sorcery wizard. More... | |
void | ast_sorcery_wizard_observer_remove (struct ast_sorcery_wizard *interface, const struct ast_sorcery_wizard_observer *callbacks) |
Remove an observer from a sorcery wizard. More... | |
int | ast_sorcery_wizard_unregister (const struct ast_sorcery_wizard *interface) |
Unregister a sorcery wizard. More... | |
AST_VECTOR_RW (ast_sorcery_object_wizards, struct ast_sorcery_object_wizard *) | |
Interface for a sorcery object type wizards. More... | |
static int | bool_handler_fn (const void *obj, const intptr_t *args, char **buf) |
static int | chararray_handler_fn (const void *obj, const intptr_t *args, char **buf) |
static int | codec_handler_fn (const void *obj, const intptr_t *args, char **buf) |
static int | double_handler_fn (const void *obj, const intptr_t *args, char **buf) |
static struct ast_variable * | get_multiple_fields_as_var_list (const void *object, struct ast_sorcery_object_field *object_field) |
static struct ast_variable * | get_single_field_as_var_list (const void *object, struct ast_sorcery_object_field *object_field) |
static int | int_handler_fn (const void *obj, const intptr_t *args, char **buf) |
static int | is_registered_cb (void *obj, void *arg, int flags) |
static int | sockaddr_handler_fn (const void *obj, const intptr_t *args, char **buf) |
static int | sorcery_cache_create (void *obj, void *arg, int flags) |
Internal function used to create an object in caching wizards. More... | |
static void | sorcery_cleanup (void) |
Hashing and comparison functions for sorcery wizards. More... | |
static void | sorcery_destructor (void *obj) |
Destructor called when sorcery structure is destroyed. More... | |
static int | sorcery_extended_config_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | sorcery_extended_fields_handler (const void *obj, struct ast_variable **fields) |
static sorcery_field_handler | sorcery_field_default_handler (enum aco_option_type type) |
static int | sorcery_generic_observer_remove (void *obj, void *arg, int flags) |
Internal callback function for removing a generic observer. More... | |
static void | sorcery_internal_wizard_destructor (void *obj) |
static void | sorcery_object_destructor (void *object) |
static void | sorcery_object_field_destructor (void *obj) |
static int | sorcery_object_load (void *obj, void *arg, int flags) |
static struct ast_sorcery_object_type * | sorcery_object_type_alloc (const char *type, const char *module) |
Internal function which allocates an object type structure. More... | |
static void | sorcery_object_type_destructor (void *obj) |
Destructor function for object types. More... | |
static void | sorcery_object_wizard_destructor (void *obj) |
Object wizard destructor. More... | |
static struct sorcery_observer_invocation * | sorcery_observer_invocation_alloc (struct ast_sorcery_object_type *object_type, void *object) |
Allocator function for observer invocation. More... | |
static void | sorcery_observer_invocation_destroy (void *obj) |
Destructor for observer invocation. More... | |
static int | sorcery_observer_notify_create (void *obj, void *arg, int flags) |
Internal callback function which notifies an individual observer that an object has been created. More... | |
static int | sorcery_observer_notify_delete (void *obj, void *arg, int flags) |
Internal callback function which notifies an individual observer that an object has been deleted. More... | |
static int | sorcery_observer_notify_loaded (void *obj, void *arg, int flags) |
Internal callback function which notifies an individual observer that an object type has been loaded. More... | |
static int | sorcery_observer_notify_update (void *obj, void *arg, int flags) |
Internal callback function which notifies an individual observer that an object has been updated. More... | |
static int | sorcery_observer_remove (void *obj, void *arg, int flags) |
Internal callback function for removing an observer. More... | |
static int | sorcery_observers_notify_create (void *data) |
Internal callback function which notifies observers that an object has been created. More... | |
static int | sorcery_observers_notify_delete (void *data) |
Internal callback function which notifies observers that an object has been deleted. More... | |
static int | sorcery_observers_notify_loaded (void *data) |
Internal callback function which notifies observers that an object type has been loaded. More... | |
static int | sorcery_observers_notify_update (void *data) |
Internal callback function which notifies observers that an object has been updated. More... | |
static void | sorcery_proxy_cb (void *weakproxy, void *data) |
Hashing function for sorcery types. More... | |
static int | sorcery_reloadable (const struct ast_sorcery *sorcery, const char *type) |
Retrieves whether or not the type is reloadable. More... | |
static int | sorcery_wizard_create (const struct ast_sorcery_object_wizard *object_wizard, const struct sorcery_details *details) |
Internal function which returns if the wizard has created the object. More... | |
static int | sorcery_wizard_delete (const struct ast_sorcery_object_wizard *object_wizard, const struct sorcery_details *details) |
Internal function which returns if a wizard has deleted the object. More... | |
static int | sorcery_wizard_load (void *obj, void *arg, int flags) |
static int | sorcery_wizard_update (const struct ast_sorcery_object_wizard *object_wizard, const struct sorcery_details *details) |
Internal function which returns if a wizard has updated the object. More... | |
static int | stringfield_handler_fn (const void *obj, const intptr_t *args, char **buf) |
static int | uint_handler_fn (const void *obj, const intptr_t *args, char **buf) |
static int | yesno_handler_fn (const void *obj, const intptr_t *args, char **buf) |
Variables | |
static struct ao2_container * | instances |
Registered sorcery instances. More... | |
struct ao2_container * | observers |
Registered global observers. More... | |
static struct ast_threadpool * | threadpool |
Thread pool for observers. More... | |
static struct ao2_container * | wizards |
Registered sorcery wizards. More... | |
Sorcery Data Access Layer API.
Definition in file sorcery.c.
#define INITIAL_WIZARD_VECTOR_SIZE 5 |
#define INSTANCE_BUCKETS 17 |
#define MAX_REGEX_ERROR_LEN 128 |
#define NOTIFY_GLOBAL_OBSERVERS | ( | container, | |
callback, | |||
... | |||
) | NOTIFY_GENERIC_OBSERVERS(container, sorcery_global_observer, callback, __VA_ARGS__) |
#define NOTIFY_INSTANCE_OBSERVERS | ( | container, | |
callback, | |||
... | |||
) | NOTIFY_GENERIC_OBSERVERS(container, sorcery_instance_observer, callback, __VA_ARGS__) |
#define NOTIFY_WIZARD_OBSERVERS | ( | container, | |
callback, | |||
... | |||
) | NOTIFY_GENERIC_OBSERVERS(container, sorcery_wizard_observer, callback, __VA_ARGS__) |
#define OBJECT_FIELD_BUCKETS 29 |
#define TYPE_BUCKETS 53 |
#define WIZARD_BUCKETS 7 |
#define WIZARD_NAME_COMPARE | ( | a, | |
b | |||
) | (strcmp((a)->wizard->callbacks.name, (b)) == 0) |
enum ast_sorcery_apply_result __ast_sorcery_apply_config | ( | struct ast_sorcery * | sorcery, |
const char * | name, | ||
const char * | module | ||
) |
Apply configured wizard mappings.
sorcery | Pointer to a sorcery structure |
name | Name of the category to use within the configuration file, normally the module name |
module | The module name (AST_MODULE) |
This function is called automatically by __ast_sorcery_open() using the module name as the configuration category. The only reason you should call this function is if your module wishes to apply configuration from additional sections of sorcery.conf.
If a configuration section attempts to apply the same sorcery wizard to an object type more than once, the wizard will only be applied one time.
Definition at line 985 of file sorcery.c.
References __ast_sorcery_apply_wizard_mapping(), ast_config_destroy(), ast_config_load2(), ast_free, AST_SORCERY_APPLY_FAIL, AST_SORCERY_APPLY_NO_CONFIGURATION, AST_SORCERY_APPLY_SUCCESS, ast_strdup, ast_strlen_zero(), ast_variable_browse(), config, CONFIG_STATUS_FILEINVALID, ast_flags::flags, name, ast_variable::name, ast_variable::next, options, RAII_VAR, sorcery, strsep(), type, and ast_variable::value.
Referenced by __ast_sorcery_open().
enum ast_sorcery_apply_result __ast_sorcery_apply_default | ( | struct ast_sorcery * | sorcery, |
const char * | type, | ||
const char * | module, | ||
const char * | name, | ||
const char * | data | ||
) |
Apply default object wizard mappings.
sorcery | Pointer to a sorcery structure |
type | Type of object to apply to |
module | The name of the module, typically AST_MODULE |
name | Name of the wizard to use |
data | Data to be passed to wizard |
Definition at line 1031 of file sorcery.c.
References __ast_sorcery_apply_wizard_mapping(), ao2_cleanup, ao2_find, AST_SORCERY_APPLY_DEFAULT_UNNECESSARY, name, OBJ_KEY, RAII_VAR, sorcery, type, and ast_sorcery::types.
enum ast_sorcery_apply_result __ast_sorcery_apply_wizard_mapping | ( | struct ast_sorcery * | sorcery, |
const char * | type, | ||
const char * | module, | ||
const char * | name, | ||
const char * | data, | ||
unsigned int | caching | ||
) |
Internal function which creates an object type and adds a wizard mapping.
Apply additional object wizard mappings.
Definition at line 977 of file sorcery.c.
References __ast_sorcery_insert_wizard_mapping(), AST_SORCERY_WIZARD_POSITION_LAST, ast_sorcery_object_wizard::caching, ast_sorcery_object_wizard::data, name, sorcery, and type.
Referenced by __ast_sorcery_apply_config(), and __ast_sorcery_apply_default().
enum ast_sorcery_apply_result __ast_sorcery_insert_wizard_mapping | ( | struct ast_sorcery * | sorcery, |
const char * | type, | ||
const char * | module, | ||
const char * | name, | ||
const char * | data, | ||
unsigned int | caching, | ||
int | position | ||
) |
Internal function which creates an object type and inserts a wizard mapping.
Insert an additional object wizard mapping at a specific position in the wizard list.
Definition at line 967 of file sorcery.c.
References __ast_sorcery_object_type_insert_wizard(), AST_SORCERY_WIZARD_APPLY_CACHING, AST_SORCERY_WIZARD_APPLY_NONE, ast_sorcery_object_wizard::caching, ast_sorcery_object_wizard::data, name, NULL, sorcery, and type.
Referenced by __ast_sorcery_apply_wizard_mapping().
int __ast_sorcery_object_field_register | ( | struct ast_sorcery * | sorcery, |
const char * | type, | ||
const char * | name, | ||
const char * | default_val, | ||
enum aco_option_type | opt_type, | ||
aco_option_handler | config_handler, | ||
sorcery_field_handler | sorcery_handler, | ||
sorcery_fields_handler | multiple_handler, | ||
unsigned int | flags, | ||
unsigned int | no_doc, | ||
unsigned int | alias, | ||
size_t | argc, | ||
... | |||
) |
Register a field within an object.
sorcery | Pointer to a sorcery structure |
type | Type of object |
name | Name of the field |
default_val | Default value of the field |
config_handler | A custom handler for translating the string representation of the fields |
sorcery_handler | A custom handler for translating the native representation of the fields |
multiple_handler | A custom handler for translating the native representation of the fields |
opt_type | Option type |
flags | Option type specific flags |
no_doc | Field should not be documented |
alias | Interpret and apply field value only |
argc |
0 | success |
-1 | failure |
Definition at line 1192 of file sorcery.c.
References __aco_option_register(), ACO_EXACT, ao2_alloc, ao2_cleanup, ao2_find, ao2_link, args, ast_assert, ast_copy_string(), ast_sorcery_object_field::multiple_handler, name, NULL, OBJ_KEY, RAII_VAR, sorcery, sorcery_field_default_handler(), type, and ast_sorcery::types.
int __ast_sorcery_object_register | ( | struct ast_sorcery * | sorcery, |
const char * | type, | ||
unsigned int | hidden, | ||
unsigned int | reloadable, | ||
aco_type_item_alloc | alloc, | ||
sorcery_transform_handler | transform, | ||
sorcery_apply_handler | apply | ||
) |
Register an object type.
sorcery | Pointer to a sorcery structure |
type | Type of object |
hidden | All objects of this type are internal and should not be manipulated by users |
reloadable | All objects of this type are reloadable |
alloc | Required object allocation callback |
transform | Optional transformation callback |
apply | Optional object set apply callback |
0 | success |
-1 | failure |
Definition at line 1080 of file sorcery.c.
References aco_info_init(), ACO_ITEM, ao2_cleanup, ao2_find, ast_sorcery_object_type::apply, ast_sorcery_object_fields_register(), ast_sorcery::module_name, NOTIFY_INSTANCE_OBSERVERS, NULL, OBJ_KEY, ast_sorcery::observers, RAII_VAR, ast_sorcery_object_type::reloadable, sorcery, sorcery_extended_config_handler(), sorcery_extended_fields_handler(), ast_sorcery_object_type::transform, type, and ast_sorcery::types.
enum ast_sorcery_apply_result __ast_sorcery_object_type_insert_wizard | ( | struct ast_sorcery * | sorcery, |
const char * | object_type_name, | ||
const char * | module, | ||
const char * | wizard_type_name, | ||
const char * | wizard_args, | ||
enum ast_sorcery_wizard_apply_flags | flags, | ||
int | position, | ||
struct ast_sorcery_wizard ** | wizard, | ||
void ** | wizard_data | ||
) |
Insert an additional object wizard mapping at a specific position in the wizard list returning wizard information.
sorcery | Pointer to a sorcery structure | |
object_type_name | Name of the object type to apply to | |
module | The name of the module, typically AST_MODULE | |
wizard_type_name | Name of the wizard type to use | |
wizard_args | Opaque string to be passed to the wizard May be NULL but see note below | |
flags | One or more of enum ast_sorcery_wizard_apply_flags | |
position | An index to insert to or one of ast_sorcery_wizard_position | |
[out] | wizard | A variable to receive a pointer to the ast_sorcery_wizard structure. May be NULL if not needed. |
[out] | wizard_data | A variable to receive a pointer to the wizard's internal data. May be NULL if not needed. |
wizard_args
is an optional parameter it is highly recommended to supply one. If you use the AST_SORCERY_WIZARD_APPLY_ALLOW_DUPLICATE flag, and you intend to ever remove a wizard mapping, you'll need wizard_args
to remove specific instances of a wizard type. Definition at line 869 of file sorcery.c.
References ast_sorcery_object_wizard::allow_duplicates, ao2_alloc, ao2_bump, ao2_cleanup, ao2_find, ao2_link, ast_debug, ast_log, ast_module_running_ref, ast_module_unref, AST_SORCERY_APPLY_DUPLICATE, AST_SORCERY_APPLY_FAIL, AST_SORCERY_APPLY_SUCCESS, AST_SORCERY_WIZARD_APPLY_ALLOW_DUPLICATE, AST_SORCERY_WIZARD_APPLY_CACHING, AST_SORCERY_WIZARD_APPLY_READONLY, AST_SORCERY_WIZARD_POSITION_LAST, ast_strlen_zero(), AST_VECTOR_GET_CMP, AST_VECTOR_INSERT_AT, AST_VECTOR_RW_UNLOCK, AST_VECTOR_RW_WRLOCK, AST_VECTOR_SIZE, ast_sorcery_internal_wizard::callbacks, LOG_ERROR, LOG_WARNING, ast_sorcery::module_name, NOTIFY_INSTANCE_OBSERVERS, NULL, OBJ_KEY, ast_sorcery::observers, RAII_VAR, S_OR, sorcery, sorcery_object_type_alloc(), sorcery_object_wizard_destructor(), ast_sorcery::types, ast_sorcery_object_wizard::wizard, ast_sorcery_object_wizard::wizard_args, WIZARD_COMPARE, and wizards.
Referenced by __ast_sorcery_insert_wizard_mapping().
int __ast_sorcery_object_type_remove_wizard | ( | struct ast_sorcery * | sorcery, |
const char * | object_type_name, | ||
const char * | module, | ||
const char * | wizard_type_name, | ||
const char * | wizard_args | ||
) |
Remove an object wizard mapping.
sorcery | Pointer to a sorcery structure |
object_type_name | Name of the object type to remove from |
module | The name of the module, typically AST_MODULE |
wizard_type_name | The name of the of the wizard type to remove |
wizard_args | Opaque string originally passed to the wizard |
0 | success |
-1 | failure |
wizard_args
, then only the first wizard matching wizard_type will be removed. Definition at line 820 of file sorcery.c.
References ao2_cleanup, ao2_find, AST_VECTOR_GET, AST_VECTOR_REMOVE_ORDERED, AST_VECTOR_RW_UNLOCK, AST_VECTOR_RW_WRLOCK, AST_VECTOR_SIZE, ast_sorcery_internal_wizard::callbacks, ast_sorcery_wizard::name, OBJ_SEARCH_KEY, RAII_VAR, S_OR, sorcery, ast_sorcery::types, ast_sorcery_object_wizard::wizard, and ast_sorcery_object_wizard::wizard_args.
struct ast_sorcery * __ast_sorcery_open | ( | const char * | module_name, |
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 601 of file sorcery.c.
References __ao2_alloc(), __ao2_weakproxy_find(), __ast_sorcery_apply_config(), AO2_ALLOC_OPT_LOCK_MUTEX, AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_cleanup, ao2_container_alloc_hash, ao2_container_alloc_list, ao2_link_flags, ao2_ref, ao2_t_weakproxy_alloc, ao2_t_weakproxy_set_object, ao2_unlock, ao2_weakproxy_subscribe(), ao2_wrlock, ast_assert, ast_log, AST_SORCERY_APPLY_FAIL, make_ari_stubs::file, instances, LOG_ERROR, sorcery_proxy::module_name, ast_sorcery::module_name, NOTIFY_GLOBAL_OBSERVERS, NULL, OBJ_NOLOCK, OBJ_SEARCH_KEY, ast_sorcery::observers, observers, sorcery, sorcery_destructor(), sorcery_proxy_cb(), TYPE_BUCKETS, and ast_sorcery::types.
int __ast_sorcery_remove_wizard_mapping | ( | struct ast_sorcery * | sorcery, |
const char * | type, | ||
const char * | module, | ||
const char * | name | ||
) |
Internal function removes a wizard mapping.
Remove an object wizard mapping.
Definition at line 850 of file sorcery.c.
References ao2_cleanup, ao2_find, AST_VECTOR_REMOVE_CMP_ORDERED, AST_VECTOR_RW_UNLOCK, AST_VECTOR_RW_WRLOCK, name, OBJ_KEY, RAII_VAR, sorcery, type, ast_sorcery::types, and WIZARD_NAME_COMPARE.
int __ast_sorcery_wizard_register | ( | const struct ast_sorcery_wizard * | interface, |
struct ast_module * | module | ||
) |
Register a sorcery wizard.
interface | Pointer to a wizard interface |
module | Pointer to the module implementing the interface |
0 | success |
-1 | failure |
Definition at line 432 of file sorcery.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_cleanup, ao2_container_alloc_list, ao2_find, ao2_link_flags, ao2_lock, ao2_unlock, ast_assert, ast_log, ast_strlen_zero(), ast_verb, ast_sorcery_internal_wizard::callbacks, done, LOG_WARNING, ast_sorcery_wizard::module, ast_sorcery_wizard::name, NOTIFY_GLOBAL_OBSERVERS, NULL, OBJ_KEY, OBJ_NOLOCK, ast_sorcery_internal_wizard::observers, observers, sorcery_internal_wizard_destructor(), and wizards.
Referenced by ast_bucket_init().
void * ast_sorcery_alloc | ( | const struct ast_sorcery * | sorcery, |
const char * | type, | ||
const char * | id | ||
) |
Allocate an object.
sorcery | Pointer to a sorcery structure |
type | Type of object to allocate |
id | Optional unique identifier, if none is provided one will be generated |
non-NULL | success |
NULL | failure |
Definition at line 1744 of file sorcery.c.
References aco_set_defaults(), ao2_cleanup, ao2_find, ao2_ref, ast_copy_string(), ast_strdup, ast_strlen_zero(), ast_tvnow(), ast_uuid_generate_str(), AST_UUID_STR_LEN, ast_sorcery_object::created, ast_sorcery_object::id, NULL, OBJ_KEY, ast_sorcery_object_details::object, RAII_VAR, sorcery, type, ast_sorcery_object::type, ast_sorcery::types, and uuid().
Referenced by alloc_artificial_auth(), ast_ari_asterisk_update_object(), ast_bucket_alloc(), ast_bucket_file_alloc(), ast_mwi_mailbox_alloc(), ast_sip_initialize_system(), ast_sip_location_create_contact(), ast_sorcery_copy(), AST_TEST_DEFINE(), create_artificial_endpoint(), create_effective_profile(), create_object(), default_profile_create(), global_loaded_observer(), load_module(), mock_retrieve_id(), permanent_uri_handler(), sip_cli_print_global(), sip_cli_print_system(), sorcery_astdb_retrieve_fields_common(), sorcery_astdb_retrieve_id(), sorcery_astdb_retrieve_prefix(), sorcery_astdb_retrieve_regex(), sorcery_config_internal_load(), sorcery_memory_cache_thrash_update(), sorcery_realtime_retrieve_fields(), sorcery_realtime_retrieve_multiple(), sorcery_test_retrieve_id(), and subscription_persistence_create().
int ast_sorcery_changeset_create | ( | const struct ast_variable * | original, |
const struct ast_variable * | modified, | ||
struct ast_variable ** | changes | ||
) |
Create a changeset given two object sets.
original | Original object set |
modified | Modified object set |
changes | Pointer to hold any changes between the object sets |
0 | success |
-1 | failure |
Definition at line 1663 of file sorcery.c.
References ast_variable_find_in_list(), ast_variable_new, ast_variables_destroy(), ast_variable::name, ast_variable::next, NULL, tmp(), and ast_variable::value.
Referenced by ast_sorcery_diff(), AST_TEST_DEFINE(), can_reuse_registration(), and sorcery_is_criteria_met().
void * ast_sorcery_copy | ( | const struct ast_sorcery * | sorcery, |
const void * | object | ||
) |
Create a copy of an object.
sorcery | Pointer to a sorcery structure |
object | Existing object |
non-NULL | success |
NULL | failure |
Definition at line 1778 of file sorcery.c.
References ao2_cleanup, ao2_find, ast_sorcery_alloc(), ast_sorcery_objectset_apply(), ast_sorcery_objectset_create, ast_variables_destroy(), copy(), ast_sorcery_object::id, NULL, OBJ_KEY, ast_sorcery_object_details::object, RAII_VAR, sorcery, ast_sorcery_object::type, and ast_sorcery::types.
Referenced by ast_ari_asterisk_update_object(), ast_bucket_clone(), ast_bucket_file_clone(), ast_mwi_mailbox_copy(), and AST_TEST_DEFINE().
int ast_sorcery_create | ( | const struct ast_sorcery * | sorcery, |
void * | object | ||
) |
Create and potentially persist an object using an available wizard.
sorcery | Pointer to a sorcery structure |
object | Pointer to a sorcery object |
0 | success |
-1 | failure |
Definition at line 2062 of file sorcery.c.
References ao2_cleanup, ao2_container_count(), ao2_find, ast_taskprocessor_push(), AST_VECTOR_GET, AST_VECTOR_RW_RDLOCK, AST_VECTOR_RW_UNLOCK, AST_VECTOR_SIZE, ast_sorcery_object_wizard::caching, CMP_MATCH, NULL, OBJ_KEY, ast_sorcery_object_details::object, sorcery_observer_invocation::object_type, RAII_VAR, ast_sorcery_object_type::serializer, sorcery_details::sorcery, sorcery, sorcery_observer_invocation_alloc(), sorcery_observers_notify_create(), sorcery_wizard_create(), ast_sorcery_object::type, ast_sorcery::types, and ast_sorcery_object_type::wizards.
Referenced by ast_ari_asterisk_update_object(), ast_bucket_create(), ast_bucket_file_create(), ast_mwi_mailbox_update(), ast_sip_location_create_contact(), AST_TEST_DEFINE(), create_effective_profile(), default_profile_create(), load_module(), and subscription_persistence_create().
int ast_sorcery_delete | ( | const struct ast_sorcery * | sorcery, |
void * | object | ||
) |
Delete an object.
sorcery | Pointer to a sorcery structure |
object | Pointer to a sorcery object |
0 | success |
-1 | failure |
Definition at line 2238 of file sorcery.c.
References ao2_cleanup, ao2_container_count(), ao2_find, ast_taskprocessor_push(), AST_VECTOR_GET, AST_VECTOR_RW_RDLOCK, AST_VECTOR_RW_UNLOCK, AST_VECTOR_SIZE, ast_sorcery_object_wizard::caching, CMP_MATCH, NULL, OBJ_KEY, ast_sorcery_object_details::object, sorcery_observer_invocation::object_type, RAII_VAR, ast_sorcery_object_type::serializer, sorcery_details::sorcery, sorcery, sorcery_observer_invocation_alloc(), sorcery_observers_notify_delete(), sorcery_wizard_delete(), ast_sorcery_object::type, ast_sorcery::types, and ast_sorcery_object_type::wizards.
Referenced by ast_ari_asterisk_delete_object(), ast_bucket_delete(), ast_bucket_file_delete(), ast_sip_location_delete_contact(), AST_TEST_DEFINE(), bucket_http_wizard_retrieve_id(), mwi_mailbox_delete(), sub_persistence_recreate(), subscription_persistence_recreate(), subscription_persistence_remove(), and unload_module().
int ast_sorcery_diff | ( | const struct ast_sorcery * | sorcery, |
const void * | original, | ||
const void * | modified, | ||
struct ast_variable ** | changes | ||
) |
Create a changeset of two objects.
sorcery | Pointer to a sorcery structure |
original | Original object |
modified | Modified object |
changes | Pointer which will be populated with changes if any exist |
0 | success |
-1 | failure |
Definition at line 1805 of file sorcery.c.
References ao2_cleanup, ao2_find, ast_sorcery_changeset_create(), ast_sorcery_object_get_type(), ast_sorcery_objectset_create, ast_variables_destroy(), NULL, OBJ_KEY, RAII_VAR, sorcery, and ast_sorcery::types.
Referenced by AST_TEST_DEFINE(), and transport_apply().
void ast_sorcery_force_reload | ( | const struct ast_sorcery * | sorcery | ) |
Inform any wizards to reload persistent objects, even if no changes determined.
sorcery | Pointer to a sorcery structure |
Definition at line 1425 of file sorcery.c.
References ao2_callback, ast_sorcery::module_name, NOTIFY_INSTANCE_OBSERVERS, OBJ_NODATA, ast_sorcery::observers, sorcery_load_details::sorcery, sorcery, sorcery_object_load(), and ast_sorcery::types.
void ast_sorcery_force_reload_object | ( | const struct ast_sorcery * | sorcery, |
const char * | type | ||
) |
Inform any wizards of a specific object type to reload persistent objects even if no changes determined.
sorcery | Pointer to a sorcery structure |
type | Name of the object type to reload |
Definition at line 1457 of file sorcery.c.
References ao2_cleanup, ao2_find, OBJ_KEY, RAII_VAR, sorcery_load_details::sorcery, sorcery, sorcery_object_load(), type, and ast_sorcery::types.
Referenced by acl_change_stasis_cb(), as_config_reload(), profile_reload(), tn_config_reload(), and vs_config_reload().
void * ast_sorcery_generic_alloc | ( | size_t | size, |
ao2_destructor_fn | destructor | ||
) |
Allocate a generic sorcery capable object.
size | Size of the object |
destructor | Optional destructor function |
non-NULL | success |
NULL | failure |
Definition at line 1728 of file sorcery.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ast_sorcery_object::destructor, NULL, ast_sorcery_object_details::object, and sorcery_object_destructor().
Referenced by acl_alloc(), ast_sip_endpoint_alloc(), asterisk_publication_config_alloc(), attestation_alloc(), auth_alloc(), bucket_alloc(), bucket_file_alloc(), client_config_alloc(), contact_alloc(), domain_alias_alloc(), geoloc_location_alloc(), geoloc_profile_alloc(), global_alloc(), ip_identify_alloc(), mapping_alloc(), mwi_sorcery_object_alloc(), phoneprov_alloc(), profile_alloc(), publication_resource_alloc(), resource_list_alloc(), sip_nat_hook_alloc(), sip_outbound_publish_alloc(), sip_outbound_registration_alloc(), sip_transport_alloc(), subscription_persistence_alloc(), system_alloc(), test_data_alloc(), test_sorcery_object_alloc(), tn_alloc(), and verification_alloc().
const char * ast_sorcery_get_module | ( | const struct ast_sorcery * | sorcery | ) |
Get the module that has opened the provided sorcery instance.
sorcery | The sorcery instance |
Definition at line 2536 of file sorcery.c.
References ast_sorcery::module_name, and sorcery.
Referenced by sorcery_memory_cache_load().
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.
sorcery | The sorcery from which to retrieve the object type |
type | The type name |
Definition at line 2494 of file sorcery.c.
References ao2_find, OBJ_SEARCH_KEY, sorcery, type, and ast_sorcery::types.
Referenced by ast_ari_asterisk_delete_object(), ast_ari_asterisk_get_object(), ast_ari_asterisk_update_object(), AST_TEST_DEFINE(), load_module(), sorcery_astdb_filter_objectset(), sorcery_is_explicit_name_met(), and sorcery_realtime_filter_objectset().
int ast_sorcery_get_wizard_mapping | ( | struct ast_sorcery * | sorcery, |
const char * | type, | ||
int | index, | ||
struct ast_sorcery_wizard ** | wizard, | ||
void ** | data | ||
) |
By index, return a wizard mapped to an object type.
sorcery | Pointer to a sorcery structure |
type | Type of object |
index | Index of the wizard |
wizard | A pointer to receive the wizard pointer |
data | A pointer to receive the data pointer |
0 | success |
-1 | failure |
Definition at line 790 of file sorcery.c.
References ao2_bump, ao2_cleanup, ao2_find, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_sorcery_internal_wizard::callbacks, ast_sorcery_object_wizard::data, NULL, OBJ_KEY, RAII_VAR, sorcery, type, ast_sorcery::types, and ast_sorcery_object_wizard::wizard.
Referenced by AST_TEST_DEFINE().
int ast_sorcery_get_wizard_mapping_count | ( | struct ast_sorcery * | sorcery, |
const char * | type | ||
) |
Return the number of wizards mapped to an object type.
sorcery | Pointer to a sorcery structure |
type | Type of object |
Definition at line 778 of file sorcery.c.
References ao2_cleanup, ao2_find, AST_VECTOR_SIZE, OBJ_KEY, RAII_VAR, sorcery, type, and ast_sorcery::types.
Referenced by AST_TEST_DEFINE().
int ast_sorcery_global_observer_add | ( | const struct ast_sorcery_global_observer * | callbacks | ) |
Add a global observer to sorcery.
callbacks | Implementation of the global observer interface |
0 | success |
-1 | failure |
Definition at line 498 of file sorcery.c.
References ao2_alloc, ao2_link, ao2_ref, sorcery_global_observer::callbacks, callbacks, NULL, and observers.
Referenced by AST_TEST_DEFINE(), and load_module().
void ast_sorcery_global_observer_remove | ( | const struct ast_sorcery_global_observer * | callbacks | ) |
Remove a global observer from sorcery.
A global observer is notified... After a new wizard is registered. After a new sorcery instance is opened. Before an instance is destroyed. Before a wizard is unregistered.
callbacks | Implementation of the global observer interface |
Definition at line 514 of file sorcery.c.
References ao2_callback, callbacks, OBJ_NODATA, OBJ_UNLINK, observers, and sorcery_generic_observer_remove().
Referenced by AST_TEST_DEFINE(), and unload_module().
int ast_sorcery_init | ( | void | ) |
Compare function for sorcery instances.
Initialize the sorcery API.
Hashing function for sorcery instances
Definition at line 387 of file sorcery.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_container_alloc_hash, ao2_container_alloc_list, ast_assert, ast_register_cleanup(), ast_threadpool_create(), AST_THREADPOOL_OPTIONS_VERSION, INSTANCE_BUCKETS, instances, NULL, observers, options, sorcery_cleanup(), threadpool, WIZARD_BUCKETS, and wizards.
Referenced by asterisk_daemon().
int ast_sorcery_instance_observer_add | ( | struct ast_sorcery * | sorcery, |
const struct ast_sorcery_instance_observer * | callbacks | ||
) |
Add an observer to a sorcery instance.
sorcery | Pointer to a sorcery structure |
callbacks | Implementation of the instance observer interface |
An instance observer is notified... Before an instance is loaded or reloaded. After an instance is loaded or reloaded. After a wizard is mapped to an object type. After an object type is registered. Before an object type is loaded or reloaded. After an object type is loaded or reloaded.
0 | success |
-1 | failure |
Definition at line 520 of file sorcery.c.
References ao2_alloc, ao2_link, ao2_ref, sorcery_instance_observer::callbacks, callbacks, NULL, ast_sorcery::observers, and sorcery.
Referenced by ast_sip_initialize_sorcery_global(), AST_TEST_DEFINE(), instance_created_observer(), load_module(), and pjsip_outbound_registration_metrics_init().
void ast_sorcery_instance_observer_remove | ( | struct ast_sorcery * | sorcery, |
const struct ast_sorcery_instance_observer * | callbacks | ||
) |
Remove an observer from a sorcery instance.
sorcery | Pointer to a sorcery structure |
callbacks | Implementation of the instance observer interface |
Definition at line 537 of file sorcery.c.
References ao2_callback, callbacks, OBJ_NODATA, OBJ_UNLINK, ast_sorcery::observers, sorcery, and sorcery_generic_observer_remove().
Referenced by ast_sip_destroy_sorcery_global(), AST_TEST_DEFINE(), instance_destroying_observer(), pjsip_outbound_registration_metrics_init(), pjsip_outbound_registration_metrics_unload_cb(), and unload_module().
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.
object_type | The object type to check against |
field_name | The name of the field to check |
0 | The field is not registered for this sorcery type |
1 | The field is registered for this sorcery type |
Definition at line 2514 of file sorcery.c.
References ao2_callback, ao2_cleanup, ao2_find, ast_assert, ast_sorcery_object_type::fields, is_registered_cb(), NULL, and OBJ_SEARCH_KEY.
Referenced by AST_TEST_DEFINE(), sorcery_astdb_filter_objectset(), sorcery_is_explicit_name_met(), and sorcery_realtime_filter_objectset().
int ast_sorcery_is_stale | ( | const struct ast_sorcery * | sorcery, |
void * | object | ||
) |
Determine if a sorcery object is stale with respect to its backing datastore.
This function will query the wizard(s) backing the particular sorcery object to determine if the in-memory object is now stale. No action is taken to update the object. Callers of this function may use one of the ast_sorcery_retrieve functions to obtain a new instance of the object if desired.
0 | the object is not stale |
1 | the object is stale |
Definition at line 2288 of file sorcery.c.
References ao2_cleanup, ao2_find, ast_debug, ast_sorcery_object_get_id(), AST_VECTOR_GET, AST_VECTOR_RW_RDLOCK, AST_VECTOR_RW_UNLOCK, AST_VECTOR_SIZE, ast_sorcery_internal_wizard::callbacks, ast_sorcery_object_wizard::data, ast_sorcery_wizard::is_stale, ast_sorcery_wizard::name, OBJ_KEY, ast_sorcery_object_details::object, RAII_VAR, sorcery, ast_sorcery_object::type, ast_sorcery::types, and ast_sorcery_object_wizard::wizard.
Referenced by ast_bucket_file_is_stale(), ast_bucket_is_stale(), and AST_TEST_DEFINE().
void ast_sorcery_load | ( | const struct ast_sorcery * | sorcery | ) |
Inform any wizards to load persistent objects.
sorcery | Pointer to a sorcery structure |
Definition at line 1377 of file sorcery.c.
References ao2_callback, ast_sorcery::module_name, NOTIFY_INSTANCE_OBSERVERS, OBJ_NODATA, ast_sorcery::observers, sorcery_load_details::sorcery, sorcery, sorcery_object_load(), and ast_sorcery::types.
Referenced by ast_res_pjsip_initialize_configuration(), ast_sip_initialize_system(), AST_TEST_DEFINE(), geoloc_config_load(), and load_module().
void ast_sorcery_load_object | ( | const struct ast_sorcery * | sorcery, |
const char * | type | ||
) |
Inform any wizards of a specific object type to load persistent objects.
sorcery | Pointer to a sorcery structure |
type | Name of the object type to load |
Definition at line 1393 of file sorcery.c.
References ao2_cleanup, ao2_find, OBJ_KEY, RAII_VAR, sorcery_load_details::sorcery, sorcery, sorcery_object_load(), type, and ast_sorcery::types.
Referenced by as_config_load(), AST_TEST_DEFINE(), load_module(), profile_load(), reregister_all(), tn_config_load(), and vs_config_load().
void * ast_sorcery_lockable_alloc | ( | size_t | size, |
ao2_destructor_fn | destructor, | ||
void * | lockobj | ||
) |
Allocate a generic sorcery capable object with locking.
Sorcery objects may be replaced with new allocations during reloads. If locking is required on sorcery objects it must be shared between the old object and the new one. lockobj can be any AO2 object with locking enabled, but in most cases named locks should be used to provide stable locking.
size | Size of the object |
destructor | Optional destructor function |
lockobj | An AO2 object that will provide locking. |
non-NULL | success |
NULL | failure |
Definition at line 1712 of file sorcery.c.
References ao2_alloc_with_lockobj, ast_sorcery_object::destructor, NULL, ast_sorcery_object_details::object, and sorcery_object_destructor().
Referenced by aor_alloc().
int ast_sorcery_object_fields_register | ( | struct ast_sorcery * | sorcery, |
const char * | type, | ||
const char * | regex, | ||
aco_option_handler | config_handler, | ||
sorcery_fields_handler | sorcery_handler | ||
) |
Register a regex for multiple fields within an object.
sorcery | Pointer to a sorcery structure |
type | Type of object |
regex | A regular expression pattern for the fields |
config_handler | A custom handler for translating the string representation of the fields |
sorcery_handler | A custom handler for translating the native representation of the fields |
0 | success |
-1 | failure |
Definition at line 1160 of file sorcery.c.
References __aco_option_register(), ACO_REGEX, ao2_alloc, ao2_cleanup, ao2_find, ao2_link, ast_alloca, ast_calloc, ast_copy_string(), ast_log, LOG_ERROR, MAX_REGEX_ERROR_LEN, NULL, OBJ_KEY, OPT_CUSTOM_T, RAII_VAR, regex(), sorcery, sorcery_object_field_destructor(), type, and ast_sorcery::types.
Referenced by __ast_sorcery_object_register(), AST_TEST_DEFINE(), and load_module().
const struct timeval ast_sorcery_object_get_created | ( | const void * | object | ) |
Get when the sorcery object was created.
object | Pointer to a sorcery object |
Definition at line 2323 of file sorcery.c.
References ast_sorcery_object::created, and ast_sorcery_object_details::object.
const char * ast_sorcery_object_get_extended | ( | const void * | object, |
const char * | name | ||
) |
Get an extended field value from a sorcery object.
object | Pointer to a sorcery object |
name | Name of the extended field value |
non-NULL | if found |
NULL | if not found |
Definition at line 2335 of file sorcery.c.
References ast_sorcery_object::extended, name, ast_variable::name, ast_variable::next, NULL, ast_sorcery_object_details::object, and ast_variable::value.
Referenced by AST_TEST_DEFINE(), asterisk_start_devicestate_publishing(), asterisk_start_mwi_publishing(), delete_existing_cb(), and publisher_start().
const char * ast_sorcery_object_get_id | ( | const void * | object | ) |
Get the unique identifier of a sorcery object.
object | Pointer to a sorcery object |
Definition at line 2317 of file sorcery.c.
References ast_sorcery_object::id, and ast_sorcery_object_details::object.
Referenced by __print_debug_details(), aeap_cli_show(), aeap_tab_complete_name(), allocate_subscription_tree(), allow_and_or_replace_unsolicited(), ami_outbound_registration_task(), ami_show_registration_contact_statuses(), anonymous_identify(), aor_deleted_observer(), apply_acls(), ast_bucket_file_json(), ast_bucket_json(), ast_geoloc_eprofile_create_from_profile(), ast_mwi_mailbox_get_id(), ast_mwi_mailbox_update(), ast_res_pjsip_find_or_create_contact_status(), ast_res_pjsip_initialize_configuration(), ast_sip_create_dialog_uac(), ast_sip_create_subscription(), ast_sip_for_each_contact(), ast_sip_format_contact_ami(), ast_sip_get_contact_status(), ast_sip_get_device_state(), ast_sip_initialize_sorcery_auth(), ast_sip_initialize_sorcery_transport(), ast_sip_location_create_contact(), ast_sip_location_retrieve_aor_contacts_nolock_filtered(), ast_sip_session_alloc(), ast_sip_session_create_outgoing(), ast_sip_session_get_name(), ast_sip_set_tpselector_from_transport(), ast_sip_subscription_destroy(), ast_sorcery_is_stale(), ast_sorcery_object_id_hash(), ast_sorcery_object_id_sort(), AST_TEST_DEFINE(), asterisk_publication_devicestate(), asterisk_publication_devicestate_refresh(), asterisk_publication_devicestate_state_change(), asterisk_publication_mailboxstate(), asterisk_publication_mwi_refresh(), asterisk_publication_mwi_state_change(), attestation_apply(), auth_apply(), auth_observer(), bucket_file_run_curl(), bucket_http_test_wizard_create(), bucket_http_test_wizard_delete(), bucket_http_test_wizard_update(), build_resource_tree(), can_reuse_registration(), cancel_and_unpublish(), chan_pjsip_indicate(), chan_pjsip_new(), change_outgoing_sdp_stream_media_address(), check_state(), cli_aor_get_id(), cli_aor_print_body(), cli_complete_endpoint(), cli_complete_registration(), cli_complete_uri(), cli_contact_print_body(), cli_endpoint_print_body(), cli_iterator(), cli_list_subscriptions_detail(), cli_print_body(), cli_show_subscriptions_detail(), client_config_apply(), codec_prefs_handler(), common_identify(), config_object_cli_show(), config_object_tab_complete_name(), connected_line_method_handler(), contact_apply_handler(), contact_function_get_permanent(), create_dialog_uas(), create_effective_profile(), create_out_of_dialog_request(), create_outgoing_sdp_stream(), create_rtp(), create_unsolicited_mwi_subscriptions(), current_state_reusable(), destroy_subscription(), digest_check_auth(), digest_create_request_with_auth(), direct_media_glare_mitigation_handler(), direct_media_method_handler(), domain_alias_apply(), endpt_send_request(), eprofile_apply(), expire_objects_from_cache(), file_extension_from_url_path(), find_internal_state_by_transport(), find_or_create_temporary_state(), find_registrar_aor(), format_ami_aor_handler(), format_ami_auth_handler(), format_ami_endpoint_identify(), format_ami_endpoint_transport(), from_user_handler(), geoloc_config_list_locations(), geoloc_config_list_profiles(), geoloc_location_apply_handler(), geoloc_profile_apply_handler(), get_account_id(), get_curl_instance(), get_resource_display_name(), handle_export_primitives(), handle_incoming_request(), handle_outgoing_request(), handle_slash(), has_mwi_subscription(), header_identify_match_check(), ident_handler(), internal_state_alloc(), ip_identify_apply(), ip_identify_match_check(), ip_identify_match_handler(), line_identify(), load_engine(), load_module(), log_caps(), mark_object_as_stale_in_cache(), matches_engine(), media_cache_handle_show_item(), media_cache_item_del_from_astdb(), media_cache_item_sync_to_astdb(), media_cache_prnt_summary(), memory_cache_stale_update_object(), msg_send(), mwi_contact_changed(), mwi_observe_delete(), mwi_post_event(), mwi_subscription_alloc(), mwi_validate_for_aor(), new_subscribe(), permanent_uri_handler(), permanent_uri_sort_fn(), persistent_endpoint_find_or_create(), pjsip_aor_function_read(), profile_apply(), publish_request_initial(), publisher_start(), publisher_stop(), pubsub_on_rx_mwi_notify_request(), pubsub_on_rx_publish_request(), pubsub_on_rx_refresh(), pubsub_on_rx_subscribe_request(), qualify_contact_cb(), read_pjsip(), redirect_handler(), refer_client_on_evsub_state(), refer_incoming_attended_request(), refer_incoming_blind_request(), refer_incoming_invite_request(), refer_incoming_refer_request(), refer_progress_alloc(), refer_send(), registrar_contact_delete(), registrar_on_rx_request(), registration_deleted_observer(), registration_state_cmp(), registration_state_hash(), remove_from_cache(), remove_subscription(), request_identify_match_check(), resource_list_apply_handler(), rfc3326_add_reason_header(), rx_data_to_ast_msg(), session_destructor(), session_inv_on_redirected(), session_inv_on_tsx_state_changed(), session_outgoing_nat_hook(), set_outbound_authentication_credentials(), sip_aor_to_ami(), sip_endpoint_apply_handler(), sip_options_aor_alloc(), sip_options_aor_observer_deleted_task(), sip_options_aor_observer_modified_task(), sip_options_apply_aor_configuration(), sip_options_contact_status_notify_task(), sip_options_endpoint_observer_deleted_task(), sip_options_endpoint_observer_modified_task(), sip_options_endpoint_state_compositor_find_or_alloc(), sip_options_endpoint_unlink_aor_feeders(), sip_options_qualify_contact(), sip_options_remove_contact_status(), sip_options_synchronize_aor(), sip_options_synchronize_endpoint(), sip_outbound_publish_apply(), sip_outbound_publish_callback(), sip_outbound_publish_state_alloc(), sip_outbound_publish_synchronize(), sip_outbound_publisher_alloc(), sip_outbound_publisher_init(), sip_outbound_publisher_set_uris(), sip_outbound_registration_apply(), sip_outbound_registration_regc_alloc(), sip_outbound_registration_state_alloc(), sip_sorcery_object_ami_set_type_name(), sip_subscription_send_request(), sip_subscription_to_ami(), sorcery_astdb_create(), sorcery_astdb_delete(), sorcery_astdb_update(), sorcery_config_fields_cmp(), sorcery_memory_cache_complete_object_name(), sorcery_memory_cache_create(), sorcery_memory_cache_delete(), sorcery_memory_cache_fields_cmp(), sorcery_memory_cache_print_object(), sorcery_memory_cache_retrieve_id(), sorcery_memory_cached_object_cmp(), sorcery_memory_cached_object_hash(), sorcery_memory_cmp(), sorcery_memory_create(), sorcery_memory_delete(), sorcery_memory_fields_cmp(), sorcery_memory_hash(), sorcery_memory_update(), sorcery_realtime_create(), sorcery_realtime_delete(), sorcery_realtime_update(), stale_item_update(), stir_shaken_handler(), subscription_established(), subscription_persistence_create(), subscription_persistence_remove(), subscription_tree_destructor(), t38_initialize_session(), tn_apply(), tn_get_etn(), tos_handler(), transport_apply(), transport_tls_file_handler(), transport_tos_handler(), unload_engine(), update_devstate(), users_apply_handler(), validate_publish_config(), and verification_apply().
const char * ast_sorcery_object_get_type | ( | const void * | object | ) |
Get the type of a sorcery object.
object | Pointer to a sorcery object |
Definition at line 2329 of file sorcery.c.
References ast_sorcery_object_details::object, and ast_sorcery_object::type.
Referenced by aeap_cli_show(), ast_sorcery_diff(), AST_TEST_DEFINE(), config_object_cli_show(), memory_cache_stale_check_object(), memory_cache_stale_update_object(), sip_aor_to_ami(), sip_sorcery_object_ami_set_type_name(), sorcery_astdb_create(), sorcery_astdb_delete(), sorcery_astdb_update(), and stale_item_update().
unsigned int ast_sorcery_object_has_dynamic_contents | ( | const void * | object | ) |
Get whether an object contains dynamic contents or not.
object | Pointer to a sorcery object |
Definition at line 2377 of file sorcery.c.
References ast_sorcery_object::has_dynamic_contents, and ast_sorcery_object_details::object.
Referenced by sorcery_config_internal_load().
int ast_sorcery_object_id_compare | ( | void * | obj, |
void * | arg, | ||
int | flags | ||
) |
ao2 object comparator based on sorcery id.
Definition at line 2464 of file sorcery.c.
References ast_sorcery_object_id_sort(), and CMP_MATCH.
Referenced by ast_media_cache_init(), cli_aor_get_container(), cli_endpoint_get_container(), cli_get_container(), handle_registrations(), sip_options_aor_alloc(), and sorcery_config_internal_load().
int ast_sorcery_object_id_hash | ( | const void * | obj, |
int | flags | ||
) |
ao2 object hasher based on sorcery id.
Definition at line 2475 of file sorcery.c.
References ast_assert, ast_sorcery_object_get_id(), ast_str_hash(), OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, and OBJ_SEARCH_OBJECT.
Referenced by ast_media_cache_init(), sip_options_aor_alloc(), and sorcery_config_internal_load().
int ast_sorcery_object_id_sort | ( | const void * | obj, |
const void * | arg, | ||
int | flags | ||
) |
ao2 object sorter based on sorcery id.
Definition at line 2440 of file sorcery.c.
References ast_sorcery_object_get_id(), OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and OBJ_SEARCH_PARTIAL_KEY.
Referenced by ast_sorcery_object_id_compare(), cli_aor_get_container(), cli_endpoint_get_container(), cli_get_container(), geoloc_config_list_locations(), geoloc_config_list_profiles(), geoloc_config_show_profiles(), and sip_options_aor_alloc().
int ast_sorcery_object_set_congestion_levels | ( | struct ast_sorcery * | sorcery, |
const char * | type, | ||
long | low_water, | ||
long | high_water | ||
) |
Set the high and low alert water marks of the sorcery object type.
sorcery | Pointer to a sorcery structure |
type | Type of object |
low_water | New queue low water mark. (-1 to set as 90% of high_water) |
high_water | New queue high water mark. |
0 | on success. |
-1 | on error (water marks not changed). |
Definition at line 1114 of file sorcery.c.
References ao2_find, ao2_ref, ast_taskprocessor_alert_set_levels(), OBJ_SEARCH_KEY, ast_sorcery_object_type::serializer, sorcery, type, and ast_sorcery::types.
Referenced by ast_sip_initialize_sorcery_location().
void ast_sorcery_object_set_copy_handler | ( | struct ast_sorcery * | sorcery, |
const char * | type, | ||
sorcery_copy_handler | copy | ||
) |
Set the copy handler for an object type.
sorcery | Pointer to a sorcery structure |
type | Type of object |
copy | Copy handler |
Definition at line 1128 of file sorcery.c.
References ao2_cleanup, ao2_find, copy(), OBJ_KEY, RAII_VAR, sorcery, type, and ast_sorcery::types.
Referenced by ast_bucket_init(), and AST_TEST_DEFINE().
void ast_sorcery_object_set_diff_handler | ( | struct ast_sorcery * | sorcery, |
const char * | type, | ||
sorcery_diff_handler | diff | ||
) |
Set the diff handler for an object type.
sorcery | Pointer to a sorcery structure |
type | Type of object |
diff | Diff handler |
Definition at line 1139 of file sorcery.c.
References ao2_cleanup, ao2_find, ast_sorcery_object_type::diff, OBJ_KEY, RAII_VAR, sorcery, type, and ast_sorcery::types.
Referenced by AST_TEST_DEFINE().
int ast_sorcery_object_set_extended | ( | const void * | object, |
const char * | name, | ||
const char * | value | ||
) |
Set an extended field value on a sorcery object.
object | Pointer to a sorcery object |
name | Name of the extended field |
value | Value of the extended field |
0 | success |
-1 | failure |
Definition at line 2349 of file sorcery.c.
References ast_variable_new, ast_variables_destroy(), ast_sorcery_object::extended, name, ast_variable::next, NULL, ast_sorcery_object_details::object, RAII_VAR, and value.
Referenced by AST_TEST_DEFINE(), and sorcery_extended_config_handler().
void ast_sorcery_object_set_has_dynamic_contents | ( | const void * | object | ) |
Set the dynamic contents flag on a sorcery object.
object | Pointer to a sorcery object |
Definition at line 2384 of file sorcery.c.
References ast_sorcery_object::has_dynamic_contents, and ast_sorcery_object_details::object.
Referenced by ip_identify_apply(), and transport_tls_file_handler().
int ast_sorcery_object_unregister | ( | struct ast_sorcery * | sorcery, |
const char * | type | ||
) |
Unregister an object type.
sorcery | Pointer to a sorcery structure |
type | Type of object |
0 | success |
-1 | failure |
Definition at line 1061 of file sorcery.c.
References ACO_ITEM, ao2_cleanup, ao2_find, ao2_unlink_flags, ao2_unlock, ao2_wrlock, OBJ_NOLOCK, OBJ_SEARCH_KEY, sorcery, type, aco_type::type, ast_sorcery_object_type::type, and ast_sorcery::types.
Referenced by geoloc_config_unload(), and unload_module().
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.
sorcery | Pointer to a sorcery structure |
object | Pointer to a sorcery object |
objectset | Object set itself |
0 | success |
-1 | failure |
Definition at line 1632 of file sorcery.c.
References aco_process_var(), ao2_cleanup, ao2_find, ast_variables_destroy(), ast_sorcery_object::id, ast_variable::next, NULL, OBJ_KEY, ast_sorcery_object_details::object, RAII_VAR, sorcery, ast_sorcery_object::type, and ast_sorcery::types.
Referenced by ast_ari_asterisk_update_object(), ast_sorcery_copy(), AST_TEST_DEFINE(), create_effective_profile(), create_object(), sorcery_astdb_retrieve_fields_common(), sorcery_astdb_retrieve_id(), sorcery_astdb_retrieve_prefix(), sorcery_astdb_retrieve_regex(), sorcery_config_internal_load(), sorcery_realtime_retrieve_fields(), and sorcery_realtime_retrieve_multiple().
struct ast_variable * ast_sorcery_objectset_create2 | ( | const struct ast_sorcery * | sorcery, |
const void * | object, | ||
enum ast_sorcery_field_handler_flags | flags | ||
) |
Create an object set (KVP list) for an object.
sorcery | Pointer to a sorcery structure |
object | Pointer to a sorcery object |
flags | Flags indicating which handler to use and in what order. |
non-NULL | success |
NULL | if error occurred |
Definition at line 1511 of file sorcery.c.
References ao2_cleanup, ao2_find, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, AST_HANDLER_ONLY_LIST, AST_HANDLER_ONLY_STRING, AST_HANDLER_PREFER_LIST, AST_HANDLER_PREFER_STRING, ast_variable_list_append_hint(), get_multiple_fields_as_var_list(), get_single_field_as_var_list(), NULL, OBJ_KEY, ast_sorcery_object_details::object, RAII_VAR, sorcery, tmp(), ast_sorcery_object::type, and ast_sorcery::types.
Referenced by ast_sip_sorcery_object_to_ami(), config_object_cli_show(), and sip_aor_to_ami().
struct ast_json * ast_sorcery_objectset_json_create | ( | const struct ast_sorcery * | sorcery, |
const void * | object | ||
) |
Create an object set in JSON format for an object.
sorcery | Pointer to a sorcery structure |
object | Pointer to a sorcery object |
non-NULL | success |
NULL | if error occurred |
Definition at line 1565 of file sorcery.c.
References ao2_cleanup, ao2_find, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_sorcery_object_field::args, ast_debug, ast_free, ast_json_object_create(), ast_json_object_set(), ast_json_string_create(), ast_json_unref(), ast_variables_destroy(), buf, ast_sorcery_object_field::handler, ast_sorcery_object_field::multiple_handler, ast_variable::name, ast_sorcery_object_field::name, ast_variable::next, NULL, OBJ_KEY, ast_sorcery_object_details::object, RAII_VAR, sorcery, tmp(), ast_sorcery_object::type, ast_sorcery::types, ast_variable::value, and value.
Referenced by ast_bucket_file_json(), ast_bucket_json(), AST_TEST_DEFINE(), and sorcery_astdb_create().
int ast_sorcery_observer_add | ( | const struct ast_sorcery * | sorcery, |
const char * | type, | ||
const struct ast_sorcery_observer * | callbacks | ||
) |
Add an observer to a specific object type.
sorcery | Pointer to a sorcery structure |
type | Type of object that should be observed |
callbacks | Implementation of the observer interface |
0 | success |
-1 | failure |
Definition at line 2391 of file sorcery.c.
References ao2_alloc, ao2_cleanup, ao2_find, ao2_link, ao2_ref, callbacks, NULL, OBJ_KEY, observer, RAII_VAR, sorcery, type, and ast_sorcery::types.
Referenced by ast_bucket_file_observer_add(), ast_bucket_observer_add(), ast_res_pjsip_initialize_configuration(), ast_sip_initialize_distributor(), ast_sip_initialize_sorcery_location(), ast_sip_initialize_transport_management(), AST_TEST_DEFINE(), load_module(), pjsip_outbound_registration_metrics_init(), and sip_options_init_task().
void ast_sorcery_observer_remove | ( | const struct ast_sorcery * | sorcery, |
const char * | type, | ||
const struct ast_sorcery_observer * | callbacks | ||
) |
Remove an observer from a specific object type.
sorcery | Pointer to a sorcery structure |
type | Type of object that should no longer be observed |
callbacks | Implementation of the observer interface |
Definition at line 2423 of file sorcery.c.
References ao2_callback, ao2_cleanup, ao2_find, callbacks, NULL, OBJ_KEY, OBJ_NODATA, OBJ_UNLINK, RAII_VAR, sorcery, sorcery_observer_remove(), type, and ast_sorcery::types.
Referenced by ast_bucket_file_observer_remove(), ast_bucket_observer_remove(), ast_res_pjsip_cleanup_options_handling(), ast_sip_destroy_distributor(), ast_sip_destroy_sorcery_location(), ast_sip_destroy_transport_management(), load_module(), pjsip_outbound_registration_metrics_init(), pjsip_outbound_registration_metrics_unload_cb(), and unload_module().
void ast_sorcery_ref | ( | struct ast_sorcery * | sorcery | ) |
void ast_sorcery_reload | ( | const struct ast_sorcery * | sorcery | ) |
Inform any wizards to reload persistent objects.
sorcery | Pointer to a sorcery structure |
Definition at line 1408 of file sorcery.c.
References ao2_callback, ast_sorcery::module_name, NOTIFY_INSTANCE_OBSERVERS, OBJ_NODATA, ast_sorcery::observers, sorcery_load_details::sorcery, sorcery, sorcery_object_load(), and ast_sorcery::types.
Referenced by ast_res_pjsip_reload_configuration(), AST_TEST_DEFINE(), geoloc_config_reload(), load_module(), and reload_module().
void ast_sorcery_reload_object | ( | const struct ast_sorcery * | sorcery, |
const char * | type | ||
) |
Inform any wizards of a specific object type to reload persistent objects.
sorcery | Pointer to a sorcery structure |
type | Name of the object type to reload |
Definition at line 1442 of file sorcery.c.
References ao2_cleanup, ao2_find, OBJ_KEY, RAII_VAR, sorcery_load_details::sorcery, sorcery, sorcery_object_load(), type, and ast_sorcery::types.
Referenced by apply_list_configuration(), ast_sip_initialize_distributor(), ast_sip_initialize_transport_management(), AST_TEST_DEFINE(), load_module(), load_users(), and reload_module().
void * ast_sorcery_retrieve_by_fields | ( | const struct ast_sorcery * | sorcery, |
const char * | type, | ||
unsigned int | flags, | ||
struct ast_variable * | fields | ||
) |
Retrieve an object or multiple objects using specific fields.
sorcery | Pointer to a sorcery structure |
type | Type of object to retrieve |
flags | Flags to control behavior |
fields | Optional object fields and values to match against |
non-NULL | if found |
NULL | if not found |
Example:
The following code can be significantly faster when a realtime backend is in use because the expression "qualify_frequency > 0" is passed to the database to limit the number of rows returned.
struct ast_variable *var = ast_variable_new("qualify_frequency >", "0", ""); struct ao2_container *aors;
if (!var) { return; }
aors = ast_sorcery_retrieve_by_fields(ast_sip_get_sorcery(), "aor", AST_RETRIEVE_FLAG_MULTIPLE, var);
Definition at line 1897 of file sorcery.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_list, ao2_container_count(), ao2_find, AST_RETRIEVE_FLAG_MULTIPLE, AST_VECTOR_CALLBACK, AST_VECTOR_GET, AST_VECTOR_RW_RDLOCK, AST_VECTOR_RW_UNLOCK, AST_VECTOR_SIZE, ast_sorcery_internal_wizard::callbacks, NULL, OBJ_KEY, RAII_VAR, ast_sorcery_wizard::retrieve_fields, ast_sorcery_wizard::retrieve_multiple, sorcery_details::sorcery, sorcery, sorcery_cache_create(), type, ast_sorcery::types, and ast_sorcery_object_wizard::wizard.
Referenced by acl_on_rx_msg(), ami_show_registration_contact_statuses(), ami_show_resource_lists(), ast_aeap_client_configs_get(), ast_mwi_mailbox_get_all(), ast_sip_get_endpoints(), ast_sip_initialize_sorcery_transport(), ast_sip_initialize_system(), ast_sip_location_prune_boot_contacts(), AST_TEST_DEFINE(), asterisk_publication_send_refresh(), auth_observer(), check_expiration_thread(), cli_complete_registration(), cli_contact_get_container(), cli_get_aors(), cli_get_auths(), cli_iterator(), common_identify(), create_mwi_subscriptions(), eprofile_get_all(), format_ami_endpoint_identify(), geoloc_config_list_locations(), geoloc_config_list_profiles(), geoloc_config_show_profiles(), get_all_contacts(), get_publishes_and_update_state(), get_registrations(), get_system_cfg(), get_tn_all(), global_loaded_observer(), handle_export_primitives(), load_all_endpoints(), load_users(), memory_cache_populate(), process_nat(), profile_get_all(), sip_options_aor_observer_modified_task(), sip_options_synchronize_task(), stale_cache_update(), and subscription_persistence_load().
void * ast_sorcery_retrieve_by_id | ( | const struct ast_sorcery * | sorcery, |
const char * | type, | ||
const char * | id | ||
) |
Retrieve an object using its unique identifier.
sorcery | Pointer to a sorcery structure |
type | Type of object to retrieve |
id | Unique object identifier |
non-NULL | if found |
NULL | if not found |
Definition at line 1853 of file sorcery.c.
References ao2_find, ao2_ref, ast_strlen_zero(), AST_VECTOR_CALLBACK, AST_VECTOR_GET, AST_VECTOR_RW_RDLOCK, AST_VECTOR_RW_UNLOCK, AST_VECTOR_SIZE, ast_sorcery_internal_wizard::callbacks, ast_sorcery_object_type::name, NULL, OBJ_SEARCH_KEY, ast_sorcery_wizard::retrieve_id, sorcery_details::sorcery, sorcery, sorcery_cache_create(), type, ast_sorcery::types, ast_sorcery_object_wizard::wizard, and ast_sorcery_object_type::wizards.
Referenced by add_security_headers(), ami_show_endpoint(), ami_sip_qualify(), anonymous_identify(), as_get_cfg(), as_is_config_loaded(), ast_ari_asterisk_delete_object(), ast_ari_asterisk_get_object(), ast_ari_asterisk_update_object(), ast_bucket_file_retrieve(), ast_bucket_retrieve(), ast_geoloc_datastore_create_from_profile_name(), ast_geoloc_eprofile_refresh_location(), ast_geoloc_get_location(), ast_geoloc_get_profile(), ast_mwi_mailbox_get(), ast_mwi_mailbox_update(), ast_sip_default_outbound_endpoint(), ast_sip_for_each_auth(), ast_sip_location_retrieve_aor(), ast_sip_location_retrieve_contact(), ast_sip_retrieve_auths(), ast_sip_retrieve_auths_vector(), ast_sip_rewrite_uri_to_local(), ast_sip_set_tpselector_from_transport_name(), AST_TEST_DEFINE(), asterisk_publication_devicestate_state_change(), asterisk_publication_mwi_state_change(), asterisk_publication_new(), chan_pjsip_devicestate(), check_state(), cli_aor_retrieve_by_id(), cli_endpoint_retrieve_by_id(), cli_iterate(), cli_qualify(), cli_reload_qualify_aor(), cli_reload_qualify_endpoint(), cli_retrieve_by_id(), cli_show_qualify_endpoint(), client_config_get(), common_identify(), contact_observer_updated(), create_effective_profile(), create_rtp(), eprofile_get_cfg(), find_aor2(), find_aor_name(), find_endpoint(), format_ami_endpoint_transport(), geoloc_profile_apply_handler(), get_log_mappings(), get_write_timeout(), handle_atsign(), handle_registration_response(), handle_single_token(), handle_slash(), line_identify(), load_endpoint(), mwi_contact_changed(), mwi_contact_deleted(), mwi_subscription_shutdown(), on_rx_process_symmetric_transport(), pjsip_acf_dial_contacts_read(), pjsip_aor_function_read(), pjsip_contact_function_read(), pjsip_endpoint_function_read(), process_nat(), profile_get_cfg(), publish_request_initial(), push_notify(), request(), retrieve_resource_list(), send_unsolicited_mwi_notify(), sip_options_contact_add_management_task(), sip_options_qualify_contact(), sorcery_function_read(), sorcery_memory_cache_thrash_retrieve(), stale_item_update(), sub_persistence_recreate(), t38_initialize_session(), tn_get_cfg(), tn_get_etn(), transfer(), vs_get_cfg(), and vs_is_config_loaded().
struct ast_sorcery * ast_sorcery_retrieve_by_module_name | ( | const char * | module_name | ) |
Search function for sorcery instances.
Retrieves an existing sorcery instance by module name.
Definition at line 672 of file sorcery.c.
References ao2_weakproxy_find, instances, ast_sorcery::module_name, and OBJ_SEARCH_KEY.
Referenced by ast_ari_asterisk_delete_object(), ast_ari_asterisk_get_object(), ast_ari_asterisk_update_object(), AST_TEST_DEFINE(), and sorcery_function_read().
struct ao2_container * ast_sorcery_retrieve_by_prefix | ( | const struct ast_sorcery * | sorcery, |
const char * | type, | ||
const char * | prefix, | ||
const size_t | prefix_len | ||
) |
Retrieve multiple objects whose id begins with the specified prefix.
sorcery | Pointer to a sorcery structure |
type | Type of object to retrieve |
prefix | Object id prefix |
prefix_len | The length of prefix in bytes |
non-NULL | if error occurs |
NULL | success |
Definition at line 1989 of file sorcery.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_list, ao2_container_count(), ao2_find, AST_VECTOR_GET, AST_VECTOR_RW_RDLOCK, AST_VECTOR_RW_UNLOCK, AST_VECTOR_SIZE, ast_sorcery_internal_wizard::callbacks, NULL, OBJ_KEY, prefix, RAII_VAR, ast_sorcery_wizard::retrieve_prefix, sorcery, type, ast_sorcery::types, and ast_sorcery_object_wizard::wizard.
Referenced by aor_deleted_observer(), ast_sip_location_retrieve_aor_contacts_nolock_filtered(), cli_complete_endpoint(), and sip_options_apply_aor_configuration().
struct ao2_container * ast_sorcery_retrieve_by_regex | ( | const struct ast_sorcery * | sorcery, |
const char * | type, | ||
const char * | regex | ||
) |
Retrieve multiple objects using a regular expression on their id.
sorcery | Pointer to a sorcery structure |
type | Type of object to retrieve |
regex | Regular expression |
non-NULL | if error occurs |
NULL | success |
Definition at line 1954 of file sorcery.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_list, ao2_container_count(), ao2_find, AST_VECTOR_GET, AST_VECTOR_RW_RDLOCK, AST_VECTOR_RW_UNLOCK, AST_VECTOR_SIZE, ast_sorcery_internal_wizard::callbacks, NULL, OBJ_KEY, RAII_VAR, regex(), ast_sorcery_wizard::retrieve_regex, sorcery, type, ast_sorcery::types, and ast_sorcery_object_wizard::wizard.
Referenced by ast_mwi_mailbox_get_by_regex(), AST_TEST_DEFINE(), cli_aor_get_container(), cli_contact_get_container(), cli_endpoint_get_container(), cli_get_container(), geoloc_config_list_locations(), geoloc_config_list_profiles(), and geoloc_config_show_profiles().
int ast_sorcery_update | ( | const struct ast_sorcery * | sorcery, |
void * | object | ||
) |
Update an object.
sorcery | Pointer to a sorcery structure |
object | Pointer to a sorcery object |
0 | success |
-1 | failure |
Definition at line 2150 of file sorcery.c.
References ao2_cleanup, ao2_container_count(), ao2_find, ast_taskprocessor_push(), AST_VECTOR_GET, AST_VECTOR_RW_RDLOCK, AST_VECTOR_RW_UNLOCK, AST_VECTOR_SIZE, ast_sorcery_object_wizard::caching, CMP_MATCH, NULL, OBJ_KEY, ast_sorcery_object_details::object, sorcery_observer_invocation::object_type, RAII_VAR, ast_sorcery_object_type::serializer, sorcery_details::sorcery, sorcery, sorcery_observer_invocation_alloc(), sorcery_observers_notify_update(), sorcery_wizard_update(), ast_sorcery_object::type, ast_sorcery::types, and ast_sorcery_object_type::wizards.
Referenced by ast_ari_asterisk_update_object(), ast_bucket_file_update(), ast_mwi_mailbox_update(), ast_sip_location_update_contact(), AST_TEST_DEFINE(), create_effective_profile(), sorcery_memory_cache_thrash_update(), and subscription_persistence_update().
int ast_sorcery_wizard_observer_add | ( | struct ast_sorcery_wizard * | wizard, |
const struct ast_sorcery_wizard_observer * | callbacks | ||
) |
Add an observer to a sorcery wizard.
wizard | Pointer to a previously registered wizard structure |
callbacks | Implementation of the wizard observer interface |
A wizard observer is notified... Before a wizard is loaded or reloaded. After a wizard is loaded or reloaded.
0 | success |
-1 | failure |
Definition at line 543 of file sorcery.c.
References ao2_alloc, ao2_cleanup, ao2_find, ao2_link, ao2_ref, sorcery_wizard_observer::callbacks, callbacks, ast_sorcery_wizard::name, NULL, OBJ_SEARCH_KEY, RAII_VAR, and wizards.
Referenced by AST_TEST_DEFINE().
void ast_sorcery_wizard_observer_remove | ( | struct ast_sorcery_wizard * | interface, |
const struct ast_sorcery_wizard_observer * | callbacks | ||
) |
Remove an observer from a sorcery wizard.
interface | Pointer to a sorcery structure |
callbacks | Implementation of the wizard observer interface |
Definition at line 568 of file sorcery.c.
References ao2_callback, ao2_cleanup, ao2_find, callbacks, ast_sorcery_wizard::name, NULL, OBJ_NODATA, OBJ_SEARCH_KEY, OBJ_UNLINK, RAII_VAR, sorcery_generic_observer_remove(), and wizards.
Referenced by AST_TEST_DEFINE().
int ast_sorcery_wizard_unregister | ( | const struct ast_sorcery_wizard * | interface | ) |
Unregister a sorcery wizard.
interface | Pointer to the wizard interface |
0 | success |
-1 | failure |
Definition at line 474 of file sorcery.c.
References ao2_find, ao2_ref, ao2_unlink, ast_verb, ast_sorcery_internal_wizard::callbacks, if(), name, ast_sorcery_wizard::name, NOTIFY_GLOBAL_OBSERVERS, NULL, OBJ_SEARCH_KEY, observers, and wizards.
Referenced by AST_TEST_DEFINE(), bucket_cleanup(), sorcery_memory_cache_thrash_destroy(), and unload_module().
AST_VECTOR_RW | ( | ast_sorcery_object_wizards | , |
struct ast_sorcery_object_wizard * | |||
) |
Interface for a sorcery object type wizards.
|
static |
Definition at line 310 of file sorcery.c.
References args, ast_strdup, and buf.
Referenced by sorcery_field_default_handler().
|
static |
Definition at line 328 of file sorcery.c.
References args, ast_strdup, and buf.
Referenced by sorcery_field_default_handler().
|
static |
Definition at line 334 of file sorcery.c.
References args, ast_format_cap_get_names(), AST_FORMAT_CAP_NAMES_LEN, ast_str_alloca, ast_strdup, and buf.
Referenced by sorcery_field_default_handler().
|
static |
Definition at line 298 of file sorcery.c.
References args, ast_asprintf, and buf.
Referenced by sorcery_field_default_handler().
|
static |
Definition at line 1495 of file sorcery.c.
References ast_variables_destroy(), ast_sorcery_object_field::multiple_handler, NULL, and tmp().
Referenced by ast_sorcery_objectset_create2().
|
static |
Definition at line 1478 of file sorcery.c.
References ast_sorcery_object_field::args, ast_free, ast_variable_new, buf, ast_sorcery_object_field::handler, ast_sorcery_object_field::name, NULL, S_OR, and tmp().
Referenced by ast_sorcery_objectset_create2().
|
static |
Definition at line 286 of file sorcery.c.
References args, ast_asprintf, and buf.
Referenced by sorcery_field_default_handler().
|
static |
Definition at line 2500 of file sorcery.c.
References CMP_MATCH, name, ast_sorcery_object_field::name_regex, and NULL.
Referenced by ast_sorcery_is_object_field_registered().
|
static |
Definition at line 322 of file sorcery.c.
References args, ast_sockaddr_stringify(), ast_strdup, and buf.
Referenced by sorcery_field_default_handler().
|
static |
Internal function used to create an object in caching wizards.
Definition at line 1839 of file sorcery.c.
References ast_sorcery_object_wizard::caching, ast_sorcery_internal_wizard::callbacks, ast_sorcery_wizard::create, ast_sorcery_object_wizard::data, sorcery_details::obj, sorcery_details::sorcery, and ast_sorcery_object_wizard::wizard.
Referenced by ast_sorcery_retrieve_by_fields(), and ast_sorcery_retrieve_by_id().
|
static |
Hashing and comparison functions for sorcery wizards.
Cleanup function for graceful shutdowns
Definition at line 369 of file sorcery.c.
References ao2_cleanup, ast_threadpool_shutdown(), instances, NULL, observers, threadpool, and wizards.
Referenced by ast_sorcery_init().
|
static |
Destructor called when sorcery structure is destroyed.
Definition at line 581 of file sorcery.c.
References ao2_cleanup, ast_sorcery::module_name, NOTIFY_GLOBAL_OBSERVERS, ast_sorcery::observers, observers, sorcery, and ast_sorcery::types.
Referenced by __ast_sorcery_open().
|
static |
Definition at line 1043 of file sorcery.c.
References ast_sorcery_object_set_extended(), and var.
Referenced by __ast_sorcery_object_register().
|
static |
Definition at line 1048 of file sorcery.c.
References ast_variables_dup(), ast_sorcery_object::extended, NULL, and ast_sorcery_object_details::object.
Referenced by __ast_sorcery_object_register().
|
static |
Definition at line 341 of file sorcery.c.
References bool_handler_fn(), chararray_handler_fn(), codec_handler_fn(), double_handler_fn(), int_handler_fn(), NULL, OPT_BOOL_T, OPT_CHAR_ARRAY_T, OPT_CODEC_T, OPT_CUSTOM_T, OPT_DOUBLE_T, OPT_INT_T, OPT_SOCKADDR_T, OPT_STRINGFIELD_T, OPT_UINT_T, OPT_YESNO_T, sockaddr_handler_fn(), stringfield_handler_fn(), type, uint_handler_fn(), and yesno_handler_fn().
Referenced by __ast_sorcery_object_field_register().
|
static |
Internal callback function for removing a generic observer.
Definition at line 491 of file sorcery.c.
References CMP_MATCH, and observer.
Referenced by ast_sorcery_global_observer_remove(), ast_sorcery_instance_observer_remove(), and ast_sorcery_wizard_observer_remove().
|
static |
Definition at line 425 of file sorcery.c.
References ao2_cleanup, and ast_sorcery_internal_wizard::observers.
Referenced by __ast_sorcery_wizard_register().
|
static |
Definition at line 1700 of file sorcery.c.
References ast_free, ast_variables_destroy(), ast_sorcery_object::destructor, ast_sorcery_object::extended, ast_sorcery_object::id, and ast_sorcery_object_details::object.
Referenced by ast_sorcery_generic_alloc(), and ast_sorcery_lockable_alloc().
|
static |
Definition at line 1150 of file sorcery.c.
References ast_free, and ast_sorcery_object_field::name_regex.
Referenced by ast_sorcery_object_fields_register().
|
static |
Definition at line 1336 of file sorcery.c.
References ao2_cleanup, ao2_container_count(), ast_log, ast_taskprocessor_push(), AST_VECTOR_CALLBACK, AST_VECTOR_RW_RDLOCK, AST_VECTOR_RW_UNLOCK, LOG_NOTICE, ast_sorcery::module_name, NOTIFY_INSTANCE_OBSERVERS, NULL, ast_sorcery::observers, sorcery_load_details::reload, sorcery_load_details::sorcery, sorcery_observer_invocation_alloc(), sorcery_observers_notify_loaded(), sorcery_reloadable(), sorcery_wizard_load(), type, and sorcery_load_details::type.
Referenced by ast_sorcery_force_reload(), ast_sorcery_force_reload_object(), ast_sorcery_load(), ast_sorcery_load_object(), ast_sorcery_reload(), and ast_sorcery_reload_object().
|
static |
Internal function which allocates an object type structure.
Definition at line 700 of file sorcery.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_container_alloc_hash, ao2_container_alloc_list, ao2_ref, ast_calloc, ast_copy_string(), ast_taskprocessor_build_name(), AST_TASKPROCESSOR_MAX_NAME, ast_threadpool_serializer(), AST_VECTOR_RW_INIT, ast_sorcery_object_type::fields, ast_sorcery_object_type::file, aco_info::files, ast_sorcery_object_type::info, INITIAL_WIZARD_VECTOR_SIZE, aco_info::module, ast_sorcery_object_type::name, NULL, OBJECT_FIELD_BUCKETS, ast_sorcery_object_type::observers, ast_sorcery_object_type::serializer, sorcery_object_type_destructor(), threadpool, type, aco_file::types, and ast_sorcery_object_type::wizards.
Referenced by __ast_sorcery_object_type_insert_wizard().
|
static |
Destructor function for object types.
Definition at line 678 of file sorcery.c.
References aco_info_destroy(), ao2_cleanup, ast_free, ast_taskprocessor_unreference(), AST_VECTOR_CALLBACK_VOID, AST_VECTOR_RW_FREE, AST_VECTOR_RW_UNLOCK, AST_VECTOR_RW_WRLOCK, ast_sorcery_object_type::fields, ast_sorcery_object_type::file, ast_sorcery_object_type::info, ast_sorcery_object_type::observers, ast_sorcery_object_type::serializer, and ast_sorcery_object_type::wizards.
Referenced by sorcery_object_type_alloc().
|
static |
Object wizard destructor.
Definition at line 762 of file sorcery.c.
References ao2_cleanup, ast_module_unref, ast_sorcery_internal_wizard::callbacks, ast_sorcery_wizard::close, ast_sorcery_object_wizard::data, ast_sorcery_wizard::module, and ast_sorcery_object_wizard::wizard.
Referenced by __ast_sorcery_object_type_insert_wizard().
|
static |
Allocator function for observer invocation.
Definition at line 1292 of file sorcery.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_ref, NULL, sorcery_observer_invocation::object, sorcery_observer_invocation::object_type, and sorcery_observer_invocation_destroy().
Referenced by ast_sorcery_create(), ast_sorcery_delete(), ast_sorcery_update(), and sorcery_object_load().
|
static |
Destructor for observer invocation.
Definition at line 1283 of file sorcery.c.
References ao2_cleanup, sorcery_observer_invocation::object, and sorcery_observer_invocation::object_type.
Referenced by sorcery_observer_invocation_alloc().
|
static |
Internal callback function which notifies an individual observer that an object has been created.
Definition at line 2040 of file sorcery.c.
References observer.
Referenced by sorcery_observers_notify_create().
|
static |
Internal callback function which notifies an individual observer that an object has been deleted.
Definition at line 2201 of file sorcery.c.
References observer.
Referenced by sorcery_observers_notify_delete().
|
static |
Internal callback function which notifies an individual observer that an object type has been loaded.
Definition at line 1314 of file sorcery.c.
References observer.
Referenced by sorcery_observers_notify_loaded().
|
static |
Internal callback function which notifies an individual observer that an object has been updated.
Definition at line 2113 of file sorcery.c.
References observer.
Referenced by sorcery_observers_notify_update().
|
static |
Internal callback function for removing an observer.
Definition at line 2416 of file sorcery.c.
References CMP_MATCH, and observer.
Referenced by ast_sorcery_observer_remove().
|
static |
Internal callback function which notifies observers that an object has been created.
Definition at line 2052 of file sorcery.c.
References ao2_callback, ao2_cleanup, OBJ_NODATA, sorcery_observer_invocation::object, sorcery_observer_invocation::object_type, ast_sorcery_object_type::observers, and sorcery_observer_notify_create().
Referenced by ast_sorcery_create().
|
static |
Internal callback function which notifies observers that an object has been deleted.
Definition at line 2213 of file sorcery.c.
References ao2_callback, ao2_cleanup, OBJ_NODATA, sorcery_observer_invocation::object, sorcery_observer_invocation::object_type, ast_sorcery_object_type::observers, and sorcery_observer_notify_delete().
Referenced by ast_sorcery_delete().
|
static |
Internal callback function which notifies observers that an object type has been loaded.
Definition at line 1326 of file sorcery.c.
References ao2_callback, ao2_cleanup, ast_sorcery_object_type::name, OBJ_NODATA, sorcery_observer_invocation::object_type, ast_sorcery_object_type::observers, and sorcery_observer_notify_loaded().
Referenced by sorcery_object_load().
|
static |
Internal callback function which notifies observers that an object has been updated.
Definition at line 2125 of file sorcery.c.
References ao2_callback, ao2_cleanup, OBJ_NODATA, sorcery_observer_invocation::object, sorcery_observer_invocation::object_type, ast_sorcery_object_type::observers, and sorcery_observer_notify_update().
Referenced by ast_sorcery_update().
|
static |
Hashing function for sorcery types.
Definition at line 596 of file sorcery.c.
References ao2_unlink, and instances.
Referenced by __ast_sorcery_open().
|
static |
Retrieves whether or not the type is reloadable.
Definition at line 1246 of file sorcery.c.
References ao2_cleanup, ao2_find, OBJ_KEY, RAII_VAR, sorcery, type, and ast_sorcery::types.
Referenced by sorcery_object_load().
|
static |
Internal function which returns if the wizard has created the object.
Definition at line 2025 of file sorcery.c.
References ast_debug, ast_sorcery_internal_wizard::callbacks, CMP_MATCH, ast_sorcery_wizard::create, ast_sorcery_object_wizard::data, ast_sorcery_wizard::name, sorcery_details::obj, ast_sorcery_object_wizard::read_only, sorcery_details::sorcery, and ast_sorcery_object_wizard::wizard.
Referenced by ast_sorcery_create().
|
static |
Internal function which returns if a wizard has deleted the object.
Definition at line 2224 of file sorcery.c.
References ast_debug, ast_sorcery_internal_wizard::callbacks, CMP_MATCH, ast_sorcery_object_wizard::data, ast_sorcery_wizard::delete, ast_sorcery_wizard::name, sorcery_details::obj, ast_sorcery_object_wizard::read_only, sorcery_details::sorcery, and ast_sorcery_object_wizard::wizard.
Referenced by ast_sorcery_delete().
|
static |
Definition at line 1253 of file sorcery.c.
References ast_sorcery_internal_wizard::callbacks, ast_sorcery_object_wizard::data, sorcery_load_details::force, ast_sorcery_wizard::force_reload, ast_sorcery_wizard::load, ast_sorcery_wizard::name, NOTIFY_WIZARD_OBSERVERS, ast_sorcery_internal_wizard::observers, ast_sorcery_wizard::reload, sorcery_load_details::reload, sorcery_load_details::sorcery, sorcery, type, sorcery_load_details::type, and ast_sorcery_object_wizard::wizard.
Referenced by sorcery_object_load().
|
static |
Internal function which returns if a wizard has updated the object.
Definition at line 2136 of file sorcery.c.
References ast_debug, ast_sorcery_internal_wizard::callbacks, CMP_MATCH, ast_sorcery_object_wizard::data, ast_sorcery_wizard::name, sorcery_details::obj, ast_sorcery_object_wizard::read_only, sorcery_details::sorcery, ast_sorcery_wizard::update, and ast_sorcery_object_wizard::wizard.
Referenced by ast_sorcery_update().
|
static |
Definition at line 304 of file sorcery.c.
References args, ast_strdup, and buf.
Referenced by sorcery_field_default_handler().
|
static |
Definition at line 292 of file sorcery.c.
References args, ast_asprintf, and buf.
Referenced by sorcery_field_default_handler().
|
static |
Definition at line 316 of file sorcery.c.
References args, ast_strdup, and buf.
Referenced by sorcery_field_default_handler().
|
static |
Registered sorcery instances.
Definition at line 284 of file sorcery.c.
Referenced by __ast_sorcery_open(), ast_sorcery_init(), ast_sorcery_retrieve_by_module_name(), sorcery_cleanup(), and sorcery_proxy_cb().
struct ao2_container* observers |
Registered global observers.
Definition at line 281 of file sorcery.c.
Referenced by __ast_sorcery_open(), __ast_sorcery_wizard_register(), ast_sorcery_global_observer_add(), ast_sorcery_global_observer_remove(), ast_sorcery_init(), ast_sorcery_wizard_unregister(), sorcery_cleanup(), and sorcery_destructor().
|
static |
Thread pool for observers.
Definition at line 86 of file sorcery.c.
Referenced by ast_serializer_pool_create(), ast_sip_initialize_system(), ast_sorcery_init(), AST_TEST_DEFINE(), sorcery_cleanup(), and sorcery_object_type_alloc().
|
static |
Registered sorcery wizards.
Definition at line 257 of file sorcery.c.
Referenced by __ast_sorcery_object_type_insert_wizard(), __ast_sorcery_wizard_register(), ast_sorcery_init(), ast_sorcery_wizard_observer_add(), ast_sorcery_wizard_observer_remove(), ast_sorcery_wizard_unregister(), and sorcery_cleanup().