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

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

#include "presentation.h"

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_parse (uint8_t slot_id)
 Drain the transport ring buffer and advance the HTTP parser.
 

Detailed Description

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

This file is now a thin adapter. The HTTP parsing logic lives in http_parser.cpp. This layer only knows about:

  • The transport ring buffer (conn_pool[slot].rx_buffer / rx_head / rx_tail)
  • Slot-indexed helpers that the session and application layers expect

The slot-indexed http_reset() pre-stamps slot_id then delegates to http_parser_reset(). The slot-indexed http_parse() drains all available bytes from the ring buffer through http_parser_feed() and stops as soon as the parser reaches any terminal state.

Definition in file presentation.cpp.

Function Documentation

◆ http_reset()

void http_reset ( uint8_t  slot_id)

Reset the HTTP parser for a connection slot.

Reset a presentation-layer parser slot (Layer 6 forward decl).

Delegates to http_parser_reset(&http_pool[slot_id]). Silently ignores out-of-range slot IDs.

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

Definition at line 21 of file presentation.cpp.

References http_parser_reset(), http_pool, MAX_CONNS, and HttpReq::slot_id.

Referenced by DetWebServer::begin(), DetWebServer::handle(), DetWebServer::send(), DetWebServer::send_empty(), server_tick(), and DetWebServer::stop().

◆ http_parse()

void http_parse ( uint8_t  slot_id)

Drain the transport ring buffer and advance the HTTP parser.

Advance the HTTP parser for a slot (Layer 6 forward decl).

Reads all available bytes from conn_pool[slot_id].rx_buffer and feeds each byte to http_parser_feed(). Stops early if the parser reaches a terminal state (PARSE_COMPLETE, PARSE_ERROR, PARSE_ENTITY_TOO_LARGE, PARSE_URI_TOO_LONG).

Silently ignores out-of-range slot IDs.

Parameters
slot_idConnection slot to parse.

Definition at line 29 of file presentation.cpp.

References conn_pool, http_parser_feed(), http_pool, MAX_CONNS, PARSE_COMPLETE, PARSE_ENTITY_TOO_LARGE, PARSE_ERROR, HttpReq::parse_state, PARSE_URI_TOO_LONG, RX_BUF_SIZE, TcpConn::rx_buffer, TcpConn::rx_head, and TcpConn::rx_tail.

Referenced by server_tick().