Asterisk - The Open Source Telephony Project GIT-master-8f1982c
|
#include "asterisk.h"
#include "asterisk/cli.h"
#include "asterisk/logger.h"
#include "asterisk/sorcery.h"
#include "asterisk/paths.h"
#include "stir_shaken.h"
Go to the source code of this file.
Macros | |
#define | _TRACE_PREFIX_ "ac",__LINE__, "" |
#define | CONFIG_TYPE "attestation" |
#define | DEFAULT_attest_level attest_level_NOT_SET |
#define | DEFAULT_check_tn_cert_public_url check_tn_cert_public_url_NO |
#define | DEFAULT_global_disable 0 |
#define | DEFAULT_private_key_file NULL |
#define | DEFAULT_public_cert_url NULL |
#define | DEFAULT_send_mky send_mky_NO |
#define | DEFAULT_unknown_tn_attest_level attest_level_NOT_SET |
Functions | |
void | acfg_cleanup (struct attestation_cfg_common *acfg_common) |
int | as_check_common_config (const char *id, struct attestation_cfg_common *acfg_common) |
int | as_config_load (void) |
int | as_config_reload (void) |
int | as_config_unload (void) |
int | as_copy_cfg_common (const char *id, struct attestation_cfg_common *cfg_dst, struct attestation_cfg_common *cfg_src) |
struct attestation_cfg * | as_get_cfg (void) |
int | as_is_config_loaded (void) |
static void * | attestation_alloc (const char *name) |
static int | attestation_apply (const struct ast_sorcery *sorcery, void *obj) |
static void | attestation_destructor (void *obj) |
static char * | attestation_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
generate_acfg_common_sorcery_handlers (attestation_cfg) | |
generate_sorcery_enum_from_str_ex (attestation_cfg,, unknown_tn_attest_level, attest_level, UNKNOWN) | |
generate_sorcery_enum_to_str_ex (attestation_cfg,, unknown_tn_attest_level, attest_level) | |
Variables | |
static struct ast_cli_entry | attestation_cli [] |
static struct attestation_cfg * | empty_cfg = NULL |
#define _TRACE_PREFIX_ "ac",__LINE__, "" |
Definition at line 19 of file attestation_config.c.
#define CONFIG_TYPE "attestation" |
Definition at line 30 of file attestation_config.c.
#define DEFAULT_attest_level attest_level_NOT_SET |
Definition at line 37 of file attestation_config.c.
#define DEFAULT_check_tn_cert_public_url check_tn_cert_public_url_NO |
Definition at line 34 of file attestation_config.c.
#define DEFAULT_global_disable 0 |
Definition at line 32 of file attestation_config.c.
#define DEFAULT_private_key_file NULL |
Definition at line 35 of file attestation_config.c.
#define DEFAULT_public_cert_url NULL |
Definition at line 36 of file attestation_config.c.
#define DEFAULT_send_mky send_mky_NO |
Definition at line 39 of file attestation_config.c.
#define DEFAULT_unknown_tn_attest_level attest_level_NOT_SET |
Definition at line 38 of file attestation_config.c.
void acfg_cleanup | ( | struct attestation_cfg_common * | acfg_common | ) |
Definition at line 68 of file attestation_config.c.
References attestation_cfg::acfg_common, ao2_cleanup, ast_string_field_free_memory, and attestation_cfg_common::raw_key.
Referenced by attestation_destructor(), profile_destructor(), and tn_destructor().
int as_check_common_config | ( | const char * | id, |
struct attestation_cfg_common * | acfg_common | ||
) |
Definition at line 139 of file attestation_config.c.
References attestation_cfg::acfg_common, ao2_alloc, ast_file_is_readable(), ast_free, ast_std_free(), ast_strlen_zero(), attestation_cfg_common::check_tn_cert_public_url, crypto_extract_raw_privkey(), crypto_has_private_key_from_memory(), crypto_is_cert_time_valid(), crypto_load_cert_from_memory(), crypto_load_privkey_from_file(), curl_download_to_memory(), ENUM_BOOL, LOG_ERROR, NULL, attestation_cfg_common::private_key_file, attestation_cfg_common::public_cert_url, RAII_VAR, attestation_cfg_common::raw_key, attestation_cfg_common::raw_key_length, SCOPE_ENTER, SCOPE_EXIT, SCOPE_EXIT_LOG_RTN_VALUE, and SCOPE_EXIT_RTN_VALUE.
Referenced by attestation_apply(), profile_apply(), and tn_apply().
int as_config_load | ( | void | ) |
Definition at line 300 of file attestation_config.c.
References ARRAY_LEN, as_is_config_loaded(), ast_cli_register_multiple, ast_log, ast_sorcery_apply_default, ast_sorcery_load_object(), ast_sorcery_object_field_register, ast_sorcery_object_field_register_nodoc, ast_sorcery_object_register, attestation_alloc(), attestation_apply(), attestation_cli, CONFIG_TYPE, DEFAULT_global_disable, empty_cfg, enum_option_register_ex, FLDSET, get_sorcery(), attestation_cfg::global_disable, LOG_ERROR, LOG_WARNING, NULL, OPT_NOOP_T, OPT_YESNO_T, register_common_attestation_fields, and sorcery.
Referenced by as_load().
int as_config_reload | ( | void | ) |
Definition at line 272 of file attestation_config.c.
References as_is_config_loaded(), ast_log, ast_sorcery_force_reload_object(), attestation_alloc(), CONFIG_TYPE, empty_cfg, get_sorcery(), attestation_cfg::global_disable, LOG_WARNING, and sorcery.
Referenced by as_reload().
int as_config_unload | ( | void | ) |
Definition at line 291 of file attestation_config.c.
References ao2_cleanup, ARRAY_LEN, ast_cli_unregister_multiple(), attestation_cli, and empty_cfg.
Referenced by as_unload().
int as_copy_cfg_common | ( | const char * | id, |
struct attestation_cfg_common * | cfg_dst, | ||
struct attestation_cfg_common * | cfg_src | ||
) |
Definition at line 113 of file attestation_config.c.
References ao2_bump, ao2_cleanup, cfg_enum_copy, cfg_sf_copy_wrapper, attestation_cfg_common::raw_key, and attestation_cfg_common::raw_key_length.
Referenced by create_effective_profile(), and tn_get_etn().
struct attestation_cfg * as_get_cfg | ( | void | ) |
Definition at line 43 of file attestation_config.c.
References ao2_bump, ast_sorcery_retrieve_by_id(), CONFIG_TYPE, empty_cfg, get_sorcery(), and NULL.
Referenced by ast_stir_shaken_as_ctx_create(), attestation_show(), and create_effective_profile().
int as_is_config_loaded | ( | void | ) |
Definition at line 54 of file attestation_config.c.
References ao2_cleanup, ast_sorcery_retrieve_by_id(), CONFIG_TYPE, and get_sorcery().
Referenced by as_config_load(), as_config_reload(), and attestation_show().
|
static |
Definition at line 85 of file attestation_config.c.
References attestation_cfg::acfg_common, ao2_ref, ast_sorcery_generic_alloc(), ast_string_field_init, attestation_destructor(), and NULL.
Referenced by as_config_load(), and as_config_reload().
|
static |
Definition at line 221 of file attestation_config.c.
References attestation_cfg::acfg_common, as_check_common_config(), and ast_sorcery_object_get_id().
Referenced by as_config_load().
|
static |
Definition at line 77 of file attestation_config.c.
References acfg_cleanup(), attestation_cfg::acfg_common, and ast_string_field_free_memory.
Referenced by attestation_alloc().
|
static |
Definition at line 233 of file attestation_config.c.
References a, ao2_cleanup, as_get_cfg(), as_is_config_loaded(), ast_log, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, config_object_cli_show(), config_object_type_attestation, LOG_WARNING, NULL, config_object_cli_data::title, and ast_cli_entry::usage.
generate_acfg_common_sorcery_handlers | ( | attestation_cfg | ) |
generate_sorcery_enum_from_str_ex | ( | attestation_cfg | , |
unknown_tn_attest_level | , | ||
attest_level | , | ||
UNKNOWN | |||
) |
generate_sorcery_enum_to_str_ex | ( | attestation_cfg | , |
unknown_tn_attest_level | , | ||
attest_level | |||
) |
|
static |
Definition at line 268 of file attestation_config.c.
Referenced by as_config_load(), and as_config_unload().
|
static |
Definition at line 41 of file attestation_config.c.
Referenced by as_config_load(), as_config_reload(), as_config_unload(), and as_get_cfg().