Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
 4.1.99
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

Data Structures

struct  uuid
 Binary representation of a UUID. More...
 

Macros

#define UUID_SIZE   16U
 Number of bytes in the binary representation of a UUID.
 
#define UUID_STR_LEN   37U
 Length of the UUID canonical string representation, including the NULL terminator.
 
#define UUID_BASE64_LEN   25U
 Length of the UUID base64 string representation, including the NULL terminator.
 
#define UUID_BASE64URL_LEN   23U
 Length of the UUID base64 URL and filename safe string representation, including the NULL terminator.
 

Functions

int uuid_generate_v4 (struct uuid *out)
 Generate a UUIDv4.
 
int uuid_generate_v5 (const struct uuid *namespace, const void *data, size_t data_size, struct uuid *out)
 Generate a UUIDv5.
 
int uuid_copy (const struct uuid *data, struct uuid *out)
 Copy an UUID into another UUID.
 
int uuid_from_buffer (const uint8_t data[16U], struct uuid *out)
 Create a uuid_t from a binary (big-endian) formatted UUID.
 
int uuid_from_string (const char data[37U], struct uuid *out)
 Parse a UUID from its canonical (RFC9562) string representation.
 
int uuid_to_buffer (const struct uuid *data, uint8_t out[16U])
 Create a uuid_t from a binary (big-endian) formatted UUID.
 
int uuid_to_string (const struct uuid *data, char out[37U])
 Convert a UUID to its canonical (RFC9562) string representation.
 
int uuid_to_base64 (const struct uuid *data, char out[25U])
 Convert a UUID to its base 64 (RFC 3548, RFC 4648) string representation.
 
int uuid_to_base64url (const struct uuid *data, char out[23U])
 Convert a UUID to its base 64 (RFC 4648 sec.
 

Detailed Description

Since
4.0
Version
0.1.0

Macro Definition Documentation

◆ UUID_BASE64_LEN

#define UUID_BASE64_LEN   25U

#include <zephyr/sys/uuid.h>

Length of the UUID base64 string representation, including the NULL terminator.

◆ UUID_BASE64URL_LEN

#define UUID_BASE64URL_LEN   23U

#include <zephyr/sys/uuid.h>

Length of the UUID base64 URL and filename safe string representation, including the NULL terminator.

◆ UUID_SIZE

#define UUID_SIZE   16U

#include <zephyr/sys/uuid.h>

Number of bytes in the binary representation of a UUID.

◆ UUID_STR_LEN

#define UUID_STR_LEN   37U

#include <zephyr/sys/uuid.h>

Length of the UUID canonical string representation, including the NULL terminator.

Function Documentation

◆ uuid_copy()

int uuid_copy ( const struct uuid * data,
struct uuid * out )

#include <zephyr/sys/uuid.h>

Copy an UUID into another UUID.

Parameters
dataInput data to copy.
outDestination for the copy.
Return values
0The UUID has been correctly copied in dst
-EINVALdst is not acceptable

◆ uuid_from_buffer()

int uuid_from_buffer ( const uint8_t data[16U],
struct uuid * out )

#include <zephyr/sys/uuid.h>

Create a uuid_t from a binary (big-endian) formatted UUID.

Parameters
dataThe buffer where the binary UUID is stored in a big-endian order.
outThe UUID where the result will be written.
Return values
0The UUID has been correctly parsed and stored in out
-EINVALdata or out are not acceptable

◆ uuid_from_string()

int uuid_from_string ( const char data[37U],
struct uuid * out )

#include <zephyr/sys/uuid.h>

Parse a UUID from its canonical (RFC9562) string representation.

Parameters
dataA pointer to the string to be parsed.
outThe UUID where the result will be written.
Return values
0The UUID has been correctly parsed and stored in out
-EINVALinput or out are not acceptable

◆ uuid_generate_v4()

int uuid_generate_v4 ( struct uuid * out)

#include <zephyr/sys/uuid.h>

Generate a UUIDv4.

Parameters
outThe UUID where the result will be written.
Return values
0The UUID has been correctly generated and stored in out
-EINVALout is not acceptable

◆ uuid_generate_v5()

int uuid_generate_v5 ( const struct uuid * namespace,
const void * data,
size_t data_size,
struct uuid * out )

#include <zephyr/sys/uuid.h>

Generate a UUIDv5.

This function computes a deterministic UUID starting from a namespace UUID and binary data.

Parameters
namespaceA pointer to an UUID to be used as namespace.
dataA pointer to the data that will be hashed to produce the UUID.
data_sizeThe size of the data buffer.
outThe UUID where the result will be written.
Return values
0The UUID has been correctly generated and stored in out
-EINVALout is not acceptable
-ENOMEMMemory allocation failed
-ENOTSUPmbedTLS returned an unrecognized error

◆ uuid_to_base64()

int uuid_to_base64 ( const struct uuid * data,
char out[25U] )

#include <zephyr/sys/uuid.h>

Convert a UUID to its base 64 (RFC 3548, RFC 4648) string representation.

Parameters
dataThe UUID to convert to string.
outA pointer to a previously allocated buffer where the result will be written.
Return values
0The UUID has been converted and written in out
-EINVALout is not acceptable

◆ uuid_to_base64url()

int uuid_to_base64url ( const struct uuid * data,
char out[23U] )

#include <zephyr/sys/uuid.h>

Convert a UUID to its base 64 (RFC 4648 sec.

5) URL and filename safe string representation.

Parameters
dataThe UUID to convert to string.
outA pointer to a previously allocated buffer where the result will be written.
Return values
0The UUID has been converted and written in out
-EINVALout is not acceptable

◆ uuid_to_buffer()

int uuid_to_buffer ( const struct uuid * data,
uint8_t out[16U] )

#include <zephyr/sys/uuid.h>

Create a uuid_t from a binary (big-endian) formatted UUID.

Parameters
dataThe input UUID to store in the buffer.
outThe buffer where the binary UUID is stored in a big-endian order.
Return values
0The UUID has been correctly parsed and stored in buff
-EINVALbuff is not acceptable

◆ uuid_to_string()

int uuid_to_string ( const struct uuid * data,
char out[37U] )

#include <zephyr/sys/uuid.h>

Convert a UUID to its canonical (RFC9562) string representation.

Parameters
dataThe UUID to convert to string.
outA pointer to a previously allocated buffer where the result will be written.
Return values
0The UUID has been converted and written in out
-EINVALout is not acceptable