24void frame_blob(std::span<uint8_t> blob, uint32_t magic);
30std::optional<std::span<const uint8_t>>
unframe_blob(std::span<const uint8_t> blob, uint32_t magic);
constexpr size_t kFrameOverhead
Bytes the frame adds around the body: the magic in front and the CRC behind.
Definition blob_frame.h:18
void frame_blob(std::span< uint8_t > blob, uint32_t magic)
Stamps magic into the first four bytes and the CRC-32 of all but the last four bytes into the last fo...
Definition blob_frame.cpp:9
std::optional< std::span< const uint8_t > > unframe_blob(std::span< const uint8_t > blob, uint32_t magic)
Checks the magic and the CRC; returns the body (bytes 4 .. size-4), or empty if either check fails.
Definition blob_frame.cpp:20