YAMI4Industry
|
Functions | |
enum yami_result | yami_put_type (uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, const enum yami_parameter_type type) |
Places type indicator value in the serialization buffer. More... | |
enum yami_result | yami_get_type (const uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, enum yami_parameter_type *const type) |
Reads type code from the serialization buffer. More... | |
enum yami_result | yami_put_integer (uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, const int32_t value) |
Places integer value in the serialization buffer. More... | |
enum yami_result | yami_get_integer (const uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, int32_t *const value) |
Reads integer value from the serialization buffer. More... | |
enum yami_result | yami_put_long_long (uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, const int64_t value) |
Places long long value in the serialization buffer. More... | |
enum yami_result | yami_get_long_long (const uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, int64_t *const value) |
Reads long long value from the serialization buffer. More... | |
enum yami_result | yami_put_cstring (uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, const char value[]) |
Places string value in the serialization buffer. More... | |
enum yami_result | yami_get_raw_cstring (const uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, char value[], const size_t value_length) |
Reads raw string value from the serialization buffer. More... | |
enum yami_result | yami_put_binary (uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, const uint8_t value[], const size_t value_length) |
Places binary value in the serialization buffer. More... | |
enum yami_result | yami_get_raw_binary (const uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, uint8_t value[], const size_t value_length) |
Reads raw binary value from the serialization buffer. More... | |
enum yami_result | yami_put_boolean_array (uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, const int32_t value[], const size_t value_length) |
Places boolean array in the serialization buffer. More... | |
enum yami_result | yami_get_raw_boolean_array (const uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, int32_t value[], const size_t value_length) |
Reads raw boolean array from the serialization buffer. More... | |
enum yami_result | yami_put_integer_array (uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, const int32_t value[], const size_t value_length) |
Places integer array in the serialization buffer. More... | |
enum yami_result | yami_get_raw_integer_array (const uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, int32_t value[], const size_t value_length) |
Reads raw integer array from the serialization buffer. More... | |
enum yami_result | yami_put_long_long_array (uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, const int64_t value[], const size_t value_length) |
Places long long array in the serialization buffer. More... | |
enum yami_result | yami_get_raw_long_long_array (const uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, int64_t value[], const size_t value_length) |
Reads raw long long array from the serialization buffer. More... | |
enum yami_result | yami_skip_field (const uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, const enum yami_parameter_type type) |
Skips the given field in serialization buffer. More... | |
enum yami_result | yami_fill_message_header (uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, const char object_name[], const char message_name[], const int64_t message_id) |
Places message header fields in the serialization buffer. More... | |
void | yami_fill_reply_header (uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, const int64_t message_id) |
Places reply header fields in the serialization buffer. More... | |
enum yami_result | yami_fill_exception_header (uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, const char reason[], const int64_t message_id) |
Places exception header fields in the serialization buffer. More... | |
enum yami_result | yami_parse_message_header (const uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, char out_header_type[], const size_t header_type_size, char out_object_name[], const size_t object_name_size, char out_message_name[], const size_t message_name_size, char out_reason[], const size_t reason_size, int64_t *const out_message_id) |
Parses message header. More... | |
void | yami_fill_frame_header (uint8_t buffer[], const uint32_t message_id, const size_t message_header_size, const size_t frame_payload_size) |
enum yami_result | yami_parse_frame_header (const uint8_t buffer[], const size_t buffer_size, size_t *const buffer_position, uint32_t *const message_id, size_t *const message_header_size, size_t *const frame_payload_size) |
enum yami_result yami_fill_exception_header | ( | uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
const char | reason[], | ||
int64_t | message_id | ||
) |
Places exception header fields in the serialization buffer.
Places exception header fields in the serialization buffer at the specified index and advances the index to the position after the header.
buffer | (in/out) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the new value should be written |
reason | exception reason |
message_id | message identifier |
yami_ok
or yami_not_enough_space
void yami_fill_frame_header | ( | uint8_t | buffer[], |
const uint32_t | message_id, | ||
const size_t | message_header_size, | ||
const size_t | frame_payload_size | ||
) |
enum yami_result yami_fill_message_header | ( | uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
const char | object_name[], | ||
const char | message_name[], | ||
int64_t | message_id | ||
) |
Places message header fields in the serialization buffer.
Places message header fields in the serialization buffer at the specified index and advances the index to the position after the header.
buffer | (in/out) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the new value should be written |
object_name | target object name |
message_name | target message name |
message_id | message identifier |
yami_ok
or yami_not_enough_space
void yami_fill_reply_header | ( | uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
int64_t | message_id | ||
) |
Places reply header fields in the serialization buffer.
Places reply header fields in the serialization buffer at the specified index and advances the index to the position after the header. This function assumes that the buffer is big enough and does not check the buffer size.
buffer | (in/out) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the new value should be written |
message_id | message identifier |
enum yami_result yami_get_integer | ( | const uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
int32_t * | value | ||
) |
Reads integer value from the serialization buffer.
Reads integer value from the serialization buffer from the specified index and advances the index to the position immediately after the value that was read.
buffer | (in) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the value should be read from |
value | (out) integer value to be read |
yami_ok
or yami_not_enough_space
enum yami_result yami_get_long_long | ( | const uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
int64_t * | value | ||
) |
Reads long long value from the serialization buffer.
Reads long long value from the serialization buffer from the specified index and advances the index to the position immediately after the value that was read.
buffer | (in) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the value should be read from |
value | (out) long long value to be read |
yami_ok
or yami_not_enough_space
enum yami_result yami_get_raw_binary | ( | const uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
uint8_t | value[], | ||
size_t | value_length | ||
) |
Reads raw binary value from the serialization buffer.
Reads raw binary value from the serialization buffer from the specified index and advances the index to the position immediately after the value that was read. Note: The binary is read without the length prefix, so it is assumed that the caller has already read the length prefix and has allocated the buffer that is big enough to accommodate the output.
buffer | (in) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the value should be read from |
value | (out) buffer to store the binary value |
value_length | length of binary to read |
yami_ok
or yami_not_enough_space
enum yami_result yami_get_raw_boolean_array | ( | const uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
int32_t | value[], | ||
size_t | value_length | ||
) |
Reads raw boolean array from the serialization buffer.
Reads raw boolean array from the serialization buffer from the specified index and advances the index to the position immediately after the value that was read. Note: The array is read without the length prefix, so it is assumed that the caller has already read the length prefix and has allocated the buffer that is big enough to accommodate the output. The array is read in an unpacked form.
buffer | (in) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the value should be read from |
value | (out) buffer to store the array value |
value_length | length of array to read |
yami_ok
or yami_not_enough_space
enum yami_result yami_get_raw_cstring | ( | const uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
char | value[], | ||
size_t | value_length | ||
) |
Reads raw string value from the serialization buffer.
Reads raw string value from the serialization buffer from the specified index and advances the index to the position immediately after the value that was read. Note: The string is read without the length prefix, so it is assumed that the caller has already read the length prefix and has allocated the buffer that is big enough to accommodate the output, together with the nul character that is appended after the extracted value.
buffer | (in) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the value should be read from |
value | (out) buffer to store the string |
value_length | length of string to read |
yami_ok
or yami_not_enough_space
enum yami_result yami_get_raw_integer_array | ( | const uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
int32_t | value[], | ||
size_t | value_length | ||
) |
Reads raw integer array from the serialization buffer.
Reads raw integer array from the serialization buffer from the specified index and advances the index to the position immediately after the value that was read. Note: The array is read without the length prefix, so it is assumed that the caller has already read the length prefix and has allocated the buffer that is big enough to accommodate the output.
buffer | (in) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the value should be read from |
value | (out) buffer to store the array value |
value_length | length of array to read |
yami_ok
or yami_not_enough_space
enum yami_result yami_get_raw_long_long_array | ( | const uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
int64_t | value[], | ||
size_t | value_length | ||
) |
Reads raw long long array from the serialization buffer.
Reads raw long long array from the serialization buffer from the specified index and advances the index to the position immediately after the value that was read. Note: The array is read without the length prefix, so it is assumed that the caller has already read the length prefix and has allocated the buffer that is big enough to accommodate the output.
buffer | (in) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the value should be read from |
value | (out) buffer to store the array value |
value_length | length of array to read |
yami_ok
or yami_not_enough_space
enum yami_result yami_get_type | ( | const uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
enum yami_parameter_type * | type | ||
) |
Reads type code from the serialization buffer.
Reads type code from the serialization buffer from the specified index and advances the index to the position immediately after the value that was read.
buffer | (in) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the value should be read from |
type | (out) type code to be read |
yami_ok
or yami_unexpected_value
or yami_not_enough_space
enum yami_result yami_parse_frame_header | ( | const uint8_t | buffer[], |
const size_t | buffer_size, | ||
size_t *const | buffer_position, | ||
uint32_t *const | message_id, | ||
size_t *const | message_header_size, | ||
size_t *const | frame_payload_size | ||
) |
enum yami_result yami_parse_message_header | ( | const uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
char | out_header_type[], | ||
size_t | header_type_size, | ||
char | out_object_name[], | ||
size_t | object_name_size, | ||
char | out_message_name[], | ||
size_t | message_name_size, | ||
char | out_reason[], | ||
size_t | reason_size, | ||
int64_t * | out_message_id | ||
) |
Parses message header.
Parses message header and extracts individual fields. Note: only those fields which are found in the header are returned, the remaining parameters are set to empty strings or to 0.
buffer | (in) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the header values should be read from |
out_header_type | set to the value of "type" field, this field is expected |
header_type_size | max length of the header type (char buffer size) |
out_object_name | set to the value of "object_name" field, if found |
object_name_size | max length of object name (char buffer size) |
out_message_name | set to the value of "message_name" field, if found |
message_name_size | max length of message name (char buffer size) |
out_reason | set to the value of "reason" field, if found |
reason_size | max length of reason (char buffer size) |
out_message_id | set to the value of "message_id" field, this field is expected |
yami_ok
if the header was parsed correctly, yami_no_such_name
if the header lacks expected fields or yami_not_enough_space
if the output parameters are too small or yami_unexpected_value
if the buffer contains unrecognized data enum yami_result yami_put_binary | ( | uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
const uint8_t | value[], | ||
size_t | value_length | ||
) |
Places binary value in the serialization buffer.
Places binary value in the serialization buffer at the specified index and advances the index to the position after the written value. Note: The function stores the length prefix before the binary itself.
buffer | (in/out) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the new value should be written |
value | binary value to be written |
value_length | length of the binary value |
yami_ok
or yami_not_enough_space
enum yami_result yami_put_boolean_array | ( | uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
const int32_t | value[], | ||
size_t | value_length | ||
) |
Places boolean array in the serialization buffer.
Places boolean array in the serialization buffer at the specified index and advances the index to the position after the written value. Note: The function stores the length prefix before the array itself. The boolean array is stored in the packed form, properly padded.
buffer | (in/out) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the new value should be written |
value | boolean array to be written, each array field contains a single boolean value |
value_length | length of the array |
yami_ok
or yami_not_enough_space
enum yami_result yami_put_cstring | ( | uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
const char | value[] | ||
) |
Places string value in the serialization buffer.
Places string value in the serialization buffer at the specified index and advances the index to the position after the written value. Note: It is assumed that the string is nul-terminated and the function will stop copying characters at the first nul character. The function stores the length prefix before the string itself; the length does not take into account the nul character.
buffer | (in/out) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the new value should be written |
value | string value to be written, nul-terminated |
yami_ok
or yami_not_enough_space
enum yami_result yami_put_integer | ( | uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
int32_t | value | ||
) |
Places integer value in the serialization buffer.
Places integer value in the serialization buffer at the specified index and advances the index to the position immediately after the written value.
buffer | (in/out) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the new value should be written |
value | integer value to be written |
yami_ok
or yami_not_enough_space
enum yami_result yami_put_integer_array | ( | uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
const int32_t | value[], | ||
size_t | value_length | ||
) |
Places integer array in the serialization buffer.
Places integer array in the serialization buffer at the specified index and advances the index to the position after the written value. Note: The function stores the length prefix before the array itself.
buffer | (in/out) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the new value should be written |
value | integer array to be written |
value_length | length of the array |
yami_ok
or yami_not_enough_space
enum yami_result yami_put_long_long | ( | uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
int64_t | value | ||
) |
Places long long value in the serialization buffer.
Places long long value in the serialization buffer at the specified index and advances the index to the position immediately after the written value.
buffer | (in/out) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the new value should be written |
value | long long value to be written |
yami_ok
or yami_not_enough_space
enum yami_result yami_put_long_long_array | ( | uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
const int64_t | value[], | ||
size_t | value_length | ||
) |
Places long long array in the serialization buffer.
Places long long array in the serialization buffer at the specified index and advances the index to the position after the written value. Note: The function stores the length prefix before the array itself.
buffer | (in/out) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the new value should be written |
value | long long array to be written |
value_length | length of the array |
yami_ok
or yami_not_enough_space
enum yami_result yami_put_type | ( | uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
enum yami_parameter_type | type | ||
) |
Places type indicator value in the serialization buffer.
Places type indicator value in the serialization buffer at the specified index and advances the index to the position immediately after the written value.
buffer | (in/out) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array where the new value should be written |
type | type code to be written |
yami_ok
or yami_not_enough_space
enum yami_result yami_skip_field | ( | const uint8_t | buffer[], |
size_t | buffer_size, | ||
size_t * | buffer_position, | ||
enum yami_parameter_type | type | ||
) |
Skips the given field in serialization buffer.
Skips the field of the given type in the serialization buffer. This function can be particularly useful when processing fields that can have varying length (strings, binaries and arrays).
buffer | (in) serialization buffer |
buffer_size | size of the serialization buffer |
buffer_position | (in/out) position (in bytes) in the buffer array |
type | type of the field to be skipped |
yami_ok
or yami_not_enough_space