|
DeterministicESPAsyncWebServer 1.2.0
Zero-allocation, bounded-execution async HTTP server for ESP32
|
Layer 5 (Session) — event queue dispatcher and session lifecycle. More...
#include "freertos/FreeRTOS.h"#include "freertos/queue.h"#include "transport.h"#include <Arduino.h>Go to the source code of this file.
Functions | |
| void | server_tick () |
| Drive the session layer for one Arduino loop iteration. | |
| void | http_reset (uint8_t slot_id) |
| Reset a presentation-layer parser slot (Layer 6 forward decl). | |
| void | http_parse (uint8_t slot_id) |
| Advance the HTTP parser for a slot (Layer 6 forward decl). | |
Layer 5 (Session) — event queue dispatcher and session lifecycle.
The session layer is the bridge between the interrupt-driven transport layer and the application-layer HTTP handler. It processes all pending events from the FreeRTOS queue in a single bounded loop, ensuring that server_tick() has a deterministic worst-case execution time of O(queue_depth + MAX_CONNS).
Definition in file session.h.
| void server_tick | ( | ) |
Drive the session layer for one Arduino loop iteration.
Call this function from your loop() (or indirectly via DetWebServer::handle()). It performs three actions in order:
EVT_CONNECT / EVT_DISCONNECT / EVT_ERROR → http_reset()EVT_DATA → http_parse()Definition at line 15 of file session.cpp.
References DeterministicAsyncTCP::check_timeouts(), EVT_CONNECT, EVT_DATA, EVT_DISCONNECT, EVT_ERROR, http_parse(), http_reset(), DeterministicAsyncTCP::queue, TcpEvt::slot_id, and TcpEvt::type.
Referenced by DetWebServer::handle().
| void http_reset | ( | uint8_t | slot_id | ) |
Reset a presentation-layer parser slot (Layer 6 forward decl).
| slot_id | Connection slot to reset. |
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.
| slot_id | Index 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().
| void http_parse | ( | uint8_t | slot_id | ) |
Advance the HTTP parser for a slot (Layer 6 forward decl).
| slot_id | Connection slot to parse. |
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.
| slot_id | Connection 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().