DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
proto_builtins.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4/**
5 * @file proto_builtins.cpp
6 * @brief Layer 5 (Session) - the built-in protocol registry (policy, not mechanism).
7 *
8 * The session dispatcher (session.cpp) is pure mechanism: it routes events to whatever
9 * ProtoHandler is registered for a connection's ConnProto and names no protocol. This
10 * file is the one place that knows which protocols the build includes. Each built-in's
11 * handler + callbacks live in its own module and are exposed by a pure `*_proto_handler()`
12 * accessor (no session dependency); here we install each behind the matching feature flag.
13 * Adding a protocol means writing its module and adding one guarded line here - never editing
14 * the dispatcher.
15 *
16 * (The SSH remote-forward listener, ConnProto::PROTO_SSH_RFWD, is intentionally NOT here: it is a
17 * runtime opt-in that self-registers from ssh_forward_begin().)
18 */
19
20#include "proto_handler.h"
21
22#include "network_drivers/presentation/presentation.h" // http_proto_handler()
23#if DETWS_ENABLE_TELNET
25#endif
26#if DETWS_ENABLE_SSH
28#endif
29#if DETWS_ENABLE_MODBUS
31#endif
32#if DETWS_ENABLE_OPCUA
34#endif
35
36// Register @p h for @p proto only if the module actually supplied one (modbus / opcua return nullptr
37// on host builds, where there is no TCP transport handler).
38static inline void register_if(ConnProto proto, const ProtoHandler *h)
39{
40 if (h)
41 proto_register(proto, h);
42}
43
45{
46 register_if(ConnProto::PROTO_HTTP, http_proto_handler()); // always present (the core request/response protocol)
47#if DETWS_ENABLE_TELNET
48 register_if(ConnProto::PROTO_TELNET, telnet_proto_handler());
49#endif
50#if DETWS_ENABLE_SSH
52#endif
53#if DETWS_ENABLE_MODBUS
54 register_if(ConnProto::PROTO_MODBUS, modbus_proto_handler());
55#endif
56#if DETWS_ENABLE_OPCUA
57 register_if(ConnProto::PROTO_OPCUA, opcua_proto_handler());
58#endif
59}
ConnProto
Application protocol spoken on a listener port or connection slot.
@ PROTO_HTTP
HTTP/1.1 with optional WS and SSE upgrades.
@ PROTO_OPCUA
OPC UA Binary (UA-TCP) server.
@ PROTO_TELNET
Telnet (RFC 854).
@ PROTO_MODBUS
Modbus TCP slave (Modbus Application Protocol).
@ PROTO_SSH
SSH (RFC 4253/4252/4254).
Zero-heap Modbus TCP slave/server (Modbus Application Protocol v1.1b3).
OPC UA Binary server: handshake + SecureChannel + Session + Read/Write + Browse (DETWS_ENABLE_OPCUA).
const ProtoHandler * http_proto_handler(void)
Layer 6 (Presentation) - wires the transport ring buffer to the HTTP parser.
void proto_register_builtins(void)
Register every built-in protocol's handler (the policy list).
Layer 5 (Session) - per-protocol connection handler dispatch table.
void proto_register(ConnProto proto, const ProtoHandler *h)
Register h for protocol proto (replaces any previous handler).
Definition session.cpp:38
const ProtoHandler * ssh_proto_handler(void)
Definition ssh_conn.cpp:86
Glue between the TCP transport (conn_pool) and the SSH protocol stack.
Per-protocol connection event/poll callbacks (Layer 5 dispatch vtable).
Layer 6/7 - minimal RFC 854 Telnet server (DETWS_ENABLE_TELNET).