VirtualBox

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

Last change on this file since 97786 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

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