|
#define | COL_TYPE_NAME_STRING "string" |
| Name used for string type.
|
|
#define | COL_TYPE_NAME_BINARY "bin" |
| Name used for binary type.
|
|
#define | COL_TYPE_NAME_INTEGER "int" |
| Name used for integer type.
|
|
#define | COL_TYPE_NAME_UNSIGNED "uint" |
| Name used for unsigned integer type.
|
|
#define | COL_TYPE_NAME_LONG "long" |
| Name used for long type.
|
|
#define | COL_TYPE_NAME_ULONG "ulong" |
| Name used for unsigned long type.
|
|
#define | COL_TYPE_NAME_DOUBLE "double" |
| Name used for floating point type.
|
|
#define | COL_TYPE_NAME_BOOL "bool" |
| Name used for boolean type.
|
|
#define | COL_TYPE_NAME_UNKNOWN "unknown" |
| Name used for unknown type.
|
|
#define | TEXT_COLLECTION "SET" |
| Literal used in the default serialization.
|
|
#define | TEXT_COLLEN 3 |
| Length of the TEXT_COLLECTION literal.
|
|
#define | BLOCK_SIZE 1024 |
| The data will be allocated in BLOCK_SIZE blocks during serialization.
|
|
|
int | col_get_data_len (int type, int length) |
| Calculate the potential size of the item.
|
|
int | col_grow_buffer (struct col_serial_data *buf_data, int len) |
| Grow serialization buffer.
|
|
int | col_put_marker (struct col_serial_data *buf_data, const void *data, int len) |
| Add special data to the serialization output.
|
|
int | col_serialize (const char *property_in, int property_len_in, int type, void *data_in, int length_in, void *custom_data, int *dummy) |
| Serialization of data callback.
|
|
int | col_debug_handle (const char *property, int property_len, int type, void *data, int length, void *custom_data, int *dummy) |
| Debug property callback.
|
|
int | col_debug_item (struct collection_item *item) |
| Convenience function to debug an item.
|
|
int | col_debug_collection (struct collection_item *handle, int flag) |
| Print collection for debugging purposes.
|
|
int | col_print_collection (struct collection_item *handle) |
| Print collection data.
|
|
int | col_print_collection2 (struct collection_item *handle) |
| Print collection data.
|
|
int | col_print_item (struct collection_item *handle, const char *name) |
| Find and print one property.
|
|
char ** | col_collection_to_list (struct collection_item *handle, int *size, int *error) |
| Convert collection to the array of properties.
|
|
void | col_free_property_list (char **str_list) |
| Free list of properties.
|
|
Additional functions retaed to tracing, printing, debugging and serializaing collections.
Functions in this module are more a sample implementation than a part of the interface. There is a chance they will change over time.
◆ col_get_data_len()
int col_get_data_len |
( |
int | type, |
|
|
int | length ) |
Calculate the potential size of the item.
- Parameters
-
[in] | type | Type of the value. |
[in] | length | Length of the value. |
- Returns
- Maximum length the value would occupy when serialized.
◆ col_grow_buffer()
Grow serialization buffer.
- Parameters
-
[in] | buf_data | Serialization object. |
[in] | len | For how much the serialization storage should be incrementally increased. |
- Returns
- 0 - Success.
-
ENOMEM - No memory.
◆ col_put_marker()
int col_put_marker |
( |
struct col_serial_data * | buf_data, |
|
|
const void * | data, |
|
|
int | len ) |
Add special data to the serialization output.
- Parameters
-
[in] | buf_data | Serialization object. |
[in] | data | Pointer to special data. |
[in] | len | Length of the data to insert. |
- Returns
- 0 - Success.
-
ENOMEM - No memory.
◆ col_serialize()
int col_serialize |
( |
const char * | property_in, |
|
|
int | property_len_in, |
|
|
int | type, |
|
|
void * | data_in, |
|
|
int | length_in, |
|
|
void * | custom_data, |
|
|
int * | dummy ) |
Serialization of data callback.
- Parameters
-
[in] | property_in | Property to serialize. |
[in] | property_len_in | Length of the property to serialize. |
[in] | type | Type of the value. |
[in] | data_in | Value to serialize. |
[in] | length_in | Length of the value. |
[in] | custom_data | State data passed to callback. It is actually a serialization object. |
[in] | dummy | Not used. It is here because the callback needs to comply to the functions signature. |
- Returns
- 0 - Success.
-
ENOMEM - No memory.
◆ col_debug_handle()
int col_debug_handle |
( |
const char * | property, |
|
|
int | property_len, |
|
|
int | type, |
|
|
void * | data, |
|
|
int | length, |
|
|
void * | custom_data, |
|
|
int * | dummy ) |
Debug property callback.
- Parameters
-
[in] | property | Property to debug. |
[in] | property_len | Length of the property to debug. |
[in] | type | Type of the value. |
[in] | data | Value to serialize. |
[in] | length | Length of the value. |
[in] | custom_data | State data passed to the callback. |
[in] | dummy | Not used. It is here because the callback needs to comply to the functions signature. |
- Returns
- 0 - Success.
-
ENOMEM - No memory.
◆ col_debug_item()
Convenience function to debug an item.
Prints item internals.
- Parameters
-
- Returns
- 0 - Success.
-
ENOMEM - No memory.
◆ col_debug_collection()
Print collection for debugging purposes.
Prints collection internals.
- Parameters
-
[in] | handle | Collection to debug. |
[in] | flag | See traverse flags. |
- Returns
- 0 - Success.
-
ENOMEM - No memory.
◆ col_print_collection()
Print collection data.
Prints collection data. Uses traverse function to iterate through the collection.
- Parameters
-
[in] | handle | Collection to print. |
- Returns
- 0 - Success.
-
ENOMEM - No memory.
◆ col_print_collection2()
Print collection data.
Prints collection data. Uses iterator to process the collection.
- Parameters
-
[in] | handle | Collection to print. |
- Returns
- 0 - Success.
-
ENOMEM - No memory.
◆ col_print_item()
Find and print one property.
Prints item data.
- Parameters
-
[in] | handle | Collection to search. |
[in] | name | Item to find and print. |
- Returns
- 0 - Success.
-
ENOMEM - No memory.
◆ col_collection_to_list()
char ** col_collection_to_list |
( |
struct collection_item * | handle, |
|
|
int * | size, |
|
|
int * | error ) |
Convert collection to the array of properties.
- Parameters
-
[in] | handle | Collection to convert. |
[in] | size | Will receive the number of the strings in the array. Can be NULL if caller is not interested in the size of the array. |
[in] | error | Will receive error value if any. Can be NULL if the caller does not care about error codes.
- 0 - Success.
- ENOMEM - No memory.
|
- Returns
- List of strings that constitute the properties in the collection. Collection name is not included.
◆ col_free_property_list()
void col_free_property_list |
( |
char ** | str_list | ) |
|
Free list of properties.
- Parameters
-
[in] | str_list | List to free. |