Framing
Messages are binary data packet encoded via protocol buffers (protobuf) according to specifications in .proto files. The binary data packets do not by them self indicate their size (number of bytes). Therefore we need to add a length to the data. The HDLC layers for serial communication will handle length, thus any further framing is not needed. For communication over ethernet via TCP a framing is introduced by prepending a packet by its length.
HDLC
The HDLC layers handles length of frames, so for HDLC no additional framing is needed.
Length bytes |
Protocol buffer encoded message |
MyDefence devices will enable HDLC keep-alive, to detect broken connections. This is transparent to the application.
TCP
TCP provides a data stream, so each binary protobuf encoded message is prepended with a 4 byte length field encoded as a little endian 32 bit unsigned integer.
4 bytes |
Length bytes |
Length |
Protocol buffer encoded message |
MyDefence devices will enable TCP keep-alive, to detect broken connections. This is transparent to the application.