1 | /* $Id: ExtPackUtil.h 37843 2011-07-08 12:34:18Z 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 | */
|
---|
65 | typedef 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. */
|
---|
77 | typedef VBOXEXTPACKPLUGINDESC *PVBOXEXTPACKPLUGINDESC;
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Extension pack descriptor
|
---|
81 | *
|
---|
82 | * This is the internal representation of the ExtPack.xml.
|
---|
83 | */
|
---|
84 | typedef struct VBOXEXTPACKDESC
|
---|
85 | {
|
---|
86 | /** The name. */
|
---|
87 | RTCString strName;
|
---|
88 | /** The description. */
|
---|
89 | RTCString strDescription;
|
---|
90 | /** The version string. */
|
---|
91 | RTCString strVersion;
|
---|
92 | /** The internal revision number. */
|
---|
93 | uint32_t uRevision;
|
---|
94 | /** The name of the main module. */
|
---|
95 | RTCString strMainModule;
|
---|
96 | /** The name of the VRDE module, empty if none. */
|
---|
97 | RTCString strVrdeModule;
|
---|
98 | /** The number of plug-in descriptors. */
|
---|
99 | uint32_t cPlugIns;
|
---|
100 | /** Pointer to an array of plug-in descriptors. */
|
---|
101 | PVBOXEXTPACKPLUGINDESC paPlugIns;
|
---|
102 | /** Whether to show the license prior to installation. */
|
---|
103 | bool fShowLicense;
|
---|
104 | } VBOXEXTPACKDESC;
|
---|
105 |
|
---|
106 | /** Pointer to a extension pack descriptor. */
|
---|
107 | typedef VBOXEXTPACKDESC *PVBOXEXTPACKDESC;
|
---|
108 | /** Pointer to a const extension pack descriptor. */
|
---|
109 | typedef VBOXEXTPACKDESC const *PCVBOXEXTPACKDESC;
|
---|
110 |
|
---|
111 |
|
---|
112 | void VBoxExtPackInitDesc(PVBOXEXTPACKDESC a_pExtPackDesc);
|
---|
113 | RTCString *VBoxExtPackLoadDesc(const char *a_pszDir, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo);
|
---|
114 | RTCString *VBoxExtPackLoadDescFromVfsFile(RTVFSFILE hVfsFile, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo);
|
---|
115 | RTCString *VBoxExtPackExtractNameFromTarballPath(const char *pszTarball);
|
---|
116 | void VBoxExtPackFreeDesc(PVBOXEXTPACKDESC a_pExtPackDesc);
|
---|
117 | bool VBoxExtPackIsValidName(const char *pszName);
|
---|
118 | bool VBoxExtPackIsValidMangledName(const char *pszMangledName, size_t cchMax = RTSTR_MAX);
|
---|
119 | RTCString *VBoxExtPackMangleName(const char *pszName);
|
---|
120 | RTCString *VBoxExtPackUnmangleName(const char *pszMangledName, size_t cbMax);
|
---|
121 | int VBoxExtPackCalcDir(char *pszExtPackDir, size_t cbExtPackDir, const char *pszParentDir, const char *pszName);
|
---|
122 | bool VBoxExtPackIsValidVersionString(const char *pszName);
|
---|
123 | bool VBoxExtPackIsValidModuleString(const char *pszModule);
|
---|
124 |
|
---|
125 | int VBoxExtPackValidateMember(const char *pszName, RTVFSOBJTYPE enmType, RTVFSOBJ hVfsObj, char *pszError, size_t cbError);
|
---|
126 | int VBoxExtPackOpenTarFss(RTFILE hTarballFile, char *pszError, size_t cbError, PRTVFSFSSTREAM phTarFss);
|
---|
127 | int VBoxExtPackValidateTarball(RTFILE hTarballFile, const char *pszExtPackName, const char *pszTarball,
|
---|
128 | char *pszError, size_t cbError, PRTMANIFEST phValidManifest, PRTVFSFILE phXmlFile);
|
---|
129 |
|
---|
130 |
|
---|
131 | #endif
|
---|
132 |
|
---|