22 #ifndef ETCPAL_UUID_H_
23 #define ETCPAL_UUID_H_
28 #include "etcpal/error.h"
90 #define ETCPAL_UUID_BYTES 16u
106 #define ETCPAL_UUID_CMP(uuid1ptr, uuid2ptr) memcmp((uuid1ptr)->data, (uuid2ptr)->data, ETCPAL_UUID_BYTES)
119 #define ETCPAL_UUID_IS_NULL(uuidptr) (memcmp((uuidptr)->data, kEtcPalNullUuid.data, ETCPAL_UUID_BYTES) == 0)
122 #define ETCPAL_UUID_STRING_BYTES 37
125 #define ETCPAL_UUID_DEV_STR_MAX_LEN 32
138 const uint8_t* mac_addr,
etcpal_error_t
A set of error codes that can be returned by library functions.
Definition: error.h:49
etcpal_error_t etcpal_generate_device_uuid(const char *dev_str, const uint8_t *mac_addr, uint32_t uuid_num, EtcPalUuid *uuid)
Generate a UUID from a combination of a custom string and MAC address.
Definition: uuid.c:309
etcpal_error_t etcpal_generate_v4_uuid(EtcPalUuid *uuid)
Generate a Version 4 UUID.
Definition: uuid.c:216
struct EtcPalUuid EtcPalUuid
The UUID type.
bool etcpal_uuid_to_string(const EtcPalUuid *uuid, char *buf)
Create a string representation of a UUID.
Definition: uuid.c:61
#define ETCPAL_UUID_CMP(uuid1ptr, uuid2ptr)
Compare two UUIDs.
Definition: uuid.h:106
etcpal_error_t etcpal_generate_v1_uuid(EtcPalUuid *uuid)
Generate a Version 1 UUID.
Definition: uuid.c:152
bool etcpal_string_to_uuid(const char *str, EtcPalUuid *uuid)
Create a UUID from a string representation.
Definition: uuid.c:85
etcpal_error_t etcpal_generate_os_preferred_uuid(EtcPalUuid *uuid)
Generate the preferred UUID version of the underlying OS.
Definition: uuid.c:282
etcpal_error_t etcpal_generate_v5_uuid(const EtcPalUuid *ns, const void *name, size_t name_len, EtcPalUuid *uuid)
Generate a Version 5 UUID.
Definition: uuid.c:243
etcpal_error_t etcpal_generate_v3_uuid(const EtcPalUuid *ns, const void *name, size_t name_len, EtcPalUuid *uuid)
Generate a Version 3 UUID.
Definition: uuid.c:178
#define ETCPAL_UUID_BYTES
The number of bytes that make up a UUID.
Definition: uuid.h:90
const EtcPalUuid kEtcPalNullUuid
A null (all 0's) UUID, used by ETCPAL_UUID_IS_NULL() for comparison.
Definition: uuid.c:46
The UUID type.
Definition: uuid.h:94
uint8_t data[ETCPAL_UUID_BYTES]
The 16-byte UUID data.
Definition: uuid.h:95