Provides RFC 4122 compliant UUID's.
More...
Provides RFC 4122 compliant UUID's.
This module provides RFC 4122 compliant UUID generation. The UUID stored in uuid_t struct is stored in network byte order.
|
#define | UUID_NODE_LEN (6U) |
| Size of the node identifier in bytes.
|
|
#define | UUID_STR_LEN (36U) |
| Size of a string UUID without null character.
|
|
|
#define | UUID_V1 (0x01) |
| Type 1 UUID - timestamp based
|
|
#define | UUID_V2 (0x02) |
| Type 2 UUID - DCE Security version.
|
|
#define | UUID_V3 (0x03) |
| Type 3 UUID - Name based with MD5
|
|
#define | UUID_V4 (0x04) |
| Type 4 UUID - Random generated
|
|
#define | UUID_V5 (0x05) |
| Type 5 UUID - Name based with SHA1.
|
|
|
#define | UUID_VERSION_MASK (0xF000) |
|
◆ uuid_equal()
static bool uuid_equal |
( |
const uuid_t * |
uuid1, |
|
|
const uuid_t * |
uuid2 |
|
) |
| |
|
inlinestatic |
Compare two UUID's.
- Parameters
-
[in] | uuid1 | First uuid to compare |
[in] | uuid2 | Second uuid to compare |
- Returns
- True when equal
Definition at line 140 of file uuid.h.
◆ uuid_from_string()
int uuid_from_string |
( |
uuid_t * |
uuid, |
|
|
const char * |
str |
|
) |
| |
Populate an UUID structure from an UUID string.
- Parameters
-
[out] | uuid | out UUID |
[in] | str | null-terminated input UUID string, must be UUID_STR_LEN bytes |
- Returns
- 0 on success, < 0 if
str
is not valid
◆ uuid_to_string()
void uuid_to_string |
( |
const uuid_t * |
uuid, |
|
|
char * |
str |
|
) |
| |
Generate an UUID string from an UUID structure.
- Parameters
-
[in] | uuid | UUID |
[out] | str | null-terminated UUID string, must be at least UUID_STR_LEN + 1 bytes |
◆ uuid_v3()
void uuid_v3 |
( |
uuid_t * |
uuid, |
|
|
const uuid_t * |
ns, |
|
|
const uint8_t * |
name, |
|
|
size_t |
len |
|
) |
| |
Generate a version 3(md5 based) UUID from a namespace and a byte array.
- Parameters
-
[out] | uuid | UUID struct to fill |
[in] | ns | Namespace UUID |
[in] | name | Ptr to byte array to use as name part |
[in] | len | Length of the byte array |
◆ uuid_v4()
Generate a version 4(Full random) UUID.
- Parameters
-
[out] | uuid | UUID struct to fill |
◆ uuid_v5()
void uuid_v5 |
( |
uuid_t * |
uuid, |
|
|
const uuid_t * |
ns, |
|
|
const uint8_t * |
name, |
|
|
size_t |
len |
|
) |
| |
Generate a version 5(sha1 based) UUID from a namespace and a byte array.
- Parameters
-
[out] | uuid | UUID struct to fill |
[in] | ns | Namespace UUID |
[in] | name | Ptr to byte array to use as name part |
[in] | len | Length of the byte array |
◆ uuid_version()
static unsigned uuid_version |
( |
const uuid_t * |
uuid | ) |
|
|
inlinestatic |
Retrieve the type number of a UUID.
- Parameters
-
[in] | uuid | UUID to retrieve version number from |
- Returns
- Version number
Definition at line 125 of file uuid.h.