VirtualBox

source: vbox/trunk/include/iprt/manifest.h@ 33516

Last change on this file since 33516 was 33289, checked in by vboxsync, 14 years ago

Runtime;Main-OVF-Import: added online creation of SHA1 sums; preread/calc is done in a second worker thread; reading is cached; directly read out of an ova file; started to make reading fully streaming aware

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.4 KB
Line 
1/** @file
2 * IPRT - Manifest file handling.
3 */
4
5/*
6 * Copyright (C) 2009 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
32RT_C_DECLS_BEGIN
33
34/** @defgroup grp_rt_manifest RTManifest - Manifest file creation and checking
35 * @ingroup grp_rt
36 * @{
37 */
38
39/**
40 * Input structure for RTManifestVerify() which contains the filename & the
41 * SHA1 digest.
42 */
43typedef struct RTMANIFESTTEST
44{
45 /** The filename. */
46 const char *pszTestFile;
47 /** The SHA1 digest of the file. */
48 const char *pszTestDigest;
49} RTMANIFESTTEST;
50/** Pointer to the input structure. */
51typedef RTMANIFESTTEST* PRTMANIFESTTEST;
52
53
54/**
55 * Verify the given SHA1 digests against the entries in the manifest file.
56 *
57 * Please note that not only the various digest have to match, but the
58 * filenames as well. If there are more or even less files listed in the
59 * manifest file than provided by paTests, VERR_MANIFEST_FILE_MISMATCH will be
60 * returned.
61 *
62 * @returns iprt status code.
63 *
64 * @param pszManifestFile Filename of the manifest file to verify.
65 * @param paTests Array of files & SHA1 sums.
66 * @param cTests Number of entries in paTests.
67 * @param piFailed A index to paTests in the
68 * VERR_MANIFEST_DIGEST_MISMATCH error case
69 * (optional).
70 */
71RTR3DECL(int) RTManifestVerify(const char *pszManifestFile, PRTMANIFESTTEST paTests, size_t cTests, size_t *piFailed);
72
73/**
74 * This is analogous to function RTManifestVerify(), but calculates the SHA1
75 * sums of the given files itself.
76 *
77 * @returns iprt status code.
78 *
79 * @param pszManifestFile Filename of the manifest file to verify.
80 * @param papszFiles Array of files to check SHA1 sums.
81 * @param cFiles Number of entries in papszFiles.
82 * @param piFailed A index to papszFiles in the
83 * VERR_MANIFEST_DIGEST_MISMATCH error case
84 * (optional).
85 * @param pfnProgressCallback optional callback for the progress indication
86 * @param pvUser user defined pointer for the callback
87 */
88RTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, size_t *piFailed,
89 PFNRTPROGRESS pfnProgressCallback, void *pvUser);
90
91/**
92 * Creates a manifest file for a set of files. The manifest file contains SHA1
93 * sums of every provided file and could be used to verify the data integrity
94 * of them.
95 *
96 * @returns iprt status code.
97 *
98 * @param pszManifestFile Filename of the manifest file to create.
99 * @param papszFiles Array of files to create SHA1 sums for.
100 * @param cFiles Number of entries in papszFiles.
101 * @param pfnProgressCallback optional callback for the progress indication
102 * @param pvUser user defined pointer for the callback
103 */
104RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles,
105 PFNRTPROGRESS pfnProgressCallback, void *pvUser);
106
107/**
108 * Verify the given SHA1 digests against the entries in the manifest file in
109 * memory.
110 *
111 * @returns iprt status code.
112 *
113 * @param pvBuf Pointer to memory buffer of the manifest file.
114 * @param cbSize Size of the memory buffer.
115 * @param paTests Array of file names and digests.
116 * @param cTest Number of entries in paTests.
117 * @param piFailed A index to paTests in the
118 * VERR_MANIFEST_DIGEST_MISMATCH error case
119 * (optional).
120 */
121RTR3DECL(int) RTManifestVerifyFilesBuf(void *pvBuf, size_t cbSize, PRTMANIFESTTEST paTests, size_t cTests, size_t *piFailed);
122
123/**
124 * Creates a manifest file in memory for a set of files. The manifest file
125 * contains SHA1 sums of every provided file and could be used to verify the
126 * data integrity of them.
127 *
128 * @returns iprt status code.
129 *
130 * @param ppvBuf Pointer to resulting memory buffer.
131 * @param pcbSize Pointer for the size of the memory buffer.
132 * @param paFiles Array of file names and digests.
133 * @param cFiles Number of entries in paFiles.
134 */
135RTR3DECL(int) RTManifestWriteFilesBuf(void **ppvBuf, size_t *pcbSize, PRTMANIFESTTEST paFiles, size_t cFiles);
136
137/** @} */
138
139RT_C_DECLS_END
140
141#endif
142
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