Skip to content
Start free evaluation

pdcomm_tcp_event_body

Function

Copies the message body of a received event.

PdcommStatus pdcomm_tcp_event_body(const PdcommTcpEvent *event, uint8_t *output, size_t capacity, size_t *required)

Declared in: #include <pdcomm_tcp.h>

The body is the encoded SECS-II item exactly as received; it is empty for a message without a body and for every event kind other than #PDCOMM_TCP_RECEIVED. The copy is all or nothing.

Parameters

NameDescription
eventLive event.
outputDestination. Pass NULL with capacity 0 to query the size; NULL with a nonzero capacity is rejected even for an empty body.
capacitySize of output in bytes.
requiredReceives the body length; set to 0 first. Must not be NULL.

Returns

#PDCOMM_OK when the body was copied (or is empty and output is NULL with capacity 0); #PDCOMM_BUFFER_TOO_SMALL when capacity is smaller than *required (output untouched); #PDCOMM_INVALID_ARGUMENT when required or event is NULL, or output is NULL with a nonzero capacity; #PDCOMM_INTERNAL_ERROR when a panic was contained.

Notes

  • Thread safety: read calls on the same event may run concurrently; destruction must be synchronized with them.