Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Interact with security agreement negotiations and mechanisms. More...
Go to the source code of this file.
Functions | |
int | ast_sip_add_security_headers (struct ast_sip_security_mechanism_vector *security_mechanisms, const char *header_name, int add_qval, pjsip_tx_data *tdata) |
Add security headers to transmission data. More... | |
void | ast_sip_header_to_security_mechanism (const pjsip_generic_string_hdr *hdr, struct ast_sip_security_mechanism_vector *security_mechanisms) |
Append to security mechanism vector from SIP header. More... | |
void | ast_sip_remove_headers_by_name_and_value (pjsip_msg *msg, const pj_str_t *hdr_name, const char *value) |
Removes all headers of a specific name and value from a pjsip_msg. More... | |
int | ast_sip_security_mechanism_vector_init (struct ast_sip_security_mechanism_vector *security_mechanisms, const char *value) |
Initialize security mechanism vector from string of security mechanisms. More... | |
int | ast_sip_security_mechanisms_to_str (const struct ast_sip_security_mechanism_vector *security_mechanisms, int add_qvalue, char **buf) |
Writes the security mechanisms of an endpoint into a buffer as a string and returns the buffer. More... | |
void | ast_sip_security_mechanisms_vector_copy (struct ast_sip_security_mechanism_vector *dst, const struct ast_sip_security_mechanism_vector *src) |
Duplicate a security mechanism. More... | |
void | ast_sip_security_mechanisms_vector_destroy (struct ast_sip_security_mechanism_vector *security_mechanisms) |
Free contents of a security mechanism vector. More... | |
int | ast_sip_str_to_security_mechanism (struct ast_sip_security_mechanism **security_mechanism, const char *value) |
Allocate a security mechanism from a string. More... | |
static float | parse_qvalue (const char *q_value) |
static void | security_mechanism_destroy (struct ast_sip_security_mechanism *mech) |
static int | security_mechanism_to_str (const struct ast_sip_security_mechanism *security_mechanism, int add_qvalue, char **buf) |
static struct ast_sip_security_mechanism * | security_mechanisms_alloc (size_t n_params) |
static struct ast_sip_security_mechanism * | security_mechanisms_copy (const struct ast_sip_security_mechanism *src) |
static int | str_to_security_mechanism_type (const char *security_mechanism) |
Variables | |
static char * | mechanism_str [] |
Interact with security agreement negotiations and mechanisms.
Definition in file security_agreements.c.
int ast_sip_add_security_headers | ( | struct ast_sip_security_mechanism_vector * | security_mechanisms, |
const char * | header_name, | ||
int | add_qval, | ||
pjsip_tx_data * | tdata | ||
) |
Add security headers to transmission data.
security_mechanisms | Vector of security mechanisms. |
header_name | The header name under which to add the security mechanisms. One of Security-Client, Security-Server, Security-Verify. |
add_qval | If zero, don't add the q-value to the header. |
tdata | The transmission data. |
0 | Success |
non-zero | Failure |
Definition at line 290 of file security_agreements.c.
References ast_free, ast_sip_add_header(), AST_VECTOR_GET, AST_VECTOR_SIZE, buf, NULL, and security_mechanism_to_str().
Referenced by add_outgoing_request_headers(), and add_security_headers().
void ast_sip_header_to_security_mechanism | ( | const pjsip_generic_string_hdr * | hdr, |
struct ast_sip_security_mechanism_vector * | security_mechanisms | ||
) |
Append to security mechanism vector from SIP header.
hdr | The header of the security mechanisms. |
security_mechanisms | Vector of security mechanisms to append to. Header name must be one of Security-Client, Security-Server, Security-Verify. |
Definition at line 333 of file security_agreements.c.
References ast_copy_pj_str(), ast_sip_str_to_security_mechanism(), ast_skip_blanks(), ast_strsep(), AST_STRSEP_ALL, AST_VECTOR_APPEND, and buf.
Referenced by contact_add_security_headers_to_status(), and handle_registration_response().
void ast_sip_remove_headers_by_name_and_value | ( | pjsip_msg * | msg, |
const pj_str_t * | hdr_name, | ||
const char * | value | ||
) |
Removes all headers of a specific name and value from a pjsip_msg.
msg | PJSIP message from which to remove headers. |
hdr_name | Name of the header to remove. |
value | Optional string value of the header to remove. If NULL, remove all headers of given hdr_name. |
Definition at line 203 of file security_agreements.c.
Referenced by add_security_headers().
int ast_sip_security_mechanism_vector_init | ( | struct ast_sip_security_mechanism_vector * | security_mechanism, |
const char * | value | ||
) |
Initialize security mechanism vector from string of security mechanisms.
security_mechanism | Pointer to vector of security mechanisms to initialize. |
value | String of security mechanisms as defined in RFC 3329. |
0 | Success |
non-zero | Failure |
Definition at line 360 of file security_agreements.c.
References ast_sip_security_mechanisms_vector_destroy(), ast_sip_str_to_security_mechanism(), ast_strdupa, ast_strsep(), AST_STRSEP_ALL, AST_VECTOR_APPEND, AST_VECTOR_INIT, NULL, and value.
Referenced by security_mechanism_handler(), and security_mechanisms_handler().
int ast_sip_security_mechanisms_to_str | ( | const struct ast_sip_security_mechanism_vector * | security_mechanisms, |
int | add_qvalue, | ||
char ** | buf | ||
) |
Writes the security mechanisms of an endpoint into a buffer as a string and returns the buffer.
endpoint | Pointer to endpoint. |
add_qvalue | If non-zero, the q-value is printed as well |
buf | The buffer to write the string into |
0 | Success |
non-zero | Failure |
Definition at line 162 of file security_agreements.c.
References ast_free, ast_str_append(), ast_str_create, ast_str_truncate(), ast_strdup, AST_VECTOR_GET, AST_VECTOR_SIZE, buf, MAX_OBJECT_FIELD, NULL, RAII_VAR, security_mechanism_to_str(), str, and tmp_buf.
Referenced by security_mechanism_to_str().
void ast_sip_security_mechanisms_vector_copy | ( | struct ast_sip_security_mechanism_vector * | dst, |
const struct ast_sip_security_mechanism_vector * | src | ||
) |
Duplicate a security mechanism.
dst | Security mechanism to duplicate to. |
src | Security mechanism to duplicate. |
Definition at line 81 of file security_agreements.c.
References ast_sip_security_mechanisms_vector_destroy(), AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_SIZE, and security_mechanisms_copy().
Referenced by sip_contact_status_copy(), and sip_outbound_registration_perform().
void ast_sip_security_mechanisms_vector_destroy | ( | struct ast_sip_security_mechanism_vector * | security_mechanisms | ) |
Free contents of a security mechanism vector.
security_mechanisms | Vector whose contents are to be freed |
Definition at line 94 of file security_agreements.c.
References AST_VECTOR_FREE, AST_VECTOR_RESET, and security_mechanism_destroy().
Referenced by ast_sip_security_mechanism_vector_init(), ast_sip_security_mechanisms_vector_copy(), endpoint_destructor(), handle_client_state_destruction(), sip_contact_status_dtor(), sip_outbound_registration_destroy(), and sip_outbound_registration_perform().
int ast_sip_str_to_security_mechanism | ( | struct ast_sip_security_mechanism ** | security_mechanism, |
const char * | value | ||
) |
Allocate a security mechanism from a string.
security_mechanism | Pointer-pointer to the security mechanism to allocate. |
value | The security mechanism string as defined in RFC 3329 (section 2.2) in the form <mechanism_name>;q=<q_value>;<mechanism_parameters> |
0 | Success |
non-zero | Failure |
Definition at line 242 of file security_agreements.c.
References ast_strdup, ast_strdupa, ast_strsep(), AST_STRSEP_ALL, AST_VECTOR_APPEND, ast_sip_security_mechanism::mechanism_parameters, NULL, out, parse_qvalue(), ast_sip_security_mechanism::qvalue, security_mechanism_destroy(), security_mechanisms_alloc(), str_to_security_mechanism_type(), tmp(), type, ast_sip_security_mechanism::type, and value.
Referenced by ast_sip_header_to_security_mechanism(), ast_sip_security_mechanism_vector_init(), and rfc3329_incoming_response().
|
static |
Definition at line 225 of file security_agreements.c.
References end.
Referenced by ast_sip_str_to_security_mechanism().
|
static |
Definition at line 74 of file security_agreements.c.
References ast_free, AST_VECTOR_FREE, AST_VECTOR_RESET, and ast_sip_security_mechanism::mechanism_parameters.
Referenced by ast_sip_security_mechanisms_vector_destroy(), and ast_sip_str_to_security_mechanism().
|
static |
Definition at line 124 of file security_agreements.c.
References ast_free, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_set(), ast_strdup, AST_VECTOR_GET, AST_VECTOR_SIZE, buf, MAX_OBJECT_FIELD, ast_sip_security_mechanism::mechanism_parameters, mechanism_str, NULL, ast_sip_security_mechanism::qvalue, RAII_VAR, str, and ast_sip_security_mechanism::type.
Referenced by ast_sip_add_security_headers(), and ast_sip_security_mechanisms_to_str().
|
static |
Definition at line 33 of file security_agreements.c.
References ast_calloc, ast_free, AST_VECTOR_INIT, ast_sip_security_mechanism::mechanism_parameters, NULL, and ast_sip_security_mechanism::qvalue.
Referenced by ast_sip_str_to_security_mechanism(), and security_mechanisms_copy().
|
static |
Definition at line 50 of file security_agreements.c.
References ast_strdup, AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_sip_security_mechanism::mechanism_parameters, NULL, ast_sip_security_mechanism::qvalue, security_mechanisms_alloc(), and ast_sip_security_mechanism::type.
Referenced by ast_sip_security_mechanisms_vector_copy().
|
static |
Definition at line 112 of file security_agreements.c.
References ARRAY_LEN, and mechanism_str.
Referenced by ast_sip_str_to_security_mechanism().
|
static |
Definition at line 104 of file security_agreements.c.
Referenced by security_mechanism_to_str(), and str_to_security_mechanism_type().