Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
http_parser.h File Reference
#include <sys/types.h>
#include <zephyr/types.h>
#include <stddef.h>
#include <net/http_parser_state.h>
#include <net/http_parser_url.h>

Go to the source code of this file.

Data Structures

struct  http_parser
 
struct  http_parser_settings
 

Macros

#define HTTP_PARSER_VERSION_MAJOR   2
 
#define HTTP_PARSER_VERSION_MINOR   7
 
#define HTTP_PARSER_VERSION_PATCH   1
 
#define HTTP_MAX_HEADER_SIZE   (80 * 1024)
 
#define HTTP_PARSER_ERRNO(p)   ((enum http_errno) (p)->http_errno)
 

Typedefs

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

Enumerations

enum  http_method {
  HTTP_DELETE = 0 , HTTP_GET = 1 , HTTP_HEAD = 2 , HTTP_POST = 3 ,
  HTTP_PUT = 4 , HTTP_CONNECT = 5 , HTTP_OPTIONS = 6 , HTTP_TRACE = 7 ,
  HTTP_COPY = 8 , HTTP_LOCK = 9 , HTTP_MKCOL = 10 , HTTP_MOVE = 11 ,
  HTTP_PROPFIND = 12 , HTTP_PROPPATCH = 13 , HTTP_SEARCH = 14 , HTTP_UNLOCK = 15 ,
  HTTP_BIND = 16 , HTTP_REBIND = 17 , HTTP_UNBIND = 18 , HTTP_ACL = 19 ,
  HTTP_REPORT = 20 , HTTP_MKACTIVITY = 21 , HTTP_CHECKOUT = 22 , HTTP_MERGE = 23 ,
  HTTP_MSEARCH = 24 , HTTP_NOTIFY = 25 , HTTP_SUBSCRIBE = 26 , HTTP_UNSUBSCRIBE = 27 ,
  HTTP_PATCH = 28 , HTTP_PURGE = 29 , HTTP_MKCALENDAR = 30 , HTTP_LINK = 31 ,
  HTTP_UNLINK = 32
}
 
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 , F_CONTENTLENGTH = 1 << 7
}
 
enum  http_errno {
  HPE_OK , HPE_CB_message_begin , HPE_CB_url , HPE_CB_header_field ,
  HPE_CB_header_value , HPE_CB_headers_complete , HPE_CB_body , HPE_CB_message_complete ,
  HPE_CB_status , HPE_CB_chunk_header , HPE_CB_chunk_complete , HPE_INVALID_EOF_STATE ,
  HPE_HEADER_OVERFLOW , HPE_CLOSED_CONNECTION , HPE_INVALID_VERSION , HPE_INVALID_STATUS ,
  HPE_INVALID_METHOD , HPE_INVALID_URL , HPE_INVALID_HOST , HPE_INVALID_PORT ,
  HPE_INVALID_PATH , HPE_INVALID_QUERY_STRING , HPE_INVALID_FRAGMENT , HPE_LF_EXPECTED ,
  HPE_INVALID_HEADER_TOKEN , HPE_INVALID_CONTENT_LENGTH , HPE_UNEXPECTED_CONTENT_LENGTH , HPE_INVALID_CHUNK_SIZE ,
  HPE_INVALID_CONSTANT , HPE_INVALID_INTERNAL_STATE , HPE_STRICT , HPE_PAUSED ,
  HPE_UNKNOWN
}
 

Functions

unsigned long http_parser_version (void)
 
void http_parser_init (struct http_parser *parser, enum http_parser_type type)
 
void http_parser_settings_init (struct http_parser_settings *settings)
 
size_t http_parser_execute (struct http_parser *parser, const struct http_parser_settings *settings, const char *data, size_t len)
 
int http_should_keep_alive (const struct 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)
 
void http_parser_pause (struct http_parser *parser, int paused)
 
int http_body_is_final (const struct http_parser *parser)
 

Macro Definition Documentation

◆ HTTP_MAX_HEADER_SIZE

#define HTTP_MAX_HEADER_SIZE   (80 * 1024)

◆ HTTP_PARSER_ERRNO

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

