TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Classes | Macros | Typedefs | Enumerations | Functions
http_parser.h File Reference
#include <sys/types.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  http_parser
 
struct  http_parser_settings
 
struct  http_parser_url
 

Macros

#define HTTP_PARSER_VERSION_MAJOR   2
 
#define HTTP_PARSER_VERSION_MINOR   5
 
#define HTTP_PARSER_VERSION_PATCH   0
 
#define HTTP_PARSER_STRICT   1
 
#define HTTP_MAX_HEADER_SIZE   (80*1024)
 
#define HTTP_METHOD_MAP(XX)
 
#define XX(num, name, string)   HTTP_##name = num,
 
#define HTTP_ERRNO_MAP(XX)
 
#define HTTP_ERRNO_GEN(n, s)   HPE_##n,
 
#define HTTP_PARSER_ERRNO(p)   ((enum http_errno) (p)->http_errno)
 

Typedefs

typedef struct http_parser http_parser
 
typedef struct http_parser_settings http_parser_settings
 
typedef int(* http_data_cb) (http_parser *, const char *at, size_t length)
 
typedef int(* http_cb) (http_parser *)
 

Enumerations

enum  http_method
 
enum  http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH }
 
enum  flags {
  F_CHUNKED = 1 << 0, F_CONNECTION_KEEP_ALIVE = 1 << 1, F_CONNECTION_CLOSE = 1 << 2, F_CONNECTION_UPGRADE = 1 << 3,
  F_TRAILING = 1 << 4, F_UPGRADE = 1 << 5, F_SKIPBODY = 1 << 6
}
 
enum  http_errno
 
enum  http_parser_url_fields {
  UF_SCHEMA = 0, UF_HOST = 1, UF_PORT = 2, UF_PATH = 3,
  UF_QUERY = 4, UF_FRAGMENT = 5, UF_USERINFO = 6, UF_MAX = 7
}
 

Functions

unsigned long http_parser_version (void)
 
void http_parser_init (http_parser *parser, enum http_parser_type type)
 
void http_parser_settings_init (http_parser_settings *settings)
 
size_t http_parser_execute (http_parser *parser, const http_parser_settings *settings, const char *data, size_t len)
 
int http_should_keep_alive (const http_parser *parser)
 
const char * http_method_str (enum http_method m)
 
const char * http_errno_name (enum http_errno err)
 
const char * http_errno_description (enum http_errno err)
 
int http_parser_parse_url (const char *buf, size_t buflen, int is_connect, struct http_parser_url *u)
 
void http_parser_pause (http_parser *parser, int paused)
 
int http_body_is_final (const http_parser *parser)
 

Macro Definition Documentation

#define HTTP_ERRNO_GEN (   n,
 
)    HPE_##n,

Definition at line 195 of file http_parser.h.

#define HTTP_ERRNO_MAP (   XX)

Definition at line 150 of file http_parser.h.

#define HTTP_MAX_HEADER_SIZE   (80*1024)

Definition at line 63 of file http_parser.h.

Referenced by http_parser_execute().

#define HTTP_METHOD_MAP (   XX)

Definition at line 88 of file http_parser.h.

#define HTTP_PARSER_ERRNO (   p)    ((enum http_errno) (p)->http_errno)

Definition at line 203 of file http_parser.h.

Referenced by http_parser_execute(), and http_parser_pause().

#define HTTP_PARSER_STRICT   1

Definition at line 52 of file http_parser.h.

#define HTTP_PARSER_VERSION_MAJOR   2

Definition at line 28 of file http_parser.h.

Referenced by http_parser_version().

#define HTTP_PARSER_VERSION_MINOR   5

Definition at line 29 of file http_parser.h.

Referenced by http_parser_version().

#define HTTP_PARSER_VERSION_PATCH   0

Definition at line 30 of file http_parser.h.

Referenced by http_parser_version().

#define XX (   num,
  name,
  string 
)    HTTP_##name = num,

Definition at line 125 of file http_parser.h.

Typedef Documentation

typedef int(* http_cb) (http_parser *)

Definition at line 84 of file http_parser.h.

typedef int(* http_data_cb) (http_parser *, const char *at, size_t length)

Definition at line 83 of file http_parser.h.

typedef struct http_parser http_parser

Definition at line 66 of file http_parser.h.

Definition at line 67 of file http_parser.h.

Enumeration Type Documentation

enum flags
Enumerator
F_CHUNKED 
F_CONNECTION_KEEP_ALIVE 
F_CONNECTION_CLOSE 
F_CONNECTION_UPGRADE 
F_TRAILING 
F_UPGRADE 
F_SKIPBODY 

Definition at line 135 of file http_parser.h.

enum http_errno

Definition at line 196 of file http_parser.h.

Definition at line 123 of file http_parser.h.

Enumerator
HTTP_REQUEST 
HTTP_RESPONSE 
HTTP_BOTH 

Definition at line 131 of file http_parser.h.

