c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync/** @file
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * IPRT - Manifest file handling.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync */
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync/*
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Copyright (C) 2009-2012 Oracle Corporation
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync *
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * available from http://www.virtualbox.org. This file is free software;
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * you can redistribute it and/or modify it under the terms of the GNU
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * General Public License (GPL) as published by the Free Software
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync *
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * The contents of this file may alternatively be used under the terms
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * of the Common Development and Distribution License Version 1.0
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * VirtualBox OSE distribution, in which case the provisions of the
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * CDDL are applicable instead of those of the GPL.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync *
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * You may elect to license modified versions of this file under the
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * terms and conditions of either the GPL or the CDDL or both.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync */
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync#ifndef ___iprt_manifest_h
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync#define ___iprt_manifest_h
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync#include <iprt/cdefs.h>
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync#include <iprt/types.h>
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsyncRT_C_DECLS_BEGIN
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync/** @defgroup grp_rt_manifest RTManifest - Manifest file creation and checking
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * @ingroup grp_rt
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * @{
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync */
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/** @name Manifest attribute types.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * The types can be ORed together to form a set.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @{ */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/** For use with other attributes. Representation unknown. */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync#define RTMANIFEST_ATTR_UNKNOWN 0
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/** The size of the content. Represented as a decimal number. */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync#define RTMANIFEST_ATTR_SIZE RT_BIT_32(0)
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/** The MD5 of the content. Represented as a hex string. */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync#define RTMANIFEST_ATTR_MD5 RT_BIT_32(1)
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/** The SHA-1 of the content. Represented as a hex string. */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync#define RTMANIFEST_ATTR_SHA1 RT_BIT_32(2)
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/** The SHA-256 of the content. Represented as a hex string. */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync#define RTMANIFEST_ATTR_SHA256 RT_BIT_32(3)
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/** The SHA-512 of the content. Represented as a hex string. */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync#define RTMANIFEST_ATTR_SHA512 RT_BIT_32(4)
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/** The end of the valid values. */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync#define RTMANIFEST_ATTR_END RT_BIT_32(5)
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync/** Wildcard for use in queries. */
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync#define RTMANIFEST_ATTR_ANY UINT32_C(0xffffffff)
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/** @} */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Creates an empty manifest.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns IPRT status code.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param fFlags Flags, MBZ.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param phManifest Where to return the handle to the manifest.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestCreate(uint32_t fFlags, PRTMANIFEST phManifest);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Retains a reference to the manifest handle.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns The new reference count, UINT32_MAX if the handle is invalid.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest The handle to retain.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(uint32_t) RTManifestRetain(RTMANIFEST hManifest);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Releases a reference to the manifest handle.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns The new reference count, 0 if free. UINT32_MAX is returned if the
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * handle is invalid.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest The handle to release.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * NIL is quietly ignored (returns 0).
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(uint32_t) RTManifestRelease(RTMANIFEST hManifest);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Creates a duplicate of the specified manifest.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns IPRT status code
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifestSrc The manifest to clone.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param phManifestDst Where to store the handle to the duplicate.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestDup(RTMANIFEST hManifestSrc, PRTMANIFEST phManifestDst);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Compares two manifests for equality.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
db22a92f701bfcc17823963d6c8b745f68d44e30vboxsync * @returns IPRT status code.
db22a92f701bfcc17823963d6c8b745f68d44e30vboxsync * @retval VINF_SUCCESS if equal.
db22a92f701bfcc17823963d6c8b745f68d44e30vboxsync * @retval VERR_NOT_EQUAL if not equal.
db22a92f701bfcc17823963d6c8b745f68d44e30vboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest1 The first manifest.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest2 The second manifest.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param papszIgnoreEntries Entries to ignore. Ends with a NULL entry.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param papszIgnoreAttrs Attributes to ignore. Ends with a NULL entry.
956230513f1e35e9d694c219c7009034b71bb836vboxsync * @param fFlags A combination of RTMANIFEST_EQUALS_XXX values.
956230513f1e35e9d694c219c7009034b71bb836vboxsync * @param pszError Where to store the name of the mismatching
db22a92f701bfcc17823963d6c8b745f68d44e30vboxsync * entry, or as much of the name as there is room
db22a92f701bfcc17823963d6c8b745f68d44e30vboxsync * for. This is always set. Optional.
956230513f1e35e9d694c219c7009034b71bb836vboxsync * @param cbError The size of the buffer pointed to by @a
956230513f1e35e9d694c219c7009034b71bb836vboxsync * pszError.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestEqualsEx(RTMANIFEST hManifest1, RTMANIFEST hManifest2, const char * const *papszIgnoreEntries,
956230513f1e35e9d694c219c7009034b71bb836vboxsync const char * const *papszIgnoreAttr, uint32_t fFlags, char *pszError, size_t cbError);
956230513f1e35e9d694c219c7009034b71bb836vboxsync
956230513f1e35e9d694c219c7009034b71bb836vboxsync/** @defgroup RTMANIFEST_EQUALS_XXX RTManifestEqualsEx flags
956230513f1e35e9d694c219c7009034b71bb836vboxsync * @{ */
956230513f1e35e9d694c219c7009034b71bb836vboxsync/** Ignore missing attributes if there is one or more to compare. */
956230513f1e35e9d694c219c7009034b71bb836vboxsync#define RTMANIFEST_EQUALS_IGN_MISSING_ATTRS RT_BIT_32(0)
956230513f1e35e9d694c219c7009034b71bb836vboxsync/** Ignore attributes missing in the 1st manifest.
956230513f1e35e9d694c219c7009034b71bb836vboxsync * @todo implement this */
956230513f1e35e9d694c219c7009034b71bb836vboxsync#define RTMANIFEST_EQUALS_IGN_MISSING_ATTRS_1ST RT_BIT_32(1)
956230513f1e35e9d694c219c7009034b71bb836vboxsync/** Mask of valid flags. */
956230513f1e35e9d694c219c7009034b71bb836vboxsync#define RTMANIFEST_EQUALS_VALID_MASK UINT32_C(0x00000003)
956230513f1e35e9d694c219c7009034b71bb836vboxsync/** @} */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Compares two manifests for equality.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
db22a92f701bfcc17823963d6c8b745f68d44e30vboxsync * @returns IPRT status code.
db22a92f701bfcc17823963d6c8b745f68d44e30vboxsync * @retval VINF_SUCCESS if equal.
db22a92f701bfcc17823963d6c8b745f68d44e30vboxsync * @retval VERR_NOT_EQUAL if not equal.
db22a92f701bfcc17823963d6c8b745f68d44e30vboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest1 The first manifest.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest2 The second manifest.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestEquals(RTMANIFEST hManifest1, RTMANIFEST hManifest2);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Sets a manifest attribute.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns IPRT status code.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest The manifest handle.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param pszAttr The attribute name. If this already exists,
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * its value will be replaced.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param pszValue The value string.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param fType The attribute type, pass
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * RTMANIFEST_ATTR_UNKNOWN if not known.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestSetAttr(RTMANIFEST hManifest, const char *pszAttr, const char *pszValue, uint32_t fType);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Unsets (removes) a manifest attribute if it exists.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns IPRT status code.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @retval VWRN_NOT_FOUND if not found.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest The manifest handle.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param pszAttr The attribute name.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestUnsetAttr(RTMANIFEST hManifest, const char *pszAttr);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync/**
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * Query a manifest entry attribute.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync *
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @returns IPRT status code.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @retval VERR_BUFFER_OVERFLOW if the value buffer is too small. The @a
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * pszValue buffer will not be modified.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @retval VERR_MANIFEST_ATTR_NOT_FOUND
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @retval VERR_MANIFEST_ATTR_TYPE_NOT_FOUND
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @retval VERR_MANIFEST_ATTR_TYPE_MISMATCH
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync *
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param hManifest The manifest handle.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param pszEntry The entry name.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param pszAttr The attribute name. If NULL, it will be
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * selected by @a fType alone.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param fType The attribute types the entry should match. Pass
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * Pass RTMANIFEST_ATTR_ANY match any. If more
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * than one is given, the first matching one is
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * returned.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param pszValue Where to return value.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param cbValue The size of the buffer @a pszValue points to.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param pfType Where to return the attribute type value.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync */
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsyncRTDECL(int) RTManifestQueryAttr(RTMANIFEST hManifest, const char *pszAttr, uint32_t fType,
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync char *pszValue, size_t cbValue, uint32_t *pfType);
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Sets an attribute of a manifest entry.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns IPRT status code.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest The manifest handle.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param pszEntry The entry name. This will automatically be
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * added if there was no previous call to
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * RTManifestEntryAdd for this name. See
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * RTManifestEntryAdd for the entry name rules.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param pszAttr The attribute name. If this already exists,
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * its value will be replaced.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param pszValue The value string.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param fType The attribute type, pass
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * RTMANIFEST_ATTR_UNKNOWN if not known.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestEntrySetAttr(RTMANIFEST hManifest, const char *pszEntry, const char *pszAttr,
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync const char *pszValue, uint32_t fType);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Unsets (removes) an attribute of a manifest entry if they both exist.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns IPRT status code.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @retval VWRN_NOT_FOUND if not found.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest The manifest handle.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param pszEntry The entry name.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param pszAttr The attribute name.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestEntryUnsetAttr(RTMANIFEST hManifest, const char *pszEntry, const char *pszAttr);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync/**
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * Query a manifest entry attribute.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync *
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @returns IPRT status code.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @retval VERR_BUFFER_OVERFLOW if the value buffer is too small. The @a
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * pszValue buffer will not be modified.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @retval VERR_NOT_FOUND if the entry was not found.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @retval VERR_MANIFEST_ATTR_NOT_FOUND
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @retval VERR_MANIFEST_ATTR_TYPE_NOT_FOUND
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @retval VERR_MANIFEST_ATTR_TYPE_MISMATCH
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync *
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param hManifest The manifest handle.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param pszEntry The entry name.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param pszAttr The attribute name. If NULL, it will be
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * selected by @a fType alone.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param fType The attribute types the entry should match. Pass
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * Pass RTMANIFEST_ATTR_ANY match any. If more
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * than one is given, the first matching one is
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * returned.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param pszValue Where to return value.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param cbValue The size of the buffer @a pszValue points to.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync * @param pfType Where to return the attribute type value.
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync */
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsyncRTDECL(int) RTManifestEntryQueryAttr(RTMANIFEST hManifest, const char *pszEntry, const char *pszAttr, uint32_t fType,
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync char *pszValue, size_t cbValue, uint32_t *pfType);
49bcf64aaacb2de9703cdd3633eec0a2610c3cf3vboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Adds a new entry to a manifest.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * The entry name rules:
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * - The entry name can contain any character defined by unicode, except
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * control characters, ':', '(' and ')'. The exceptions are mainly there
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * because of uncertainty around how various formats handles these.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * - It is considered case sensitive.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * - Forward (unix) and backward (dos) slashes are considered path
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * separators and converted to forward slashes.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns IPRT status code.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @retval VWRN_ALREADY_EXISTS if the entry already exists.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest The manifest handle.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param pszEntry The entry name (UTF-8).
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @remarks Some manifest formats will not be able to store an entry without
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * any attributes. So, this is just here in case it comes in handy
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * when dealing with formats which can.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestEntryAdd(RTMANIFEST hManifest, const char *pszEntry);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Removes an entry.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns IPRT status code.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest The manifest handle.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param pszEntry The entry name.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestEntryRemove(RTMANIFEST hManifest, const char *pszEntry);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync/**
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * Add an entry for an I/O stream using a passthru stream.
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync *
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * The passthru I/O stream will hash all the data read from or written to the
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * stream and automatically add an entry to the manifest with the desired
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * attributes when it is released. Alternatively one can call
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * RTManifestPtIosAddEntryNow() to have more control over exactly when this
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * action is performed and which status it yields.
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync *
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * @returns IPRT status code.
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * @param hManifest The manifest to add the entry to.
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * @param hVfsIos The I/O stream to pass thru to/from.
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * @param pszEntry The entry name.
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * @param fAttrs The attributes to create for this stream.
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * @param fReadOrWrite Whether it's a read or write I/O stream.
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * @param phVfsIosPassthru Where to return the new handle.
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync */
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsyncRTDECL(int) RTManifestEntryAddPassthruIoStream(RTMANIFEST hManifest, RTVFSIOSTREAM hVfsIos, const char *pszEntry,
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync uint32_t fAttrs, bool fReadOrWrite, PRTVFSIOSTREAM phVfsIosPassthru);
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync/**
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * Adds the entry to the manifest right now.
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync *
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * @returns IPRT status code.
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * @param hVfsPtIos The manifest passthru I/O stream returned by
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync * RTManifestEntryAddPassthruIoStream().
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsync */
835ac9173220411ef9fe578c3d4c03e5edfa20bevboxsyncRTDECL(int) RTManifestPtIosAddEntryNow(RTVFSIOSTREAM hVfsPtIos);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Adds an entry for a file with the specified set of attributes.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns IPRT status code.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest The manifest handle.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hVfsIos The I/O stream handle of the entry. This will
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * be processed to its end on successful return.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * (Must be positioned at the start to get
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * the expected results.)
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param pszEntry The entry name.
4d45842309f5db66367ef1c4a701fc37619b0ec0vboxsync * @param fAttrs The attributes to create for this stream. See
4d45842309f5db66367ef1c4a701fc37619b0ec0vboxsync * RTMANIFEST_ATTR_XXX.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestEntryAddIoStream(RTMANIFEST hManifest, RTVFSIOSTREAM hVfsIos, const char *pszEntry, uint32_t fAttrs);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
35d0bfb0c568c691325cade7618555e3d3df918avboxsync/**
35d0bfb0c568c691325cade7618555e3d3df918avboxsync * Checks if there is a manifest entry by the given name.
35d0bfb0c568c691325cade7618555e3d3df918avboxsync *
35d0bfb0c568c691325cade7618555e3d3df918avboxsync * @returns true if there is, false if not or if the handle is invalid.
35d0bfb0c568c691325cade7618555e3d3df918avboxsync * @param hManifest The manifest handle.
35d0bfb0c568c691325cade7618555e3d3df918avboxsync * @param pszEntry The entry name.
35d0bfb0c568c691325cade7618555e3d3df918avboxsync */
35d0bfb0c568c691325cade7618555e3d3df918avboxsyncRTDECL(bool) RTManifestEntryExists(RTMANIFEST hManifest, const char *pszEntry);
35d0bfb0c568c691325cade7618555e3d3df918avboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * Reads in a "standard" manifest.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * This reads the format used by OVF, the distinfo in FreeBSD ports, and
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * others.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns IPRT status code.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest The handle to the manifest where to add the
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * manifest that's read in.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hVfsIos The I/O stream to read the manifest from.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestReadStandard(RTMANIFEST hManifest, RTVFSIOSTREAM hVfsIos);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync/**
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync * Reads in a "standard" manifest.
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync *
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync * This reads the format used by OVF, the distinfo in FreeBSD ports, and
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync * others.
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync *
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync * @returns IPRT status code.
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync * @param hManifest The handle to the manifest where to add the
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync * manifest that's read in.
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync * @param hVfsIos The I/O stream to read the manifest from.
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync * @param pszErr Where to return extended error info on failure.
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync * Optional.
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync * @param cbErr The size of the buffer @a pszErr points to.
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync */
a917e98de4393d1090e536fdbeb04c285f98c92evboxsyncRTDECL(int) RTManifestReadStandardEx(RTMANIFEST hManifest, RTVFSIOSTREAM hVfsIos, char *pszErr, size_t cbErr);
a917e98de4393d1090e536fdbeb04c285f98c92evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync/**
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * Reads in a "standard" manifest from the specified file.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * This reads the format used by OVF, the distinfo in FreeBSD ports, and
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * others.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync *
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @returns IPRT status code.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hManifest The handle to the manifest where to add the
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * manifest that's read in.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * @param pszFilename The name of the file to read in.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync */
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsyncRTDECL(int) RTManifestReadStandardFromFile(RTMANIFEST hManifest, const char *pszFilename);
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync/**
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * Writes a "standard" manifest.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync *
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * This writes the format used by OVF, the distinfo in FreeBSD ports, and
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * others.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync *
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * @returns IPRT status code.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * @param hManifest The handle to the manifest to write.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync * @param hVfsIos The I/O stream to read the manifest from.
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync */
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsyncRTDECL(int) RTManifestWriteStandard(RTMANIFEST hManifest, RTVFSIOSTREAM hVfsIos);
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync/**
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * Writes a "standard" manifest to the specified file.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync *
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * @returns IPRT status code.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * @param hManifest The handle to the manifest to write.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * @param pszFilename The name of the file.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync */
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsyncRTDECL(int) RTManifestWriteStandardToFile(RTMANIFEST hManifest, const char *pszFilename);
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2evboxsync
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync/**
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * Input structure for RTManifestVerify() which contains the filename & the
454ac5c6ef4960887035ceea6b5247789d3272davboxsync * SHA1/SHA256 digest.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync */
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsynctypedef struct RTMANIFESTTEST
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync{
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync /** The filename. */
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync const char *pszTestFile;
454ac5c6ef4960887035ceea6b5247789d3272davboxsync /** The SHA1/SHA256 digest of the file. */
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync const char *pszTestDigest;
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync} RTMANIFESTTEST;
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync/** Pointer to the input structure. */
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsynctypedef RTMANIFESTTEST* PRTMANIFESTTEST;
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync
510dd1bd989d25f95680fc2a3b51bf11854bc6a4vboxsync
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync/**
ac1200e63b58a0451085add197084e5a4a1bb4cavboxsync * Verify the given SHA1 digests against the entries in the manifest file.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync *
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * Please note that not only the various digest have to match, but the
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * filenames as well. If there are more or even less files listed in the
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * manifest file than provided by paTests, VERR_MANIFEST_FILE_MISMATCH will be
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * returned.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync *
d960e43fb3727c884b5f7eca3c920c9549839881vboxsync * @returns iprt status code.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync *
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * @param pszManifestFile Filename of the manifest file to verify.
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * @param paTests Array of files & SHA1 sums.
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * @param cTests Number of entries in paTests.
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * @param piFailed A index to paTests in the
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * VERR_MANIFEST_DIGEST_MISMATCH error case
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * (optional).
13194d15bc799cdfb231c1ba3fa26674334601b5vboxsync * @deprecated Use the RTMANIFEST based API instead.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync */
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsyncRTR3DECL(int) RTManifestVerify(const char *pszManifestFile, PRTMANIFESTTEST paTests, size_t cTests, size_t *piFailed);
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync/**
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * This is analogous to function RTManifestVerify(), but calculates the SHA1
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * sums of the given files itself.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync *
d960e43fb3727c884b5f7eca3c920c9549839881vboxsync * @returns iprt status code.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync *
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * @param pszManifestFile Filename of the manifest file to verify.
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * @param papszFiles Array of files to check SHA1 sums.
ac1200e63b58a0451085add197084e5a4a1bb4cavboxsync * @param cFiles Number of entries in papszFiles.
ac1200e63b58a0451085add197084e5a4a1bb4cavboxsync * @param piFailed A index to papszFiles in the
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * VERR_MANIFEST_DIGEST_MISMATCH error case
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * (optional).
510dd1bd989d25f95680fc2a3b51bf11854bc6a4vboxsync * @param pfnProgressCallback optional callback for the progress indication
510dd1bd989d25f95680fc2a3b51bf11854bc6a4vboxsync * @param pvUser user defined pointer for the callback
13194d15bc799cdfb231c1ba3fa26674334601b5vboxsync * @deprecated Use the RTMANIFEST based API instead.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync */
44918d7b9fb45f0d3e2ba56bf6d2cede9a2ae566vboxsyncRTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, size_t *piFailed,
44918d7b9fb45f0d3e2ba56bf6d2cede9a2ae566vboxsync PFNRTPROGRESS pfnProgressCallback, void *pvUser);
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync/**
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * Creates a manifest file for a set of files. The manifest file contains SHA1
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * sums of every provided file and could be used to verify the data integrity
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * of them.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync *
d960e43fb3727c884b5f7eca3c920c9549839881vboxsync * @returns iprt status code.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync *
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync * @param pszManifestFile Filename of the manifest file to create.
454ac5c6ef4960887035ceea6b5247789d3272davboxsync * @param enmDigestType The digest type (RTDIGESTTYPE_*)
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * @param papszFiles Array of files to create SHA1 sums for.
84c4a51d2a3c1a5c3f7d6902a8ac8c2eb267f4e0vboxsync * @param cFiles Number of entries in papszFiles.
510dd1bd989d25f95680fc2a3b51bf11854bc6a4vboxsync * @param pfnProgressCallback optional callback for the progress indication
510dd1bd989d25f95680fc2a3b51bf11854bc6a4vboxsync * @param pvUser user defined pointer for the callback
13194d15bc799cdfb231c1ba3fa26674334601b5vboxsync * @deprecated Use the RTMANIFEST based API instead.
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync */
454ac5c6ef4960887035ceea6b5247789d3272davboxsyncRTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, RTDIGESTTYPE enmDigestType,
454ac5c6ef4960887035ceea6b5247789d3272davboxsync const char * const *papszFiles, size_t cFiles,
44918d7b9fb45f0d3e2ba56bf6d2cede9a2ae566vboxsync PFNRTPROGRESS pfnProgressCallback, void *pvUser);
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync
62c8fef246519d59ee7ad41dd71de75b96b3552bvboxsync/**
13194d15bc799cdfb231c1ba3fa26674334601b5vboxsync * Queries the first digest type found in the given manifest.
62c8fef246519d59ee7ad41dd71de75b96b3552bvboxsync *
62c8fef246519d59ee7ad41dd71de75b96b3552bvboxsync * @returns iprt status code.
62c8fef246519d59ee7ad41dd71de75b96b3552bvboxsync *
62c8fef246519d59ee7ad41dd71de75b96b3552bvboxsync * @param pvBuf Pointer to memory buffer of the manifest file.
62c8fef246519d59ee7ad41dd71de75b96b3552bvboxsync * @param cbSize Size of the memory buffer.
76cee75a33698a93fdc4b666fdc74df0167100dbvboxsync * @param penmDigestType Where to return the first digest type found in
13194d15bc799cdfb231c1ba3fa26674334601b5vboxsync * the manifest.
13194d15bc799cdfb231c1ba3fa26674334601b5vboxsync * @deprecated Use the RTMANIFEST based API instead.
62c8fef246519d59ee7ad41dd71de75b96b3552bvboxsync */
13194d15bc799cdfb231c1ba3fa26674334601b5vboxsyncRTR3DECL(int) RTManifestVerifyDigestType(void const *pvBuf, size_t cbSize, RTDIGESTTYPE *penmDigestType);
62c8fef246519d59ee7ad41dd71de75b96b3552bvboxsync
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync/**
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * Verify the given SHA1 digests against the entries in the manifest file in
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * memory.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync *
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @returns iprt status code.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync *
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @param pvBuf Pointer to memory buffer of the manifest file.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @param cbSize Size of the memory buffer.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @param paTests Array of file names and digests.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @param cTest Number of entries in paTests.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @param piFailed A index to paTests in the
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * VERR_MANIFEST_DIGEST_MISMATCH error case
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * (optional).
13194d15bc799cdfb231c1ba3fa26674334601b5vboxsync * @deprecated Use the RTMANIFEST based API instead.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync */
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsyncRTR3DECL(int) RTManifestVerifyFilesBuf(void *pvBuf, size_t cbSize, PRTMANIFESTTEST paTests, size_t cTests, size_t *piFailed);
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync
42f4857b15e5d875e39345f1d1b804c2c1313e91vboxsync/**
42f4857b15e5d875e39345f1d1b804c2c1313e91vboxsync * Creates a manifest file in memory for a set of files. The manifest file
42f4857b15e5d875e39345f1d1b804c2c1313e91vboxsync * contains SHA1 sums of every provided file and could be used to verify the
42f4857b15e5d875e39345f1d1b804c2c1313e91vboxsync * data integrity of them.
42f4857b15e5d875e39345f1d1b804c2c1313e91vboxsync *
42f4857b15e5d875e39345f1d1b804c2c1313e91vboxsync * @returns iprt status code.
42f4857b15e5d875e39345f1d1b804c2c1313e91vboxsync *
42f4857b15e5d875e39345f1d1b804c2c1313e91vboxsync * @param ppvBuf Pointer to resulting memory buffer.
42f4857b15e5d875e39345f1d1b804c2c1313e91vboxsync * @param pcbSize Pointer for the size of the memory buffer.
454ac5c6ef4960887035ceea6b5247789d3272davboxsync * @param enmDigestType Which type of digest ("SHA1", "SHA256", ...)
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @param paFiles Array of file names and digests.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @param cFiles Number of entries in paFiles.
13194d15bc799cdfb231c1ba3fa26674334601b5vboxsync * @deprecated Use the RTMANIFEST based API instead.
42f4857b15e5d875e39345f1d1b804c2c1313e91vboxsync */
454ac5c6ef4960887035ceea6b5247789d3272davboxsyncRTR3DECL(int) RTManifestWriteFilesBuf(void **ppvBuf, size_t *pcbSize, RTDIGESTTYPE enmDigestType, PRTMANIFESTTEST paFiles, size_t cFiles);
42f4857b15e5d875e39345f1d1b804c2c1313e91vboxsync
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync/** @} */
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsyncRT_C_DECLS_END
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync
44918d7b9fb45f0d3e2ba56bf6d2cede9a2ae566vboxsync#endif
c40afa339b10a23d6fffcbeb7d4572bb494685f0vboxsync