Serialization
The following function prototypes can be found in the serialization.h header file.
#include <flashfix/serialization.h>
These functions don't check the validity of messages, they assume that the message struct is correctly filled with the right values.
ff_serialize
uint16_t ff_serialize(char *restrict buffer, const fix_message_t *restrict message);
Description
serializes a fix message into a buffer by concatenating the fields with '=' and '\x01' delimiters and adding the mandatory beginstring, bodylength, and checksum fields.
Parameters
buffer- the buffer where to store the serialized messagemessage- the message struct containing the fields to serialize
Returns
- length of the serialized message in bytes
Undefined Behavior
bufferisNULLmessageisNULLmessagedoesn't fit in the buffer- value_len and
tag_lenare different from the actual length of the value and tag field_countis different from the actual number of fields in the messagemessagewithNULLfieldsmessagewith empty{}fields arraymessagewith empty""field stringsmessagewithvalue_len == 0ortag_len == 0messagewithfield_count == 0
ff_serialize_raw
uint16_t ff_serialize_raw(char *restrict buffer, const fix_message_t *restrict message);
Description
serializes a fix message into a buffer by concatenating the fields with '=' and '\x01' delimiters.
Parameters
buffer- the buffer where to store the serialized messagemessage- the message struct containing the fields to serialize.
Returns
- length of the serialized message in bytes
Undefined Behavior
bufferisNULLmessageisNULLmessagedoesn't fit in the buffermessage->fieldsisNULLvalue_lenortag_lenare different from the actual lengths of the stringsvalueortagisNULLfield_countis different from the actual number of fields in the message