|
SatCat5
|
Inline COBS encoder and decoder objects.
Consistent Overhead Byte Stuffing (COBS) is a packet-delimiting protocol. Its function is similar to SLIP, with equivalent average overhead but much better worst-case: just ceil(n/254) additional bytes vs. SLIP's potential to double packet length in extreme cases.
The inline CobsEncoder implements the Writeable interface, encodes each incoming byte, and writes the result to a different Writeable object with encoded data and inter-frame tokens.
The inline CobsDecoder does the inverse, accepting a COBS stream one byte at a time through the Writeable interface, and forwarding the decoded result to a different Writeable object. (Often a PacketBuffer.)
In both cases, the input uses the io::Writeable API. To attach either input to an io::Readable interface, use io::BufferedCopy.
See also: https://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing http://www.stuartcheshire.org/papers/COBSforToN.pdf
Definition in file codec_cobs.h.
Go to the source code of this file.
Classes | |
| class | satcat5::io::CobsEncoder |
| Inline COBS encoder. More... | |
| class | satcat5::io::CobsDecoder |
| Inline COBS decoder. More... | |
| class | satcat5::io::CobsCodec |
| Buffered COBS encoder / decoder pair. More... | |
| class | satcat5::io::CobsCodecInverse |
| Buffered COBS encoder / decoder pair with opposite polarity. More... | |
Macros | |
| #define | SATCAT5_COBS_BUFFSIZE 1600 |
| #define | SATCAT5_COBS_PACKETS 32 |