|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Binary DataMessage protocol handler: size-prefixed serialised messages. More...
#include <NetworkProtocols.h>
Public Member Functions | |
| MessageProtocol () | |
| Public Member Functions inherited from cmlabs::NetworkProtocol | |
| NetworkProtocol () | |
Static Public Member Functions | |
| static bool | CheckBufferForCompatibility (const char *buffer, uint32 length) |
| static bool | InitialiseConversation (NetworkConnection *con) |
| Perform the initial message-protocol greeting. | |
| static bool | SendMessage (NetworkConnection *con, DataMessage *msg, uint64 receiver=0, bool packed=false) |
| Serialise and send one message. | |
| static DataMessage * | ReceiveMessage (NetworkConnection *con, uint32 timeout) |
| Read one full message frame. | |
| Static Public Member Functions inherited from cmlabs::NetworkProtocol | |
| 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. | |
Additional Inherited Members | |
| Public Attributes inherited from cmlabs::NetworkProtocol | |
| uint8 | protocol |
| PROTOCOL_* id of this handler. | |
Binary DataMessage protocol handler: size-prefixed serialised messages.
The native CMSDK inter-node protocol. A "frame" is simply the serialised DataMessage memory image: its first uint32 is the total size, followed by the DATAMESSAGEID object id — ReceiveMessage() peeks those 8 bytes, then reads exactly size bytes and hands the buffer to a DataMessage that adopts it (zero-copy). Used by NetworkChannel::MessageConnectionRun() and the Request* classes.
Definition at line 889 of file NetworkProtocols.h.
|
inline |
Definition at line 892 of file NetworkProtocols.h.
References cmlabs::NetworkProtocol::protocol, and PROTOCOL_MESSAGE.
|
static |
buffer starts with the DataMessage frame signature. Definition at line 2360 of file NetworkProtocols.cpp.
References DATAMESSAGEID, GetObjID, and PACKEDDATAMESSAGEID.
Referenced by cmlabs::NetworkChannel::ConnectionAutodetectRun().
|
static |
Perform the initial message-protocol greeting.
| con | Connection. |
Definition at line 2366 of file NetworkProtocols.cpp.
|
static |
Read one full message frame.
| con | Connection. |
| timeout | Max wait in ms. |
Definition at line 2386 of file NetworkProtocols.cpp.
References DATAMESSAGEID, cmlabs::DataMessage::FromPacked(), GetObjID, PACKEDDATAMESSAGEID, and cmlabs::NetworkConnection::receive().
Referenced by cmlabs::NetworkChannel::MessageConnectionRun().
|
static |
Serialise and send one message.
| con | Connection. |
| msg | Message (caller keeps ownership). |
| receiver | Destination endpoint for datagram transports (0 for TCP). |
| packed | send the packed wire form (DataMessage::toPacked()); ReceiveMessage() reads both. |
Definition at line 2370 of file NetworkProtocols.cpp.
References cmlabs::DataMessage::data, cmlabs::DataMessage::getSize(), cmlabs::NetworkConnection::send(), and cmlabs::DataMessage::toPacked().
Referenced by cmlabs::NetworkChannel::sendMessage(), cmlabs::NetworkChannel::sendMessage(), and cmlabs::NetworkManager::sendUDPMessage().