summaryrefslogtreecommitdiffstats
path: root/src/VBox/Main/include/ExtPackUtil.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:17:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:17:27 +0000
commitf215e02bf85f68d3a6106c2a1f4f7f063f819064 (patch)
tree6bb5b92c046312c4e95ac2620b10ddf482d3fa8b /src/VBox/Main/include/ExtPackUtil.h
parentInitial commit. (diff)
downloadvirtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.tar.xz
virtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.zip
Adding upstream version 7.0.14-dfsg.upstream/7.0.14-dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/Main/include/ExtPackUtil.h')
-rw-r--r--src/VBox/Main/include/ExtPackUtil.h158
1 files changed, 158 insertions, 0 deletions
diff --git a/src/VBox/Main/include/ExtPackUtil.h b/src/VBox/Main/include/ExtPackUtil.h
new file mode 100644
index 00000000..82c0ef0c
--- /dev/null
+++ b/src/VBox/Main/include/ExtPackUtil.h
@@ -0,0 +1,158 @@
+/* $Id: ExtPackUtil.h $ */
+/** @file
+ * VirtualBox Main - Extension Pack Utilities and definitions, VBoxC, VBoxSVC, ++.
+ */
+
+/*
+ * Copyright (C) 2010-2023 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+#ifndef MAIN_INCLUDED_ExtPackUtil_h
+#define MAIN_INCLUDED_ExtPackUtil_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef __cplusplus
+# include <iprt/cpp/ministring.h>
+#endif
+#include <iprt/fs.h>
+#include <iprt/vfs.h>
+
+
+/** @name VBOX_EXTPACK_DESCRIPTION_NAME
+ * The name of the description file in an extension pack. */
+#define VBOX_EXTPACK_DESCRIPTION_NAME "ExtPack.xml"
+/** @name VBOX_EXTPACK_DESCRIPTION_NAME
+ * The name of the manifest file in an extension pack. */
+#define VBOX_EXTPACK_MANIFEST_NAME "ExtPack.manifest"
+/** @name VBOX_EXTPACK_SIGNATURE_NAME
+ * The name of the signature file in an extension pack. */
+#define VBOX_EXTPACK_SIGNATURE_NAME "ExtPack.signature"
+/** @name VBOX_EXTPACK_LICENSE_NAME_PREFIX
+ * The name prefix of a license file in an extension pack. There can be
+ * several license files in a pack, the variations being on locale, language
+ * and format (HTML, RTF, plain text). All extension packages shall include
+ * a */
+#define VBOX_EXTPACK_LICENSE_NAME_PREFIX "ExtPack-license"
+/** @name VBOX_EXTPACK_SUFFIX
+ * The suffix of a extension pack tarball. */
+#define VBOX_EXTPACK_SUFFIX ".vbox-extpack"
+
+/** The minimum length (strlen) of a extension pack name. */
+#define VBOX_EXTPACK_NAME_MIN_LEN 3
+/** The max length (strlen) of a extension pack name. */
+#define VBOX_EXTPACK_NAME_MAX_LEN 64
+
+/** The architecture-dependent application data subdirectory where the
+ * extension packs are installed. Relative to RTPathAppPrivateArch. */
+#define VBOX_EXTPACK_INSTALL_DIR "ExtensionPacks"
+/** The architecture-independent application data subdirectory where the
+ * certificates are installed. Relative to RTPathAppPrivateNoArch. */
+#define VBOX_EXTPACK_CERT_DIR "ExtPackCertificates"
+
+/** The maximum entry name length.
+ * Play short and safe. */
+#define VBOX_EXTPACK_MAX_MEMBER_NAME_LENGTH 128
+
+
+#ifdef __cplusplus
+
+/**
+ * Plug-in descriptor.
+ */
+typedef struct VBOXEXTPACKPLUGINDESC
+{
+ /** The name. */
+ RTCString strName;
+ /** The module name. */
+ RTCString strModule;
+ /** The description. */
+ RTCString strDescription;
+ /** The frontend or component which it plugs into. */
+ RTCString strFrontend;
+} VBOXEXTPACKPLUGINDESC;
+/** Pointer to a plug-in descriptor. */
+typedef VBOXEXTPACKPLUGINDESC *PVBOXEXTPACKPLUGINDESC;
+
+/**
+ * Extension pack descriptor
+ *
+ * This is the internal representation of the ExtPack.xml.
+ */
+typedef struct VBOXEXTPACKDESC
+{
+ /** The name. */
+ RTCString strName;
+ /** The description. */
+ RTCString strDescription;
+ /** The version string. */
+ RTCString strVersion;
+ /** The edition string. */
+ RTCString strEdition;
+ /** The internal revision number. */
+ uint32_t uRevision;
+ /** The name of the main module. */
+ RTCString strMainModule;
+ /** The name of the main VM module, empty if none. */
+ RTCString strMainVMModule;
+ /** The name of the VRDE module, empty if none. */
+ RTCString strVrdeModule;
+ /** The name of the cryptographic module, empty if none. */
+ RTCString strCryptoModule;
+ /** The number of plug-in descriptors. */
+ uint32_t cPlugIns;
+ /** Pointer to an array of plug-in descriptors. */
+ PVBOXEXTPACKPLUGINDESC paPlugIns;
+ /** Whether to show the license prior to installation. */
+ bool fShowLicense;
+} VBOXEXTPACKDESC;
+
+/** Pointer to a extension pack descriptor. */
+typedef VBOXEXTPACKDESC *PVBOXEXTPACKDESC;
+/** Pointer to a const extension pack descriptor. */
+typedef VBOXEXTPACKDESC const *PCVBOXEXTPACKDESC;
+
+
+void VBoxExtPackInitDesc(PVBOXEXTPACKDESC a_pExtPackDesc);
+RTCString *VBoxExtPackLoadDesc(const char *a_pszDir, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo);
+RTCString *VBoxExtPackLoadDescFromVfsFile(RTVFSFILE hVfsFile, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo);
+RTCString *VBoxExtPackExtractNameFromTarballPath(const char *pszTarball);
+void VBoxExtPackFreeDesc(PVBOXEXTPACKDESC a_pExtPackDesc);
+bool VBoxExtPackIsValidName(const char *pszName);
+bool VBoxExtPackIsValidMangledName(const char *pszMangledName, size_t cchMax = RTSTR_MAX);
+RTCString *VBoxExtPackMangleName(const char *pszName);
+RTCString *VBoxExtPackUnmangleName(const char *pszMangledName, size_t cbMax);
+int VBoxExtPackCalcDir(char *pszExtPackDir, size_t cbExtPackDir, const char *pszParentDir, const char *pszName);
+bool VBoxExtPackIsValidVersionString(const char *pszVersion);
+bool VBoxExtPackIsValidEditionString(const char *pszEdition);
+bool VBoxExtPackIsValidModuleString(const char *pszModule);
+
+int VBoxExtPackValidateMember(const char *pszName, RTVFSOBJTYPE enmType, RTVFSOBJ hVfsObj, char *pszError, size_t cbError);
+int VBoxExtPackOpenTarFss(RTFILE hTarballFile, char *pszError, size_t cbError, PRTVFSFSSTREAM phTarFss, PRTMANIFEST phFileManifest);
+int VBoxExtPackValidateTarball(RTFILE hTarballFile, const char *pszExtPackName,
+ const char *pszTarball, const char *pszTarballDigest,
+ char *pszError, size_t cbError,
+ PRTMANIFEST phValidManifest, PRTVFSFILE phXmlFile, RTCString *pStrDigest);
+#endif /* __cplusplus */
+
+#endif /* !MAIN_INCLUDED_ExtPackUtil_h */
+