|
RADLib
RADical C++ application framework
|
There is no standalone RADProtocol module. RADLib's binary-protocol support is a facet of RADNet: the RADProtocol* types live in the RADNet namespace (RADNet/headers/RADNet.h), and the code generator ships as a CMake-invoked Python tool.
RADLib includes a CMake-invoked Python generator for compact binary TCP protocols. The wire frame is:
uint32 messageId in network byte order.uint32 payloadSize in network byte order.JSON protocol files define messages and fields. The generator emits C++ structs, message IDs, payload encoders/decoders, and frame helpers.
At runtime a frame is the RADNet::RADTcpFrame struct (a messageId plus a payload byte vector). RADNet::encodeFrame() serializes one frame to wire bytes, and RADNet::decodeFrames() pulls all complete frames out of a receive buffer, enforcing maxPayloadBytes. Endpoint configuration is described by RADNet::RADProtocolEndpointConfig (address, port, backlog, connect timeout, max payload) and stays JSON-loadable through RADNet::endpointConfigFromJson().
RADNet::RADProtocolSocket is a RADCore::RADObject that frames a RADTcpSocket byte stream. It exposes sendFrame() and the frameReceived, connected, disconnected, and errorOccurred events. RADNet::RADProtocolClient adds connectUsingConfig(), and RADNet::RADProtocolServer adds listenUsingConfig() plus a newConnection event delivering accepted RADProtocolSocket instances.
messageId/payloadSize network-byte-order frame header.RADTcpFrame with encodeFrame()/decodeFrames() helpers.RADProtocolEndpointConfig via endpointConfigFromJson().RADProtocolSocket/RADProtocolClient/RADProtocolServer event-driven types.Example: