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

Messages in SLIP (RFC 1055), each ended by 0xC0. More...

#include <Framing.hpp>

Collaboration diagram for MayaFlux::Transitive::Protocol::SlipFramer:

Public Member Functions

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

Static Public Attributes

static constexpr uint8_t end = 0xC0
static constexpr uint8_t escape = 0xDB
static constexpr uint8_t escaped_end = 0xDC
static constexpr uint8_t escaped_escape = 0xDD

Private Attributes

bool m_discarding { false }
bool m_escaped { false }
size_t m_max_message
std::vector< uint8_t > m_pending

Detailed Description

Messages in SLIP (RFC 1055), each ended by 0xC0.

The payload may hold any bytes, with 0xC0 and 0xDB escaped. Empty frames are skipped, so a leading 0xC0 is harmless. An escape followed by anything but the two defined codes, or by 0xC0, drops the frame and counts it as discarded with FrameFault::Invalid. A decoded message longer than max_message is dropped with FrameFault::Oversized. Either way the framer resumes after the next 0xC0.

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

Definition at line 654 of file Framing.hpp.


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