Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
#include "asterisk.h"
#include <pjsip.h>
#include <pjlib.h>
#include "asterisk/res_pjsip.h"
#include "asterisk/logger.h"
#include "asterisk/sorcery.h"
#include "asterisk/cli.h"
#include "include/res_pjsip_private.h"
#include "asterisk/res_pjsip_cli.h"
Go to the source code of this file.
Functions | |
static int | ami_show_auths (struct mansession *s, const struct message *m) |
const char * | ast_sip_auth_type_to_str (enum ast_sip_auth_type type) |
Converts the given auth type to a string. More... | |
int | ast_sip_destroy_sorcery_auth (void) |
int | ast_sip_for_each_auth (const struct ast_sip_auth_vector *vector, ao2_callback_fn on_auth, void *arg) |
For every auth in the array call the given 'on_auth' handler. More... | |
int | ast_sip_format_auths_ami (const struct ast_sip_auth_vector *auths, struct ast_sip_ami *ami) |
Format auth details for AMI. More... | |
int | ast_sip_initialize_sorcery_auth (void) |
Initialize sorcery with auth support. More... | |
static void * | auth_alloc (const char *name) |
static int | auth_apply (const struct ast_sorcery *sorcery, void *obj) |
static void | auth_destroy (void *obj) |
static int | auth_type_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | auth_type_to_str (const void *obj, const intptr_t *args, char **buf) |
static struct ao2_container * | cli_get_auths (void) |
static struct ao2_container * | cli_get_container (const char *regex) |
static int | cli_iterator (void *container, ao2_callback_fn callback, void *args) |
static int | cli_print_body (void *obj, void *arg, int flags) |
static int | cli_print_header (void *obj, void *arg, int flags) |
static void * | cli_retrieve_by_id (const char *id) |
static int | format_ami_auth_handler (void *obj, void *arg, int flags) |
static int | format_ami_authlist_handler (void *obj, void *arg, int flags) |
static int | format_ami_endpoint_auth (const struct ast_sip_endpoint *endpoint, struct ast_sip_ami *ami) |
static int | sip_auth_to_ami (const struct ast_sip_auth *auth, struct ast_str **buf) |
Variables | |
static const char * | auth_types_map [] |
static struct ast_cli_entry | cli_commands [] |
static struct ast_sip_cli_formatter_entry * | cli_formatter |
static struct ast_sip_endpoint_formatter | endpoint_auth_formatter |
|
static |
Definition at line 247 of file config_auth.c.
References ao2_callback, ao2_container_count(), ao2_ref, astman_get_header(), astman_send_error(), astman_send_list_complete_end(), astman_send_list_complete_start(), astman_send_listack(), cli_get_auths(), ast_sip_ami::count, format_ami_authlist_handler(), ast_sip_ami::m, OBJ_NODATA, and ast_sip_ami::s.
Referenced by ast_sip_initialize_sorcery_auth().
const char * ast_sip_auth_type_to_str | ( | enum ast_sip_auth_type | type | ) |
Converts the given auth type to a string.
type | the auth type to convert |
a | string representative of the auth type |
Definition at line 80 of file config_auth.c.
References ARRAY_IN_BOUNDS, auth_types_map, and type.
Referenced by auth_type_to_str().
int ast_sip_destroy_sorcery_auth | ( | void | ) |
Definition at line 426 of file config_auth.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), ast_manager_unregister(), ast_sip_unregister_cli_formatter(), ast_sip_unregister_endpoint_formatter(), cli_commands, cli_formatter, and endpoint_auth_formatter.
Referenced by ast_res_pjsip_destroy_configuration().
int ast_sip_for_each_auth | ( | const struct ast_sip_auth_vector * | array, |
ao2_callback_fn | on_auth, | ||
void * | arg | ||
) |
For every auth in the array call the given 'on_auth' handler.
array | an array of auths |
on_auth | callback for each auth |
arg | user data passed to handler |
0 | Success, non-zero on failure |
Definition at line 135 of file config_auth.c.
References ao2_cleanup, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_id(), AST_VECTOR_GET, AST_VECTOR_SIZE, RAII_VAR, and SIP_SORCERY_AUTH_TYPE.
Referenced by ast_sip_format_auths_ami(), and cli_iterator().
int ast_sip_format_auths_ami | ( | const struct ast_sip_auth_vector * | auths, |
struct ast_sip_ami * | ami | ||
) |
Format auth details for AMI.
auths | an auth array |
ami | ami variable container |
0 | Success, non-zero on failure |
Definition at line 195 of file config_auth.c.
References ast_sip_for_each_auth(), and format_ami_auth_handler().
Referenced by ami_outbound_registration_task(), and format_ami_endpoint_auth().
int ast_sip_initialize_sorcery_auth | ( | void | ) |
Initialize sorcery with auth support.
Definition at line 370 of file config_auth.c.
References ami_show_auths(), ao2_alloc, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_manager_register_xml, ast_sip_get_sorcery(), ast_sip_register_cli_formatter(), ast_sip_register_endpoint_formatter(), ast_sorcery_apply_default, ast_sorcery_object_field_register, ast_sorcery_object_field_register_custom, ast_sorcery_object_get_id(), ast_sorcery_object_register, auth_alloc(), auth_apply(), auth_type_handler(), auth_type_to_str(), cli_commands, cli_formatter, cli_get_container(), cli_iterator(), cli_print_body(), cli_print_header(), cli_retrieve_by_id(), endpoint_auth_formatter, EVENT_FLAG_SYSTEM, FLDSET, ast_sip_cli_formatter_entry::get_container, ast_sip_cli_formatter_entry::get_id, ast_sip_cli_formatter_entry::iterate, LOG_ERROR, ast_sip_cli_formatter_entry::name, NULL, OPT_NOOP_T, OPT_STRINGFIELD_T, OPT_UINT_T, ast_sip_cli_formatter_entry::print_body, ast_sip_cli_formatter_entry::print_header, ast_sip_cli_formatter_entry::retrieve_by_id, SIP_SORCERY_AUTH_TYPE, sorcery, and STRFLDSET.
Referenced by ast_res_pjsip_initialize_configuration().
|
static |
Definition at line 36 of file config_auth.c.
References ao2_cleanup, ast_sorcery_generic_alloc(), ast_string_field_init, auth_destroy(), and NULL.
Referenced by ast_sip_initialize_sorcery_auth().
|
static |
Definition at line 93 of file config_auth.c.
References ast_log, AST_SIP_AUTH_TYPE_ARTIFICIAL, AST_SIP_AUTH_TYPE_GOOGLE_OAUTH, AST_SIP_AUTH_TYPE_MD5, AST_SIP_AUTH_TYPE_USER_PASS, ast_sorcery_object_get_id(), ast_strlen_zero(), ast_sip_auth::auth_user, LOG_ERROR, ast_sip_auth::md5_creds, ast_sip_auth::oauth_clientid, ast_sip_auth::oauth_secret, ast_sip_auth::refresh_token, and ast_sip_auth::type.
Referenced by ast_sip_initialize_sorcery_auth().
|
static |
Definition at line 30 of file config_auth.c.
References ast_string_field_free_memory.
Referenced by auth_alloc().
|
static |
Definition at line 52 of file config_auth.c.
References ast_log, AST_SIP_AUTH_TYPE_GOOGLE_OAUTH, AST_SIP_AUTH_TYPE_MD5, AST_SIP_AUTH_TYPE_USER_PASS, LOG_WARNING, ast_sip_auth::type, and var.
Referenced by ast_sip_initialize_sorcery_auth().
|
static |
Definition at line 86 of file config_auth.c.
References ast_sip_auth_type_to_str(), ast_strdup, buf, and ast_sip_auth::type.
Referenced by ast_sip_initialize_sorcery_auth().
|
static |
Definition at line 216 of file config_auth.c.
References AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_fields(), and NULL.
Referenced by ami_show_auths().
|
static |
Definition at line 277 of file config_auth.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_list, ao2_container_dup(), ao2_ref, ast_sip_get_sorcery(), ast_sorcery_object_id_compare(), ast_sorcery_object_id_sort(), ast_sorcery_retrieve_by_regex(), container, NULL, RAII_VAR, and regex().
Referenced by ast_sip_initialize_sorcery_auth().
|
static |
Definition at line 301 of file config_auth.c.
References args, ast_sip_for_each_auth(), and container.
Referenced by ast_sip_initialize_sorcery_auth().
|
static |
Definition at line 326 of file config_auth.c.
References ast_assert, ast_sip_cli_print_sorcery_objectset(), ast_sorcery_object_get_id(), ast_str_append(), ast_sip_auth::auth_user, CLI_INDENT_TO_SPACES, voicemailpwcheck::context, and NULL.
Referenced by ast_sip_initialize_sorcery_auth().
|
static |
Definition at line 311 of file config_auth.c.
References ast_assert, ast_str_append(), CLI_HEADER_FILLER, CLI_INDENT_TO_SPACES, CLI_MAX_WIDTH, voicemailpwcheck::context, and NULL.
Referenced by ast_sip_initialize_sorcery_auth().
|
static |
Definition at line 306 of file config_auth.c.
References ast_sip_get_sorcery(), ast_sorcery_retrieve_by_id(), and SIP_SORCERY_AUTH_TYPE.
Referenced by ast_sip_initialize_sorcery_auth().
|
static |
Definition at line 168 of file config_auth.c.
References ast_sip_ami::arg, ast_free, ast_sip_create_ami_event(), ast_sorcery_object_get_id(), ast_str_append(), ast_str_buffer(), astman_append(), buf, ast_sip_ami::count, RAII_VAR, ast_sip_ami::s, and sip_auth_to_ami().
Referenced by ast_sip_format_auths_ami().
|
static |
Definition at line 226 of file config_auth.c.
References ast_sip_ami::arg, ast_free, ast_sip_create_ami_event(), ast_str_buffer(), astman_append(), buf, CMP_STOP, ast_sip_ami::count, ast_sip_ami::s, and sip_auth_to_ami().
Referenced by ami_show_auths().
|
static |
Definition at line 201 of file config_auth.c.
References ast_sip_ami::arg, ast_sip_format_auths_ami(), ast_sip_endpoint::inbound_auths, and ast_sip_endpoint::outbound_auths.
|
static |
Definition at line 162 of file config_auth.c.
References ast_sip_sorcery_object_to_ami(), and buf.
Referenced by format_ami_auth_handler(), and format_ami_authlist_handler().
|
static |
Definition at line 74 of file config_auth.c.
Referenced by ast_sip_auth_type_to_str().
|
static |
Definition at line 350 of file config_auth.c.
Referenced by ast_sip_destroy_sorcery_auth(), and ast_sip_initialize_sorcery_auth().
|
static |
Definition at line 367 of file config_auth.c.
Referenced by ast_sip_destroy_sorcery_auth(), and ast_sip_initialize_sorcery_auth().
|
static |
Definition at line 212 of file config_auth.c.
Referenced by ast_sip_destroy_sorcery_auth(), and ast_sip_initialize_sorcery_auth().