Enumerator
UF_SCHEMA 
UF_HOST 
UF_PORT 
UF_PATH 
UF_QUERY 
UF_FRAGMENT 
UF_USERINFO 
UF_MAX 

Definition at line 253 of file http_parser.h.

Function Documentation

int http_body_is_final ( const http_parser parser)
const char* http_errno_description ( enum http_errno  err)

Definition at line 2162 of file http_parser.c.

References http_strerror_tab.

const char* http_errno_name ( enum http_errno  err)

Definition at line 2155 of file http_parser.c.

References http_strerror_tab.

const char* http_method_str ( enum http_method  m)

Definition at line 2131 of file http_parser.c.

References ELEM_AT, and method_strings.

size_t http_parser_execute ( http_parser parser,
const http_parser_settings settings,
const char *  data,
size_t  len 
)

Definition at line 626 of file http_parser.c.

References CALLBACK_DATA, CALLBACK_DATA_, CALLBACK_DATA_NOADVANCE, CALLBACK_NOTIFY, CALLBACK_NOTIFY_NOADVANCE, CHUNKED, CLOSE, CONNECTION, CONTENT_LENGTH, http_parser::content_length, COUNT_HEADER_SIZE, CR, CURRENT_STATE, F_CHUNKED, F_CONNECTION_CLOSE, F_CONNECTION_KEEP_ALIVE, F_CONNECTION_UPGRADE, F_SKIPBODY, F_TRAILING, F_UPGRADE, http_parser::flags, h_C, h_CO, h_CON, h_connection, h_connection_close, h_connection_keep_alive, h_connection_upgrade, h_content_length, h_general, h_matching_connection, h_matching_connection_close, h_matching_connection_keep_alive, h_matching_connection_token, h_matching_connection_token_start, h_matching_connection_upgrade, h_matching_content_length, h_matching_proxy_connection, h_matching_transfer_encoding, h_matching_transfer_encoding_chunked, h_matching_upgrade, h_transfer_encoding, h_transfer_encoding_chunked, h_upgrade, http_parser::header_state, http_parser::http_major, HTTP_MAX_HEADER_SIZE, http_message_needs_eof(), http_parser::http_minor, HTTP_PARSER_ERRNO, HTTP_REQUEST, HTTP_RESPONSE, http_parser::index, IS_ALPHA, IS_NUM, KEEP_ALIVE, LF, LIKELY, LOWER, MARK, http_parser::method, method_strings, MIN, NEW_MESSAGE, http_parser::nread, http_parser_settings::on_headers_complete, parse_url_char(), PARSING_HEADER, PROXY_CONNECTION, REEXECUTE, RETURN, s_body_identity, s_body_identity_eof, s_chunk_data, s_chunk_data_almost_done, s_chunk_data_done, s_chunk_parameters, s_chunk_size, s_chunk_size_almost_done, s_chunk_size_start, s_dead, s_header_almost_done, s_header_field, s_header_field_start, s_header_value, s_header_value_discard_lws, s_header_value_discard_ws, s_header_value_discard_ws_almost_done, s_header_value_lws, s_header_value_start, s_headers_almost_done, s_headers_done, s_message_done, s_req_first_http_major, s_req_first_http_minor, s_req_fragment, s_req_fragment_start, s_req_http_H, s_req_http_HT, s_req_http_HTT, s_req_http_HTTP, s_req_http_major, s_req_http_minor, s_req_http_start, s_req_line_almost_done, s_req_method, s_req_path, s_req_query_string, s_req_query_string_start, s_req_schema, s_req_schema_slash, s_req_schema_slash_slash, s_req_server, s_req_server_start, s_req_server_with_at, s_req_spaces_before_url, s_res_first_http_major, s_res_first_http_minor, s_res_first_status_code, s_res_H, s_res_HT, s_res_HTT, s_res_HTTP, s_res_http_major, s_res_http_minor, s_res_line_almost_done, s_res_or_resp_H, s_res_status, s_res_status_code, s_res_status_start, s_start_req, s_start_req_or_res, s_start_res, SET_ERRNO, http_parser::state, http_parser::status_code, STRICT_CHECK, STRICT_TOKEN, TOKEN, TRANSFER_ENCODING, http_parser::type, ULLONG_MAX, unhex, UNLIKELY, UPDATE_STATE, UPGRADE, and http_parser::upgrade.

Referenced by QHttpConnectionPrivate::parseRequest().

void http_parser_init ( http_parser parser,
enum http_parser_type  type 
)
int http_parser_parse_url ( const char *  buf,
size_t  buflen,
int  is_connect,
struct http_parser_url u 
)
void http_parser_pause ( http_parser parser,
int  paused 
)

Definition at line 2407 of file http_parser.c.

References HTTP_PARSER_ERRNO, and SET_ERRNO.

void http_parser_settings_init ( http_parser_settings settings)

Definition at line 2149 of file http_parser.c.

unsigned long http_parser_version ( void  )
int http_should_keep_alive ( const http_parser parser)