◆ HTTP_PARSER_VERSION_MAJOR

#define HTTP_PARSER_VERSION_MAJOR   2

◆ HTTP_PARSER_VERSION_MINOR

#define HTTP_PARSER_VERSION_MINOR   7

◆ HTTP_PARSER_VERSION_PATCH

#define HTTP_PARSER_VERSION_PATCH   1

Typedef Documentation

◆ http_cb

typedef int(* http_cb) (struct http_parser *)

◆ http_data_cb

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

Enumeration Type Documentation

◆ flags

enum flags
Enumerator
F_CHUNKED 
F_CONNECTION_KEEP_ALIVE 
F_CONNECTION_CLOSE 
F_CONNECTION_UPGRADE 
F_TRAILING 
F_UPGRADE 
F_SKIPBODY 
F_CONTENTLENGTH 

◆ http_errno

enum http_errno
Enumerator
HPE_OK 
HPE_CB_message_begin 
HPE_CB_url 
HPE_CB_header_field 
HPE_CB_header_value 
HPE_CB_headers_complete 
HPE_CB_body 
HPE_CB_message_complete 
HPE_CB_status 
HPE_CB_chunk_header 
HPE_CB_chunk_complete 
HPE_INVALID_EOF_STATE 
HPE_HEADER_OVERFLOW 
HPE_CLOSED_CONNECTION 
HPE_INVALID_VERSION 
HPE_INVALID_STATUS 
HPE_INVALID_METHOD 
HPE_INVALID_URL 
HPE_INVALID_HOST 
HPE_INVALID_PORT 
HPE_INVALID_PATH 
HPE_INVALID_QUERY_STRING 
HPE_INVALID_FRAGMENT 
HPE_LF_EXPECTED 
HPE_INVALID_HEADER_TOKEN 
HPE_INVALID_CONTENT_LENGTH 
HPE_UNEXPECTED_CONTENT_LENGTH 
HPE_INVALID_CHUNK_SIZE 
HPE_INVALID_CONSTANT 
HPE_INVALID_INTERNAL_STATE 
HPE_STRICT 
HPE_PAUSED 
HPE_UNKNOWN 

◆ http_method

Enumerator
HTTP_DELETE 
HTTP_GET 
HTTP_HEAD 
HTTP_POST 
HTTP_PUT 
HTTP_CONNECT 
HTTP_OPTIONS 
HTTP_TRACE 
HTTP_COPY 
HTTP_LOCK 
HTTP_MKCOL 
HTTP_MOVE 
HTTP_PROPFIND 
HTTP_PROPPATCH 
HTTP_SEARCH 
HTTP_UNLOCK 
HTTP_BIND 
HTTP_REBIND 
HTTP_UNBIND 
HTTP_ACL 
HTTP_REPORT 
HTTP_MKACTIVITY 
HTTP_CHECKOUT 
HTTP_MERGE 
HTTP_MSEARCH 
HTTP_NOTIFY 
HTTP_SUBSCRIBE 
HTTP_UNSUBSCRIBE 
HTTP_PATCH 
HTTP_PURGE 
HTTP_MKCALENDAR 
HTTP_LINK 
HTTP_UNLINK 

◆ http_parser_type

Enumerator
HTTP_REQUEST 
HTTP_RESPONSE 
HTTP_BOTH 

Function Documentation

◆ http_body_is_final()

int http_body_is_final ( const struct http_parser parser)

◆ http_errno_description()

const char * http_errno_description ( enum http_errno  err)

◆ http_errno_name()

const char * http_errno_name ( enum http_errno  err)

◆ http_method_str()

const char * http_method_str ( enum http_method  m)

◆ http_parser_execute()

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

◆ http_parser_init()

void http_parser_init ( struct http_parser parser,
enum http_parser_type  type 
)

◆ http_parser_pause()

void http_parser_pause ( struct http_parser parser,
int  paused 
)

◆ http_parser_settings_init()

void http_parser_settings_init ( struct http_parser_settings settings)

◆ http_parser_version()

unsigned long http_parser_version ( void  )

◆ http_should_keep_alive()

int http_should_keep_alive ( const struct http_parser parser)