MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Transitive::Protocol::CobsFramer Class Reference

Messages in Consistent Overhead Byte Stuffing, each ended by a zero byte. More...

#include <Framing.hpp>

Collaboration diagram for MayaFlux::Transitive::Protocol::CobsFramer:

Public Member Functions

size_t buffered () const noexcept
 Encoded bytes held for a frame that has not ended.
 CobsFramer (size_t max_frame=default_max_line) noexcept
template<MessageSink Sink>
FrameReport push (Message bytes, Sink &&sink)
void reset () noexcept
 Drop any partial frame and any discard in progress.

Private Attributes

std::vector< uint8_t > m_decoded
bool m_discarding { false }
size_t m_max_frame
std::vector< uint8_t > m_pending

Detailed Description

Messages in Consistent Overhead Byte Stuffing, each ended by a zero byte.

The payload may hold any bytes, since COBS removes every zero from the encoded frame. Frames that are only a delimiter are skipped. A frame that does not decode is dropped and counted as discarded with FrameFault::Invalid, and one whose encoded length exceeds max_frame is dropped with FrameFault::Oversized. Either way the framer resumes after the next zero.

Not thread safe: one thread at a time per framer.

Definition at line 530 of file Framing.hpp.


The documentation for this class was generated from the following file: