VirtualBox

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

Last change on this file since 94714 was 94714, checked in by vboxsync, 3 years ago

Main,Settings: Integrate the extension pack cryptographic module in the ExtPack manager etc., bugref:9955

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