VirtualBox

source: vbox/trunk/include/iprt/uuid.h@ 23702

Last change on this file since 23702 was 20374, checked in by vboxsync, 15 years ago

*: s/RT_\(BEGIN|END\)_DECLS/RT_C_DECLS_\1/g

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
Line 
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
36RT_C_DECLS_BEGIN
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 * @note IPRT uses little endian byte ordering in the UUID integer fields. If
47 * you want to pass IPRT UUIDs in binary representation to other UUID libraries
48 * and expect to get exactly the same string representation as in IPRT, you
49 * need to convert the first three integer fields (one 32 bit value, two 16 bit
50 * values) separately to big endian (also called network byte order).
51 *
52 * @sa RTUUID::Gen
53 *
54 * @returns iprt status code.
55 * @param pUuid Where to store generated uuid.
56 */
57RTDECL(int) RTUuidCreate(PRTUUID pUuid);
58
59/**
60 * Makes null UUID value.
61 *
62 * @returns iprt status code.
63 * @param pUuid Where to store generated null uuid.
64 */
65RTDECL(int) RTUuidClear(PRTUUID pUuid);
66
67/**
68 * Checks if UUID is null.
69 *
70 * @returns true if UUID is null.
71 * @param pUuid uuid to check.
72 */
73RTDECL(bool) RTUuidIsNull(PCRTUUID pUuid);
74
75/**
76 * Compares two UUID values.
77 *
78 * @returns 0 if eq, < 0 or > 0.
79 * @param pUuid1 First value to compare. NULL is treated like if RTUuidIsNull() return true.
80 * @param pUuid2 Second value to compare. NULL is treated like if RTUuidIsNull() return true.
81 */
82RTDECL(int) RTUuidCompare(PCRTUUID pUuid1, PCRTUUID pUuid2);
83
84/**
85 * Compares a UUID value with a UUID string.
86 *
87 * @note IPRT uses little endian byte ordering in the UUID integer fields. If
88 * you want to pass IPRT UUIDs in binary representation to other UUID libraries
89 * and expect to get exactly the same string representation as in IPRT, you
90 * need to convert the first three integer fields (one 32 bit value, two 16 bit
91 * values) separately to big endian (also called network byte order).
92 * Correspondingly, if you want to get the right result with UUIDs which are in
93 * big endian format, you need to convert them before using this function.
94 *
95 * @sa RTUUID::Gen
96 *
97 * @returns 0 if eq, < 0 or > 0.
98 * @param pUuid1 First value to compare. NULL is not allowed.
99 * @param pszString2 The 2nd UUID in string form. NULL of malformed string is not permitted.
100 */
101RTDECL(int) RTUuidCompareStr(PCRTUUID pUuid1, const char *pszString);
102
103/**
104 * Converts binary UUID to its string representation.
105 *
106 * @note IPRT uses little endian byte ordering in the UUID integer fields. If
107 * you want to pass IPRT UUIDs in binary representation to other UUID libraries
108 * and expect to get exactly the same string representation as in IPRT, you
109 * need to convert the first three integer fields (one 32 bit value, two 16 bit
110 * values) separately to big endian (also called network byte order).
111 * Correspondingly, if you want to get the right result with UUIDs which are in
112 * big endian format, you need to convert them before using this function.
113 *
114 * @sa RTUUID::Gen
115 *
116 * @returns iprt status code.
117 * @param pUuid Uuid to convert.
118 * @param pszString Where to store result string.
119 * @param cchString pszString buffer length, must be >= RTUUID_STR_LENGTH.
120 */
121RTDECL(int) RTUuidToStr(PCRTUUID pUuid, char *pszString, size_t cchString);
122
123/**
124 * Converts UUID from its string representation to binary format.
125 *
126 * @note IPRT uses little endian byte ordering in the UUID integer fields. If
127 * you want to pass IPRT UUIDs in binary representation to other UUID libraries
128 * and expect to get exactly the same string representation as in IPRT, you
129 * need to convert the first three integer fields (one 32 bit value, two 16 bit
130 * values) separately to big endian (also called network byte order).
131 * Correspondingly, if you want to get the right result with UUIDs which are in
132 * big endian format, you need to convert them before using this function.
133 *
134 * @sa RTUUID::Gen
135 *
136 * @returns iprt status code.
137 * @param pUuid Where to store result Uuid.
138 * @param pszString String with UUID text data.
139 */
140RTDECL(int) RTUuidFromStr(PRTUUID pUuid, const char *pszString);
141
142/**
143 * Converts binary UUID to its UTF-16 string representation.
144 *
145 * @note See note in RTUuidToStr.
146 *
147 * @sa RTUUID::Gen
148 *
149 * @returns iprt status code.
150 * @param pUuid Uuid to convert.
151 * @param pwszString Where to store result string.
152 * @param cwcString pszString buffer length, must be >=
153 * RTUUID_STR_LENGTH.
154 */
155RTDECL(int) RTUuidToUtf16(PCRTUUID pUuid, PRTUTF16 pwszString, size_t cwcString);
156
157/**
158 * Converts UUID from its UTF-16 string representation to binary format.
159 *
160 * @note See note in RTUuidFromStr.
161 *
162 * @sa RTUUID::Gen
163 *
164 * @returns iprt status code.
165 * @param pUuid Where to store result Uuid.
166 * @param pwszString String with UUID text data.
167 */
168RTDECL(int) RTUuidFromUtf16(PRTUUID pUuid, PCRTUTF16 pwszString);
169
170/** @} */
171
172RT_C_DECLS_END
173
174#endif
175
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette