33#ifndef DETERMINISTICESPASYNCWEBSERVER_TRANSPORT_H
34#define DETERMINISTICESPASYNCWEBSERVER_TRANSPORT_H
37#include "freertos/FreeRTOS.h"
38#include "freertos/queue.h"
User-facing configuration for DeterministicESPAsyncWebServer.
#define RX_BUF_SIZE
Ring-buffer capacity in bytes per connection slot.
#define MAX_CONNS
Maximum simultaneous TCP connections.
Static-only facade over the raw lwIP TCP API.
static bool heap_available()
Always returns true — no heap allocation means no pre-flight needed.
static void check_timeouts()
Scan the pool and force-close connections idle for > conn_timeout_ms.
static int32_t init(uint16_t port, const WebServerConfig *cfg=nullptr)
Initialise the TCP stack, create the event queue, and begin listening.
static size_t heap_needed()
Always returns 0 — the library makes no heap allocations.
static uint32_t conn_timeout_ms
Runtime connection-idle timeout in milliseconds.
static void stop()
Stop the server: abort all connections, close the listener, free the queue.
static QueueHandle_t queue
FreeRTOS queue handle shared between lwIP callbacks and server_tick().
A single TCP connection context.
volatile ConnState state
Lifecycle state; volatile for inter-task visibility.
struct tcp_pcb * pcb
lwIP PCB; null when slot is free.
volatile size_t rx_tail
Consumer read index (main-loop context).
uint32_t last_activity_ms
millis() timestamp of last TX/RX event.
uint8_t id
Fixed slot index (0 … MAX_CONNS-1).
uint8_t rx_buffer[RX_BUF_SIZE]
Ring buffer storage.
volatile size_t rx_head
Producer write index (lwIP context).
Event record posted from lwIP callbacks to the main-loop task.
EvtType type
What happened.
size_t data_len
Bytes copied (EVT_DATA only); 0 for other types.
uint8_t slot_id
Which connection slot is affected.
Runtime-tunable server parameters.
ConnState
Lifecycle state of a connection pool slot.
@ CONN_CLOSING
FIN sent; waiting for final ACK (reserved).
@ CONN_FREE
Slot is available; no PCB is attached.
@ CONN_ACTIVE
Live connection; PCB is valid.
EvtType
Type of connection event posted to the FreeRTOS event queue.
@ EVT_CONNECT
New connection accepted.
@ EVT_DISCONNECT
Remote peer closed the connection gracefully.
@ EVT_ERROR
lwIP reported an error (PCB may already be freed).
@ EVT_DATA
Data received; bytes are already in the ring buffer.
TcpConn conn_pool[MAX_CONNS]
Static pool of connection contexts. Defined in transport.cpp.