manifest2.cpp revision f1f5335f9ec8e56fe0e3e27f253e24b10ff20f2e
1N/A * IPRT - Manifest, the core. 1N/A * Copyright (C) 2010 Oracle Corporation 1N/A * This file is part of VirtualBox Open Source Edition (OSE), as 1N/A * you can redistribute it and/or modify it under the terms of the GNU 1N/A * General Public License (GPL) as published by the Free Software 1N/A * Foundation, in version 2 as it comes in the "COPYING" file of the 1N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 1N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 1N/A * The contents of this file may alternatively be used under the terms 1N/A * of the Common Development and Distribution License Version 1.0 1N/A * (CDDL) only, as it comes in the "COPYING.CDDL" file of the 1N/A * VirtualBox OSE distribution, in which case the provisions of the 1N/A * CDDL are applicable instead of those of the GPL. 1N/A * You may elect to license modified versions of this file under the 1N/A * terms and conditions of either the GPL or the CDDL or both. 1N/A/******************************************************************************* 1N/A*******************************************************************************/ 1N/A/******************************************************************************* 1N/A* Structures and Typedefs * 1N/A*******************************************************************************/ 1N/A * Manifest attribute. 1N/A * Used both for entries and manifest attributes. 1N/A /** The string space core (szName). */ 1N/A /** The property value. */ 1N/A /** The attribute type if applicable, RTMANIFEST_ATTR_UNKNOWN if not. */ 1N/A /** The normalized property name that StrCore::pszString points at. */ 1N/A/** Pointer to a manifest attribute. */ 1N/A /** The string space core (szName). */ 1N/A /** The entry attributes (hashes, checksums, size, etc) - 1N/A * RTMANIFESTATTR. */ 1N/A /** The normalized entry name that StrCore::pszString points at. */ 1N/A/** Pointer to a manifest entry. */ /** Magic value (RTMANIFEST_MAGIC). */ /** The number of references to this manifest. */ /** Manifest attributes - RTMANIFESTATTR. */ /** String space of the entries covered by this manifest - /** The value of RTMANIFESTINT::u32Magic. */ * Creates an empty manifest. * @returns IPRT status code. * @param fFlags Flags, MBZ. * @param phManifest Where to return the handle to the manifest. * Retains a reference to the manifest handle. * @returns The new reference count, UINT32_MAX if the handle is invalid. * @param hManifest The handle to retain. * @callback_method_impl{FNRTSTRSPACECALLBACK, Destroys RTMANIFESTATTR.} * @callback_method_impl{FNRTSTRSPACECALLBACK, Destroys RTMANIFESTENTRY.} * Releases a reference to the manifest handle. * @returns The new reference count, 0 if free. UINT32_MAX is returned if the * @param hManifest The handle to release. * NIL is quietly ignored (returns 0). * Creates a duplicate of the specified manifest. * @returns IPRT status code * @param hManifestSrc The manifest to clone. * @param phManifestDst Where to store the handle to the duplicate. /** @todo implement cloning. */ * Compares two manifests for equality. * @returns true if equals, false if not. * @param hManifest1 The first manifest. * @param hManifest2 The second manifest. * @param papszIgnoreEntries Entries to ignore. Ends with a NULL entry. * @param papszIgnoreAttrs Attributes to ignore. Ends with a NULL entry. /** @todo implement comparing. */ * Compares two manifests for equality. * @returns true if equals, false if not. * @param hManifest1 The first manifest. * @param hManifest2 The second manifest. * Worker common to RTManifestSetAttr and RTManifestEntrySetAttr. * @returns IPRT status code. * @param pAttributes The attribute container. * @param pszAttr The name of the attribute to add. * @param pszValue The value string. * @param fType The attribute type type. * Does the attribute exist already? * Sets a manifest attribute. * @returns IPRT status code. * @param hManifest The manifest handle. * @param pszAttr The attribute name. If this already exists, * its value will be replaced. * @param pszValue The value string. * @param fType The attribute type, pass * RTMANIFEST_ATTR_UNKNOWN if not known. * Worker common to RTManifestUnsetAttr and RTManifestEntryUnsetAttr. * @returns IPRT status code. * @param pAttributes The attribute container. * @param pszAttr The name of the attribute to remove. * Unsets (removes) a manifest attribute if it exists. * @returns IPRT status code. * @retval VWRN_NOT_FOUND if not found. * @param hManifest The manifest handle. * @param pszAttr The attribute name. * Validates the name entry. * @returns IPRT status code. * @param pszEntry The entry name to validate. * @param pfNeedNormalization Where to return whether it needs normalization * @param pcchEntry Where to return the length. Optional. else if (
uc <
32 ||
uc ==
':' ||
uc ==
'(' ||
uc ==
')')
* Normalizes a entry name. * @param pszEntry The entry name to normalize. * @returns IPRT status code. * @param pThis The manifest to work with. * @param pszEntry The entry name. * @param fNeedNormalization Whether rtManifestValidateNameEntry said it * @param cchEntry The length of the name. * @param ppEntry Where to return the entry pointer on success. * Sets an attribute of a manifest entry. * @returns IPRT status code. * @param hManifest The manifest handle. * @param pszEntry The entry name. This will automatically be * added if there was no previous call to * RTManifestEntryAdd for this name. See * RTManifestEntryAdd for the entry name rules. * @param pszAttr The attribute name. If this already exists, * its value will be replaced. * @param pszValue The value string. * @param fType The attribute type, pass * RTMANIFEST_ATTR_UNKNOWN if not known. * Resolve the entry, adding one if necessary. * Unsets (removes) an attribute of a manifest entry if they both exist. * @returns IPRT status code. * @retval VWRN_NOT_FOUND if not found. * @param hManifest The manifest handle. * @param pszEntry The entry name. * @param pszAttr The attribute name. * Resolve the entry and hand it over to the worker. * Adds a new entry to a manifest. * - The entry name can contain any character defined by unicode, except * control characters, ':', '(' and ')'. The exceptions are mainly there * because of uncertainty around how various formats handles these. * - It is considered case sensitive. * - Forward (unix) and backward (dos) slashes are considered path * separators and converted to forward slashes. * @returns IPRT status code. * @retval VWRN_ALREADY_EXISTS if the entry already exists. * @param hManifest The manifest handle. * @param pszEntry The entry name (UTF-8). * @remarks Some manifest formats will not be able to store an entry without * any attributes. So, this is just here in case it comes in handy * when dealing with formats which can. * Only add one if it does not already exist. * @returns IPRT status code. * @param hManifest The manifest handle. * @param pszEntry The entry name. * Only add one if it does not already exist. * Reads in a "standard" manifest. * This reads the format used by OVF, the distinfo in FreeBSD ports, and * @returns IPRT status code. * @param hManifest The handle to the manifest where to add the * manifest that's read in. * @param hVfsIos The I/O stream to read the manifest from. * Writes a "standard" manifest. * This writes the format used by OVF, the distinfo in FreeBSD ports, and * @returns IPRT status code. * @param hManifest The handle to the manifest where to add the * manifest that's read in. * @param hVfsIos The I/O stream to read the manifest from.