1 | /** @file
|
---|
2 | * IPRT - Universal Unique Identifiers (UUID).
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | *
|
---|
25 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
26 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
27 | * additional information or have any questions.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef ___iprt_uuid_h
|
---|
31 | #define ___iprt_uuid_h
|
---|
32 |
|
---|
33 | #include <iprt/cdefs.h>
|
---|
34 | #include <iprt/types.h>
|
---|
35 |
|
---|
36 | __BEGIN_DECLS
|
---|
37 |
|
---|
38 | /** @defgroup grp_rt_uuid RTUuid - Universally Unique Identifiers
|
---|
39 | * @ingroup grp_rt
|
---|
40 | * @{
|
---|
41 | */
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Generates new UUID value.
|
---|
45 | *
|
---|
46 | * @returns iprt status code.
|
---|
47 | * @param pUuid Where to store generated uuid.
|
---|
48 | */
|
---|
49 | RTDECL(int) RTUuidCreate(PRTUUID pUuid);
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * Makes null UUID value.
|
---|
53 | *
|
---|
54 | * @returns iprt status code.
|
---|
55 | * @param pUuid Where to store generated null uuid.
|
---|
56 | */
|
---|
57 | RTDECL(int) RTUuidClear(PRTUUID pUuid);
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * Checks if UUID is null.
|
---|
61 | *
|
---|
62 | * @returns true if UUID is null.
|
---|
63 | * @param pUuid uuid to check.
|
---|
64 | */
|
---|
65 | RTDECL(bool) RTUuidIsNull(PCRTUUID pUuid);
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Compares two UUID values.
|
---|
69 | *
|
---|
70 | * @returns 0 if eq, < 0 or > 0.
|
---|
71 | * @param pUuid1 First value to compare. NULL is treated like if RTUuidIsNull() return true.
|
---|
72 | * @param pUuid2 Second value to compare. NULL is treated like if RTUuidIsNull() return true.
|
---|
73 | */
|
---|
74 | RTDECL(int) RTUuidCompare(PCRTUUID pUuid1, PCRTUUID pUuid2);
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Compares a UUID value with a UUID string.
|
---|
78 | *
|
---|
79 | * @returns 0 if eq, < 0 or > 0.
|
---|
80 | * @param pUuid1 First value to compare. NULL is not allowed.
|
---|
81 | * @param pszString2 The 2nd UUID in string form. NULL of malformed string is not permitted.
|
---|
82 | */
|
---|
83 | RTDECL(int) RTUuidCompareStr(PCRTUUID pUuid1, const char *pszString);
|
---|
84 |
|
---|
85 | /**
|
---|
86 | * Converts binary UUID to its string representation.
|
---|
87 | *
|
---|
88 | * @returns iprt status code.
|
---|
89 | * @param pUuid Uuid to convert.
|
---|
90 | * @param pszString Where to store result string.
|
---|
91 | * @param cchString pszString buffer length, must be >= RTUUID_STR_LENGTH.
|
---|
92 | */
|
---|
93 | RTDECL(int) RTUuidToStr(PCRTUUID pUuid, char *pszString, size_t cchString);
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * Converts UUID from its string representation to binary format.
|
---|
97 | *
|
---|
98 | * @returns iprt status code.
|
---|
99 | * @param pUuid Where to store result Uuid.
|
---|
100 | * @param pszString String with UUID text data.
|
---|
101 | */
|
---|
102 | RTDECL(int) RTUuidFromStr(PRTUUID pUuid, const char *pszString);
|
---|
103 |
|
---|
104 | /** @} */
|
---|
105 |
|
---|
106 | __END_DECLS
|
---|
107 |
|
---|
108 | #endif
|
---|
109 |
|
---|