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

A single TCP connection context. More...

#include <tcp.h>

Public Attributes

uint8_t id
 Fixed slot index (0 … MAX_CONNS-1).
 
DetAtomic< ConnStatestate
 Lifecycle state; acquire/release for inter-task visibility.
 
struct tcp_pcb * pcb
 lwIP PCB; null when slot is free.
 
uint32_t last_activity_ms
 millis() timestamp of last TX/RX event.
 
uint8_t rx_buffer [RX_BUF_SIZE]
 Ring buffer storage.
 
DetAtomic< size_t > rx_head
 Producer write index (lwIP/tcpip context).
 
DetAtomic< size_t > rx_tail
 Consumer read index (worker context).
 
size_t rx_acked
 
uint8_t listener_id
 Index into listener_pool[]; set at accept time.
 
uint8_t owner
 Worker that owns this slot (round-robin at accept). Always 0 at N=1.
 
ConnProto proto
 Application protocol for this connection.
 
uint8_t proto_slot
 Per-protocol session/pool index (0xFF = none): the SSH session, an MQTT/Modbus session, etc.
 
DetIface iface
 Interface this connection arrived on; set at accept time.
 
uint8_t tls
 Non-zero when this connection is TLS (set at accept time).
 

Detailed Description

A single TCP connection context.

Sized so that MAX_CONNS instances fit in a static array without fragmentation. All fields except the volatile ring-buffer indices may only be accessed from the Arduino main-loop task.

Definition at line 71 of file tcp.h.

Member Data Documentation

◆ id

uint8_t TcpConn::id

◆ state

◆ pcb

◆ last_activity_ms

uint32_t TcpConn::last_activity_ms

millis() timestamp of last TX/RX event.

Definition at line 76 of file tcp.h.

Referenced by DeterministicAsyncTCP::check_timeouts(), det_conn_begin_close(), det_conn_touch_active(), lowlevel_recv_cb(), and lowlevel_sent_cb().

◆ rx_buffer

uint8_t TcpConn::rx_buffer[RX_BUF_SIZE]

Ring buffer storage.

Definition at line 78 of file tcp.h.

Referenced by lowlevel_recv_cb().

◆ rx_head

DetAtomic<size_t> TcpConn::rx_head

Producer write index (lwIP/tcpip context).

Definition at line 79 of file tcp.h.

Referenced by lowlevel_recv_cb().

◆ rx_tail

DetAtomic<size_t> TcpConn::rx_tail

Consumer read index (worker context).

Definition at line 80 of file tcp.h.

Referenced by det_conn_ack_consumed(), and lowlevel_recv_cb().

◆ rx_acked

size_t TcpConn::rx_acked

rx_tail position last ACKed to lwIP (tcp_recved). Worker-only: the window is reopened by exactly the bytes drained since, so it tracks ring occupancy (ack-on-consume) rather than copy.

Definition at line 81 of file tcp.h.

Referenced by det_conn_ack_consumed().

◆ listener_id

uint8_t TcpConn::listener_id

Index into listener_pool[]; set at accept time.

Definition at line 85 of file tcp.h.

◆ owner

uint8_t TcpConn::owner

Worker that owns this slot (round-robin at accept). Always 0 at N=1.

Definition at line 86 of file tcp.h.

Referenced by DeterministicAsyncTCP::check_timeouts(), listener_enqueue(), and lowlevel_sent_cb().

◆ proto

ConnProto TcpConn::proto

Application protocol for this connection.

Definition at line 87 of file tcp.h.

◆ proto_slot

uint8_t TcpConn::proto_slot

Per-protocol session/pool index (0xFF = none): the SSH session, an MQTT/Modbus session, etc.

Definition at line 89 of file tcp.h.

Referenced by ssh_conn_accept(), ssh_conn_close(), ssh_conn_poll(), and ssh_conn_rx().

◆ iface

DetIface TcpConn::iface

Interface this connection arrived on; set at accept time.

Definition at line 90 of file tcp.h.

◆ tls

uint8_t TcpConn::tls

Non-zero when this connection is TLS (set at accept time).

Definition at line 91 of file tcp.h.

Referenced by det_conn_abort_slot(), and det_conn_close().


The documentation for this struct was generated from the following file: