17#ifndef PROTOCORE_TCP_EVT_H
18#define PROTOCORE_TCP_EVT_H
50static_assert(
sizeof(ConnState) == 1,
51 "ConnState must stay one byte (EMBED_ENUM_BYTE); TcpConn and conn_pool[] size themselves on it");
66static_assert(
sizeof(EvtType) == 1,
67 "EvtType must stay one byte (EMBED_ENUM_BYTE); every listener's queue storage sizes itself on TcpEvt");
85#if PROTOCORE_ENABLE_OBSERVABILITY
89 PROTOCORE_CONN_R_ACCEPT,
90 PROTOCORE_CONN_R_CLOSE_REMOTE,
91 PROTOCORE_CONN_R_CLOSE_LOCAL,
92 PROTOCORE_CONN_R_ERROR,
93 PROTOCORE_CONN_R_TIMEOUT,
94 PROTOCORE_CONN_R_ABORT,
95 PROTOCORE_CONN_R_DRAINED,
96 PROTOCORE_CONN_R_BACKPRESSURE,
97 PROTOCORE_CONN_R_DEFER_DROP
99static_assert(
sizeof(protocore_conn_reason) == 1,
"protocore_conn_reason must stay one byte (EMBED_ENUM_BYTE)");
102typedef struct protocore_conn_counters
105 uint32_t closes_remote;
106 uint32_t closes_local;
107 uint32_t closes_error;
108 uint32_t closes_timeout;
109 uint32_t closes_abort;
110 uint32_t backpressure;
111 uint32_t defer_drops;
112 uint32_t closing_gauge;
113} protocore_conn_counters;
123typedef void (*protocore_conn_event_cb)(uint8_t slot, ConnState old_state, ConnState new_state,
124 protocore_conn_reason reason);
128void protocore_obs_transition(uint8_t slot, ConnState olds, ConnState news, protocore_conn_reason reason);
129void protocore_obs_notice(uint8_t slot, ConnState st, protocore_conn_reason reason);
130#define PROTOCORE_OBS_TRANSITION(slot, olds, news, reason) protocore_obs_transition((slot), (olds), (news), (reason))
131#define PROTOCORE_OBS_NOTICE(slot, st, reason) protocore_obs_notice((slot), (st), (reason))
137#define PROTOCORE_OBS_TRANSITION(slot, olds, news, reason) ((void)0)
138#define PROTOCORE_OBS_NOTICE(slot, st, reason) ((void)0)
EMBED_ENUM_BYTE(ConnState, CONN_FREE, CONN_ACTIVE, CONN_CLOSING)
Lifecycle state of a connection pool slot.
Event record posted from the stack callbacks to the session layer.
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.