Enumerations | |
enum | token_type_t { TT_IDENTIFIER , TT_WHITESPACE , TT_CRLF , TT_CTRL , TT_SEPARATOR , TT_QUOTEDSTRING } |
Used to represent different types of tokens in input. More... | |
Functions | |
void | scanner_init (scanner_t *scanner, membuffer *bufptr) |
Initialize scanner. | |
int | is_separator_char (int c) |
Determines if the passed value is a separator. | |
int | is_identifier_char (int c) |
Determines if the passed value is permissible in token. | |
int | is_control_char (int c) |
Determines if the passed value is a control character. | |
int | is_qdtext_char (int c) |
Determines if the passed value is permissible in qdtext. | |
parse_status_t | scanner_get_token (scanner_t *scanner, memptr *token, token_type_t *tok_type) |
Reads next token from the input stream. | |
char * | scanner_get_str (scanner_t *scanner) |
Get pointer to next character in string. | |
int | httpmsg_compare (void *param1, void *param2) |
Compares name id in the http headers. | |
void | httpheader_free (void *msg) |
Free memory allocated for the http header. | |
parse_status_t | skip_blank_lines (scanner_t *scanner) |
Skips blank lines at the start of a msg. | |
parse_status_t | skip_lws (scanner_t *scanner) |
Skip linear whitespace. | |
parse_status_t | match_non_ws_string (scanner_t *scanner, memptr *str) |
Match a string without whitespace or CRLF (S) | |
parse_status_t | match_raw_value (scanner_t *scanner, memptr *raw_value) |
Matches a raw value in a the input. | |
parse_status_t | match_int (scanner_t *scanner, int base, int *value) |
Matches an unsigned integer value in the input. | |
parse_status_t | read_until_crlf (scanner_t *scanner, memptr *str) |
Reads data until end of line. | |
parse_status_t | match_char (scanner_t *scanner, char c, int case_sensitive) |
Compares a character to the next char in the scanner. | |
parse_status_t | vfmatch (scanner_t *scanner, const char *fmt, va_list argp) |
Extracts variable parameters depending on the passed in format parameter. | |
parse_status_t | match (scanner_t *scanner, const char *fmt,...) |
Matches a variable parameter list and takes necessary actions based on the data type specified. | |
void | httpmsg_init (http_message_t *msg) |
Initialize and allocate memory for http message. | |
void | parser_init (http_parser_t *parser) |
Initializes the parser object. | |
parse_status_t | parser_parse_requestline (http_parser_t *parser) |
Get HTTP Method, URL location and version information. | |
parse_status_t | parser_parse_entity_using_clen (http_parser_t *parser) |
Reads entity using content-length. | |
parse_status_t | parser_parse_chunky_body (http_parser_t *parser) |
Read data in the chunks. | |
parse_status_t | parser_parse_chunky_headers (http_parser_t *parser) |
Read headers at the end of the chunked entity. | |
parse_status_t | parser_parse_chunky_entity (http_parser_t *parser) |
Read entity using chunked transfer encoding. | |
parse_status_t | parser_parse_entity_until_close (http_parser_t *parser) |
Keep reading entity until the connection is closed. | |
Variables | |
constexpr std::array< const UPnPsdk::str_int_entry, 11 > | Http_Method_Table |
Defines the HTTP methods. | |
enum anonymous_namespace{httpparser.cpp}::token_type_t |
Used to represent different types of tokens in input.
Definition at line 64 of file httpparser.cpp.
|
inline |
Initialize scanner.
[out] | scanner | Scanner Object to be initialized |
[in] | bufptr | Buffer to be copied |
Definition at line 100 of file httpparser.cpp.
|
inline |
Determines if the passed value is a separator.
[in] | c | Character to be tested against used separator values |
Definition at line 112 of file httpparser.cpp.
|
inline |
Determines if the passed value is permissible in token.
[in] | c | Character to be tested for separator values |
Definition at line 121 of file httpparser.cpp.
|
inline |
Determines if the passed value is a control character.
[in] | c | Character to be tested for a control character |
Definition at line 130 of file httpparser.cpp.
|
inline |
Determines if the passed value is permissible in qdtext.
[in] | c | Character to be tested for CR/LF |
Definition at line 139 of file httpparser.cpp.
parse_status_t anonymous_namespace{httpparser.cpp}::scanner_get_token | ( | scanner_t * | scanner, |
memptr * | token, | ||
token_type_t * | tok_type | ||
) |
Reads next token from the input stream.
0 and is used as a marker, and will not be valid in a quote.
[in,out] | scanner | Scanner Object |
[out] | token | Token |
[out] | tok_type | Type of token |
Definition at line 160 of file httpparser.cpp.
|
inline |
Get pointer to next character in string.
[in] | scanner | Scanner Object |
Definition at line 277 of file httpparser.cpp.
int anonymous_namespace{httpparser.cpp}::httpmsg_compare | ( | void * | param1, |
void * | param2 | ||
) |
Compares name id in the http headers.
[in] | param1 | Pointer to a HTTP header |
[in] | param2 | Pointer to a HTTP header |
Definition at line 290 of file httpparser.cpp.
void anonymous_namespace{httpparser.cpp}::httpheader_free | ( | void * | msg | ) |
Free memory allocated for the http header.
[in] | msg | Pointer to HTTP header. |
Definition at line 304 of file httpparser.cpp.
|
inline |
Skips blank lines at the start of a msg.
[in,out] | scanner | Scanner Object |
Definition at line 324 of file httpparser.cpp.
|
inline |
Skip linear whitespace.
[in,out] | scanner | Scanner Object |
Definition at line 353 of file httpparser.cpp.
|
inline |
Match a string without whitespace or CRLF (S)
[in,out] | scanner | Scanner Object. |
[out] | str | Buffer to get the scanner buffer contents. |
Definition at line 402 of file httpparser.cpp.
|
inline |
Matches a raw value in a the input.
Value's length can be 0 or more. Whitespace after value is trimmed. On success, scanner points the CRLF that ended the value.
[in,out] | scanner | Scanner Object |
[out] | raw_value | Buffer to get the scanner buffer. |
Definition at line 463 of file httpparser.cpp.
|
inline |
Matches an unsigned integer value in the input.
The integer is returned in 'value'. Except for PARSE_OK result, the scanner's cursor is moved back to its original position on error.
[in,out] | scanner | Scanner Object. |
[in] | base | Base of number in the string; valid values: 10 or 16. |
[out] | value | Number stored here. |
Definition at line 549 of file httpparser.cpp.
|
inline |
Reads data until end of line.
The crlf at the end of line is not consumed. On error, scanner is not restored. On success, str points to a string that runs until eol.
[in,out] | scanner | Scanner Object. |
[out] | str | Buffer to copy scanner buffer contents to. |
Definition at line 600 of file httpparser.cpp.
|
inline |
Compares a character to the next char in the scanner.
On error, scanner chars are not restored.
[in,out] | scanner | Scanner Object. |
[in] | c | Character to be compared with. |
[in] | case_sensitive | Flag indicating whether comparison should be case sensitive. |
Definition at line 641 of file httpparser.cpp.
parse_status_t anonymous_namespace{httpparser.cpp}::vfmatch | ( | scanner_t * | scanner, |
const char * | fmt, | ||
va_list | argp | ||
) |
Extracts variable parameters depending on the passed in format parameter.
Parses data also based on the passed in format parameter.
[in,out] | scanner | Scanner Object. |
[in] | fmt | Pattern Format. |
[in] | argp | List of variable arguments. |
Definition at line 710 of file httpparser.cpp.
parse_status_t anonymous_namespace{httpparser.cpp}::match | ( | scanner_t * | scanner, |
const char * | fmt, | ||
... | |||
) |
Matches a variable parameter list and takes necessary actions based on the data type specified.
[in,out] | scanner | Scanner Object. |
[in] | fmt | Pattern format (like printf()). |
[in] | ... | Variable arguments (like printf()). |
Definition at line 882 of file httpparser.cpp.
void anonymous_namespace{httpparser.cpp}::httpmsg_init | ( | http_message_t * | msg | ) |
Initialize and allocate memory for http message.
[in,out] | msg | HTTP Message Object |
Definition at line 900 of file httpparser.cpp.
|
inline |
Initializes the parser object.
[out] | parser | HTTP Parser Object. |
Definition at line 916 of file httpparser.cpp.
parse_status_t anonymous_namespace{httpparser.cpp}::parser_parse_requestline | ( | http_parser_t * | parser | ) |
Get HTTP Method, URL location and version information.
[in,out] | parser | HTTP Parser Object. |
Definition at line 942 of file httpparser.cpp.
|
inline |
Reads entity using content-length.
[in,out] | parser | HTTP Parser Object. |
Definition at line 1079 of file httpparser.cpp.
|
inline |
Read data in the chunks.
[in,out] | parser | HTTP Parser Object. |
Definition at line 1125 of file httpparser.cpp.
|
inline |
Read headers at the end of the chunked entity.
[in,out] | parser | HTTP Parser Object. |
Definition at line 1166 of file httpparser.cpp.
|
inline |
Read entity using chunked transfer encoding.
[in,out] | parser | HTTP Parser Object. |
Definition at line 1202 of file httpparser.cpp.
|
inline |
Keep reading entity until the connection is closed.
[in,out] | parser | HTTP Parser Object. |
Definition at line 1247 of file httpparser.cpp.
|
inlineconstexpr |
Defines the HTTP methods.
Definition at line 75 of file httpparser.cpp.