DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
presentation.h File Reference

Layer 6 (Presentation) - wires the transport ring buffer to the HTTP parser. More...

Go to the source code of this file.

Functions

void http_reset (uint8_t slot_id)
 Reset the HTTP parser for a connection slot.
 
void http_conn_open (uint8_t slot_id)
 Initialize a slot for a freshly-accepted HTTP connection.
 
void http_parse (uint8_t slot_id)
 Drain the transport ring buffer and advance the HTTP parser.
 
const struct ProtoHandlerhttp_proto_handler (void)
 
void http_proto_set_poll (void(*fn)(uint8_t slot))
 Install the HTTP per-slot poll pump (the routing core's instance-bound on_poll).
 

Detailed Description

Layer 6 (Presentation) - wires the transport ring buffer to the HTTP parser.

This layer owns two responsibilities:

  1. Drain bytes via the transport read API (det_conn_available / det_conn_read_byte) and feed them into the HTTP parser one at a time - the ring is transport's.
  2. Expose slot-indexed http_reset() and http_parse() helpers that the session layer (server_tick) and application layer (handle) call by slot ID.

The actual HTTP parsing logic lives in http_parser.h / http_parser.cpp. This file merely includes it so callers only need one include.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file presentation.h.

Function Documentation

◆ http_reset()

void http_reset ( uint8_t  slot_id)

Reset the HTTP parser for a connection slot.

Delegates to http_parser_reset() for the slot's request struct. Silently ignores out-of-range slot IDs.

Parameters
slot_idIndex into conn_pool / http_pool (0 … MAX_CONNS-1).

Definition at line 40 of file presentation.cpp.

◆ http_conn_open()

void http_conn_open ( uint8_t  slot_id)

Initialize a slot for a freshly-accepted HTTP connection.

Resets the HTTP parser (like http_reset()) and, when keep-alive is enabled, zeroes the slot's persistent request counter. The session layer calls this on EvtType::EVT_CONNECT; http_reset() is used for the lighter inter-request reset that must not clear the counter. With keep-alive off this is identical to http_reset().

Parameters
slot_idIndex into conn_pool / http_pool (0 … MAX_CONNS-1).

Definition at line 65 of file presentation.cpp.

◆ http_parse()

void http_parse ( uint8_t  slot_id)

Drain the transport ring buffer and advance the HTTP parser.

Reads all available bytes from the slot's transport ring buffer and feeds each byte to http_parser_feed(). Stops early if the parser reaches a terminal state (ParseState::PARSE_COMPLETE, ParseState::PARSE_ERROR, ParseState::PARSE_ENTITY_TOO_LARGE, ParseState::PARSE_URI_TOO_LONG).

Silently ignores out-of-range slot IDs.

Parameters
slot_idConnection slot to parse.

Definition at line 76 of file presentation.cpp.

◆ http_proto_handler()

const struct ProtoHandler * http_proto_handler ( void  )

Definition at line 251 of file presentation.cpp.

Referenced by proto_register_builtins().

◆ http_proto_set_poll()

void http_proto_set_poll ( void(*)(uint8_t slot)  fn)

Install the HTTP per-slot poll pump (the routing core's instance-bound on_poll).

HTTP is the one protocol whose poll needs the DetWebServer instance (routing), so the application layer installs its pump here at begin() - the TX-seam (resp_sink) counterpart for the poll direction. With it set, HTTP plugs into the uniform ProtoHandler::on_poll seam exactly like every other protocol, so the L5/worker dispatch loop has no HTTP special case.

Definition at line 244 of file presentation.cpp.

Referenced by DetWebServer::service_once().