DeterministicESPAsyncWebServer 1.2.0
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
presentation.h
Go to the documentation of this file.
1// Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4/**
5 * @file presentation.h
6 * @brief Layer 6 (Presentation) — wires the transport ring buffer to the HTTP parser.
7 *
8 * This layer owns two responsibilities:
9 * 1. Drain bytes from `conn_pool[slot_id].rx_buffer` (transport ring buffer)
10 * and feed them into the HTTP parser one at a time.
11 * 2. Expose slot-indexed `http_reset()` and `http_parse()` helpers that the
12 * session layer (server_tick) and application layer (handle) call by slot ID.
13 *
14 * The actual HTTP parsing logic lives in `http_parser.h / http_parser.cpp`.
15 * This file merely includes it so callers only need one include.
16 *
17 * @author Douglas Quigg (dstroy0)
18 * @date 2026
19 */
20
21#ifndef DETERMINISTICESPASYNCWEBSERVER_PRESENTATION_H
22#define DETERMINISTICESPASYNCWEBSERVER_PRESENTATION_H
23
24#include "http_parser.h"
25#include "transport.h"
26
27// ---------------------------------------------------------------------------
28// Slot-indexed wrappers called by the session and application layers
29// ---------------------------------------------------------------------------
30
31/**
32 * @brief Reset the HTTP parser for a connection slot.
33 *
34 * Delegates to http_parser_reset(&http_pool[slot_id]). Silently ignores
35 * out-of-range slot IDs.
36 *
37 * @param slot_id Index into conn_pool / http_pool (0 … MAX_CONNS-1).
38 */
39void http_reset(uint8_t slot_id);
40
41/**
42 * @brief Drain the transport ring buffer and advance the HTTP parser.
43 *
44 * Reads all available bytes from `conn_pool[slot_id].rx_buffer` and feeds
45 * each byte to `http_parser_feed()`. Stops early if the parser reaches a
46 * terminal state (PARSE_COMPLETE, PARSE_ERROR, PARSE_ENTITY_TOO_LARGE,
47 * PARSE_URI_TOO_LONG).
48 *
49 * Silently ignores out-of-range slot IDs.
50 *
51 * @param slot_id Connection slot to parse.
52 */
53void http_parse(uint8_t slot_id);
54
55#endif
Standalone HTTP/1.1 request parser — no transport dependency.
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.
Layer 4 (Transport) — TCP connection pool, ring buffers, and lwIP integration.