top logo menu kitty mascot
AROS.ORG Developers Localization Bounties

uuid

Index


UUID_Clear() UUID_Compare() UUID_Copy() UUID_Generate()
UUID_GetNameSpace() UUID_Pack() UUID_Parse() UUID_Unpack()
UUID_Unparse()      

UUID_Clear()

Synopsis

void UUID_Clear(
         uuid_t * uuid );

Function

Clears the specified uuid.

Inputs

uuid - UUID to be cleared.

Result

This function always succeeds.

UUID_Compare()

Synopsis

int UUID_Compare(
         const uuid_t * u1,
         const uuid_t * u2 );

Function

Compares between two UUIDs.

Inputs

u1, u2 - UUIDs to be compared.

Result

<0 - if the u1 is lexically BEFORE u2
=0 - if u1 equals u2
>0 - if the u1 is lexically AFTER u2

UUID_Copy()

Synopsis

void UUID_Copy(
         const uuid_t * src,
         uuid_t * dst );

Function

Copies the UUID's.

Inputs

src - the source UUID.
dst - the desitation UUID.

Result

This function always succeeds.

UUID_Generate()

Synopsis

void UUID_Generate(
         uuid_type_t type,
         uuid_t * uuid );

Function

Generate Universally Unique Identifier conforming the RFC 4122.

Inputs

type - type of the identifier:
       UUID_TYPE_DCE_RANDOM - random identifier. Do not use it on purpose
                              due to the weak source of noise on AROS.
       UUID_TYPE_DCE_TIME - system time based identifier.

uuid - storage for generated UUID.

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.

Inputs

NameSpace - UUID_NAMESPACE_DNS, UUID_NAMESPACE_URL,
            UUID_NAMESPACE_OID or UUID_NAMESPACE_X500.
uuid - Non-NULL pointer to a writable uuid_t.

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.

Inputs

uuid - Non-NULL pointer to a readable uuid_t.
out - Non-NULL pointer to at least 16 writable bytes. The output
      buffer must not overlap the input object.

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.

Inputs

in - Non-NULL pointer to a readable NUL-terminated string.
uuid - Non-NULL pointer to a writable uuid_t.

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.

Inputs

in - Non-NULL pointer to at least 16 readable bytes.
uuid - Non-NULL pointer to a writable uuid_t. The output object
       must not overlap the input buffer.

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.

Inputs

uuid - Non-NULL pointer to a readable uuid_t.
out - Non-NULL pointer to a writable buffer of at least
      UUID_STRLEN + 1 (37) bytes, separate from the input object.

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.