DPDK  24.03.0
rte_uuid.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
3  */
10 #ifndef _RTE_UUID_H_
11 #define _RTE_UUID_H_
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 #include <stdbool.h>
18 #include <stddef.h>
19 #include <string.h>
20 
24 typedef unsigned char rte_uuid_t[16];
25 
29 #define RTE_UUID_INIT(a, b, c, d, e) { \
30  ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, \
31  ((a) >> 8) & 0xff, (a) & 0xff, \
32  ((b) >> 8) & 0xff, (b) & 0xff, \
33  ((c) >> 8) & 0xff, (c) & 0xff, \
34  ((d) >> 8) & 0xff, (d) & 0xff, \
35  ((e) >> 40) & 0xff, ((e) >> 32) & 0xff, \
36  ((e) >> 24) & 0xff, ((e) >> 16) & 0xff, \
37  ((e) >> 8) & 0xff, (e) & 0xff \
38 }
39 
41 #define RTE_UUID_STRLEN (36 + 1)
42 
51 bool rte_uuid_is_null(const rte_uuid_t uu);
52 
61 static inline void rte_uuid_copy(rte_uuid_t dst, const rte_uuid_t src)
62 {
63  memcpy(dst, src, sizeof(rte_uuid_t));
64 }
65 
77 int rte_uuid_compare(const rte_uuid_t a, const rte_uuid_t b);
78 
89 int rte_uuid_parse(const char *in, rte_uuid_t uu);
90 
101 void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len);
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 #endif /* RTE_UUID_H */
int rte_uuid_parse(const char *in, rte_uuid_t uu)
void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len)
int rte_uuid_compare(const rte_uuid_t a, const rte_uuid_t b)
bool rte_uuid_is_null(const rte_uuid_t uu)
unsigned char rte_uuid_t[16]
Definition: rte_uuid.h:24
static void rte_uuid_copy(rte_uuid_t dst, const rte_uuid_t src)
Definition: rte_uuid.h:61