31#include "librats/util/rats_export.h"
33#include "librats/core/types.h"
Lightweight byte container aliases and a non-owning byte view.
Non-owning view over a contiguous run of bytes.
void encode_block(Bytes &out, ByteView body)
Append [u32 len][body] to out.
void encode_block_header(uint8_t *out, size_t body_size)
Write just the [u32 len] prefix into out (exactly kLengthPrefixSize bytes).
constexpr uint32_t kMaxBlockSize
body cap
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).
void encode_header(uint8_t *out, FrameHeader header)
Write the kHeaderSize-byte [type][flags][channel] header at out.
constexpr size_t kLengthPrefixSize
constexpr size_t kHeaderSize
type+flags+channel
Message parse_message(ByteView inner)
Parse an inner message from inner (header + payload). ok false if short.
std::vector< uint8_t > Bytes
MessageType
Inner-message kind. Application traffic uses App, addressed by channel.
@ Punch
NAT hole-punch rendezvous, relayed peer→peer (HolePunch).
@ Pex
peer exchange — gossip of known peer addresses (PeerExchange)
@ Media
real-time media: live frames and their control plane (ratcast's MediaService)
@ Typed
typed JSON message exchange (MessageJson)
@ Storage
distributed key-value store (StorageManager)
@ Control
core control plane (peer exchange…)
@ Ping
liveness / RTT (PingService)
@ Rendezvous
meeting under a key at a server, which introduces the peers (Rendezvous)
@ Remote
remote control: input and the state that answers it, small and ordered (claimed by an application,...
A decoded inner message. payload is a non-owning view into the source bytes.
Deadline deadline
A live message's deadline as its sender gave it, on this node's clock: when it arrived,...
What became of a live message sent with a tag (SendOptions::tag), as far as its sender can tell.
ByteView body
the block body (when Ok); views the input
size_t needed
Total size of this block on the wire (prefix + body), known as soon as the prefix has been read; 0 wh...
size_t consumed
bytes to consume from the buffer (when Ok)