Module abi::bbqueue_ipc::framed
source · Expand description
A Framed flavor of BBQueue, useful for variable length packets
This module allows for a Framed
mode of operation,
where a size header is included in each grant, allowing for
“chunks” of data to be passed through a BBQueue, rather than
just a stream of bytes. This is convenient when receiving
packets of variable sizes.
§Frame header
An internal header is required for each frame stored
inside of the BBQueue
. This header is never exposed to end
users of the bbqueue library.
A variable sized integer is used for the header size, and the size of this header is based on the max size requested for the grant. This header size must be factored in when calculating an appropriate total size of your buffer.
Even if a smaller portion of the grant is committed, the original requested grant size will be used for the header size calculation.
For example, if you request a 128 byte grant, the header size will be two bytes. If you then only commit 32 bytes, two bytes will still be used for the header of that grant.
Grant Size (bytes) | Header size (bytes) |
---|---|
1..(2^7) | 1 |
(2^7)..(2^14) | 2 |
(2^14)..(2^21) | 3 |
(2^21)..(2^28) | 4 |
(2^28)..(2^35) | 5 |
(2^35)..(2^42) | 6 |
(2^42)..(2^49) | 7 |
(2^49)..(2^56) | 8 |
(2^56)..(2^64) | 9 |
Structs§
- A consumer of Framed data
- A read grant for a single frame
- A write grant for a single frame
- A producer of Framed data
Constants§
- HDR_LEN 🔒