1 | /** @file
|
---|
2 | * IPRT - Manifest file handling.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2009-2012 Oracle Corporation
|
---|
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 |
|
---|
26 | #ifndef ___iprt_manifest_h
|
---|
27 | #define ___iprt_manifest_h
|
---|
28 |
|
---|
29 | #include <iprt/cdefs.h>
|
---|
30 | #include <iprt/types.h>
|
---|
31 |
|
---|
32 | RT_C_DECLS_BEGIN
|
---|
33 |
|
---|
34 | /** @defgroup grp_rt_manifest RTManifest - Manifest file creation and checking
|
---|
35 | * @ingroup grp_rt
|
---|
36 | * @{
|
---|
37 | */
|
---|
38 |
|
---|
39 | /** @name Manifest attribute types.
|
---|
40 | * The types can be ORed together to form a set.
|
---|
41 | * @{ */
|
---|
42 | /** For use with other attributes. Representation unknown. */
|
---|
43 | #define RTMANIFEST_ATTR_UNKNOWN 0
|
---|
44 | /** The size of the content. Represented as a decimal number. */
|
---|
45 | #define RTMANIFEST_ATTR_SIZE RT_BIT_32(0)
|
---|
46 | /** The MD5 of the content. Represented as a hex string. */
|
---|
47 | #define RTMANIFEST_ATTR_MD5 RT_BIT_32(1)
|
---|
48 | /** The SHA-1 of the content. Represented as a hex string. */
|
---|
49 | #define RTMANIFEST_ATTR_SHA1 RT_BIT_32(2)
|
---|
50 | /** The SHA-256 of the content. Represented as a hex string. */
|
---|
51 | #define RTMANIFEST_ATTR_SHA256 RT_BIT_32(3)
|
---|
52 | /** The SHA-512 of the content. Represented as a hex string. */
|
---|
53 | #define RTMANIFEST_ATTR_SHA512 RT_BIT_32(4)
|
---|
54 | /** The end of the valid values. */
|
---|
55 | #define RTMANIFEST_ATTR_END RT_BIT_32(5)
|
---|
56 | /** Wildcard for use in queries. */
|
---|
57 | #define RTMANIFEST_ATTR_ANY UINT32_C(0xffffffff)
|
---|
58 | /** @} */
|
---|
59 |
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Creates an empty manifest.
|
---|
63 | *
|
---|
64 | * @returns IPRT status code.
|
---|
65 | * @param fFlags Flags, MBZ.
|
---|
66 | * @param phManifest Where to return the handle to the manifest.
|
---|
67 | */
|
---|
68 | RTDECL(int) RTManifestCreate(uint32_t fFlags, PRTMANIFEST phManifest);
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Retains a reference to the manifest handle.
|
---|
72 | *
|
---|
73 | * @returns The new reference count, UINT32_MAX if the handle is invalid.
|
---|
74 | * @param hManifest The handle to retain.
|
---|
75 | */
|
---|
76 | RTDECL(uint32_t) RTManifestRetain(RTMANIFEST hManifest);
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Releases a reference to the manifest handle.
|
---|
80 | *
|
---|
81 | * @returns The new reference count, 0 if free. UINT32_MAX is returned if the
|
---|
82 | * handle is invalid.
|
---|
83 | * @param hManifest The handle to release.
|
---|
84 | * NIL is quietly ignored (returns 0).
|
---|
85 | */
|
---|
86 | RTDECL(uint32_t) RTManifestRelease(RTMANIFEST hManifest);
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * Creates a duplicate of the specified manifest.
|
---|
90 | *
|
---|
91 | * @returns IPRT status code
|
---|
92 | * @param hManifestSrc The manifest to clone.
|
---|
93 | * @param phManifestDst Where to store the handle to the duplicate.
|
---|
94 | */
|
---|
95 | RTDECL(int) RTManifestDup(RTMANIFEST hManifestSrc, PRTMANIFEST phManifestDst);
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * Compares two manifests for equality.
|
---|
99 | *
|
---|
100 | * @returns IPRT status code.
|
---|
101 | * @retval VINF_SUCCESS if equal.
|
---|
102 | * @retval VERR_NOT_EQUAL if not equal.
|
---|
103 | *
|
---|
104 | * @param hManifest1 The first manifest.
|
---|
105 | * @param hManifest2 The second manifest.
|
---|
106 | * @param papszIgnoreEntries Entries to ignore. Ends with a NULL entry.
|
---|
107 | * @param papszIgnoreAttrs Attributes to ignore. Ends with a NULL entry.
|
---|
108 | * @param fFlags A combination of RTMANIFEST_EQUALS_XXX values.
|
---|
109 | * @param pszError Where to store the name of the mismatching
|
---|
110 | * entry, or as much of the name as there is room
|
---|
111 | * for. This is always set. Optional.
|
---|
112 | * @param cbError The size of the buffer pointed to by @a
|
---|
113 | * pszError.
|
---|
114 | */
|
---|
115 | RTDECL(int) RTManifestEqualsEx(RTMANIFEST hManifest1, RTMANIFEST hManifest2, const char * const *papszIgnoreEntries,
|
---|
116 | const char * const *papszIgnoreAttr, uint32_t fFlags, char *pszError, size_t cbError);
|
---|
117 |
|
---|
118 | /** @defgroup RTMANIFEST_EQUALS_XXX RTManifestEqualsEx flags
|
---|
119 | * @{ */
|
---|
120 | /** Ignore missing attributes if there is one or more to compare. */
|
---|
121 | #define RTMANIFEST_EQUALS_IGN_MISSING_ATTRS RT_BIT_32(0)
|
---|
122 | /** Ignore attributes missing in the 1st manifest.
|
---|
123 | * @todo implement this */
|
---|
124 | #define RTMANIFEST_EQUALS_IGN_MISSING_ATTRS_1ST RT_BIT_32(1)
|
---|
125 | /** Mask of valid flags. */
|
---|
126 | #define RTMANIFEST_EQUALS_VALID_MASK UINT32_C(0x00000003)
|
---|
127 | /** @} */
|
---|
128 |
|
---|
129 | /**
|
---|
130 | * Compares two manifests for equality.
|
---|
131 | *
|
---|
132 | * @returns IPRT status code.
|
---|
133 | * @retval VINF_SUCCESS if equal.
|
---|
134 | * @retval VERR_NOT_EQUAL if not equal.
|
---|
135 | *
|
---|
136 | * @param hManifest1 The first manifest.
|
---|
137 | * @param hManifest2 The second manifest.
|
---|
138 | */
|
---|
139 | RTDECL(int) RTManifestEquals(RTMANIFEST hManifest1, RTMANIFEST hManifest2);
|
---|
140 |
|
---|
141 | /**
|
---|
142 | * Sets a manifest attribute.
|
---|
143 | *
|
---|
144 | * @returns IPRT status code.
|
---|
145 | * @param hManifest The manifest handle.
|
---|
146 | * @param pszAttr The attribute name. If this already exists,
|
---|
147 | * its value will be replaced.
|
---|
148 | * @param pszValue The value string.
|
---|
149 | * @param fType The attribute type, pass
|
---|
150 | * RTMANIFEST_ATTR_UNKNOWN if not known.
|
---|
151 | */
|
---|
152 | RTDECL(int) RTManifestSetAttr(RTMANIFEST hManifest, const char *pszAttr, const char *pszValue, uint32_t fType);
|
---|
153 |
|
---|
154 | /**
|
---|
155 | * Unsets (removes) a manifest attribute if it exists.
|
---|
156 | *
|
---|
157 | * @returns IPRT status code.
|
---|
158 | * @retval VWRN_NOT_FOUND if not found.
|
---|
159 | *
|
---|
160 | * @param hManifest The manifest handle.
|
---|
161 | * @param pszAttr The attribute name.
|
---|
162 | */
|
---|
163 | RTDECL(int) RTManifestUnsetAttr(RTMANIFEST hManifest, const char *pszAttr);
|
---|
164 |
|
---|
165 | /**
|
---|
166 | * Query a manifest entry attribute.
|
---|
167 | *
|
---|
168 | * @returns IPRT status code.
|
---|
169 | * @retval VERR_BUFFER_OVERFLOW if the value buffer is too small. The @a
|
---|
170 | * pszValue buffer will not be modified.
|
---|
171 | * @retval VERR_MANIFEST_ATTR_NOT_FOUND
|
---|
172 | * @retval VERR_MANIFEST_ATTR_TYPE_NOT_FOUND
|
---|
173 | * @retval VERR_MANIFEST_ATTR_TYPE_MISMATCH
|
---|
174 | *
|
---|
175 | * @param hManifest The manifest handle.
|
---|
176 | * @param pszEntry The entry name.
|
---|
177 | * @param pszAttr The attribute name. If NULL, it will be
|
---|
178 | * selected by @a fType alone.
|
---|
179 | * @param fType The attribute types the entry should match. Pass
|
---|
180 | * Pass RTMANIFEST_ATTR_ANY match any. If more
|
---|
181 | * than one is given, the first matching one is
|
---|
182 | * returned.
|
---|
183 | * @param pszValue Where to return value.
|
---|
184 | * @param cbValue The size of the buffer @a pszValue points to.
|
---|
185 | * @param pfType Where to return the attribute type value.
|
---|
186 | */
|
---|
187 | RTDECL(int) RTManifestQueryAttr(RTMANIFEST hManifest, const char *pszAttr, uint32_t fType,
|
---|
188 | char *pszValue, size_t cbValue, uint32_t *pfType);
|
---|
189 |
|
---|
190 | /**
|
---|
191 | * Sets an attribute of a manifest entry.
|
---|
192 | *
|
---|
193 | * @returns IPRT status code.
|
---|
194 | * @param hManifest The manifest handle.
|
---|
195 | * @param pszEntry The entry name. This will automatically be
|
---|
196 | * added if there was no previous call to
|
---|
197 | * RTManifestEntryAdd for this name. See
|
---|
198 | * RTManifestEntryAdd for the entry name rules.
|
---|
199 | * @param pszAttr The attribute name. If this already exists,
|
---|
200 | * its value will be replaced.
|
---|
201 | * @param pszValue The value string.
|
---|
202 | * @param fType The attribute type, pass
|
---|
203 | * RTMANIFEST_ATTR_UNKNOWN if not known.
|
---|
204 | */
|
---|
205 | RTDECL(int) RTManifestEntrySetAttr(RTMANIFEST hManifest, const char *pszEntry, const char *pszAttr,
|
---|
206 | const char *pszValue, uint32_t fType);
|
---|
207 |
|
---|
208 | /**
|
---|
209 | * Unsets (removes) an attribute of a manifest entry if they both exist.
|
---|
210 | *
|
---|
211 | * @returns IPRT status code.
|
---|
212 | * @retval VWRN_NOT_FOUND if not found.
|
---|
213 | *
|
---|
214 | * @param hManifest The manifest handle.
|
---|
215 | * @param pszEntry The entry name.
|
---|
216 | * @param pszAttr The attribute name.
|
---|
217 | */
|
---|
218 | RTDECL(int) RTManifestEntryUnsetAttr(RTMANIFEST hManifest, const char *pszEntry, const char *pszAttr);
|
---|
219 |
|
---|
220 | /**
|
---|
221 | * Query a manifest entry attribute.
|
---|
222 | *
|
---|
223 | * @returns IPRT status code.
|
---|
224 | * @retval VERR_BUFFER_OVERFLOW if the value buffer is too small. The @a
|
---|
225 | * pszValue buffer will not be modified.
|
---|
226 | * @retval VERR_NOT_FOUND if the entry was not found.
|
---|
227 | * @retval VERR_MANIFEST_ATTR_NOT_FOUND
|
---|
228 | * @retval VERR_MANIFEST_ATTR_TYPE_NOT_FOUND
|
---|
229 | * @retval VERR_MANIFEST_ATTR_TYPE_MISMATCH
|
---|
230 | *
|
---|
231 | * @param hManifest The manifest handle.
|
---|
232 | * @param pszEntry The entry name.
|
---|
233 | * @param pszAttr The attribute name. If NULL, it will be
|
---|
234 | * selected by @a fType alone.
|
---|
235 | * @param fType The attribute types the entry should match. Pass
|
---|
236 | * Pass RTMANIFEST_ATTR_ANY match any. If more
|
---|
237 | * than one is given, the first matching one is
|
---|
238 | * returned.
|
---|
239 | * @param pszValue Where to return value.
|
---|
240 | * @param cbValue The size of the buffer @a pszValue points to.
|
---|
241 | * @param pfType Where to return the attribute type value.
|
---|
242 | */
|
---|
243 | RTDECL(int) RTManifestEntryQueryAttr(RTMANIFEST hManifest, const char *pszEntry, const char *pszAttr, uint32_t fType,
|
---|
244 | char *pszValue, size_t cbValue, uint32_t *pfType);
|
---|
245 |
|
---|
246 | /**
|
---|
247 | * Adds a new entry to a manifest.
|
---|
248 | *
|
---|
249 | * The entry name rules:
|
---|
250 | * - The entry name can contain any character defined by unicode, except
|
---|
251 | * control characters, ':', '(' and ')'. The exceptions are mainly there
|
---|
252 | * because of uncertainty around how various formats handles these.
|
---|
253 | * - It is considered case sensitive.
|
---|
254 | * - Forward (unix) and backward (dos) slashes are considered path
|
---|
255 | * separators and converted to forward slashes.
|
---|
256 | *
|
---|
257 | * @returns IPRT status code.
|
---|
258 | * @retval VWRN_ALREADY_EXISTS if the entry already exists.
|
---|
259 | *
|
---|
260 | * @param hManifest The manifest handle.
|
---|
261 | * @param pszEntry The entry name (UTF-8).
|
---|
262 | *
|
---|
263 | * @remarks Some manifest formats will not be able to store an entry without
|
---|
264 | * any attributes. So, this is just here in case it comes in handy
|
---|
265 | * when dealing with formats which can.
|
---|
266 | */
|
---|
267 | RTDECL(int) RTManifestEntryAdd(RTMANIFEST hManifest, const char *pszEntry);
|
---|
268 |
|
---|
269 | /**
|
---|
270 | * Removes an entry.
|
---|
271 | *
|
---|
272 | * @returns IPRT status code.
|
---|
273 | * @param hManifest The manifest handle.
|
---|
274 | * @param pszEntry The entry name.
|
---|
275 | */
|
---|
276 | RTDECL(int) RTManifestEntryRemove(RTMANIFEST hManifest, const char *pszEntry);
|
---|
277 |
|
---|
278 | /**
|
---|
279 | * Add an entry for an I/O stream using a passthru stream.
|
---|
280 | *
|
---|
281 | * The passthru I/O stream will hash all the data read from or written to the
|
---|
282 | * stream and automatically add an entry to the manifest with the desired
|
---|
283 | * attributes when it is released. Alternatively one can call
|
---|
284 | * RTManifestPtIosAddEntryNow() to have more control over exactly when this
|
---|
285 | * action is performed and which status it yields.
|
---|
286 | *
|
---|
287 | * @returns IPRT status code.
|
---|
288 | * @param hManifest The manifest to add the entry to.
|
---|
289 | * @param hVfsIos The I/O stream to pass thru to/from.
|
---|
290 | * @param pszEntry The entry name.
|
---|
291 | * @param fAttrs The attributes to create for this stream.
|
---|
292 | * @param fReadOrWrite Whether it's a read or write I/O stream.
|
---|
293 | * @param phVfsIosPassthru Where to return the new handle.
|
---|
294 | */
|
---|
295 | RTDECL(int) RTManifestEntryAddPassthruIoStream(RTMANIFEST hManifest, RTVFSIOSTREAM hVfsIos, const char *pszEntry,
|
---|
296 | uint32_t fAttrs, bool fReadOrWrite, PRTVFSIOSTREAM phVfsIosPassthru);
|
---|
297 |
|
---|
298 | /**
|
---|
299 | * Adds the entry to the manifest right now.
|
---|
300 | *
|
---|
301 | * @returns IPRT status code.
|
---|
302 | * @param hVfsPtIos The manifest passthru I/O stream returned by
|
---|
303 | * RTManifestEntryAddPassthruIoStream().
|
---|
304 | */
|
---|
305 | RTDECL(int) RTManifestPtIosAddEntryNow(RTVFSIOSTREAM hVfsPtIos);
|
---|
306 |
|
---|
307 | /**
|
---|
308 | * Adds an entry for a file with the specified set of attributes.
|
---|
309 | *
|
---|
310 | * @returns IPRT status code.
|
---|
311 | *
|
---|
312 | * @param hManifest The manifest handle.
|
---|
313 | * @param hVfsIos The I/O stream handle of the entry. This will
|
---|
314 | * be processed to its end on successful return.
|
---|
315 | * (Must be positioned at the start to get
|
---|
316 | * the expected results.)
|
---|
317 | * @param pszEntry The entry name.
|
---|
318 | * @param fAttrs The attributes to create for this stream. See
|
---|
319 | * RTMANIFEST_ATTR_XXX.
|
---|
320 | */
|
---|
321 | RTDECL(int) RTManifestEntryAddIoStream(RTMANIFEST hManifest, RTVFSIOSTREAM hVfsIos, const char *pszEntry, uint32_t fAttrs);
|
---|
322 |
|
---|
323 | /**
|
---|
324 | * Checks if there is a manifest entry by the given name.
|
---|
325 | *
|
---|
326 | * @returns true if there is, false if not or if the handle is invalid.
|
---|
327 | * @param hManifest The manifest handle.
|
---|
328 | * @param pszEntry The entry name.
|
---|
329 | */
|
---|
330 | RTDECL(bool) RTManifestEntryExists(RTMANIFEST hManifest, const char *pszEntry);
|
---|
331 |
|
---|
332 | /**
|
---|
333 | * Reads in a "standard" manifest.
|
---|
334 | *
|
---|
335 | * This reads the format used by OVF, the distinfo in FreeBSD ports, and
|
---|
336 | * others.
|
---|
337 | *
|
---|
338 | * @returns IPRT status code.
|
---|
339 | * @param hManifest The handle to the manifest where to add the
|
---|
340 | * manifest that's read in.
|
---|
341 | * @param hVfsIos The I/O stream to read the manifest from.
|
---|
342 | */
|
---|
343 | RTDECL(int) RTManifestReadStandard(RTMANIFEST hManifest, RTVFSIOSTREAM hVfsIos);
|
---|
344 |
|
---|
345 | /**
|
---|
346 | * Reads in a "standard" manifest.
|
---|
347 | *
|
---|
348 | * This reads the format used by OVF, the distinfo in FreeBSD ports, and
|
---|
349 | * others.
|
---|
350 | *
|
---|
351 | * @returns IPRT status code.
|
---|
352 | * @param hManifest The handle to the manifest where to add the
|
---|
353 | * manifest that's read in.
|
---|
354 | * @param hVfsIos The I/O stream to read the manifest from.
|
---|
355 | * @param pszErr Where to return extended error info on failure.
|
---|
356 | * Optional.
|
---|
357 | * @param cbErr The size of the buffer @a pszErr points to.
|
---|
358 | */
|
---|
359 | RTDECL(int) RTManifestReadStandardEx(RTMANIFEST hManifest, RTVFSIOSTREAM hVfsIos, char *pszErr, size_t cbErr);
|
---|
360 |
|
---|
361 | /**
|
---|
362 | * Reads in a "standard" manifest from the specified file.
|
---|
363 | *
|
---|
364 | * This reads the format used by OVF, the distinfo in FreeBSD ports, and
|
---|
365 | * others.
|
---|
366 | *
|
---|
367 | * @returns IPRT status code.
|
---|
368 | * @param hManifest The handle to the manifest where to add the
|
---|
369 | * manifest that's read in.
|
---|
370 | * @param pszFilename The name of the file to read in.
|
---|
371 | */
|
---|
372 | RTDECL(int) RTManifestReadStandardFromFile(RTMANIFEST hManifest, const char *pszFilename);
|
---|
373 |
|
---|
374 | /**
|
---|
375 | * Writes a "standard" manifest.
|
---|
376 | *
|
---|
377 | * This writes the format used by OVF, the distinfo in FreeBSD ports, and
|
---|
378 | * others.
|
---|
379 | *
|
---|
380 | * @returns IPRT status code.
|
---|
381 | * @param hManifest The handle to the manifest to write.
|
---|
382 | * @param hVfsIos The I/O stream to read the manifest from.
|
---|
383 | */
|
---|
384 | RTDECL(int) RTManifestWriteStandard(RTMANIFEST hManifest, RTVFSIOSTREAM hVfsIos);
|
---|
385 |
|
---|
386 | /**
|
---|
387 | * Writes a "standard" manifest to the specified file.
|
---|
388 | *
|
---|
389 | * @returns IPRT status code.
|
---|
390 | * @param hManifest The handle to the manifest to write.
|
---|
391 | * @param pszFilename The name of the file.
|
---|
392 | */
|
---|
393 | RTDECL(int) RTManifestWriteStandardToFile(RTMANIFEST hManifest, const char *pszFilename);
|
---|
394 |
|
---|
395 |
|
---|
396 |
|
---|
397 |
|
---|
398 |
|
---|
399 | /**
|
---|
400 | * Input structure for RTManifestVerify() which contains the filename & the
|
---|
401 | * SHA1/SHA256 digest.
|
---|
402 | */
|
---|
403 | typedef struct RTMANIFESTTEST
|
---|
404 | {
|
---|
405 | /** The filename. */
|
---|
406 | const char *pszTestFile;
|
---|
407 | /** The SHA1/SHA256 digest of the file. */
|
---|
408 | const char *pszTestDigest;
|
---|
409 | } RTMANIFESTTEST;
|
---|
410 | /** Pointer to the input structure. */
|
---|
411 | typedef RTMANIFESTTEST* PRTMANIFESTTEST;
|
---|
412 |
|
---|
413 |
|
---|
414 | /**
|
---|
415 | * Verify the given SHA1 digests against the entries in the manifest file.
|
---|
416 | *
|
---|
417 | * Please note that not only the various digest have to match, but the
|
---|
418 | * filenames as well. If there are more or even less files listed in the
|
---|
419 | * manifest file than provided by paTests, VERR_MANIFEST_FILE_MISMATCH will be
|
---|
420 | * returned.
|
---|
421 | *
|
---|
422 | * @returns iprt status code.
|
---|
423 | *
|
---|
424 | * @param pszManifestFile Filename of the manifest file to verify.
|
---|
425 | * @param paTests Array of files & SHA1 sums.
|
---|
426 | * @param cTests Number of entries in paTests.
|
---|
427 | * @param piFailed A index to paTests in the
|
---|
428 | * VERR_MANIFEST_DIGEST_MISMATCH error case
|
---|
429 | * (optional).
|
---|
430 | * @deprecated Use the RTMANIFEST based API instead.
|
---|
431 | */
|
---|
432 | RTR3DECL(int) RTManifestVerify(const char *pszManifestFile, PRTMANIFESTTEST paTests, size_t cTests, size_t *piFailed);
|
---|
433 |
|
---|
434 | /**
|
---|
435 | * This is analogous to function RTManifestVerify(), but calculates the SHA1
|
---|
436 | * sums of the given files itself.
|
---|
437 | *
|
---|
438 | * @returns iprt status code.
|
---|
439 | *
|
---|
440 | * @param pszManifestFile Filename of the manifest file to verify.
|
---|
441 | * @param papszFiles Array of files to check SHA1 sums.
|
---|
442 | * @param cFiles Number of entries in papszFiles.
|
---|
443 | * @param piFailed A index to papszFiles in the
|
---|
444 | * VERR_MANIFEST_DIGEST_MISMATCH error case
|
---|
445 | * (optional).
|
---|
446 | * @param pfnProgressCallback optional callback for the progress indication
|
---|
447 | * @param pvUser user defined pointer for the callback
|
---|
448 | * @deprecated Use the RTMANIFEST based API instead.
|
---|
449 | */
|
---|
450 | RTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, size_t *piFailed,
|
---|
451 | PFNRTPROGRESS pfnProgressCallback, void *pvUser);
|
---|
452 |
|
---|
453 | /**
|
---|
454 | * Creates a manifest file for a set of files. The manifest file contains SHA1
|
---|
455 | * sums of every provided file and could be used to verify the data integrity
|
---|
456 | * of them.
|
---|
457 | *
|
---|
458 | * @returns iprt status code.
|
---|
459 | *
|
---|
460 | * @param pszManifestFile Filename of the manifest file to create.
|
---|
461 | * @param enmDigestType The digest type (RTDIGESTTYPE_*)
|
---|
462 | * @param papszFiles Array of files to create SHA1 sums for.
|
---|
463 | * @param cFiles Number of entries in papszFiles.
|
---|
464 | * @param pfnProgressCallback optional callback for the progress indication
|
---|
465 | * @param pvUser user defined pointer for the callback
|
---|
466 | * @deprecated Use the RTMANIFEST based API instead.
|
---|
467 | */
|
---|
468 | RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, RTDIGESTTYPE enmDigestType,
|
---|
469 | const char * const *papszFiles, size_t cFiles,
|
---|
470 | PFNRTPROGRESS pfnProgressCallback, void *pvUser);
|
---|
471 |
|
---|
472 | /**
|
---|
473 | * Queries the first digest type found in the given manifest.
|
---|
474 | *
|
---|
475 | * @returns iprt status code.
|
---|
476 | *
|
---|
477 | * @param pvBuf Pointer to memory buffer of the manifest file.
|
---|
478 | * @param cbSize Size of the memory buffer.
|
---|
479 | * @param penmDigestType Where to return the first digest type found in
|
---|
480 | * the manifest.
|
---|
481 | * @deprecated Use the RTMANIFEST based API instead.
|
---|
482 | */
|
---|
483 | RTR3DECL(int) RTManifestVerifyDigestType(void const *pvBuf, size_t cbSize, RTDIGESTTYPE *penmDigestType);
|
---|
484 |
|
---|
485 | /**
|
---|
486 | * Verify the given SHA1 digests against the entries in the manifest file in
|
---|
487 | * memory.
|
---|
488 | *
|
---|
489 | * @returns iprt status code.
|
---|
490 | *
|
---|
491 | * @param pvBuf Pointer to memory buffer of the manifest file.
|
---|
492 | * @param cbSize Size of the memory buffer.
|
---|
493 | * @param paTests Array of file names and digests.
|
---|
494 | * @param cTest Number of entries in paTests.
|
---|
495 | * @param piFailed A index to paTests in the
|
---|
496 | * VERR_MANIFEST_DIGEST_MISMATCH error case
|
---|
497 | * (optional).
|
---|
498 | * @deprecated Use the RTMANIFEST based API instead.
|
---|
499 | */
|
---|
500 | RTR3DECL(int) RTManifestVerifyFilesBuf(void *pvBuf, size_t cbSize, PRTMANIFESTTEST paTests, size_t cTests, size_t *piFailed);
|
---|
501 |
|
---|
502 | /**
|
---|
503 | * Creates a manifest file in memory for a set of files. The manifest file
|
---|
504 | * contains SHA1 sums of every provided file and could be used to verify the
|
---|
505 | * data integrity of them.
|
---|
506 | *
|
---|
507 | * @returns iprt status code.
|
---|
508 | *
|
---|
509 | * @param ppvBuf Pointer to resulting memory buffer.
|
---|
510 | * @param pcbSize Pointer for the size of the memory buffer.
|
---|
511 | * @param enmDigestType Which type of digest ("SHA1", "SHA256", ...)
|
---|
512 | * @param paFiles Array of file names and digests.
|
---|
513 | * @param cFiles Number of entries in paFiles.
|
---|
514 | * @deprecated Use the RTMANIFEST based API instead.
|
---|
515 | */
|
---|
516 | RTR3DECL(int) RTManifestWriteFilesBuf(void **ppvBuf, size_t *pcbSize, RTDIGESTTYPE enmDigestType, PRTMANIFESTTEST paFiles, size_t cFiles);
|
---|
517 |
|
---|
518 | /** @} */
|
---|
519 |
|
---|
520 | RT_C_DECLS_END
|
---|
521 |
|
---|
522 | #endif
|
---|
523 |
|
---|