Layer 4 (Transport) - the connection state every half of TCP reads. More...
#include "config/platform/platform.h"#include "memoria_anularis/memoria_anularis.h"#include "network_drivers/transport/tcp/evt/evt.h"#include "shared/ip/ip.h"#include "protocore_config.h"Go to the source code of this file.
Classes | |
| struct | TcpConn |
| A single TCP connection context. More... | |
| struct | Listener |
| State for one TCP listening port. More... | |
Macros | |
| #define | PROTOCORE_PROTO_SLOT_NONE 0xFFu |
| Sentinel for TcpConn.proto_slot meaning "no per-protocol session bound". | |
| #define | PROTOCORE_DSCP_UNSET 0xFF |
| The row carries no code point of its own; accept() takes the server-wide default. | |
Typedefs | |
| typedef EMBED_BEGIN_DECLS struct TcpConn | TcpConn |
| A single TCP connection context. | |
Variables | |
| uint32_t | protocore_ap_ip |
| Access-point IPv4 address (network byte order) for STA/AP interface tagging. | |
| TcpConn | conn_pool [CONN_POOL_SLOTS] |
| Static pool of connection contexts. Defined in protocol/protocol.c. Sized CONN_POOL_SLOTS: MAX_CONNS TCP slots plus any reserved internal dispatch slot(s) (HTTP/3); the TCP accept path only ever uses [0, MAX_CONNS). | |
| mmgr_ring | protocore_conn_slots |
| The pool's slot ring, whose loculi are the slots. Defined in protocol/protocol.c. | |
| Listener | listener_pool [MAX_LISTENERS] |
| Static pool of listener contexts. Defined in server.c. | |
Layer 4 (Transport) - the connection state every half of TCP reads.
RFC 9293 sec 3.3.1 calls these the key connection state variables. Here that is the pool slot: its lifecycle state, its receive ring, and the identity fields the layers above filter on. The server (sec 3.9.1.1 passive OPEN), the client (active OPEN), the protocol engine (sec 3.10) and the lower-level seam (sec 3.9.2) all read this header and none of them declares its own copy.
The event record is in evt.h, which this header includes. The slot state below is an atomic word of embedded_types. The sketches reach evt.h alone, because they need the record and not the slot.
Concurrency model
| Context | Reads | Writes |
|---|---|---|
| stack callbacks | anularis.vacant (to check) | anularis.put |
| main loop | anularis.available/read/peek | anularis.read/consume |
The receive ring is a memoria_anularis ring over the slot's own aligned rx_buffer: one producer (the stack callbacks) and one consumer (the owning worker), with the ordering inside the ring. state is an embed_atomic_u32 of embedded_types, and each access is an EMBED_CALL of embed_atomic_u32_table.
Backpressure (lossless) When a whole inbound segment will not fit the free ring space, the recv callback refuses it without taking ownership of the segment. The stack holds it and redelivers once the main loop has drained the ring, so no received byte is dropped. Requires RX_BUF_SIZE > one TCP segment (TCP_MSS).
Definition in file common.h.
| #define PROTOCORE_PROTO_SLOT_NONE 0xFFu |
| #define PROTOCORE_DSCP_UNSET 0xFF |
The row carries no code point of its own; accept() takes the server-wide default.
Stated here rather than in diffserv.h because it is a value of Listener::dscp, which every build has: a port either names a code point or does not, and only whether the accept callback stamps one into the DS field depends on PROTOCORE_ENABLE_DIFFSERV.
| typedef EMBED_BEGIN_DECLS struct TcpConn TcpConn |
A single TCP connection context.
Sized so that MAX_CONNS instances fit in a static array without fragmentation. All fields except the ring and the state may only be accessed from the main-loop task.
|
extern |
Access-point IPv4 address (network byte order) for STA/AP interface tagging.
Zero when no access point is configured. Set via set_ap_ip(); the accept callback tags each connection PROTOCORE_IF_WIFI_AP when its local IP equals this, else PROTOCORE_IF_WIFI_STA. Used by per-route interface filters.
|
extern |
Static pool of connection contexts. Defined in protocol/protocol.c. Sized CONN_POOL_SLOTS: MAX_CONNS TCP slots plus any reserved internal dispatch slot(s) (HTTP/3); the TCP accept path only ever uses [0, MAX_CONNS).
|
extern |
The pool's slot ring, whose loculi are the slots. Defined in protocol/protocol.c.
|
extern |
Static pool of listener contexts. Defined in server.c.