Asterisk - The Open Source Telephony Project
21.4.1
|
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... | |
static char * | ast_sip_security_mechanism_type_to_str (enum ast_sip_security_mechanism_type mech_type) |
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... | |
static struct ast_sip_security_mechanism * | ast_sip_security_mechanisms_alloc (size_t n_params) |
static struct ast_sip_security_mechanism * | ast_sip_security_mechanisms_copy (const struct ast_sip_security_mechanism *src) |
static void | ast_sip_security_mechanisms_destroy (struct ast_sip_security_mechanism *mech) |
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 int | ast_sip_str_to_security_mechanism_type (const char *security_mechanism) |
static float | parse_qvalue (const char *q_value) |
static int | security_mechanism_to_str (const struct ast_sip_security_mechanism *security_mechanism, int add_qvalue, char **buf) |
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 286 of file security_agreements.c.
References AST_VECTOR_GET, and AST_VECTOR_SIZE.
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 329 of file security_agreements.c.
References ast_sip_str_to_security_mechanism(), ast_skip_blanks(), ast_strsep(), AST_STRSEP_ALL, and AST_VECTOR_APPEND.
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 199 of file security_agreements.c.
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 356 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, and AST_VECTOR_INIT.
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 169 of file security_agreements.c.
References ast_strdup, AST_VECTOR_GET, and AST_VECTOR_SIZE.
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 85 of file security_agreements.c.
References ast_sip_security_mechanisms_vector_destroy(), AST_VECTOR_APPEND, AST_VECTOR_GET, and AST_VECTOR_SIZE.
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 98 of file security_agreements.c.
References AST_VECTOR_FREE, AST_VECTOR_GET, and AST_VECTOR_SIZE.
Referenced by ast_sip_security_mechanism_vector_init(), and ast_sip_security_mechanisms_vector_copy().
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 238 of file security_agreements.c.
References ast_strdup, ast_strdupa, ast_strsep(), AST_STRSEP_ALL, and AST_VECTOR_APPEND.
Referenced by ast_sip_header_to_security_mechanism(), and ast_sip_security_mechanism_vector_init().