31#include "util/rats_export.h"
32#include "core/bytes.h"
80 enum Status { Ok, Incomplete, Error } status = Incomplete;
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).
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.
MessageType
Inner-message kind. Application traffic uses App, addressed by channel.
@ Pex
peer exchange — gossip of known peer addresses (PeerExchange)
@ Typed
typed JSON message exchange (MessageJson)
@ Storage
distributed key-value store (StorageManager)
@ Control
core control plane (peer exchange…)
@ Ping
liveness / RTT (PingService)
A decoded inner message. payload is a non-owning view into the source bytes.