22#if DETWS_ENABLE_WEBSOCKET
36#if DETWS_ENABLE_KEEPALIVE
55static inline void http_release_upgrade_bindings(uint8_t slot_id)
57#if DETWS_ENABLE_WEBSOCKET
69 http_release_upgrade_bindings(slot_id);
70#if DETWS_ENABLE_KEEPALIVE
71 http_req_count[slot_id] = 0;
81#if DETWS_ENABLE_WEBSOCKET
97 while (det_conn_available(slot_id) > 0)
111 if (!det_conn_read_byte(slot_id, &
byte))
132static void tls_abort(uint8_t slot)
141static void tls_data(uint8_t slot)
143 if (!det_tls_established(slot))
145 int h = det_tls_handshake(slot);
155#if DETWS_ENABLE_HTTP2
161 const char *alpn = det_tls_alpn(slot);
162 if (alpn && strcmp(alpn,
"h2") == 0)
165 conn_pool[slot].resp_sink = h2_server_respond;
166 h2_server_open(slot);
171 h2_server_data(slot);
176#if DETWS_ENABLE_WEBSOCKET
186 while ((n = det_tls_read(slot, buf,
sizeof(buf))) > 0)
189 for (
int i = 0; i < n; i++)
205static void http_evt_accept(uint8_t slot)
208#if DETWS_ENABLE_HTTP2
214static void http_evt_data(uint8_t slot)
225static void http_evt_close(uint8_t slot)
229 det_tls_conn_free(slot);
231 http_release_upgrade_bindings(slot);
238static void (*s_http_poll)(uint8_t slot) =
nullptr;
239static void http_evt_poll(uint8_t slot)
249static const ProtoHandler s_http_handler = {http_evt_accept, http_evt_data, http_evt_close, http_evt_poll};
253 return &s_http_handler;
#define MAX_CONNS
Maximum simultaneous TCP connections (fixed static pool; ~3.95 KB of internal RAM per slot).
Bridge between the HTTP/2 engine (h2_conn) and the server's request pipeline.
void http_parser_reset(HttpReq *req)
Reset a parser context to the initial (ParseState::PARSE_METHOD) state.
HttpReq http_pool[CONN_POOL_SLOTS]
Pool of parser contexts, one per connection-pool slot (incl. reserved dispatch slots).
void http_parser_feed(HttpReq *p, uint8_t byte)
Feed one byte to the parser state machine.
@ PARSE_ERROR
Unrecoverable parse failure → 400.
@ PARSE_ENTITY_TOO_LARGE
Content-Length > BODY_BUF_SIZE → 413.
@ PARSE_COMPLETE
Full request parsed; ready for dispatch.
@ PARSE_URI_TOO_LONG
Path exceeds MAX_PATH_LEN → 414.
void http_reset(uint8_t slot_id)
Reset the HTTP parser for a connection slot.
const ProtoHandler * http_proto_handler(void)
void http_proto_set_poll(void(*fn)(uint8_t slot))
Install the HTTP per-slot poll pump (the routing core's instance-bound on_poll).
void http_parse(uint8_t slot_id)
Drain the transport ring buffer and advance the HTTP parser.
void http_conn_open(uint8_t slot_id)
Initialize a slot for a freshly-accepted HTTP connection.
Layer 6 (Presentation) - wires the transport ring buffer to the HTTP parser.
Layer 5 (Session) - per-protocol connection handler dispatch table.
void sse_free(uint8_t slot_id)
Free the SseConn associated with a TCP slot.
Layer 6 (Presentation) – Server-Sent Events connection pool.
Fully-parsed HTTP/1.1 request.
ParseState parse_state
Current parser state.
uint8_t slot_id
Transport slot index (set by presentation layer).
Per-protocol connection event/poll callbacks (Layer 5 dispatch vtable).
TcpConn conn_pool[CONN_POOL_SLOTS]
Static pool of connection contexts. Defined in tcp.cpp. Sized CONN_POOL_SLOTS: MAX_CONNS TCP slots pl...
void det_conn_abort_slot(uint8_t slot)
Hard-abort connection slot (RST) for a fatal condition. The transport owns the teardown order: free t...
Deterministic TLS engine: mbedTLS over a static memory pool (DETWS_ENABLE_TLS).
void ws_free(uint8_t slot_id)
Free the WsConn associated with a TCP slot.
WsConn * ws_find(uint8_t slot_id)
Find the WsConn for a given TCP slot, or nullptr if none.
Layer 6 (Presentation) – WebSocket frame parser and connection pool.