VirtualBox

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

Last change on this file since 34938 was 34938, checked in by vboxsync, 14 years ago

ExtPackManager: use VBOX_EXTPACK_LICENSE_NAME_PREFIX

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.4 KB
Line 
1/* $Id: ExtPackUtil.h 34938 2010-12-10 09:15:46Z 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 */
65typedef struct VBOXEXTPACKPLUGINDESC
66{
67 /** The name. */
68 iprt::MiniString strName;
69 /** The module name. */
70 iprt::MiniString strModule;
71 /** The description. */
72 iprt::MiniString strDescription;
73 /** The frontend or component which it plugs into. */
74 iprt::MiniString strFrontend;
75} VBOXEXTPACKPLUGINDESC;
76/** Pointer to a plug-in descriptor. */
77typedef VBOXEXTPACKPLUGINDESC *PVBOXEXTPACKPLUGINDESC;
78
79/**
80 * Extension pack descriptor
81 *
82 * This is the internal representation of the ExtPack.xml.
83 */
84typedef struct VBOXEXTPACKDESC
85{
86 /** The name. */
87 iprt::MiniString strName;
88 /** The description. */
89 iprt::MiniString strDescription;
90 /** The version string. */
91 iprt::MiniString strVersion;
92 /** The internal revision number. */
93 uint32_t uRevision;
94 /** The name of the main module. */
95 iprt::MiniString strMainModule;
96 /** The name of the VRDE module, empty if none. */
97 iprt::MiniString 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. */
107typedef VBOXEXTPACKDESC *PVBOXEXTPACKDESC;
108/** Pointer to a const extension pack descriptor. */
109typedef VBOXEXTPACKDESC const *PCVBOXEXTPACKDESC;
110
111
112iprt::MiniString *VBoxExtPackLoadDesc(const char *a_pszDir, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo);
113iprt::MiniString *VBoxExtPackLoadDescFromVfsFile(RTVFSFILE hVfsFile, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo);
114iprt::MiniString *VBoxExtPackExtractNameFromTarballPath(const char *pszTarball);
115void VBoxExtPackFreeDesc(PVBOXEXTPACKDESC a_pExtPackDesc);
116bool VBoxExtPackIsValidName(const char *pszName);
117bool VBoxExtPackIsValidMangledName(const char *pszMangledName, size_t cchMax = RTSTR_MAX);
118iprt::MiniString *VBoxExtPackMangleName(const char *pszName);
119iprt::MiniString *VBoxExtPackUnmangleName(const char *pszMangledName, size_t cbMax);
120int VBoxExtPackCalcDir(char *pszExtPackDir, size_t cbExtPackDir, const char *pszParentDir, const char *pszName);
121bool VBoxExtPackIsValidVersionString(const char *pszName);
122bool VBoxExtPackIsValidModuleString(const char *pszModule);
123
124int VBoxExtPackValidateMember(const char *pszName, RTVFSOBJTYPE enmType, RTVFSOBJ hVfsObj, char *pszError, size_t cbError);
125int VBoxExtPackOpenTarFss(RTFILE hTarballFile, char *pszError, size_t cbError, PRTVFSFSSTREAM phTarFss);
126int VBoxExtPackValidateTarball(RTFILE hTarballFile, const char *pszExtPackName, const char *pszTarball,
127 char *pszError, size_t cbError, PRTMANIFEST phValidManifest, PRTVFSFILE phXmlFile);
128
129
130#endif
131
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