1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
* Copyright (C) 2008,2010 Citrix Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; version 2.1 only. with the special
* exception on linking described in file LICENSE.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
#ifndef __LIBXL_UUID_H__
#define __LIBXL_UUID_H__
#define LIBXL_UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
#define LIBXL_UUID_FMTLEN ((2*16)+4) /* 16 hex bytes plus 4 hypens */
#define LIBXL__UUID_BYTES(uuid) uuid[0], uuid[1], uuid[2], uuid[3], \
uuid[4], uuid[5], uuid[6], uuid[7], \
uuid[8], uuid[9], uuid[10], uuid[11], \
uuid[12], uuid[13], uuid[14], uuid[15]
#define LIBXL_UUID_BYTES(arg) LIBXL__UUID_BYTES((arg).uuid)
typedef struct {
/* UUID as an octet stream in big-endian byte-order. */
unsigned char uuid[16];
} libxl_uuid;
#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x040700
#if defined(__linux__)
#include <uuid/uuid.h>
#include <stdint.h>
#elif defined(__FreeBSD__) || defined(__NetBSD__)
#include <uuid.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#else
#error "Please update libxl_uuid.h for your OS"
#endif
#endif
int libxl_uuid_is_nil(const libxl_uuid *uuid);
void libxl_uuid_generate(libxl_uuid *uuid);
int libxl_uuid_from_string(libxl_uuid *uuid, const char *in);
void libxl_uuid_copy(libxl_ctx *ctx_opt, libxl_uuid *dst,
const libxl_uuid *src);
#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x040500
static inline void libxl_uuid_copy_0x040400(libxl_uuid *dst,
const libxl_uuid *src)
{
libxl_uuid_copy(NULL, dst, src);
}
#define libxl_uuid_copy libxl_uuid_copy_0x040400
#endif
void libxl_uuid_clear(libxl_uuid *uuid);
int libxl_uuid_compare(const libxl_uuid *uuid1, const libxl_uuid *uuid2);
const uint8_t *libxl_uuid_bytearray_const(const libxl_uuid *uuid);
uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid);
#endif /* __LIBXL_UUID_H__ */
/*
* Local variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
|