UUID_Compare()
Synopsis
int UUID_Compare(
const uuid_t * u1,
const uuid_t * u2 );
Function
Compares between two UUIDs.
Result
<0 - if the u1 is lexically BEFORE u2
=0 - if u1 equals u2
>0 - if the u1 is lexically AFTER u2
UUID_Generate()
Synopsis
void UUID_Generate(
uuid_type_t type,
uuid_t * uuid );
Function
Generate Universally Unique Identifier conforming the RFC 4122.
Result
This function always succeeds.
UUID_GetNameSpace()
Synopsis
void UUID_GetNameSpace(
uint32_t NameSpace,
uuid_t * uuid );
Function
Copy a predefined namespace UUID into a caller-supplied UUID object.
This does not generate a name-based UUID.
Result
None. The selected UUID is copied to *uuid. An unrecognized
NameSpace value writes the nil UUID (all fields zero).
Notes
The namespace values are respectively
6ba7b810-9dad-11d1-80b4-00c04fd430c8 (DNS),
6ba7b811-9dad-11d1-80b4-00c04fd430c8 (URL),
6ba7b812-9dad-11d1-80b4-00c04fd430c8 (OID), and
6ba7b814-9dad-11d1-80b4-00c04fd430c8 (X.500).
The caller provides and owns the output object.
UUID_Pack()
Synopsis
void UUID_Pack(
const uuid_t * uuid,
uint8_t * out );
Function
Serialize a UUID into a 16-byte sequence. The time_low, time_mid
and time_hi_and_version fields are written most significant byte
first, followed by clock_seq_hi_and_reserved, clock_seq_low and
the six node bytes in their stored order. The result is independent
of the native byte order of uuid_t.
Result
None. Exactly 16 bytes are written to out; no terminator is added.
Notes
Neither buffer size nor UUID validity is checked.
UUID_Parse()
Synopsis
int UUID_Parse(
const char * in,
uuid_t * uuid );
Function
Convert a NUL-terminated UUID string to a uuid_t. The required
form is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a
hexadecimal digit. Uppercase and lowercase hexadecimal letters are accepted.
The input must contain exactly UUID_STRLEN (36) characters before
the terminator; braces, surrounding whitespace and prefixes are
not accepted.
Result
1 on success, with the converted value in *uuid.
0 for an invalid length, separator or hexadecimal digit; *uuid
is left unchanged.
Notes
Version and variant fields are not validated. The nil UUID is
accepted, and the input string is unchanged.
UUID_Unpack()
Synopsis
void UUID_Unpack(
const uint8_t * in,
uuid_t * uuid );
Function
Deserialize the 16-byte representation produced by UUID_Pack().
The first four bytes form time_low, the next two time_mid and the
next two time_hi_and_version, all most significant byte first.
The remaining bytes supply clock_seq_hi_and_reserved,
clock_seq_low and the six node bytes.
Result
None. All UUID fields are written to *uuid.
Notes
The input is unchanged. Neither buffer size nor UUID validity is
checked; the nil UUID is accepted.
UUID_Unparse()
Synopsis
void UUID_Unparse(
const uuid_t * uuid,
char * out );
Function
Write the UUID as lowercase hexadecimal text in the form
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, followed by a NUL byte.
Result
None. The textual representation is written to out.
Notes
The caller must provide the full 37-byte buffer; there is no
size argument. Version and variant fields are not validated.