1 #ifndef _BABELTRACE_UUID_H
2 #define _BABELTRACE_UUID_H
5 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
10 * Permission is hereby granted to use or copy this program
11 * for any purpose, provided the above notices are retained on all copies.
12 * Permission to modify the code and to distribute modified code is granted,
13 * provided the above notices are retained, and a notice that the code was
14 * modified is included with the above copyright notice.
19 /* Includes final \0. */
20 #define BABELTRACE_UUID_STR_LEN 37
21 #define BABELTRACE_UUID_LEN 16
23 #ifdef BABELTRACE_HAVE_LIBUUID
24 #include <uuid/uuid.h>
27 int babeltrace_uuid_generate(unsigned char *uuid_out
)
29 uuid_generate(uuid_out
);
34 void babeltrace_uuid_unparse(const unsigned char *uuid_in
, char *str_out
)
36 return uuid_unparse(uuid_in
, str_out
);
40 int babeltrace_uuid_parse(const char *str_in
, unsigned char *uuid_out
)
42 return uuid_parse(str_in
, uuid_out
);
46 int babeltrace_uuid_compare(const unsigned char *uuid_a
,
47 const unsigned char *uuid_b
)
49 return uuid_compare(uuid_a
, uuid_b
);
52 #elif defined(BABELTRACE_HAVE_LIBC_UUID)
57 int babeltrace_uuid_generate(unsigned char *uuid_out
)
61 uuid_create((uuid_t
*) uuid_out
, &status
);
62 if (status
== uuid_s_ok
)
69 void babeltrace_uuid_unparse(const unsigned char *uuid_in
, char *str_out
)
73 uuid_to_string((uuid_t
*) uuid_in
, str_out
, &status
);
74 if (status
== uuid_s_ok
)
81 int babeltrace_uuid_parse(const char *str_in
, unsigned char *uuid_out
)
85 uuid_from_string(str_in
, (uuid_t
*) uuid_out
, &status
);
86 if (status
== uuid_s_ok
)
93 int babeltrace_uuid_compare(const unsigned char *uuid_a
,
94 const unsigned char *uuid_b
)
98 uuid_compare((uuid_t
*) uuid_a
, (uuid_t
*) uuid_b
, &status
);
99 if (status
== uuid_s_ok
)
106 #error "Babeltrace needs to have a UUID generator configured."
109 #endif /* _BABELTRACE_UUID_H */
This page took 0.032965 seconds and 5 git commands to generate.