pdcomm_secs_encode
Function
Encodes an item as SECS-II bytes into caller storage.
PdcommStatus pdcomm_secs_encode(const PdcommSecsItem *handle, uint8_t *output, size_t capacity, size_t *required)The output uses minimal length headers; primitive payload bytes are preserved unchanged. Pass NULL and a capacity of zero to query the size, which is also available as encoded_length from pdcomm_secs_info().
Parameters
| Name | Description |
|---|---|
handle | Live item. |
output | Destination; must be non-NULL when capacity is sufficient. |
capacity | Size of output in bytes. |
required | Receives the encoded length (0 when handle is NULL). Must not be NULL and must not overlap output or the item. |
Returns
#PDCOMM_OK when the item was encoded; #PDCOMM_BUFFER_TOO_SMALL when capacity is smaller than *required (output untouched); #PDCOMM_INVALID_ARGUMENT when required or handle is NULL, or output is NULL with sufficient capacity; #PDCOMM_LIMIT_EXCEEDED when the item exceeds its own limits; #PDCOMM_INTERNAL_ERROR when a panic was contained.
Notes
- Thread safety: read calls on the same item may run concurrently; destruction must be synchronized with them.