http-parser.h revision 0b5bdb5ba6c8cb928b6d2dcc4636148bfa1a7ec7
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainen * Character definitions
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainenextern const unsigned char _http_token_char_mask;
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainenextern const unsigned char _http_value_char_mask;
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainenextern const unsigned char _http_text_char_mask;
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainenextern const unsigned char _http_qdtext_char_mask;
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainenextern const unsigned char _http_ctext_char_mask;
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainenextern const unsigned char _http_token68_char_mask;
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainenextern const unsigned char _http_char_lookup[256];
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainenstatic inline bool http_char_is_token(unsigned char ch) {
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainen return (_http_char_lookup[ch] & _http_token_char_mask) != 0;
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainenstatic inline bool http_char_is_value(unsigned char ch) {
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainen return (_http_char_lookup[ch] & _http_value_char_mask) != 0;
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainenstatic inline bool http_char_is_text(unsigned char ch) {
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainen return (_http_char_lookup[ch] & _http_text_char_mask) != 0;
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainenstatic inline bool http_char_is_qdtext(unsigned char ch) {
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainen return (_http_char_lookup[ch] & _http_qdtext_char_mask) != 0;
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainenstatic inline bool http_char_is_ctext(unsigned char ch) {
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainen return (_http_char_lookup[ch] & _http_ctext_char_mask) != 0;
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainenstatic inline bool http_char_is_token68(unsigned char ch) {
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainen return (_http_char_lookup[ch] & _http_token68_char_mask) != 0;
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainen * HTTP value parsing
7ff6268cc35102675d73d44d680bed13d0709f7bTimo Sirainenvoid http_parser_init(struct http_parser *parser,
e0aff4c7e3336ec4b5edbcfc3a72e1e118603ee2Timo Sirainenvoid http_parse_ows(struct http_parser *parser);
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainenint http_parser_skip_token(struct http_parser *parser);
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainenint http_parse_token(struct http_parser *parser, const char **token_r);
34b724d1d7e50b1ab24267a3b6fc089b1147c1abAki Tuomiint http_parse_token_list_next(struct http_parser *parser,
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainen const char **token_r);
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainenint http_parse_quoted_string(struct http_parser *parser, const char **str_r);
7ff6268cc35102675d73d44d680bed13d0709f7bTimo Sirainenint http_parse_token_or_qstring(struct http_parser *parser,
66e1cf5014bec1cf1a8339be6fccc9be5ad3c793Timo Sirainen const char **word_r);