|
YAPB
|
Functions | |
| YAPB_Result_t | YAPB_initialize (YAPB_Packet_t *pkt, uint8_t *buffer, size_t size) |
| Initialize a packet for writing. | |
| YAPB_Result_t | YAPB_finalize (YAPB_Packet_t *pkt, size_t *out_len) |
| Finalize the packet, writing the total length into the header. | |
| YAPB_Result_t | YAPB_load (YAPB_Packet_t *pkt, const uint8_t *data, size_t size) |
| Load a packet for reading from raw data. | |
Packet creation, finalization, and loading.
| YAPB_Result_t YAPB_finalize | ( | YAPB_Packet_t * | pkt, |
| size_t * | out_len ) |
Finalize the packet, writing the total length into the header.
Must be called after all push operations are complete. The packet data in the buffer is ready to transmit after this call.
| pkt | Packet in write mode. |
| out_len | Output: total packet length including header. May be NULL. |
| YAPB_Result_t YAPB_initialize | ( | YAPB_Packet_t * | pkt, |
| uint8_t * | buffer, | ||
| size_t | size ) |
Initialize a packet for writing.
Sets up the packet in write mode. The caller provides the backing buffer. The header is zeroed as a safety measure in case YAPB_finalize() is forgotten.
| pkt | Packet structure to initialize. |
| buffer | Buffer to write packet data into. |
| size | Size of the buffer (must be >= YAPB_HEADER_SIZE). |
| YAPB_Result_t YAPB_load | ( | YAPB_Packet_t * | pkt, |
| const uint8_t * | data, | ||
| size_t | size ) |
Load a packet for reading from raw data.
Validates the header length field and sets up the packet in read mode. The data buffer must remain valid for the lifetime of all pop operations.
| pkt | Packet structure to initialize. |
| data | Raw packet data (including header). |
| size | Size of the data buffer. |