1 | /* $Id: ExtPackUtil.h 34787 2010-12-07 14:51: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.alldomusa.eu.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_SUFFIX
|
---|
36 | * The suffix of a extension pack tarball. */
|
---|
37 | #define VBOX_EXTPACK_SUFFIX ".vbox-extpack"
|
---|
38 |
|
---|
39 | /** The minimum length (strlen) of a extension pack name. */
|
---|
40 | #define VBOX_EXTPACK_NAME_MIN_LEN 3
|
---|
41 | /** The max length (strlen) of a extension pack name. */
|
---|
42 | #define VBOX_EXTPACK_NAME_MAX_LEN 64
|
---|
43 |
|
---|
44 | /** The architecture-dependent application data subdirectory where the
|
---|
45 | * extension packs are installed. Relative to RTPathAppPrivateArch. */
|
---|
46 | #define VBOX_EXTPACK_INSTALL_DIR "ExtensionPacks"
|
---|
47 | /** The architecture-independent application data subdirectory where the
|
---|
48 | * certificates are installed. Relative to RTPathAppPrivateNoArch. */
|
---|
49 | #define VBOX_EXTPACK_CERT_DIR "ExtPackCertificates"
|
---|
50 |
|
---|
51 | /** The maximum entry name length.
|
---|
52 | * Play short and safe. */
|
---|
53 | #define VBOX_EXTPACK_MAX_MEMBER_NAME_LENGTH 128
|
---|
54 |
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Plug-in descriptor.
|
---|
58 | */
|
---|
59 | typedef struct VBOXEXTPACKPLUGINDESC
|
---|
60 | {
|
---|
61 | /** The name. */
|
---|
62 | iprt::MiniString strName;
|
---|
63 | /** The module name. */
|
---|
64 | iprt::MiniString strModule;
|
---|
65 | /** The description. */
|
---|
66 | iprt::MiniString strDescription;
|
---|
67 | /** The frontend or component which it plugs into. */
|
---|
68 | iprt::MiniString strFrontend;
|
---|
69 | } VBOXEXTPACKPLUGINDESC;
|
---|
70 | /** Pointer to a plug-in descriptor. */
|
---|
71 | typedef VBOXEXTPACKPLUGINDESC *PVBOXEXTPACKPLUGINDESC;
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * Extension pack descriptor
|
---|
75 | *
|
---|
76 | * This is the internal representation of the ExtPack.xml.
|
---|
77 | */
|
---|
78 | typedef struct VBOXEXTPACKDESC
|
---|
79 | {
|
---|
80 | /** The name. */
|
---|
81 | iprt::MiniString strName;
|
---|
82 | /** The description. */
|
---|
83 | iprt::MiniString strDescription;
|
---|
84 | /** The version string. */
|
---|
85 | iprt::MiniString strVersion;
|
---|
86 | /** The internal revision number. */
|
---|
87 | uint32_t uRevision;
|
---|
88 | /** The name of the main module. */
|
---|
89 | iprt::MiniString strMainModule;
|
---|
90 | /** The name of the VRDE module, empty if none. */
|
---|
91 | iprt::MiniString strVrdeModule;
|
---|
92 | /** The number of plug-in descriptors. */
|
---|
93 | uint32_t cPlugIns;
|
---|
94 | /** Pointer to an array of plug-in descriptors. */
|
---|
95 | PVBOXEXTPACKPLUGINDESC paPlugIns;
|
---|
96 | } VBOXEXTPACKDESC;
|
---|
97 |
|
---|
98 | /** Pointer to a extension pack descriptor. */
|
---|
99 | typedef VBOXEXTPACKDESC *PVBOXEXTPACKDESC;
|
---|
100 | /** Pointer to a const extension pack descriptor. */
|
---|
101 | typedef VBOXEXTPACKDESC const *PCVBOXEXTPACKDESC;
|
---|
102 |
|
---|
103 |
|
---|
104 | iprt::MiniString *VBoxExtPackLoadDesc(const char *a_pszDir, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo);
|
---|
105 | iprt::MiniString *VBoxExtPackLoadDescFromVfsFile(RTVFSFILE hVfsFile, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo);
|
---|
106 | iprt::MiniString *VBoxExtPackExtractNameFromTarballPath(const char *pszTarball);
|
---|
107 | void VBoxExtPackFreeDesc(PVBOXEXTPACKDESC a_pExtPackDesc);
|
---|
108 | bool VBoxExtPackIsValidName(const char *pszName);
|
---|
109 | bool VBoxExtPackIsValidMangledName(const char *pszMangledName, size_t cchMax = RTSTR_MAX);
|
---|
110 | iprt::MiniString *VBoxExtPackMangleName(const char *pszName);
|
---|
111 | iprt::MiniString *VBoxExtPackUnmangleName(const char *pszMangledName, size_t cbMax);
|
---|
112 | int VBoxExtPackCalcDir(char *pszExtPackDir, size_t cbExtPackDir, const char *pszParentDir, const char *pszName);
|
---|
113 | bool VBoxExtPackIsValidVersionString(const char *pszName);
|
---|
114 | bool VBoxExtPackIsValidModuleString(const char *pszModule);
|
---|
115 |
|
---|
116 | int VBoxExtPackValidateMember(const char *pszName, RTVFSOBJTYPE enmType, RTVFSOBJ hVfsObj, char *pszError, size_t cbError);
|
---|
117 | int VBoxExtPackOpenTarFss(RTFILE hTarballFile, char *pszError, size_t cbError, PRTVFSFSSTREAM phTarFss);
|
---|
118 | int VBoxExtPackValidateTarball(RTFILE hTarballFile, const char *pszExtPackName, const char *pszTarball,
|
---|
119 | char *pszError, size_t cbError, PRTMANIFEST phValidManifest, PRTVFSFILE phXmlFile);
|
---|
120 |
|
---|
121 |
|
---|
122 | #endif
|
---|
123 |
|
---|