|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Connection/channel management layer: multi-protocol listeners, typed dispatch, HTTP client — and the CMSDK's built-in HTTP/WebSocket server. More...
Go to the source code of this file.
Classes | |
| struct | cmlabs::NetworkEvent |
| Notification of a connection lifecycle change (connect, disconnect, buffer state...). More... | |
| class | cmlabs::NetworkReceiver |
| Callback interface for asynchronous delivery of parsed network traffic. More... | |
| class | cmlabs::HTTPTestServer |
| Minimal HTTP server used by the unit tests: replies with a canned page. More... | |
| class | cmlabs::WebsocketTestServer |
| Minimal WebSocket echo server used by the unit tests (handles upgrade + echo). More... | |
| class | cmlabs::NetworkManager |
| Central owner of all channels, listeners and connections in a process. More... | |
| class | cmlabs::NetworkThread |
| Bookkeeping for one worker thread of a NetworkChannel (per listener or connection). More... | |
| class | cmlabs::NetworkChannel |
| One logical network interface: a group of listeners/connections with shared dispatch. More... | |
Namespaces | |
| namespace | cmlabs |
Macros | |
Network event types | |
Values of NetworkEvent::type describing connection lifecycle changes. | |
| #define | NETWORKEVENT_CONNECT 1 |
| Connection established. | |
| #define | NETWORKEVENT_RECONNECT 2 |
| Connection re-established after a failure (autoreconnect). | |
| #define | NETWORKEVENT_DISCONNECT 3 |
| Connection closed for good. | |
| #define | NETWORKEVENT_DISCONNECT_RETRYING 4 |
| Connection lost; reconnection attempts in progress. | |
| #define | NETWORKEVENT_BUFFER_LOW 5 |
| Receive buffer back below the pressure threshold. | |
| #define | NETWORKEVENT_BUFFER_FULL 6 |
| Receive buffer full; incoming data may back up. | |
| #define | NETWORKEVENT_UNPROCESSED_DATA 7 |
| Bytes arrived that no protocol handler consumed. | |
| #define | NETWORKEVENT_PROTOCOL_ERROR 8 |
| Protocol parsing/framing error on the connection. | |
Connection/channel management layer: multi-protocol listeners, typed dispatch, HTTP client — and the CMSDK's built-in HTTP/WebSocket server.
NetworkManager is the top of the CMSDK networking stack. It owns NetworkChannel objects, each of which groups listeners and connections for one logical interface and dispatches parsed protocol objects (HTTPRequest, DataMessage, TelnetLine, WebsocketData) either by pushing them to a NetworkReceiver callback (async mode) or by queuing them for waitFor*() calls (sync mode).
Key capabilities:
autoreconnect=true are transparently re-established after failures; observers learn about lifecycle changes through NETWORKEVENT_* events.A synchronous binary-message peer (listen, receive, reply) in a few lines:
Definition in file NetworkManager.h.
| #define NETWORKEVENT_BUFFER_FULL 6 |
Receive buffer full; incoming data may back up.
Definition at line 376 of file NetworkManager.h.
| #define NETWORKEVENT_BUFFER_LOW 5 |
Receive buffer back below the pressure threshold.
Definition at line 375 of file NetworkManager.h.
| #define NETWORKEVENT_CONNECT 1 |
Connection established.
Definition at line 371 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::ConnectionAutodetectRun(), cmlabs::RequestClient::receiveNetworkEvent(), and cmlabs::RequestExecutor::receiveNetworkEvent().
| #define NETWORKEVENT_DISCONNECT 3 |
Connection closed for good.
Definition at line 373 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::HTTPClientRun(), cmlabs::NetworkChannel::HTTPServerRun(), cmlabs::NetworkChannel::MessageConnectionRun(), cmlabs::RequestClient::receiveNetworkEvent(), cmlabs::RequestExecutor::receiveNetworkEvent(), cmlabs::RequestGateway::receiveNetworkEvent(), and cmlabs::NetworkChannel::TelnetServerRun().
| #define NETWORKEVENT_DISCONNECT_RETRYING 4 |
Connection lost; reconnection attempts in progress.
Definition at line 374 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::HTTPClientRun(), cmlabs::NetworkChannel::MessageConnectionRun(), cmlabs::RequestClient::receiveNetworkEvent(), and cmlabs::RequestExecutor::receiveNetworkEvent().
| #define NETWORKEVENT_PROTOCOL_ERROR 8 |
Protocol parsing/framing error on the connection.
Definition at line 378 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::HTTPServerRun().
| #define NETWORKEVENT_RECONNECT 2 |
Connection re-established after a failure (autoreconnect).
Definition at line 372 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::HTTPClientRun(), cmlabs::NetworkChannel::MessageConnectionRun(), cmlabs::RequestClient::receiveNetworkEvent(), cmlabs::RequestExecutor::receiveNetworkEvent(), and cmlabs::RequestGateway::receiveNetworkEvent().
| #define NETWORKEVENT_UNPROCESSED_DATA 7 |
Bytes arrived that no protocol handler consumed.
Definition at line 377 of file NetworkManager.h.
Referenced by cmlabs::NetworkChannel::HTTPClientRun(), cmlabs::NetworkChannel::HTTPServerRun(), cmlabs::NetworkChannel::MessageConnectionRun(), and cmlabs::NetworkChannel::TelnetServerRun().