Asterisk - The Open Source Telephony Project
18.5.0
|
#include "asterisk.h"
#include "asterisk/cli.h"
#include "asterisk/sorcery.h"
#include "stir_shaken.h"
#include "general.h"
#include "asterisk/res_stir_shaken.h"
Go to the source code of this file.
Data Structures | |
struct | stir_shaken_general |
Macros | |
#define | CONFIG_TYPE "general" |
#define | DEFAULT_CA_FILE "" |
#define | DEFAULT_CA_PATH "" |
#define | DEFAULT_CACHE_MAX_SIZE 1000 |
#define | DEFAULT_CURL_TIMEOUT 2 |
#define | DEFAULT_SIGNATURE_TIMEOUT 15 |
Functions | |
const char * | ast_stir_shaken_ca_file (const struct stir_shaken_general *cfg) |
Retrieve the 'ca_file' general configuration option value. More... | |
const char * | ast_stir_shaken_ca_path (const struct stir_shaken_general *cfg) |
Retrieve the 'ca_path' general configuration option value. More... | |
unsigned int | ast_stir_shaken_cache_max_size (const struct stir_shaken_general *cfg) |
Retrieve the 'cache_max_size' general configuration option value. More... | |
unsigned int | ast_stir_shaken_curl_timeout (const struct stir_shaken_general *cfg) |
Retrieve the 'curl_timeout' general configuration option value. More... | |
unsigned int | ast_stir_shaken_signature_timeout (const struct stir_shaken_general *cfg) |
Retrieve the 'signature_timeout' general configuration option value. More... | |
static int | ca_file_to_str (const void *obj, const intptr_t *args, char **buf) |
static int | ca_path_to_str (const void *obj, const intptr_t *args, char **buf) |
static int | on_load_ca_file (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | on_load_ca_path (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static void * | stir_shaken_general_alloc (const char *name) |
static int | stir_shaken_general_apply (const struct ast_sorcery *sorcery, void *obj) |
static void | stir_shaken_general_destructor (void *obj) |
struct stir_shaken_general * | stir_shaken_general_get () |
Retrieve the stir/shaken 'general' configuration object. More... | |
int | stir_shaken_general_load (void) |
Load time initialization for the stir/shaken 'general' configuration. More... | |
static void | stir_shaken_general_loaded (const char *name, const struct ast_sorcery *sorcery, const char *object_type, int reloaded) |
static char * | stir_shaken_general_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
int | stir_shaken_general_unload (void) |
Unload time cleanup for the stir/shaken 'general' configuration. More... | |
Variables | |
static struct stir_shaken_general * | default_config = NULL |
static struct ast_cli_entry | stir_shaken_general_cli [] |
static const struct ast_sorcery_instance_observer | stir_shaken_general_observer |
#define CONFIG_TYPE "general" |
Definition at line 28 of file general.c.
Referenced by stir_shaken_general_get(), stir_shaken_general_load(), and stir_shaken_general_loaded().
#define DEFAULT_CA_FILE "" |
Definition at line 30 of file general.c.
Referenced by ast_stir_shaken_ca_file(), and stir_shaken_general_load().
#define DEFAULT_CA_PATH "" |
Definition at line 31 of file general.c.
Referenced by ast_stir_shaken_ca_path(), and stir_shaken_general_load().
#define DEFAULT_CACHE_MAX_SIZE 1000 |
Definition at line 32 of file general.c.
Referenced by ast_stir_shaken_cache_max_size(), and stir_shaken_general_load().
#define DEFAULT_CURL_TIMEOUT 2 |
Definition at line 33 of file general.c.
Referenced by ast_stir_shaken_curl_timeout(), and stir_shaken_general_load().
#define DEFAULT_SIGNATURE_TIMEOUT 15 |
Definition at line 34 of file general.c.
Referenced by ast_stir_shaken_signature_timeout(), and stir_shaken_general_load().
const char* ast_stir_shaken_ca_file | ( | const struct stir_shaken_general * | cfg | ) |
Retrieve the 'ca_file' general configuration option value.
cfg | A 'general' configuration object |
The | 'ca_file' value |
Definition at line 72 of file general.c.
References stir_shaken_general::ca_file, and DEFAULT_CA_FILE.
const char* ast_stir_shaken_ca_path | ( | const struct stir_shaken_general * | cfg | ) |
Retrieve the 'ca_path' general configuration option value.
cfg | A 'general' configuration object |
The | 'ca_path' value |
Definition at line 77 of file general.c.
References stir_shaken_general::ca_path, and DEFAULT_CA_PATH.
unsigned int ast_stir_shaken_cache_max_size | ( | const struct stir_shaken_general * | cfg | ) |
Retrieve the 'cache_max_size' general configuration option value.
cfg | A 'general' configuration object |
The | 'cache_max_size' value |
Definition at line 82 of file general.c.
References stir_shaken_general::cache_max_size, and DEFAULT_CACHE_MAX_SIZE.
unsigned int ast_stir_shaken_curl_timeout | ( | const struct stir_shaken_general * | cfg | ) |
Retrieve the 'curl_timeout' general configuration option value.
cfg | A 'general' configuration object |
The | 'curl_timeout' value |
Definition at line 87 of file general.c.
References stir_shaken_general::curl_timeout, and DEFAULT_CURL_TIMEOUT.
Referenced by get_curl_instance().
unsigned int ast_stir_shaken_signature_timeout | ( | const struct stir_shaken_general * | cfg | ) |
Retrieve the 'signature_timeout' general configuration option value.
cfg | A 'general' configuration object |
The | 'signature_timeout' value |
Definition at line 92 of file general.c.
References DEFAULT_SIGNATURE_TIMEOUT, and stir_shaken_general::signature_timeout.
Referenced by ast_stir_shaken_get_signature_timeout().
|
static |
Definition at line 201 of file general.c.
References ast_strdup, and stir_shaken_general::ca_file.
Referenced by stir_shaken_general_load().
|
static |
Definition at line 223 of file general.c.
References ast_strdup, and stir_shaken_general::ca_path.
Referenced by stir_shaken_general_load().
|
static |
Definition at line 188 of file general.c.
References ast_file_is_readable(), ast_log, ast_string_field_set, stir_shaken_general::ca_file, LOG_ERROR, ast_variable::name, and ast_variable::value.
Referenced by stir_shaken_general_load().
|
static |
Definition at line 210 of file general.c.
References ast_file_is_readable(), ast_log, ast_string_field_set, stir_shaken_general::ca_path, LOG_ERROR, ast_variable::name, and ast_variable::value.
Referenced by stir_shaken_general_load().
|
static |
Definition at line 104 of file general.c.
References ao2_ref, ast_sorcery_generic_alloc(), ast_string_field_init, NULL, and stir_shaken_general_destructor().
Referenced by stir_shaken_general_load().
|
static |
Definition at line 121 of file general.c.
Referenced by stir_shaken_general_load(), and stir_shaken_general_loaded().
|
static |
Definition at line 97 of file general.c.
References ast_string_field_free_memory.
Referenced by stir_shaken_general_alloc().
struct stir_shaken_general* stir_shaken_general_get | ( | void | ) |
Retrieve the stir/shaken 'general' configuration object.
A default configuration object is returned if no configuration was specified. As well, NULL can be returned if there is no configuration, and a problem occurred while loading the defaults.
A | 'general' configuration object, or NULL |
Definition at line 54 of file general.c.
References ao2_bump, ao2_cleanup, ao2_container_count(), ao2_find, ao2_ref, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_retrieve_by_fields(), ast_stir_shaken_sorcery(), CONFIG_TYPE, container, and NULL.
Referenced by ast_stir_shaken_get_signature_timeout(), get_curl_instance(), stir_shaken_general_loaded(), and stir_shaken_general_show().
int stir_shaken_general_load | ( | void | ) |
Load time initialization for the stir/shaken 'general' configuration.
0 | on success, -1 on error |
Definition at line 248 of file general.c.
References __stringify, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_sorcery_apply_default, ast_sorcery_instance_observer_add(), ast_sorcery_object_field_register, ast_sorcery_object_field_register_custom, ast_sorcery_object_register, ast_stir_shaken_sorcery(), ca_file_to_str(), ca_path_to_str(), stir_shaken_general::cache_max_size, CONFIG_TYPE, stir_shaken_general::curl_timeout, DEFAULT_CA_FILE, DEFAULT_CA_PATH, DEFAULT_CACHE_MAX_SIZE, DEFAULT_CURL_TIMEOUT, DEFAULT_SIGNATURE_TIMEOUT, FLDSET, LOG_ERROR, NULL, on_load_ca_file(), on_load_ca_path(), OPT_NOOP_T, OPT_UINT_T, stir_shaken_general::signature_timeout, sorcery, stir_shaken_general_alloc(), and stir_shaken_general_apply().
Referenced by load_module().
|
static |
Definition at line 126 of file general.c.
References ao2_ref, ast_sorcery_alloc(), CONFIG_TYPE, NULL, stir_shaken_general_apply(), and stir_shaken_general_get().
|
static |
Definition at line 158 of file general.c.
References ao2_cleanup, ast_cli_args::argc, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NULL, stir_shaken_cli_show(), stir_shaken_general_get(), and ast_cli_entry::usage.
int stir_shaken_general_unload | ( | void | ) |
Unload time cleanup for the stir/shaken 'general' configuration.
0 | on success, -1 on error |
Definition at line 232 of file general.c.
References ao2_ref, ARRAY_LEN, ast_cli_unregister_multiple(), ast_sorcery_instance_observer_remove(), ast_stir_shaken_sorcery(), and NULL.
Referenced by unload_module().
|
static |
|
static |
|
static |