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

Base class for the protocol auto-detection framework. More...

#include <NetworkProtocols.h>

Inheritance diagram for cmlabs::NetworkProtocol:
[legend]

Public Member Functions

 NetworkProtocol ()

Static Public Member Functions

static bool CheckBufferForCompatibility (const char *buffer, uint32 length)
 Sniff whether buffer looks like this protocol.
static bool InitialiseConversation (NetworkConnection *con)
 Perform any protocol-specific initial exchange on a new connection.

Public Attributes

uint8 protocol
 PROTOCOL_* id of this handler.

Detailed Description

Base class for the protocol auto-detection framework.

Each protocol class implements static CheckBufferForCompatibility(), which sniffs the first bytes arriving on a fresh connection to decide whether they match its wire format, and InitialiseConversation() to perform any initial exchange. NetworkChannel::autoDetectConnection() uses these to multiplex several protocols on one listening port.

Definition at line 800 of file NetworkProtocols.h.

Constructor & Destructor Documentation

◆ NetworkProtocol()

cmlabs::NetworkProtocol::NetworkProtocol ( )
inline

Definition at line 803 of file NetworkProtocols.h.

References protocol.

Member Function Documentation

◆ CheckBufferForCompatibility()

bool cmlabs::NetworkProtocol::CheckBufferForCompatibility ( const char * buffer,
uint32 length )
inlinestatic

Sniff whether buffer looks like this protocol.

Parameters
bufferFirst bytes received.
lengthByte count.
Returns
true if compatible. Base implementation always returns false.

Definition at line 807 of file NetworkProtocols.h.

◆ InitialiseConversation()

bool cmlabs::NetworkProtocol::InitialiseConversation ( NetworkConnection * con)
inlinestatic

Perform any protocol-specific initial exchange on a new connection.

Parameters
conThe fresh connection.
Returns
true on success.

Definition at line 810 of file NetworkProtocols.h.

Member Data Documentation

◆ protocol


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