Asterisk - The Open Source Telephony Project
18.5.0
|
sip request response parser header file More...
Go to the source code of this file.
Data Structures | |
struct | contact |
struct | uriparams |
uri parameters More... | |
Functions | |
AST_LIST_HEAD_NOLOCK (contactliststruct, contact) | |
void | free_via (struct sip_via *v) |
const char * | get_calleridname (const char *input, char *output, size_t outputsize) |
Get caller id name from SIP headers, copy into output buffer. More... | |
int | get_comma (char *parse, char **out) |
Parse all contact header contacts. More... | |
char * | get_in_brackets (char *tmp) |
Pick out text in brackets from character string. More... | |
int | get_in_brackets_const (const char *src, const char **start, int *length) |
Get text in brackets on a const without copy. More... | |
int | get_in_brackets_full (char *tmp, char **out, char **residue) |
Get text in brackets and any trailing residue. More... | |
int | get_name_and_number (const char *hdr, char **name, char **number) |
Get name and number from sip header. More... | |
int | parse_contact_header (char *contactheader, struct contactliststruct *contactlist) |
int | parse_name_andor_addr (char *uri, const char *scheme, char **name, char **user, char **pass, char **domain, struct uriparams *params, char **headers, char **remander) |
Parse the ABNF structure name-andor-addr = name-addr / addr-spec into its components and return any trailing message-header parameters. More... | |
unsigned int | parse_sip_options (const char *options, char *unsupported, size_t unsupported_len) |
Parse supported header in incoming packet. More... | |
int | parse_uri (char *uri, const char *scheme, char **ret_name, char **pass, char **hostport, char **transport) |
parses a URI in its components. More... | |
int | parse_uri_full (char *uri, const char *scheme, char **user, char **pass, char **hostport, struct uriparams *params, char **headers, char **residue) |
parses a URI in to all of its components and any trailing residue More... | |
struct sip_via * | parse_via (const char *header) |
Parse a Via header. More... | |
void | sip_reqresp_parser_exit (void) |
Free resources used by request and response parser. More... | |
int | sip_reqresp_parser_init (void) |
initialize request and response parser data More... | |
void | sip_request_parser_register_tests (void) |
register request parsing tests More... | |
void | sip_request_parser_unregister_tests (void) |
unregister request parsing tests More... | |
int | sip_uri_cmp (const char *input1, const char *input2) |
Compare two URIs as described in RFC 3261 Section 19.1.4. More... | |
sip request response parser header file
Definition in file reqresp_parser.h.
AST_LIST_HEAD_NOLOCK | ( | contactliststruct | , |
contact | |||
) |
void free_via | ( | struct sip_via * | v | ) |
Definition at line 2379 of file reqresp_parser.c.
References ast_free, and sip_via::via.
Referenced by __find_call(), __sip_alloc(), AST_TEST_DEFINE(), parse_via(), and process_via().
const char* get_calleridname | ( | const char * | input, |
char * | output, | ||
size_t | outputsize | ||
) |
Get caller id name from SIP headers, copy into output buffer.
input | string pointer placed after display-name field if possible |
Definition at line 695 of file reqresp_parser.c.
References ast_log, ast_skip_blanks(), input(), and LOG_WARNING.
Referenced by AST_TEST_DEFINE(), check_user_full(), get_name_and_number(), parse_name_andor_addr(), and receive_message().
int get_comma | ( | char * | parse, |
char ** | out | ||
) |
Parse all contact header contacts.
0 | success |
-1 | failure |
1 | all contacts (star) |
Definition at line 1438 of file reqresp_parser.c.
References ast_log, c, find_closing_quote(), in, LOG_WARNING, NULL, and parse().
Referenced by parse_contact_header().
char* get_in_brackets | ( | char * | tmp | ) |
Pick out text in brackets from character string.
tmp | input string that will be modified |
Examples:
* "foo" <bar> valid input, returns bar * foo returns the whole string * < "foo ... > returns the string between brackets * < "foo... bogus (missing closing bracket), returns the whole string *
Definition at line 1173 of file reqresp_parser.c.
References get_in_brackets_full(), NULL, out, and tmp().
Referenced by AST_TEST_DEFINE(), check_user_full(), extract_uri(), get_also_info(), get_destination(), get_domain(), get_name_and_number(), get_pai(), get_rdnis(), get_refer_info(), handle_cc_notify(), parse_moved_contact(), parse_ok_contact(), parse_register_contact(), receive_message(), register_verify(), reqprep(), sip_get_cc_information(), sip_msg_send(), transmit_refer(), transmit_state_notify(), uac_sips_contact(), and uas_sips_contact().
int get_in_brackets_const | ( | const char * | src, |
const char ** | start, | ||
int * | length | ||
) |
Get text in brackets on a const without copy.
src | String to search | |
[out] | start | Set to first character inside left bracket. |
[out] | length | Set to lenght of string inside brackets |
0 | success |
-1 | failure |
1 | no brackets so got all |
Definition at line 1052 of file reqresp_parser.c.
References ast_log, ast_strlen_zero, find_closing_quote(), LOG_WARNING, NULL, and parse().
Referenced by build_route(), and sip_route_process_header().
int get_in_brackets_full | ( | char * | tmp, |
char ** | out, | ||
char ** | residue | ||
) |
Get text in brackets and any trailing residue.
0 | success |
-1 | failure |
1 | no brackets so got all |
Definition at line 1105 of file reqresp_parser.c.
References ast_log, ast_strlen_zero, find_closing_quote(), LOG_WARNING, NULL, parse(), and tmp().
Referenced by get_in_brackets(), and parse_name_andor_addr().
int get_name_and_number | ( | const char * | hdr, |
char ** | name, | ||
char ** | number | ||
) |
Get name and number from sip header.
0 | success |
-1 | failure |
Definition at line 905 of file reqresp_parser.c.
References ast_copy_string(), ast_log, ast_strdup, ast_strlen_zero, ast_uri_decode(), ast_uri_sip_user, dummy(), get_calleridname(), get_in_brackets(), LOG_ERROR, NULL, and parse_uri().
Referenced by AST_TEST_DEFINE(), change_redirecting_information(), and get_pai().
int parse_contact_header | ( | char * | contactheader, |
struct contactliststruct * | contactlist | ||
) |
Definition at line 1475 of file reqresp_parser.c.
References ast_calloc, AST_LIST_HEAD_SET_NOLOCK, AST_LIST_INSERT_TAIL, contact::expires, get_comma(), contact::headers, contact::hostport, last, contact::name, NULL, contact::params, parse_name_andor_addr(), contact::pass, contact::q, contact::user, and value.
Referenced by AST_TEST_DEFINE().
int parse_name_andor_addr | ( | char * | uri, |
const char * | scheme, | ||
char ** | name, | ||
char ** | user, | ||
char ** | pass, | ||
char ** | domain, | ||
struct uriparams * | params, | ||
char ** | headers, | ||
char ** | remander | ||
) |
Parse the ABNF structure name-andor-addr = name-addr / addr-spec into its components and return any trailing message-header parameters.
0 | success |
-1 | failure |
Definition at line 1262 of file reqresp_parser.c.
References buf, get_calleridname(), get_in_brackets_full(), NULL, and parse_uri_full().
Referenced by AST_TEST_DEFINE(), and parse_contact_header().
unsigned int parse_sip_options | ( | const char * | options, |
char * | unsupported, | ||
size_t | unsupported_len | ||
) |
Parse supported header in incoming packet.
This function parses through the options parameters and builds a bit field representing all the SIP options in that field. When an item is found that is not supported, it is copied to the unsupported out buffer.
option | list |
unsupported | out buffer (optional) |
unsupported | out buffer length (optional) |
options
to unsupported
. Callers of this function should make sure the unsupported buffer is clear before calling this function.This function parses through the options parameters and builds a bit field representing all the SIP options in that field. When an item is found that is not supported, it is copied to the unsupported out buffer.
options | list |
unsupported | out buffer (optional) |
unsupported_len | out buffer length (optional) |
Definition at line 1693 of file reqresp_parser.c.
References ARRAY_LEN, ast_copy_string(), ast_debug, ast_strdupa, ast_strip(), ast_strlen_zero, FALSE, cfsip_options::id, NULL, out, SIP_OPT_UNKNOWN, sip_options, SUPPORTED, text, and TRUE.
Referenced by AST_TEST_DEFINE(), handle_request_bye(), and handle_request_invite().
int parse_uri | ( | char * | uri, |
const char * | scheme, | ||
char ** | ret_name, | ||
char ** | pass, | ||
char ** | hostport, | ||
char ** | transport | ||
) |
parses a URI in its components.
0 | on success |
-1 | on error. |
* general form we are expecting is sip:user:password;user-parameters@host:port;uri-parameters?headers *
Definition at line 517 of file reqresp_parser.c.
References NULL, parse_uri_full(), and uriparams::transport.
Referenced by AST_TEST_DEFINE(), check_peer_ok(), get_name_and_number(), parse_uri_legacy_check(), and sip_msg_send().
int parse_uri_full | ( | char * | uri, |
const char * | scheme, | ||
char ** | user, | ||
char ** | pass, | ||
char ** | hostport, | ||
struct uriparams * | params, | ||
char ** | headers, | ||
char ** | residue | ||
) |
parses a URI in to all of its components and any trailing residue
0 | on success |
-1 | on error. |
parses a URI in to all of its components and any trailing residue
Definition at line 37 of file reqresp_parser.c.
References ast_debug, ast_strdupa, ast_strlen_zero, c, error(), uriparams::lr, uriparams::maddr, uriparams::method, NULL, strsep(), uriparams::transport, uriparams::ttl, uriparams::user, and value.
Referenced by AST_TEST_DEFINE(), parse_name_andor_addr(), and parse_uri().
struct sip_via* parse_via | ( | const char * | header | ) |
Parse a Via header.
This function parses the Via header and processes it according to section 18.2 of RFC 3261 and RFC 3581. Since we don't have a transport layer, we only care about the maddr and ttl parms. The received and rport params are not parsed.
Definition at line 2389 of file reqresp_parser.c.
References ast_calloc, ast_log, ast_skip_blanks(), ast_strdup, ast_strlen_zero, sip_via::branch, c, free_via(), LOG_ERROR, sip_via::maddr, NULL, sip_via::port, sip_via::protocol, sip_via::sent_by, strsep(), sip_via::ttl, and sip_via::via.
Referenced by __find_call(), __sip_alloc(), AST_TEST_DEFINE(), and process_via().
void sip_reqresp_parser_exit | ( | void | ) |
Free resources used by request and response parser.
Definition at line 2682 of file reqresp_parser.c.
References c_locale, and NULL.
Referenced by unload_module().
int sip_reqresp_parser_init | ( | void | ) |
initialize request and response parser data
0 | Success |
-1 | Failure |
Definition at line 2671 of file reqresp_parser.c.
References c_locale, and NULL.
Referenced by load_module().
void sip_request_parser_register_tests | ( | void | ) |
register request parsing tests
Definition at line 2644 of file reqresp_parser.c.
References AST_TEST_REGISTER.
Referenced by sip_register_tests().
void sip_request_parser_unregister_tests | ( | void | ) |
unregister request parsing tests
Definition at line 2657 of file reqresp_parser.c.
References AST_TEST_UNREGISTER.
Referenced by sip_unregister_tests().
int sip_uri_cmp | ( | const char * | input1, |
const char * | input2 | ||
) |
Compare two URIs as described in RFC 3261 Section 19.1.4.
input1 | First URI |
input2 | Second URI |
0 | URIs match |
nonzero | URIs do not match or one or both is malformed |
Definition at line 2153 of file reqresp_parser.c.
References ast_strdupa, ast_strlen_zero, ast_uri_decode(), ast_uri_sip_user, S_OR, sip_uri_domain_cmp(), sip_uri_headers_cmp(), sip_uri_params_cmp(), and strsep().
Referenced by AST_TEST_DEFINE(), find_by_notify_uri_helper(), find_by_subscribe_uri_helper(), handle_request_invite(), and match_req_to_dialog().