19#define _TRACE_PREFIX_ "tc",__LINE__, ""
31#define CONFIG_TYPE "tn"
33#define DEFAULT_check_tn_cert_public_url check_tn_cert_public_url_NOT_SET
34#define DEFAULT_private_key_file NULL
35#define DEFAULT_public_cert_url NULL
36#define DEFAULT_attest_level attest_level_NOT_SET
37#define DEFAULT_send_mky send_mky_NOT_SET
118 enum attest_level_enum effective_al = attest_level_NOT_SET;
120 SCOPE_ENTER(3,
"%s:%s: Getting effective TN\n", profile_id,
S_OR(
id,
""));
130 ast_trace(-1,
"%s:%s: TN not found. Using unknown_tn_attest_level %s\n",
131 profile_id,
id, attest_level_to_str(effective_al));
152 etn->acfg_common.attest_level = effective_al;
187 e->
command =
"stir_shaken show tns";
189 "Usage: stir_shaken show tns\n"
190 " Show all attestation TNs\n";
202 ast_cli(
a->fd,
"No stir/shaken TNs found\n");
223 e->
command =
"stir_shaken show tn";
225 "Usage: stir_shaken show tn <id>\n"
226 " Show the settings for a given TN\n";
Asterisk main include file. File version handling, generic pbx functions.
@ AO2_ALLOC_OPT_LOCK_NOLOCK
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define ao2_callback_data(container, flags, cb_fn, arg, data)
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_alloc_options(data_size, destructor_fn, options)
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
int as_check_common_config(const char *id, struct attestation_cfg_common *acfg_common)
void acfg_cleanup(struct attestation_cfg_common *acfg_common)
int as_copy_cfg_common(const char *id, struct attestation_cfg_common *cfg_dst, struct attestation_cfg_common *cfg_src)
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
int config_object_cli_show(void *obj, void *arg, void *data, int flags)
Output configuration settings to the Asterisk CLI.
char * config_object_tab_complete_name(const char *word, struct ao2_container *container)
Tab completion for name matching with STIR/SHAKEN CLI commands.
struct ast_sorcery * get_sorcery(void)
Retrieve the stir/shaken sorcery context.
#define register_common_attestation_fields(sorcery, object, CONFIG_TYPE, nodoc)
@ OPT_NOOP_T
Type for a default handler that should do nothing.
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
#define SCOPE_ENTER(level,...)
#define ast_trace(level,...)
Asterisk module definitions.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
struct ao2_container * container
static struct ast_sorcery * sorcery
Sorcery Data Access Layer API.
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
@ AST_RETRIEVE_FLAG_MULTIPLE
Return all matching objects.
@ AST_RETRIEVE_FLAG_ALL
Perform no matching, return all objects.
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
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.
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
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 determin...
#define ast_sorcery_apply_default(sorcery, type, name, data)
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_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
descriptor for a cli entry.
Full structure for sorcery.
Profile configuration for stir/shaken.
struct attestation_cfg_common acfg_common
enum attest_level_enum unknown_tn_attest_level
TN configuration for stir/shaken.
struct attestation_cfg_common acfg_common
static char * cli_tn_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
struct tn_cfg * tn_get_etn(const char *id, struct profile_cfg *eprofile)
static char * cli_tn_show_all(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct ast_cli_entry stir_shaken_certificate_cli[]
static struct ao2_container * get_tn_all(void)
int tn_config_unload(void)
static void * etn_alloc(const char *name)
static void * tn_alloc(const char *name)
int tn_config_reload(void)
static void tn_destructor(void *obj)
struct tn_cfg * tn_get_cfg(const char *id)
static int init_tn(struct tn_cfg *cfg)
generate_acfg_common_sorcery_handlers(tn_cfg)
static int tn_apply(const struct ast_sorcery *sorcery, void *obj)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.