|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
What the stack callbacks post to a listener's queue: the event type and the record. More...
#include "protocore_config.h"Go to the source code of this file.
Classes | |
| struct | TcpEvt |
| Event record posted from the stack callbacks to the session layer. More... | |
Macros | |
| #define | PROTOCORE_OBS_TRANSITION(slot, olds, news, reason) ((void)0) |
| #define | PROTOCORE_OBS_NOTICE(slot, st, reason) ((void)0) |
Typedefs | |
| typedef enum PROTO_ENUM_PACKED | ConnState |
| Lifecycle state of a connection pool slot. | |
| typedef enum PROTO_ENUM_PACKED | EvtType |
| Type of connection event posted to a listener's event queue. | |
| typedef struct TcpEvt | TcpEvt |
| Event record posted from the stack callbacks to the session layer. | |
Enumerations | |
| enum | PROTO_ENUM_PACKED { CONN_FREE , CONN_ACTIVE , CONN_CLOSING , EVT_CONNECT , EVT_DATA , EVT_DISCONNECT , EVT_ERROR } |
| Lifecycle state of a connection pool slot. More... | |
| enum | PROTO_ENUM_PACKED { CONN_FREE , CONN_ACTIVE , CONN_CLOSING , EVT_CONNECT , EVT_DATA , EVT_DISCONNECT , EVT_ERROR } |
| Type of connection event posted to a listener's event queue. More... | |
What the stack callbacks post to a listener's queue: the event type and the record.
Separate from common.h because this is all the layers above the transport need. A listener sizes its queue storage on TcpEvt, the session layer switches on EvtType, and the presentation layer names EVT_CONNECT; none of them touches a connection slot's fields. common.h carries those, and the ring cursors in them are _Atomic, which is C11 and not C++ - so a header that reaches the sketches through protocore.h cannot be the one that declares them.
Definition in file evt.h.
| #define PROTOCORE_OBS_TRANSITION | ( | slot, | |
| olds, | |||
| news, | |||
| reason | |||
| ) | ((void)0) |
| typedef enum PROTO_ENUM_PACKED ConnState |
Lifecycle state of a connection pool slot.
NOT the RFC 9293 sec 3.3.2 connection state machine. That machine (LISTEN, SYN-RECEIVED, ESTABLISHED, FIN-WAIT-1/2, CLOSE-WAIT, CLOSING, LAST-ACK, TIME-WAIT) belongs to the stack under this layer; these three name only whether the pool slot is available. A test mapping CONN_* to RFC state names 1:1 is testing the wrong thing.
Transitions, as the code performs them:
CONN_FREE -> CONN_ACTIVE accept callback fires.CONN_ACTIVE -> CONN_CLOSING the dwell that precedes a close begins.CONN_CLOSING -> CONN_FREE the peer ACKed the outbound data (snd_queuelen == 0), the dwell timed out, or data arrived that could no longer be delivered.CONN_ACTIVE -> CONN_FREE local close, remote FIN, stack error, or the idle sweep.Every terminal edge detaches the control block and frees the slot before handing it to the stack, so the slot's lifetime ends before the connection's does; the FIN and its retransmission are the stack's from that point (RFC 9293 sec 3.6).
Here rather than in common.h because the signaling layer reads a slot's state and reaches this layer through protocore.h; the enum is one packed byte and carries no _Atomic.
| typedef enum PROTO_ENUM_PACKED EvtType |
Type of connection event posted to a listener's event queue.
EVT_DISCONNECT and EVT_ERROR are the two a close is reported through, and they are distinct because RFC 9293 sec 3.6 MUST-12 requires the layer above to be told whether a connection closed normally or was aborted.
Event record posted from the stack callbacks to the session layer.
Copied into the queue by value, so nothing in it points at a slot whose lifetime ends before the record is drained.
| enum PROTO_ENUM_PACKED |
Lifecycle state of a connection pool slot.
NOT the RFC 9293 sec 3.3.2 connection state machine. That machine (LISTEN, SYN-RECEIVED, ESTABLISHED, FIN-WAIT-1/2, CLOSE-WAIT, CLOSING, LAST-ACK, TIME-WAIT) belongs to the stack under this layer; these three name only whether the pool slot is available. A test mapping CONN_* to RFC state names 1:1 is testing the wrong thing.
Transitions, as the code performs them:
CONN_FREE -> CONN_ACTIVE accept callback fires.CONN_ACTIVE -> CONN_CLOSING the dwell that precedes a close begins.CONN_CLOSING -> CONN_FREE the peer ACKed the outbound data (snd_queuelen == 0), the dwell timed out, or data arrived that could no longer be delivered.CONN_ACTIVE -> CONN_FREE local close, remote FIN, stack error, or the idle sweep.Every terminal edge detaches the control block and frees the slot before handing it to the stack, so the slot's lifetime ends before the connection's does; the FIN and its retransmission are the stack's from that point (RFC 9293 sec 3.6).
Here rather than in common.h because the signaling layer reads a slot's state and reaches this layer through protocore.h; the enum is one packed byte and carries no _Atomic.
| enum PROTO_ENUM_PACKED |
Type of connection event posted to a listener's event queue.
EVT_DISCONNECT and EVT_ERROR are the two a close is reported through, and they are distinct because RFC 9293 sec 3.6 MUST-12 requires the layer above to be told whether a connection closed normally or was aborted.