4 * Copyright 2016 Red Hat, Inc.
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
19 #include "qemu-common.h"
21 /* Version 4 UUID (pseudo random numbers), RFC4122 4.4. */
25 unsigned char data[16];
27 /* Generated in BE endian, can be swapped with qemu_uuid_bswap. */
30 uint16_t time_high_and_version;
31 uint8_t clock_seq_and_reserved;
32 uint8_t clock_seq_low;
38 #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-" \
39 "%02hhx%02hhx-%02hhx%02hhx-" \
41 "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
43 #define UUID_FMT_LEN 36
45 #define UUID_NONE "00000000-0000-0000-0000-000000000000"
47 void qemu_uuid_generate(QemuUUID *out);
49 int qemu_uuid_is_null(const QemuUUID *uu);
51 int qemu_uuid_is_equal(const QemuUUID *lhv, const QemuUUID *rhv);
53 void qemu_uuid_unparse(const QemuUUID *uuid, char *out);
55 char *qemu_uuid_unparse_strdup(const QemuUUID *uuid);
57 int qemu_uuid_parse(const char *str, QemuUUID *uuid);
59 QemuUUID qemu_uuid_bswap(QemuUUID uuid);