Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
parser.h File Reference
#include <sys/types.h>
#include <zephyr/types.h>
#include <stddef.h>
#include <zephyr/net/http/method.h>
#include <zephyr/net/http/parser_state.h>
#include <zephyr/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)
 

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_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)
Value:
((enum http_errno) (p)->http_errno)
http_errno
Definition parser.h:107

◆ 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_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)