Shared code for data made of an attribute list and a group of elements with their own attributes.
More...
|
| bool | attribute_group_parse_serial_data (AttributeGroupType type, uint8_t num_attributes, uint8_t num_group_type_elements, const uint8_t *data, size_t size, size_t *string_alloc_size_out, uint8_t *attributes_per_group_type_element_out) |
| | Measure serialized group data.
|
| |
| size_t | attribute_group_get_required_buffer_size (AttributeGroupType type, uint8_t num_attributes, uint8_t num_group_type_elements, const uint8_t *attributes_per_group_type_element, size_t required_size_for_strings) |
| | Get the size of the buffer holding group data.
|
| |
| void | attribute_group_init (AttributeGroupType type, AttributeList *attr_list, void *group_ptr, uint8_t **buffer, uint8_t num_attributes, uint8_t num_group_type_elements, const uint8_t *attributes_per_group_type_element) |
| | Lay out an attribute list and group in a buffer.
|
| |
| bool | attribute_group_deserialize (AttributeGroupType type, AttributeList *attr_list, void *group_ptr, uint8_t *buffer, uint8_t *buf_end, const uint8_t *payload, size_t payload_size) |
| | Deserialize group data into a list and group set up with attribute_group_init().
|
| |
| size_t | attribute_group_get_serialized_payload_size (AttributeGroupType type, AttributeList *attr_list, void *group_ptr) |
| | Get the serialized size of group data.
|
| |
| size_t | attribute_group_serialize_payload (AttributeGroupType type, AttributeList *attr_list, void *group_ptr, uint8_t *buffer, size_t buffer_size) |
| | Serialize group data.
|
| |
Shared code for data made of an attribute list and a group of elements with their own attributes.
The elements ("group data") are either the actions of a TimelineItemActionGroup or the addresses of an AddressList. Use the wrappers in Attributes and actions or pbl/services/contacts/attributes_address.h instead, which document the parameters.
Serialized, the attributes are followed by each element: an element header (action id, type and attribute count, or address UUID, type and attribute count) and its attributes. In memory, one buffer holds the attributes, the elements, each element's attributes and finally the string data.
◆ AttributeGroupType
◆ attribute_group_deserialize()
| bool attribute_group_deserialize |
( |
AttributeGroupType |
type, |
|
|
AttributeList * |
attr_list, |
|
|
void * |
group_ptr, |
|
|
uint8_t * |
buffer, |
|
|
uint8_t * |
buf_end, |
|
|
const uint8_t * |
payload, |
|
|
size_t |
payload_size |
|
) |
| |
Deserialize group data into a list and group set up with attribute_group_init().
- Parameters
-
| type | Kind of group elements. |
| [in,out] | attr_list | Top-level attribute list. |
| [in,out] | group_ptr | TimelineItemActionGroup or AddressList. |
| buffer | String data buffer. |
| buf_end | End of the string data buffer. |
| payload | Serialized data. |
| payload_size | Size of payload in bytes. |
- Returns
- true on success.
◆ attribute_group_get_required_buffer_size()
| size_t attribute_group_get_required_buffer_size |
( |
AttributeGroupType |
type, |
|
|
uint8_t |
num_attributes, |
|
|
uint8_t |
num_group_type_elements, |
|
|
const uint8_t * |
attributes_per_group_type_element, |
|
|
size_t |
required_size_for_strings |
|
) |
| |
Get the size of the buffer holding group data.
- Parameters
-
| type | Kind of group elements. |
| num_attributes | Number of top-level attributes. |
| num_group_type_elements | Number of elements. |
| attributes_per_group_type_element | Attribute count of each element. |
| required_size_for_strings | Size of the string data. |
- Returns
- Size in bytes.
◆ attribute_group_get_serialized_payload_size()
Get the serialized size of group data.
- Parameters
-
- Returns
- Size in bytes.
◆ attribute_group_init()
| void attribute_group_init |
( |
AttributeGroupType |
type, |
|
|
AttributeList * |
attr_list, |
|
|
void * |
group_ptr, |
|
|
uint8_t ** |
buffer, |
|
|
uint8_t |
num_attributes, |
|
|
uint8_t |
num_group_type_elements, |
|
|
const uint8_t * |
attributes_per_group_type_element |
|
) |
| |
Lay out an attribute list and group in a buffer.
- Parameters
-
| type | Kind of group elements. |
| [out] | attr_list | Top-level attribute list. |
| [out] | group_ptr | TimelineItemActionGroup or AddressList. |
| [in,out] | buffer | Buffer; advanced to the start of the string data. |
| num_attributes | Number of top-level attributes. |
| num_group_type_elements | Number of elements. |
| attributes_per_group_type_element | Attribute count of each element. |
◆ attribute_group_parse_serial_data()
| bool attribute_group_parse_serial_data |
( |
AttributeGroupType |
type, |
|
|
uint8_t |
num_attributes, |
|
|
uint8_t |
num_group_type_elements, |
|
|
const uint8_t * |
data, |
|
|
size_t |
size, |
|
|
size_t * |
string_alloc_size_out, |
|
|
uint8_t * |
attributes_per_group_type_element_out |
|
) |
| |
Measure serialized group data.
- Parameters
-
| type | Kind of group elements. |
| num_attributes | Number of top-level attributes. |
| num_group_type_elements | Number of elements. |
| data | Serialized data. |
| size | Size of data in bytes. |
| [out] | string_alloc_size_out | Size of the string data. |
| [out] | attributes_per_group_type_element_out | Attribute count of each element. |
- Returns
- true if the data is well formed.
◆ attribute_group_serialize_payload()
Serialize group data.
- Parameters
-
| type | Kind of group elements. |
| attr_list | Top-level attribute list, may be NULL. |
| group_ptr | TimelineItemActionGroup or AddressList, may be NULL. |
| [out] | buffer | Output buffer. |
| buffer_size | Size of buffer in bytes. |
- Returns
- Number of bytes written.