36#ifndef PROTOCORE_TCP_COMMON_H
37#define PROTOCORE_TCP_COMMON_H
40#include "memoria_anularis/memoria_anularis.h"
84#define PROTOCORE_PROTO_SLOT_NONE 0xFFu
102_Static_assert(
MAX_CONNS <= MMGR_RING_LOCULI,
103 "every connection slot is a loculus; raise MMGR_RING_LOCULI (and MMGR_RING_WORDS) with MAX_CONNS");
142#if PROTOCORE_WORKER_COUNT == 1
145 protocore_platform_queue_ctrl _queue_struct;
147 protocore_platform_queue queue;
161#define PROTOCORE_DSCP_UNSET 0xFF
enum PROTO_ENUM_PACKED protocore_if_kind
What an interface is, and the filter that selects one.
#define MAX_LISTENERS
Maximum number of simultaneously active listener ports.
#define RX_BUF_SIZE
Ring-buffer capacity in bytes per connection slot (feature floors enforced last, in derived_sizing....
#define EVT_QUEUE_DEPTH
Depth of the FreeRTOS event queue shared between lwIP callbacks and the main-loop task.
#define MAX_CONNS
Maximum simultaneous TCP connections (fixed static pool; ~3.95 KB of internal RAM per slot).
enum PROTO_ENUM_PACKED ProtoConn
Application protocol spoken on a listener port or connection slot.
What the stack callbacks post to a listener's queue: the event type and the record.
enum PROTO_ENUM_PACKED ConnState
Lifecycle state of a connection pool slot.
Layer 3 (Network) - a family-tagged IP address (IPv4 or IPv6) with RFC-faithful text parsing,...
State for one TCP listening port.
ProtoConn proto
Application protocol for all connections accepted here.
uint8_t dscp
Per-listener DiffServ DSCP for accepted connections; PROTOCORE_DSCP_UNSET = use the default.
proto_bool active
True after listener_add(), false after listener_stop().
proto_bool tls
True when connections accepted here begin a TLS handshake.
uint16_t port
TCP port this listener binds.
protocore_pcb * listen_pcb
the listening control block; NULL when inactive.
A single TCP connection context.
mmgr_ring rx
The receive ring over rx_buffer.
protocore_if_kind iface
Interface this connection arrived on; set at accept time.
uint32_t last_activity_ms
protocore_millis() timestamp of last TX/RX event.
uint8_t id
Fixed slot index (0 … MAX_CONNS-1).
uint8_t owner
Worker that owns this slot (round-robin at accept). Always 0 at N=1.
uint8_t listener_id
Index into listener_pool[]; set at accept time.
ProtoConn proto
Application protocol for this connection.
uint8_t tls
Non-zero when this connection is TLS (set at accept time).
uint8_t proto_slot
Per-protocol session/pool index (0xFF = none): the SSH session, an MQTT/Modbus session,...
_Atomic ConnState state
Lifecycle state; acquire/release for inter-task visibility.
protocore_pcb * pcb
Stack control block; null when slot is free.
EMBED_ALIGN(MMGR_ALIGN_BYTES) uint8_t rx_buffer[RX_BUF_SIZE]
The ring's bytes, owned here.
Event record posted from the stack callbacks to the session layer.
TcpConn conn_pool[CONN_POOL_SLOTS]
Static pool of connection contexts. Defined in protocol/protocol.c. Sized CONN_POOL_SLOTS: MAX_CONNS ...
uint32_t protocore_ap_ip
Access-point IPv4 address (network byte order) for STA/AP interface tagging.
Listener listener_pool[MAX_LISTENERS]
Static pool of listener contexts. Defined in server.c.
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS