Back to Site
Loading...
Searching...
No Matches
librats::framer Namespace Reference

Classes

struct  Block
 
struct  Message
 

Functions

void encode_block (Bytes &out, ByteView body)
 Append [u32 len][body] to out.
 
Block try_take_block (const uint8_t *data, size_t size)
 Try to take one block from the front of [data, data+size) without copying.
 
void encode_message (Bytes &out, FrameHeader header, ByteView payload)
 Append [type][flags][channel][payload] to out (no length prefix).
 
Message parse_message (ByteView inner)
 Parse an inner message from inner (header + payload). ok false if short.
 

Variables

constexpr size_t kLengthPrefixSize = 4
 
constexpr size_t kHeaderSize = 4
 type+flags+channel
 
constexpr uint32_t kMaxBlockSize = 64u * 1024 * 1024
 body cap
 

Function Documentation

◆ encode_block()

void librats::framer::encode_block ( Bytes &  out,
ByteView  body 
)

Append [u32 len][body] to out.

◆ encode_message()

void librats::framer::encode_message ( Bytes &  out,
FrameHeader  header,
ByteView  payload 
)

Append [type][flags][channel][payload] to out (no length prefix).

◆ parse_message()

Message librats::framer::parse_message ( ByteView  inner)

Parse an inner message from inner (header + payload). ok false if short.

◆ try_take_block()

Block librats::framer::try_take_block ( const uint8_t *  data,
size_t  size 
)

Try to take one block from the front of [data, data+size) without copying.

Variable Documentation

◆ kHeaderSize

constexpr size_t librats::framer::kHeaderSize = 4
constexpr

type+flags+channel

Definition at line 65 of file frame.h.

◆ kLengthPrefixSize

constexpr size_t librats::framer::kLengthPrefixSize = 4
constexpr

Definition at line 64 of file frame.h.

◆ kMaxBlockSize

constexpr uint32_t librats::framer::kMaxBlockSize = 64u * 1024 * 1024
constexpr

body cap

Definition at line 66 of file frame.h.