Zephyr Project API 4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
uuid.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025, SECO Mind Srl
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_SYS_UUID_H_
8#define ZEPHYR_INCLUDE_SYS_UUID_H_
9
17#include <zephyr/kernel.h>
18#include <zephyr/types.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
33#define UUID_SIZE 16U
34
36#define UUID_STR_LEN 37U
37
39#define UUID_BASE64_LEN 25U
40
45#define UUID_BASE64URL_LEN 23U
46
48struct uuid {
50 uint8_t val[UUID_SIZE];
52};
53
62int uuid_generate_v4(struct uuid *out);
63
80int uuid_generate_v5(const struct uuid *namespace, const void *data, size_t data_size,
81 struct uuid *out);
82
92int uuid_copy(const struct uuid *data, struct uuid *out);
93
103int uuid_from_buffer(const uint8_t data[UUID_SIZE], struct uuid *out);
104
114int uuid_from_string(const char data[UUID_STR_LEN], struct uuid *out);
115
125int uuid_to_buffer(const struct uuid *data, uint8_t out[UUID_SIZE]);
126
136int uuid_to_string(const struct uuid *data, char out[UUID_STR_LEN]);
137
147int uuid_to_base64(const struct uuid *data, char out[UUID_BASE64_LEN]);
148
159int uuid_to_base64url(const struct uuid *data, char out[UUID_BASE64URL_LEN]);
160
165#ifdef __cplusplus
166}
167#endif
168
169#endif /* ZEPHYR_INCLUDE_SYS_UUID_H_ */
#define UUID_BASE64_LEN
Length of the UUID base64 string representation, including the NULL terminator.
Definition uuid.h:39
int uuid_generate_v4(struct uuid *out)
Generate a UUIDv4.
int uuid_copy(const struct uuid *data, struct uuid *out)
Copy an UUID into another UUID.
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_base64(const struct uuid *data, char out[25U])
Convert a UUID to its base 64 (RFC 3548, RFC 4648) string representation.
#define UUID_SIZE
Number of bytes in the binary representation of a UUID.
Definition uuid.h:33
int uuid_to_base64url(const struct uuid *data, char out[23U])
Convert a UUID to its base 64 (RFC 4648 sec.
#define UUID_STR_LEN
Length of the UUID canonical string representation, including the NULL terminator.
Definition uuid.h:36
int uuid_generate_v5(const struct uuid *namespace, const void *data, size_t data_size, struct uuid *out)
Generate a UUIDv5.
int uuid_to_string(const struct uuid *data, char out[37U])
Convert a UUID to its canonical (RFC9562) string representation.
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.
#define UUID_BASE64URL_LEN
Length of the UUID base64 URL and filename safe string representation, including the NULL terminator.
Definition uuid.h:45
Public kernel APIs.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Binary representation of a UUID.
Definition uuid.h:48