Classes | |
| struct | Block |
| struct | Message |
Functions | |
| 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). | |
| 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 | |
| void librats::framer::encode_block | ( | Bytes & | out, |
| ByteView | body | ||
| ) |
Append [u32 len][body] to out.
| void librats::framer::encode_block_header | ( | uint8_t * | out, |
| size_t | body_size | ||
| ) |
Write just the [u32 len] prefix into out (exactly kLengthPrefixSize bytes).
The send path uses this to queue the prefix as its own gather slice, so the body — an encrypted frame, possibly megabytes — never has to be copied to be framed.
| void librats::framer::encode_message | ( | Bytes & | out, |
| FrameHeader | header, | ||
| ByteView | payload | ||
| ) |
Append [type][flags][channel][payload] to out (no length prefix).
| Message librats::framer::parse_message | ( | ByteView | inner | ) |
Parse an inner message from inner (header + payload). ok false if short.
| 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.
|
constexpr |
|
constexpr |