VirtualBox

source: vbox/trunk/src/VBox/Main/include/ExtPackUtil.h@ 39895

Last change on this file since 39895 was 39878, checked in by vboxsync, 13 years ago

Main,QtGui: Implemented that hashing todo, extending it all the way to the gui for good measure.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
1/* $Id: ExtPackUtil.h 39878 2012-01-25 16:30:07Z vboxsync $ */
2/** @file
3 * VirtualBox Main - Extension Pack Utilities and definitions, VBoxC, VBoxSVC, ++.
4 */
5
6/*
7 * Copyright (C) 2010 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_EXTPACKUTIL
19#define ____H_EXTPACKUTIL
20
21#include <iprt/cpp/ministring.h>
22#include <iprt/fs.h>
23#include <iprt/vfs.h>
24
25
26/** @name VBOX_EXTPACK_DESCRIPTION_NAME
27 * The name of the description file in an extension pack. */
28#define VBOX_EXTPACK_DESCRIPTION_NAME "ExtPack.xml"
29/** @name VBOX_EXTPACK_DESCRIPTION_NAME
30 * The name of the manifest file in an extension pack. */
31#define VBOX_EXTPACK_MANIFEST_NAME "ExtPack.manifest"
32/** @name VBOX_EXTPACK_SIGNATURE_NAME
33 * The name of the signature file in an extension pack. */
34#define VBOX_EXTPACK_SIGNATURE_NAME "ExtPack.signature"
35/** @name VBOX_EXTPACK_LICENSE_NAME_PREFIX
36 * The name prefix of a license file in an extension pack. There can be
37 * several license files in a pack, the variations being on locale, language
38 * and format (HTML, RTF, plain text). All extension packages shall include
39 * a */
40#define VBOX_EXTPACK_LICENSE_NAME_PREFIX "ExtPack-license"
41/** @name VBOX_EXTPACK_SUFFIX
42 * The suffix of a extension pack tarball. */
43#define VBOX_EXTPACK_SUFFIX ".vbox-extpack"
44
45/** The minimum length (strlen) of a extension pack name. */
46#define VBOX_EXTPACK_NAME_MIN_LEN 3
47/** The max length (strlen) of a extension pack name. */
48#define VBOX_EXTPACK_NAME_MAX_LEN 64
49
50/** The architecture-dependent application data subdirectory where the
51 * extension packs are installed. Relative to RTPathAppPrivateArch. */
52#define VBOX_EXTPACK_INSTALL_DIR "ExtensionPacks"
53/** The architecture-independent application data subdirectory where the
54 * certificates are installed. Relative to RTPathAppPrivateNoArch. */
55#define VBOX_EXTPACK_CERT_DIR "ExtPackCertificates"
56
57/** The maximum entry name length.
58 * Play short and safe. */
59#define VBOX_EXTPACK_MAX_MEMBER_NAME_LENGTH 128
60
61
62/**
63 * Plug-in descriptor.
64 */
65typedef struct VBOXEXTPACKPLUGINDESC
66{
67 /** The name. */
68 RTCString strName;
69 /** The module name. */
70 RTCString strModule;
71 /** The description. */
72 RTCString strDescription;
73 /** The frontend or component which it plugs into. */
74 RTCString strFrontend;
75} VBOXEXTPACKPLUGINDESC;
76/** Pointer to a plug-in descriptor. */
77typedef VBOXEXTPACKPLUGINDESC *PVBOXEXTPACKPLUGINDESC;
78
79/**
80 * Extension pack descriptor
81 *
82 * This is the internal representation of the ExtPack.xml.
83 */
84typedef struct VBOXEXTPACKDESC
85{
86 /** The name. */
87 RTCString strName;
88 /** The description. */
89 RTCString strDescription;
90 /** The version string. */
91 RTCString strVersion;
92 /** The edition string. */
93 RTCString strEdition;
94 /** The internal revision number. */
95 uint32_t uRevision;
96 /** The name of the main module. */
97 RTCString strMainModule;
98 /** The name of the VRDE module, empty if none. */
99 RTCString strVrdeModule;
100 /** The number of plug-in descriptors. */
101 uint32_t cPlugIns;
102 /** Pointer to an array of plug-in descriptors. */
103 PVBOXEXTPACKPLUGINDESC paPlugIns;
104 /** Whether to show the license prior to installation. */
105 bool fShowLicense;
106} VBOXEXTPACKDESC;
107
108/** Pointer to a extension pack descriptor. */
109typedef VBOXEXTPACKDESC *PVBOXEXTPACKDESC;
110/** Pointer to a const extension pack descriptor. */
111typedef VBOXEXTPACKDESC const *PCVBOXEXTPACKDESC;
112
113
114void VBoxExtPackInitDesc(PVBOXEXTPACKDESC a_pExtPackDesc);
115RTCString *VBoxExtPackLoadDesc(const char *a_pszDir, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo);
116RTCString *VBoxExtPackLoadDescFromVfsFile(RTVFSFILE hVfsFile, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo);
117RTCString *VBoxExtPackExtractNameFromTarballPath(const char *pszTarball);
118void VBoxExtPackFreeDesc(PVBOXEXTPACKDESC a_pExtPackDesc);
119bool VBoxExtPackIsValidName(const char *pszName);
120bool VBoxExtPackIsValidMangledName(const char *pszMangledName, size_t cchMax = RTSTR_MAX);
121RTCString *VBoxExtPackMangleName(const char *pszName);
122RTCString *VBoxExtPackUnmangleName(const char *pszMangledName, size_t cbMax);
123int VBoxExtPackCalcDir(char *pszExtPackDir, size_t cbExtPackDir, const char *pszParentDir, const char *pszName);
124bool VBoxExtPackIsValidVersionString(const char *pszVersion);
125bool VBoxExtPackIsValidEditionString(const char *pszEdition);
126bool VBoxExtPackIsValidModuleString(const char *pszModule);
127
128int VBoxExtPackValidateMember(const char *pszName, RTVFSOBJTYPE enmType, RTVFSOBJ hVfsObj, char *pszError, size_t cbError);
129int VBoxExtPackOpenTarFss(RTFILE hTarballFile, char *pszError, size_t cbError, PRTVFSFSSTREAM phTarFss, PRTMANIFEST phFileManifest);
130int VBoxExtPackValidateTarball(RTFILE hTarballFile, const char *pszExtPackName,
131 const char *pszTarball, const char *pszTarballDigest,
132 char *pszError, size_t cbError,
133 PRTMANIFEST phValidManifest, PRTVFSFILE phXmlFile, RTCString *pStrDigest);
134
135
136#endif
137
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