CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
cmlabs::NetworkReceiver Class Reference

Callback interface for asynchronous delivery of parsed network traffic. More...

#include <NetworkManager.h>

Inheritance diagram for cmlabs::NetworkReceiver:
[legend]

Public Member Functions

 NetworkReceiver ()
virtual bool receiveNetworkEvent (NetworkEvent *evt, NetworkChannel *channel, uint64 conid)
 A connection lifecycle event occurred.
virtual bool receiveHTTPRequest (HTTPRequest *req, NetworkChannel *channel, uint64 conid)
 An HTTP request arrived on a server connection.
virtual bool receiveMessage (DataMessage *msg, NetworkChannel *channel, uint64 conid)
 A binary DataMessage arrived.
virtual bool receiveTelnetLine (TelnetLine *line, NetworkChannel *channel, uint64 conid)
 A Telnet line arrived.
virtual bool receiveHTTPReply (HTTPReply *reply, HTTPRequest *req, NetworkChannel *channel, uint64 conid)
 An HTTP reply to an earlier async request arrived.
virtual bool receiveWebsocketData (WebsocketData *wsData, NetworkChannel *channel, uint64 conid)
 A WebSocket message arrived.

Detailed Description

Callback interface for asynchronous delivery of parsed network traffic.

Implement the receive*() methods you care about and pass the object to NetworkManager::createListener() / create*Connection(); each incoming item is then pushed to you instead of being queued for waitFor*(). Default implementations return false, meaning "not handled" — unhandled items are queued on the channel instead.

Note
Callbacks arrive on the connection's protocol thread; if the receiver takes ownership of the passed object it must delete it.

Definition at line 93 of file NetworkManager.h.

Constructor & Destructor Documentation

◆ NetworkReceiver()

cmlabs::NetworkReceiver::NetworkReceiver ( )
inline

Definition at line 95 of file NetworkManager.h.

Member Function Documentation

◆ receiveHTTPReply()

virtual bool cmlabs::NetworkReceiver::receiveHTTPReply ( HTTPReply * reply,
HTTPRequest * req,
NetworkChannel * channel,
uint64 conid )
inlinevirtual

An HTTP reply to an earlier async request arrived.

Parameters
replyThe reply.
reqThe originating request.
channelChannel.
conidConnection id.
Returns
true if handled.

Reimplemented in cmlabs::RequestClient.

Definition at line 105 of file NetworkManager.h.

◆ receiveHTTPRequest()

virtual bool cmlabs::NetworkReceiver::receiveHTTPRequest ( HTTPRequest * req,
NetworkChannel * channel,
uint64 conid )
inlinevirtual

An HTTP request arrived on a server connection.

Parameters
reqThe request.
channelOriginating channel.
conidConnection id (use for sendHTTPReply()).
Returns
true if handled.

Reimplemented in cmlabs::HTTPTestServer, cmlabs::RequestExecutor, cmlabs::RequestGateway, and cmlabs::WebsocketTestServer.

Definition at line 99 of file NetworkManager.h.

◆ receiveMessage()

virtual bool cmlabs::NetworkReceiver::receiveMessage ( DataMessage * msg,
NetworkChannel * channel,
uint64 conid )
inlinevirtual

A binary DataMessage arrived.

Parameters
msgThe message.
channelOriginating channel.
conidConnection id.
Returns
true if handled.

Reimplemented in cmlabs::RequestClient, cmlabs::RequestExecutor, and cmlabs::RequestGateway.

Definition at line 101 of file NetworkManager.h.

◆ receiveNetworkEvent()

virtual bool cmlabs::NetworkReceiver::receiveNetworkEvent ( NetworkEvent * evt,
NetworkChannel * channel,
uint64 conid )
inlinevirtual

A connection lifecycle event occurred.

Parameters
evtEvent data.
channelOriginating channel.
conidConnection id.
Returns
true if handled (and ownership taken).

Reimplemented in cmlabs::RequestClient, cmlabs::RequestExecutor, and cmlabs::RequestGateway.

Definition at line 97 of file NetworkManager.h.

◆ receiveTelnetLine()

virtual bool cmlabs::NetworkReceiver::receiveTelnetLine ( TelnetLine * line,
NetworkChannel * channel,
uint64 conid )
inlinevirtual

A Telnet line arrived.

Parameters
lineThe line.
channelOriginating channel.
conidConnection id.
Returns
true if handled.

Definition at line 103 of file NetworkManager.h.

◆ receiveWebsocketData()

virtual bool cmlabs::NetworkReceiver::receiveWebsocketData ( WebsocketData * wsData,
NetworkChannel * channel,
uint64 conid )
inlinevirtual

A WebSocket message arrived.

Parameters
wsDataThe frame/message.
channelChannel.
conidConnection id.
Returns
true if handled.

Reimplemented in cmlabs::RequestGateway, and cmlabs::WebsocketTestServer.

Definition at line 107 of file NetworkManager.h.


The documentation for this class was generated from the following file: