VirtualBox

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

Last change on this file since 67954 was 62485, checked in by vboxsync, 8 years ago

(C) 2016

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