Expand description
The C ABI for serial-line packet framing.
These functions wrap [pamoja_serial] for callers that reach the SDK through
the flat C boundary. Both framings are here in full: the one-shot
encode and decode of a complete frame, and the streaming decoders that
reassemble frames from the arbitrary chunks a UART actually delivers.
The Rust decoders take one byte at a time. Crossing the boundary per byte
would cost more than the decoding does, so what is exposed here is a
chunk-at-a-time feed that runs the same per-byte loop natively and hands
back every frame the chunk completed. A chunk that carries a corrupt frame
does not fail the call, because the frames around it are still good; the
decoder discards the corrupt one and counts it, and the count is readable
with the *_discarded calls.
Structs§
- Pamoja
Cobs Decoder - An opaque handle to a streaming COBS decoder.
- Pamoja
Frames - An opaque handle to the frames one call to a streaming decoder completed.
- Pamoja
Slip Decoder - An opaque handle to a streaming SLIP decoder.
Constants§
- PAMOJA_
SERIAL_ FRAME_ MAX - The largest payload, in bytes, that a streaming decoder will reassemble.
Functions§
- pamoja_
cobs_ ⚠decoder_ discarded - Returns how many corrupt frames a COBS decoder has discarded.
- pamoja_
cobs_ ⚠decoder_ feed - Feeds a chunk of the byte stream to a COBS decoder.
- pamoja_
cobs_ ⚠decoder_ free - Releases a COBS decoder handle.
- pamoja_
cobs_ decoder_ new - Creates a streaming COBS decoder.
- pamoja_
cobs_ ⚠decoder_ reset - Discards any partly assembled frame, returning a COBS decoder to its initial state.
- pamoja_
frames_ ⚠count - Returns how many frames a decoder call produced.
- pamoja_
frames_ ⚠data - Returns a pointer to one frame’s payload bytes.
- pamoja_
frames_ ⚠free - Releases a decoded frame set.
- pamoja_
frames_ ⚠len - Returns the length in bytes of one frame’s payload.
- pamoja_
serial_ ⚠cobs_ decode - Reads the payload back out of a COBS frame.
- pamoja_
serial_ ⚠cobs_ encode - Frames a payload as a COBS packet, terminated by its zero delimiter.
- pamoja_
serial_ cobs_ max_ encoded_ len - Returns the largest COBS frame a payload of
payload_lenbytes can produce. - pamoja_
serial_ ⚠slip_ decode - Reads the payload back out of a SLIP frame.
- pamoja_
serial_ ⚠slip_ encode - Frames a payload as a SLIP packet (RFC 1055).
- pamoja_
serial_ slip_ max_ encoded_ len - Returns the largest SLIP frame a payload of
payload_lenbytes can produce. - pamoja_
slip_ ⚠decoder_ discarded - Returns how many corrupt frames a SLIP decoder has discarded.
- pamoja_
slip_ ⚠decoder_ feed - Feeds a chunk of the byte stream to a SLIP decoder.
- pamoja_
slip_ ⚠decoder_ free - Releases a SLIP decoder handle.
- pamoja_
slip_ decoder_ new - Creates a streaming SLIP decoder.
- pamoja_
slip_ ⚠decoder_ reset - Discards any partly assembled frame, returning a SLIP decoder to its initial state.