|
DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
|
Layer 5 (Session) - per-protocol connection handler dispatch table. More...
Go to the source code of this file.
Classes | |
| struct | ProtoHandler |
| Per-protocol connection event/poll callbacks (Layer 5 dispatch vtable). More... | |
Functions | |
| void | proto_register (ConnProto proto, const ProtoHandler *h) |
Register h for protocol proto (replaces any previous handler). | |
| void | proto_register_builtins (void) |
| Register every built-in protocol's handler (the policy list). | |
| const ProtoHandler * | proto_get (ConnProto proto) |
Look up the handler for proto. | |
Layer 5 (Session) - per-protocol connection handler dispatch table.
Every application protocol (HTTP, Telnet, SSH, and optional services such as MQTT or Modbus) registers one ProtoHandler. The session layer (server_tick) routes each connection event - and the main loop (DetWebServer::handle()) polls each active slot - through this table by ConnProto, so a new protocol plugs in by registering a handler instead of editing the dispatchers.
All callbacks are nullable, run on the main-loop task, and take the affected connection slot index. The built-in HTTP/Telnet/SSH handlers are registered lazily on first lookup, so dispatch works even before begin() (the native test harness drives server_tick() directly).
Definition in file proto_handler.h.
| void proto_register | ( | ConnProto | proto, |
| const ProtoHandler * | h | ||
| ) |
Register h for protocol proto (replaces any previous handler).
Definition at line 38 of file session.cpp.
References DETWS_PROTO_MAX, and SessionCtx::proto_handlers.
| void proto_register_builtins | ( | void | ) |
Register every built-in protocol's handler (the policy list).
Defined in proto_builtins.cpp - the one place that knows which protocols exist. Each built-in's handler lives in its own module (http in presentation, ssh in ssh_conn, ...) behind a *_proto_handler() accessor; this installs each. The session dispatcher (session.cpp) calls this once (lazily, on first lookup) so it never names a protocol itself. Optional runtime-gated handlers (e.g. the SSH remote-forward listener) self-register at their own opt-in entry point instead.
Definition at line 44 of file proto_builtins.cpp.
References http_proto_handler(), PROTO_HTTP, PROTO_MODBUS, PROTO_OPCUA, PROTO_SSH, PROTO_TELNET, and ssh_proto_handler().
Referenced by proto_get().
| const ProtoHandler * proto_get | ( | ConnProto | proto | ) |
Look up the handler for proto.
proto is ConnProto::PROTO_NONE or has no registered handler (no implicit fallback; the event is dropped). Definition at line 44 of file session.cpp.
References DETWS_PROTO_MAX, SessionCtx::proto_handlers, PROTO_HTTP, and proto_register_builtins().
Referenced by DetWebServer::service_once().