|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
HttpParser.. More...
#include "protocore_config.h"Go to the source code of this file.
Classes | |
| struct | Header |
| struct | QueryParam |
| struct | HttpReq |
| struct | HttpParserNs |
| Dispatch table. Addressed by offset, so the layout is asserted below. More... | |
Typedefs | |
| typedef enum PROTO_ENUM_PACKED | ParseState |
| typedef enum PROTO_ENUM_PACKED | HttpVersion |
| typedef struct HttpReq | HttpReq |
| typedef proto_bool(* | HttpStreamBeginCb) (HttpReq *req) |
| typedef void(* | HttpStreamDataCb) (HttpReq *req, const uint8_t *data, size_t len) |
| typedef void(* | HttpStreamAbortCb) (HttpReq *req) |
Enumerations | |
| enum | PROTO_ENUM_PACKED { PARSE_METHOD , PARSE_PATH , PARSE_QUERY , PARSE_VERSION , PARSE_HEADER_KEY , PARSE_HEADER_VAL , PARSE_EXPECT_LF , PARSE_EXPECT_BODY_LF , PARSE_BODY , PARSE_COMPLETE , PARSE_ERROR , PARSE_ENTITY_TOO_LARGE , PARSE_URI_TOO_LONG , HTTP_UNKNOWN = 0 , HTTP_10 , HTTP_11 } |
| enum | PROTO_ENUM_PACKED { PARSE_METHOD , PARSE_PATH , PARSE_QUERY , PARSE_VERSION , PARSE_HEADER_KEY , PARSE_HEADER_VAL , PARSE_EXPECT_LF , PARSE_EXPECT_BODY_LF , PARSE_BODY , PARSE_COMPLETE , PARSE_ERROR , PARSE_ENTITY_TOO_LARGE , PARSE_URI_TOO_LONG , HTTP_UNKNOWN = 0 , HTTP_10 , HTTP_11 } |
Functions | |
| PROTOCORE_NS_LAYOUT (HttpParserNs, set_stream_hooks, reset, feed, get_header, get_cookie, forwarded_client, get_query, get_form, get_param) | |
| void | protocore_http_parser_set_stream_hooks (uint8_t *work, HttpStreamBeginCb begin, HttpStreamDataCb data, HttpStreamAbortCb abort) |
| Set_stream_hooks. | |
| void | protocore_http_parser_reset (uint8_t *work, HttpReq *req) |
| Reset. | |
| void | protocore_http_parser_feed (uint8_t *work, HttpReq *req, uint8_t byte) |
| Feed. | |
| const char * | protocore_http_parser_get_header (uint8_t *work, const HttpReq *req, const char *key) |
| Get_header. | |
| proto_bool | protocore_http_parser_get_cookie (uint8_t *work, const HttpReq *req, const char *name, char *out, size_t out_size) |
| Get_cookie. | |
| proto_bool | protocore_http_parser_forwarded_client (uint8_t *work, const HttpReq *req, char *ip_out, size_t ip_cap, proto_bool *is_https) |
| Forwarded_client. | |
| const char * | protocore_http_parser_get_query (uint8_t *work, const HttpReq *req, const char *key) |
| Get_query. | |
| proto_bool | protocore_http_parser_get_form (uint8_t *work, const HttpReq *req, const char *key, char *out, size_t out_size) |
| Get_form. | |
| const char * | protocore_http_parser_get_param (uint8_t *work, const HttpReq *req, const char *key) |
| Get_param. | |
| uint8_t * | protocore_http_parser_span (void) |
| The PROTOCORE_HTTP_PARSER_BORROW bytes this module's state lives in. | |
Variables | |
| HttpReq | http_pool [CONN_POOL_SLOTS] |
| The per-slot request table every HTTP layer parses into and reads back out of. | |
| PROTOCORE_NS HttpParserNs HttpParser | PROTOCORE_UNUSED |
| Module namespace. | |
HttpParser..
work is PROTOCORE_HTTP_PARSER_BORROW bytes the CALLER took, at an address it knows. It is not held past the call, so nothing here aliases it. How those bytes are carved is this module's and is never named here.
Definition in file http_parser.h.
| typedef enum PROTO_ENUM_PACKED ParseState |
| typedef enum PROTO_ENUM_PACKED HttpVersion |
| typedef proto_bool(* HttpStreamBeginCb)(HttpReq *req) |
Definition at line 100 of file http_parser.h.
| typedef void(* HttpStreamDataCb)(HttpReq *req, const uint8_t *data, size_t len) |
Definition at line 102 of file http_parser.h.
| typedef void(* HttpStreamAbortCb) (HttpReq *req) |
Definition at line 104 of file http_parser.h.
| enum PROTO_ENUM_PACKED |
Definition at line 19 of file http_parser.h.
| enum PROTO_ENUM_PACKED |
Definition at line 36 of file http_parser.h.
| PROTOCORE_NS_LAYOUT | ( | HttpParserNs | , |
| set_stream_hooks | , | ||
| reset | , | ||
| feed | , | ||
| get_header | , | ||
| get_cookie | , | ||
| forwarded_client | , | ||
| get_query | , | ||
| get_form | , | ||
| get_param | |||
| ) |
| void protocore_http_parser_set_stream_hooks | ( | uint8_t * | work, |
| HttpStreamBeginCb | begin, | ||
| HttpStreamDataCb | data, | ||
| HttpStreamAbortCb | abort | ||
| ) |
Set_stream_hooks.
| work | PROTOCORE_HTTP_PARSER_BORROW bytes the caller took. Not held past the call. |
| begin | Begin |
| data | Data |
| abort | Abort |
| void protocore_http_parser_reset | ( | uint8_t * | work, |
| HttpReq * | req | ||
| ) |
Reset.
| work | PROTOCORE_HTTP_PARSER_BORROW bytes the caller took. Not held past the call. |
| req | Req |
| void protocore_http_parser_feed | ( | uint8_t * | work, |
| HttpReq * | req, | ||
| uint8_t | byte | ||
| ) |
Feed.
| work | PROTOCORE_HTTP_PARSER_BORROW bytes the caller took. Not held past the call. |
| req | Req |
| byte | Byte |
| const char * protocore_http_parser_get_header | ( | uint8_t * | work, |
| const HttpReq * | req, | ||
| const char * | key | ||
| ) |
Get_header.
| work | PROTOCORE_HTTP_PARSER_BORROW bytes the caller took. Not held past the call. |
| req | Req |
| key | Key |
| proto_bool protocore_http_parser_get_cookie | ( | uint8_t * | work, |
| const HttpReq * | req, | ||
| const char * | name, | ||
| char * | out, | ||
| size_t | out_size | ||
| ) |
Get_cookie.
| work | PROTOCORE_HTTP_PARSER_BORROW bytes the caller took. Not held past the call. |
| req | Req |
| name | Name |
| out | Out |
| out_size | Out size |
| proto_bool protocore_http_parser_forwarded_client | ( | uint8_t * | work, |
| const HttpReq * | req, | ||
| char * | ip_out, | ||
| size_t | ip_cap, | ||
| proto_bool * | is_https | ||
| ) |
Forwarded_client.
| work | PROTOCORE_HTTP_PARSER_BORROW bytes the caller took. Not held past the call. |
| req | Req |
| ip_out | Ip out |
| ip_cap | Ip cap |
| is_https | Is https |
| const char * protocore_http_parser_get_query | ( | uint8_t * | work, |
| const HttpReq * | req, | ||
| const char * | key | ||
| ) |
Get_query.
| work | PROTOCORE_HTTP_PARSER_BORROW bytes the caller took. Not held past the call. |
| req | Req |
| key | Key |
| proto_bool protocore_http_parser_get_form | ( | uint8_t * | work, |
| const HttpReq * | req, | ||
| const char * | key, | ||
| char * | out, | ||
| size_t | out_size | ||
| ) |
Get_form.
| work | PROTOCORE_HTTP_PARSER_BORROW bytes the caller took. Not held past the call. |
| req | Req |
| key | Key |
| out | Out |
| out_size | Out size |
| const char * protocore_http_parser_get_param | ( | uint8_t * | work, |
| const HttpReq * | req, | ||
| const char * | key | ||
| ) |
Get_param.
| work | PROTOCORE_HTTP_PARSER_BORROW bytes the caller took. Not held past the call. |
| req | Req |
| key | Key |
| uint8_t * protocore_http_parser_span | ( | void | ) |
The PROTOCORE_HTTP_PARSER_BORROW bytes this module's state lives in.
Stated beside the namespace rather than on it: an entry takes a borrow, and this is where that borrow comes from. Taken once from the end of the pool, which no mark and no release walks, so the state lasts the life of the program.
|
extern |
The per-slot request table every HTTP layer parses into and reads back out of.
Not an entry: it is the shared cross-TU substrate a caller indexes by slot, not something the namespace hands out, so it is reached by name.
| PROTOCORE_NS HttpParserNs HttpParser PROTOCORE_UNUSED |
Module namespace.
Definition at line 224 of file http_parser.h.