Debian Codegraph @

libfguid/libfguid_identifier.h

raw symbols SCIP
1 /*
2 * Global (or Universal) Unique Identifier (GUID/UUID) functions
3 *
4 * Copyright (C) 2010-2024, Joachim Metz <[email protected]>
5 *
6 * Refer to AUTHORS for acknowledgements.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 #if !defined( _LIBFGUID_INTERNAL_IDENTIFIER_H )
23 #define _LIBFGUID_INTERNAL_IDENTIFIER_H
24
25 #include <common.h>
26 #include <types.h>
27
28 #include "libfguid_extern.h"
29 #include "libfguid_libcerror.h"
30 #include "libfguid_types.h"
31
32 #if defined( __cplusplus )
33 extern "C" {
34 #endif
35
36 typedef struct libfguid_internal_identifier libfguid_internal_identifier_t;
37
38 /* The GUID is stored as:
39 * uint32 - uint16 - uint16 - 8 byte array
40 */
41 struct libfguid_internal_identifier
42 {
43 /* The 4 MSB of the time upper contain the version
44 */
45 struct
46 {
47 uint32_t lower;
48 uint16_t middle;
49 uint16_t upper;
50 } time;
51
52 /* The clock sequence upper also contains the reserved
53 */
54 struct
55 {
56 uint8_t upper;
57 uint8_t lower;
58 }
59 clock_sequence;
60
61 uint8_t node[ 6 ];
62 };
63
64 LIBFGUID_EXTERN \
65 int libfguid_identifier_initialize(
66 libfguid_identifier_t **identifier,
67 libcerror_error_t **error );
68
69 LIBFGUID_EXTERN \
70 int libfguid_identifier_free(
71 libfguid_identifier_t **identifier,
72 libcerror_error_t **error );
73
74 LIBFGUID_EXTERN \
75 int libfguid_identifier_copy_from_byte_stream(
76 libfguid_identifier_t *identifier,
77 const uint8_t *byte_stream,
78 size_t byte_stream_size,
79 int byte_order,
80 libcerror_error_t **error );
81
82 LIBFGUID_EXTERN \
83 int libfguid_identifier_copy_to_byte_stream(
84 libfguid_identifier_t *identifier,
85 uint8_t *byte_stream,
86 size_t byte_stream_size,
87 int byte_order,
88 libcerror_error_t **error );
89
90 LIBFGUID_EXTERN \
91 int libfguid_identifier_get_string_size(
92 libfguid_identifier_t *identifier,
93 size_t *string_size,
94 uint32_t string_format_flags,
95 libcerror_error_t **error );
96
97 LIBFGUID_EXTERN \
98 int libfguid_identifier_copy_from_utf8_string(
99 libfguid_identifier_t *identifier,
100 const uint8_t *utf8_string,
101 size_t utf8_string_length,
102 uint32_t string_format_flags,
103 libcerror_error_t **error );
104
105 LIBFGUID_EXTERN \
106 int libfguid_identifier_copy_from_utf8_string_with_index(
107 libfguid_identifier_t *identifier,
108 const uint8_t *utf8_string,
109 size_t utf8_string_length,
110 size_t *utf8_string_index,
111 uint32_t string_format_flags,
112 libcerror_error_t **error );
113
114 LIBFGUID_EXTERN \
115 int libfguid_identifier_copy_to_utf8_string(
116 libfguid_identifier_t *identifier,
117 uint8_t *utf8_string,
118 size_t utf8_string_size,
119 uint32_t string_format_flags,
120 libcerror_error_t **error );
121
122 LIBFGUID_EXTERN \
123 int libfguid_identifier_copy_to_utf8_string_with_index(
124 libfguid_identifier_t *identifier,
125 uint8_t *utf8_string,
126 size_t utf8_string_size,
127 size_t *utf8_string_index,
128 uint32_t string_format_flags,
129 libcerror_error_t **error );
130
131 LIBFGUID_EXTERN \
132 int libfguid_identifier_copy_from_utf16_string(
133 libfguid_identifier_t *identifier,
134 const uint16_t *utf16_string,
135 size_t utf16_string_length,
136 uint32_t string_format_flags,
137 libcerror_error_t **error );
138
139 LIBFGUID_EXTERN \
140 int libfguid_identifier_copy_from_utf16_string_with_index(
141 libfguid_identifier_t *identifier,
142 const uint16_t *utf16_string,
143 size_t utf16_string_length,
144 size_t *utf16_string_index,
145 uint32_t string_format_flags,
146 libcerror_error_t **error );
147
148 LIBFGUID_EXTERN \
149 int libfguid_identifier_copy_to_utf16_string(
150 libfguid_identifier_t *identifier,
151 uint16_t *utf16_string,
152 size_t utf16_string_size,
153 uint32_t string_format_flags,
154 libcerror_error_t **error );
155
156 LIBFGUID_EXTERN \
157 int libfguid_identifier_copy_to_utf16_string_with_index(
158 libfguid_identifier_t *identifier,
159 uint16_t *utf16_string,
160 size_t utf16_string_size,
161 size_t *utf16_string_index,
162 uint32_t string_format_flags,
163 libcerror_error_t **error );
164
165 LIBFGUID_EXTERN \
166 int libfguid_identifier_copy_from_utf32_string(
167 libfguid_identifier_t *identifier,
168 const uint32_t *utf32_string,
169 size_t utf32_string_length,
170 uint32_t string_format_flags,
171 libcerror_error_t **error );
172
173 LIBFGUID_EXTERN \
174 int libfguid_identifier_copy_from_utf32_string_with_index(
175 libfguid_identifier_t *identifier,
176 const uint32_t *utf32_string,
177 size_t utf32_string_length,
178 size_t *utf32_string_index,
179 uint32_t string_format_flags,
180 libcerror_error_t **error );
181
182 LIBFGUID_EXTERN \
183 int libfguid_identifier_copy_to_utf32_string(
184 libfguid_identifier_t *identifier,
185 uint32_t *utf32_string,
186 size_t utf32_string_size,
187 uint32_t string_format_flags,
188 libcerror_error_t **error );
189
190 LIBFGUID_EXTERN \
191 int libfguid_identifier_copy_to_utf32_string_with_index(
192 libfguid_identifier_t *identifier,
193 uint32_t *utf32_string,
194 size_t utf32_string_size,
195 size_t *utf32_string_index,
196 uint32_t string_format_flags,
197 libcerror_error_t **error );
198
199 #if defined( __cplusplus )
200 }
201 #endif
202
203 #endif /* !defined( _LIBFGUID_INTERNAL_IDENTIFIER_H ) */
204