1 | /** @file
|
---|
2 | * IPRT - Manifest file handling.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2009 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_manifest_h
|
---|
31 | #define ___iprt_manifest_h
|
---|
32 |
|
---|
33 | #include <iprt/cdefs.h>
|
---|
34 | #include <iprt/types.h>
|
---|
35 |
|
---|
36 | RT_C_DECLS_BEGIN
|
---|
37 |
|
---|
38 | /** @group grp_rt_manifest RTManifest - Manifest file creation and checking.
|
---|
39 | * @ingroup grp_rt
|
---|
40 | * @{
|
---|
41 | */
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Input structure for RTManifestVerify which contains the filename & the SHA1
|
---|
45 | * digest.
|
---|
46 | */
|
---|
47 | typedef struct RTMANIFESTTEST
|
---|
48 | {
|
---|
49 | char *pszTestFile; /** The filename */
|
---|
50 | char *pszTestDigest; /** The SHA1 digest of the file */
|
---|
51 | } RTMANIFESTTEST;
|
---|
52 | /** Pointer to the input structure. */
|
---|
53 | typedef RTMANIFESTTEST* PRTMANIFESTTEST;
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Verify the given SHA1 digests to the entries in the manifest file.
|
---|
57 | *
|
---|
58 | * Please note that not only the various digest have to much, but the filenames
|
---|
59 | * as well. If there are more or even less files listed in the manifest file
|
---|
60 | * than provided by pTestList, VERR_MANIFEST_FILE_MISMATCH will be returned.
|
---|
61 | *
|
---|
62 | * @returns VBox status code.
|
---|
63 | *
|
---|
64 | * @param pszManifestFile Filename of the manifest file to verify.
|
---|
65 | * @param pTestList List of files & SHA1 sums.
|
---|
66 | * @param cTests Number of entries in pTestList
|
---|
67 | * @param pcFileIndexOnFailure A index to pTestList in the
|
---|
68 | * VERR_MANIFEST_DIGEST_MISMATCH error case
|
---|
69 | * (optional).
|
---|
70 | */
|
---|
71 | RTR3DECL(int) RTManifestVerify(const char *pszManifestFile, PRTMANIFESTTEST pTestList, size_t cTests, size_t *pcFileIndexOnFailure);
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * This is analogous to function RTManifestVerify, but calculates the SHA1 sums
|
---|
75 | * of the given files itself.
|
---|
76 | *
|
---|
77 | * @returns VBox status code.
|
---|
78 | *
|
---|
79 | * @param pszManifestFile Filename of the manifest file to verify.
|
---|
80 | * @param ppszFiles List of files to check SHA1 sums.
|
---|
81 | * @param cFiles Number of entries in ppszFiles.
|
---|
82 | * @param pcFileIndexOnFailure A index to ppszFiles in the
|
---|
83 | * VERR_MANIFEST_DIGEST_MISMATCH error case
|
---|
84 | * (optional).
|
---|
85 | */
|
---|
86 | RTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char **ppszFiles, size_t cFiles, size_t *pcFileIndexOnFailure);
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * Creates a manifest file for a set of files. The manifest file contains SHA1
|
---|
90 | * sums of every provided file and could be used to verify the data integrity
|
---|
91 | * of them.
|
---|
92 | *
|
---|
93 | * @returns VBox status code.
|
---|
94 | *
|
---|
95 | * @param pszManifestFile Filename of the manifest file to create.
|
---|
96 | * @param ppszFiles List of files to create SHA1 sums for.
|
---|
97 | * @param cFiles Number of entries in ppszFiles.
|
---|
98 | */
|
---|
99 | RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, const char **ppszFiles, size_t cFiles);
|
---|
100 |
|
---|
101 | /** @} */
|
---|
102 |
|
---|
103 | RT_C_DECLS_END
|
---|
104 |
|
---|
105 | #endif /* ___iprt_manifest_h */
|
---|
106 |
|
---|