28 #define CONFIG_TYPE "general" 30 #define DEFAULT_CA_FILE "" 31 #define DEFAULT_CA_PATH "" 32 #define DEFAULT_CACHE_MAX_SIZE 1000 33 #define DEFAULT_CURL_TIMEOUT 2 34 #define DEFAULT_SIGNATURE_TIMEOUT 15 127 const char *object_type,
int reloaded)
136 if (default_config) {
138 default_config =
NULL;
149 if (default_config) {
164 e->
command =
"stir_shaken show general";
166 "Usage: stir_shaken show general\n" 167 " Show the general stir/shaken settings\n";
238 &stir_shaken_general_observer);
240 if (default_config) {
242 default_config =
NULL;
253 "stir_shaken.conf,criteria=type=general,single_object=yes,explicit_name=general");
277 ast_log(
LOG_ERROR,
"stir/shaken - failed to register loaded observer for '%s' " struct stir_shaken_general * stir_shaken_general_get()
Retrieve the stir/shaken 'general' configuration object.
static int stir_shaken_general_apply(const struct ast_sorcery *sorcery, void *obj)
#define AST_CLI_DEFINE(fn, txt,...)
Asterisk main include file. File version handling, generic pbx functions.
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
unsigned int signature_timeout
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
int ast_sorcery_instance_observer_add(struct ast_sorcery *sorcery, const struct ast_sorcery_instance_observer *callbacks)
Add an observer to a sorcery instance.
int stir_shaken_general_unload(void)
Unload time cleanup for the stir/shaken 'general' configuration.
static int on_load_ca_file(const struct aco_option *opt, struct ast_variable *var, void *obj)
descriptor for a cli entry.
int ast_file_is_readable(const char *filename)
Test that a file exists and is readable by the effective user.
Structure for variables, used for configurations and for channel variables.
unsigned int ast_stir_shaken_cache_max_size(const struct stir_shaken_general *cfg)
Retrieve the 'cache_max_size' general configuration option value.
static int ca_file_to_str(const void *obj, const intptr_t *args, char **buf)
Perform no matching, return all objects.
Full structure for sorcery.
Type for a default handler that should do nothing.
static struct stir_shaken_general * default_config
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static struct ast_cli_entry stir_shaken_general_cli[]
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
Return all matching objects.
#define ast_strdup(str)
A wrapper for strdup()
static const struct ast_sorcery_instance_observer stir_shaken_general_observer
unsigned int ast_stir_shaken_signature_timeout(const struct stir_shaken_general *cfg)
Retrieve the 'signature_timeout' general configuration option value.
#define ast_sorcery_object_field_register_custom(sorcery, type, name, default_val, config_handler, sorcery_handler, multiple_handler, flags,...)
Register a field within an object with custom handlers.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
static int on_load_ca_path(const struct aco_option *opt, struct ast_variable *var, void *obj)
Type for default option handler for unsigned integers.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
unsigned int curl_timeout
Interface for the sorcery instance observer.
#define AST_STRING_FIELD(name)
Declare a string field.
#define ao2_ref(o, delta)
struct ao2_container * container
#define DEFAULT_SIGNATURE_TIMEOUT
int stir_shaken_cli_show(void *obj, void *arg, int flags)
Output configuration settings to the Asterisk CLI.
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
void ast_sorcery_instance_observer_remove(struct ast_sorcery *sorcery, const struct ast_sorcery_instance_observer *callbacks)
Remove an observer from a sorcery instance.
const char * ast_stir_shaken_ca_file(const struct stir_shaken_general *cfg)
Retrieve the 'ca_file' general configuration option value.
#define ast_sorcery_apply_default(sorcery, type, name, data)
static int ca_path_to_str(const void *obj, const intptr_t *args, char **buf)
void * ast_sorcery_alloc(const struct ast_sorcery *sorcery, const char *type, const char *id)
Allocate an object.
static void * stir_shaken_general_alloc(const char *name)
#define DEFAULT_CURL_TIMEOUT
struct ast_sorcery * ast_stir_shaken_sorcery(void)
Retrieve the stir/shaken sorcery context.
#define ao2_find(container, arg, flags)
static void stir_shaken_general_destructor(void *obj)
#define DEFAULT_CACHE_MAX_SIZE
static void stir_shaken_general_loaded(const char *name, const struct ast_sorcery *sorcery, const char *object_type, int reloaded)
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.
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
void(* object_type_loaded)(const char *name, const struct ast_sorcery *sorcery, const char *object_type, int reloaded)
Callback after any object_type is loaded/reloaded.
const ast_string_field ca_file
const char * ast_stir_shaken_ca_path(const struct stir_shaken_general *cfg)
Retrieve the 'ca_path' general configuration option value.
static struct ast_sorcery * sorcery
Standard Command Line Interface.
const ast_string_field ca_path
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
int stir_shaken_general_load(void)
Load time initialization for the stir/shaken 'general' configuration.
static char * stir_shaken_general_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Sorcery Data Access Layer API.
unsigned int cache_max_size
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
unsigned int ast_stir_shaken_curl_timeout(const struct stir_shaken_general *cfg)
Retrieve the 'curl_timeout' general configuration option value.