Message (de)serialization.
More...
◆ pb_msg_free()
- Note
- The
msg
pointer itself is also free'd by this function. You should set it to NULL afterwards to avoid confusion.
◆ pb_msg_read()
- Note
- This function allocates a
pb_msg_t
pointer that should be free'd using pb_msg_free()
- Parameters
-
buf | Binary data to interpret as puzzle bus message |
- Returns
pb_msg_t
pointer containing the deserialized message, or NULL if serialization failed
◆ pb_msg_write()
- Note
- This function allocates a
pb_buf_t
that should be free'd using pb_buf_free()
- Parameters
-
- Warning
- The type of
msg->cmd
is inferred from msg->type
. If the message is not correctly formatted, this function may cause undefined behavior. If possible, use functions from Send instead.
- Returns
pb_buf_t
containing the serialized message, or an empty struct if serialization failed