|
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) |
| 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 887 of file NetworkProtocols.h.
|
inline |
Definition at line 890 of file NetworkProtocols.h.
References cmlabs::NetworkProtocol::protocol, and PROTOCOL_MESSAGE.
|
static |
buffer starts with the DataMessage frame signature. Definition at line 2307 of file NetworkProtocols.cpp.
References DATAMESSAGEID, and GetObjID.
Referenced by cmlabs::NetworkChannel::ConnectionAutodetectRun().
|
static |
Perform the initial message-protocol greeting.
| con | Connection. |
Definition at line 2313 of file NetworkProtocols.cpp.
|
static |
Read one full message frame.
| con | Connection. |
| timeout | Max wait in ms. |
Definition at line 2326 of file NetworkProtocols.cpp.
References DATAMESSAGEID, GetObjID, 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). |
Definition at line 2317 of file NetworkProtocols.cpp.
References cmlabs::DataMessage::data, cmlabs::DataMessage::getSize(), and cmlabs::NetworkConnection::send().
Referenced by cmlabs::NetworkChannel::sendMessage(), and cmlabs::NetworkManager::sendUDPMessage().