Storage and serialization of an attribute list with an action group.
More...
|
| bool | attributes_actions_parse_serial_data (uint8_t num_attributes, uint8_t num_actions, const uint8_t *data, size_t data_size, size_t *string_alloc_size_out, uint8_t *attributes_per_action_out) |
| | Measure a serialized payload.
|
| |
| size_t | attributes_actions_get_required_buffer_size (uint8_t num_attributes, uint8_t num_actions, uint8_t *attributes_per_action, size_t required_size_for_strings) |
| | Get the size of the buffer holding attributes, actions and their strings.
|
| |
| size_t | attributes_actions_get_buffer_size (AttributeList *attr_list, TimelineItemActionGroup *action_group) |
| | Get the size of the buffer holding a deep copy of an attribute list and action group.
|
| |
| void | attributes_actions_init (AttributeList *attr_list, TimelineItemActionGroup *action_group, uint8_t **buffer, uint8_t num_attributes, uint8_t num_actions, const uint8_t *attributes_per_action) |
| | Lay out an attribute list and action group in a buffer.
|
| |
| bool | attributes_actions_deserialize (AttributeList *attr_list, TimelineItemActionGroup *action_group, uint8_t *buffer, uint8_t *buf_end, const uint8_t *payload, size_t payload_size) |
| | Fill an attribute list and action group from a serialized payload.
|
| |
| size_t | attributes_actions_get_serialized_payload_size (AttributeList *list, TimelineItemActionGroup *action_group) |
| | Get the serialized size of an attribute list and action group.
|
| |
| size_t | attributes_actions_serialize_payload (AttributeList *attr_list, TimelineItemActionGroup *action_group, uint8_t *buffer, size_t buffer_size) |
| | Serialize an attribute list and action group.
|
| |
| bool | attributes_actions_deep_copy (AttributeList *src_attr_list, AttributeList *dest_attr_list, TimelineItemActionGroup *src_action_group, TimelineItemActionGroup *dest_action_group, uint8_t *buffer, uint8_t *buf_end) |
| | Deep copy an attribute list and action group into one buffer.
|
| |
Storage and serialization of an attribute list with an action group.
Deserializing is done in three steps: attributes_actions_parse_serial_data() measures the data, attributes_actions_init() lays out a buffer of attributes_actions_get_required_buffer_size() bytes, and attributes_actions_deserialize() fills it.
The serialized payload is the attributes followed by each action: id, type and attribute count bytes, then the action's attributes.
◆ attributes_actions_deep_copy()
Deep copy an attribute list and action group into one buffer.
- Parameters
-
| src_attr_list | Source attribute list. |
| [out] | dest_attr_list | Destination attribute list. |
| src_action_group | Source action group, may be NULL. |
| [out] | dest_action_group | Destination action group, may be NULL. |
| buffer | Buffer of at least attributes_actions_get_buffer_size() bytes. |
| buf_end | End of the buffer. |
- Returns
- true on success, false if the buffer is too small.
◆ attributes_actions_deserialize()
| bool attributes_actions_deserialize |
( |
AttributeList * |
attr_list, |
|
|
TimelineItemActionGroup * |
action_group, |
|
|
uint8_t * |
buffer, |
|
|
uint8_t * |
buf_end, |
|
|
const uint8_t * |
payload, |
|
|
size_t |
payload_size |
|
) |
| |
Fill an attribute list and action group from a serialized payload.
- Parameters
-
- Returns
- true on success.
◆ attributes_actions_get_buffer_size()
Get the size of the buffer holding a deep copy of an attribute list and action group.
- Parameters
-
| attr_list | Attribute list, may be NULL. |
| action_group | Action group, may be NULL. |
- Returns
- Size in bytes.
◆ attributes_actions_get_required_buffer_size()
| size_t attributes_actions_get_required_buffer_size |
( |
uint8_t |
num_attributes, |
|
|
uint8_t |
num_actions, |
|
|
uint8_t * |
attributes_per_action, |
|
|
size_t |
required_size_for_strings |
|
) |
| |
Get the size of the buffer holding attributes, actions and their strings.
- Parameters
-
| num_attributes | Number of non-action attributes. |
| num_actions | Number of actions. |
| attributes_per_action | Attribute count of each action, in action order. |
| required_size_for_strings | Total size of the attribute strings. |
- Returns
- Size in bytes.
◆ attributes_actions_get_serialized_payload_size()
Get the serialized size of an attribute list and action group.
- Parameters
-
| list | Attribute list, may be NULL. |
| action_group | Action group, may be NULL. |
- Returns
- Size in bytes.
◆ attributes_actions_init()
| void attributes_actions_init |
( |
AttributeList * |
attr_list, |
|
|
TimelineItemActionGroup * |
action_group, |
|
|
uint8_t ** |
buffer, |
|
|
uint8_t |
num_attributes, |
|
|
uint8_t |
num_actions, |
|
|
const uint8_t * |
attributes_per_action |
|
) |
| |
Lay out an attribute list and action group in a buffer.
- Parameters
-
| [out] | attr_list | Attribute list to initialize. |
| [out] | action_group | Action group to initialize. |
| [in,out] | buffer | Buffer for the attributes and actions; advanced to the start of the string space. |
| num_attributes | Number of attributes. |
| num_actions | Number of actions. |
| attributes_per_action | Attribute count of each action, in action order. |
◆ attributes_actions_parse_serial_data()
| bool attributes_actions_parse_serial_data |
( |
uint8_t |
num_attributes, |
|
|
uint8_t |
num_actions, |
|
|
const uint8_t * |
data, |
|
|
size_t |
data_size, |
|
|
size_t * |
string_alloc_size_out, |
|
|
uint8_t * |
attributes_per_action_out |
|
) |
| |
Measure a serialized payload.
- Parameters
-
| num_attributes | Number of non-action attributes. |
| num_actions | Number of actions. |
| data | Serialized payload. |
| data_size | Size of data in bytes. |
| [out] | string_alloc_size_out | Size of the string buffer required. |
| [out] | attributes_per_action_out | Attribute count of each action, in action order. |
- Returns
- true if the data was parsed successfully.
◆ attributes_actions_serialize_payload()
Serialize an attribute list and action group.
- Parameters
-
| attr_list | Attribute list, may be NULL. |
| action_group | Action group, may be NULL. |
| [out] | buffer | Output buffer. |
| buffer_size | Size of buffer in bytes. |
- Returns
- Number of bytes written.