VirtualBox

source: vbox/trunk/src/VBox/Main/include/ExtPackManagerImpl.h@ 34772

最後變更 在這個檔案從34772是 34714,由 vboxsync 提交於 14 年 前

ExtPackManager: Added API for opening a tarball prior to installation (does not work yet).

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 8.5 KB
 
1/* $Id: ExtPackManagerImpl.h 34714 2010-12-03 22:19:31Z vboxsync $ */
2/** @file
3 * VirtualBox Main - interface for Extension Packs, VBoxSVC & VBoxC.
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_EXTPACKMANAGERIMPL
19#define ____H_EXTPACKMANAGERIMPL
20
21#include "VirtualBoxBase.h"
22#include <VBox/ExtPack/ExtPack.h>
23#include <iprt/fs.h>
24
25/**
26 * An extension pack file.
27 */
28class ATL_NO_VTABLE ExtPackFile :
29 public VirtualBoxBase,
30 VBOX_SCRIPTABLE_IMPL(IExtPackFile)
31{
32public:
33 /** @name COM and internal init/term/mapping cruft.
34 * @{ */
35 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPackFile, IExtPackFile)
36 DECLARE_NOT_AGGREGATABLE(ExtPackFile)
37 DECLARE_PROTECT_FINAL_CONSTRUCT()
38 BEGIN_COM_MAP(ExtPackFile)
39 COM_INTERFACE_ENTRY(ISupportErrorInfo)
40 COM_INTERFACE_ENTRY(IExtPackFile)
41 COM_INTERFACE_ENTRY(IExtPackBase)
42 COM_INTERFACE_ENTRY(IDispatch)
43 END_COM_MAP()
44 DECLARE_EMPTY_CTOR_DTOR(ExtPackFile)
45
46 HRESULT FinalConstruct();
47 void FinalRelease();
48 HRESULT initWithFile(const char *a_pszFile);
49 void uninit();
50 /** @} */
51
52 /** @name IExtPackBase interfaces
53 * @{ */
54 STDMETHOD(COMGETTER(Name))(BSTR *a_pbstrName);
55 STDMETHOD(COMGETTER(Description))(BSTR *a_pbstrDescription);
56 STDMETHOD(COMGETTER(Version))(BSTR *a_pbstrVersion);
57 STDMETHOD(COMGETTER(Revision))(ULONG *a_puRevision);
58 STDMETHOD(COMGETTER(VRDEModule))(BSTR *a_pbstrVrdeModule);
59 STDMETHOD(COMGETTER(PlugIns))(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns));
60 STDMETHOD(COMGETTER(Usable))(BOOL *a_pfUsable);
61 STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy);
62 /** @} */
63
64 /** @name IExtPackFile interfaces
65 * @{ */
66 STDMETHOD(COMGETTER(FilePath))(BSTR *a_pbstrPath);
67 STDMETHOD(Install)(void);
68 /** @} */
69
70private:
71 struct Data;
72 /** Pointer to the private instance. */
73 Data *m;
74
75 friend class ExtPackManager;
76};
77
78
79/**
80 * An installed extension pack.
81 */
82class ATL_NO_VTABLE ExtPack :
83 public VirtualBoxBase,
84 VBOX_SCRIPTABLE_IMPL(IExtPack)
85{
86public:
87 /** @name COM and internal init/term/mapping cruft.
88 * @{ */
89 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPack, IExtPack)
90 DECLARE_NOT_AGGREGATABLE(ExtPack)
91 DECLARE_PROTECT_FINAL_CONSTRUCT()
92 BEGIN_COM_MAP(ExtPack)
93 COM_INTERFACE_ENTRY(ISupportErrorInfo)
94 COM_INTERFACE_ENTRY(IExtPack)
95 COM_INTERFACE_ENTRY(IExtPackBase)
96 COM_INTERFACE_ENTRY(IDispatch)
97 END_COM_MAP()
98 DECLARE_EMPTY_CTOR_DTOR(ExtPack)
99
100 HRESULT FinalConstruct();
101 void FinalRelease();
102 HRESULT initWithDir(VBOXEXTPACKCTX a_enmContext, const char *a_pszName, const char *a_pszDir);
103 void uninit();
104 /** @} */
105
106 /** @name IExtPackBase interfaces
107 * @{ */
108 STDMETHOD(COMGETTER(Name))(BSTR *a_pbstrName);
109 STDMETHOD(COMGETTER(Description))(BSTR *a_pbstrDescription);
110 STDMETHOD(COMGETTER(Version))(BSTR *a_pbstrVersion);
111 STDMETHOD(COMGETTER(Revision))(ULONG *a_puRevision);
112 STDMETHOD(COMGETTER(VRDEModule))(BSTR *a_pbstrVrdeModule);
113 STDMETHOD(COMGETTER(PlugIns))(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns));
114 STDMETHOD(COMGETTER(Usable))(BOOL *a_pfUsable);
115 STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy);
116 /** @} */
117
118 /** @name IExtPack interfaces
119 * @{ */
120 STDMETHOD(QueryObject)(IN_BSTR a_bstrObjectId, IUnknown **a_ppUnknown);
121 /** @} */
122
123 /** @name Internal interfaces used by ExtPackManager.
124 * @{ */
125 bool callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock);
126 HRESULT callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval);
127 bool callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock);
128 bool callConsoleReadyHook(IConsole *a_pConsole, AutoWriteLock *a_pLock);
129 bool callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine, AutoWriteLock *a_pLock);
130 bool callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc);
131 bool callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc);
132 bool callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock);
133 HRESULT checkVrde(void);
134 HRESULT getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary);
135 bool wantsToBeDefaultVrde(void) const;
136 HRESULT refresh(bool *pfCanDelete);
137 /** @} */
138
139protected:
140 /** @name Internal helper methods.
141 * @{ */
142 void probeAndLoad(void);
143 bool findModule(const char *a_pszName, const char *a_pszExt, VBOXEXTPACKMODKIND a_enmKind,
144 Utf8Str *a_ppStrFound, bool *a_pfNative, PRTFSOBJINFO a_pObjInfo) const;
145 static bool objinfoIsEqual(PCRTFSOBJINFO pObjInfo1, PCRTFSOBJINFO pObjInfo2);
146 /** @} */
147
148 /** @name Extension Pack Helpers
149 * @{ */
150 static DECLCALLBACK(int) hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
151 VBOXEXTPACKMODKIND enmKind, char *pszFound, size_t cbFound, bool *pfNative);
152 static DECLCALLBACK(int) hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath);
153 static DECLCALLBACK(VBOXEXTPACKCTX) hlpGetContext(PCVBOXEXTPACKHLP pHlp);
154 static DECLCALLBACK(int) hlpReservedN(PCVBOXEXTPACKHLP pHlp);
155 /** @} */
156
157private:
158 struct Data;
159 /** Pointer to the private instance. */
160 Data *m;
161
162 friend class ExtPackManager;
163};
164
165
166/**
167 * Extension pack manager.
168 */
169class ATL_NO_VTABLE ExtPackManager :
170 public VirtualBoxBase,
171 VBOX_SCRIPTABLE_IMPL(IExtPackManager)
172{
173 /** @name COM and internal init/term/mapping cruft.
174 * @{ */
175 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPackManager, IExtPackManager)
176 DECLARE_NOT_AGGREGATABLE(ExtPackManager)
177 DECLARE_PROTECT_FINAL_CONSTRUCT()
178 BEGIN_COM_MAP(ExtPackManager)
179 COM_INTERFACE_ENTRY(ISupportErrorInfo)
180 COM_INTERFACE_ENTRY(IExtPackManager)
181 COM_INTERFACE_ENTRY(IDispatch)
182 END_COM_MAP()
183 DECLARE_EMPTY_CTOR_DTOR(ExtPackManager)
184
185 HRESULT FinalConstruct();
186 void FinalRelease();
187 HRESULT init(VirtualBox *a_pVirtualBox, const char *a_pszDropZonePath, bool a_fCheckDropZone,
188 VBOXEXTPACKCTX a_enmContext);
189 void uninit();
190 /** @} */
191
192 /** @name IExtPack interfaces
193 * @{ */
194 STDMETHOD(COMGETTER(InstalledExtPacks))(ComSafeArrayOut(IExtPack *, a_paExtPacks));
195 STDMETHOD(Find)(IN_BSTR a_bstrName, IExtPack **a_pExtPack);
196 STDMETHOD(OpenExtPackFile)(IN_BSTR a_bstrTarball, IExtPackFile **a_ppExtPackFile);
197 STDMETHOD(Install)(IN_BSTR a_bstrTarball, BSTR *a_pbstrName);
198 STDMETHOD(Uninstall)(IN_BSTR a_bstrName, BOOL a_fForcedRemoval);
199 STDMETHOD(Cleanup)(void);
200 STDMETHOD(QueryAllPlugInsForFrontend)(IN_BSTR a_bstrFrontend, ComSafeArrayOut(BSTR, a_pabstrPlugInModules));
201 /** @} */
202
203 /** @name Internal interfaces used by other Main classes.
204 * @{ */
205 void processDropZone(void);
206 void callAllVirtualBoxReadyHooks(void);
207 void callAllConsoleReadyHooks(IConsole *a_pConsole);
208 void callAllVmCreatedHooks(IMachine *a_pMachine);
209 int callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM);
210 int callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM);
211 void callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM);
212 HRESULT checkVrdeExtPack(Utf8Str const *a_pstrExtPack);
213 int getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary);
214 HRESULT getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack);
215 /** @} */
216
217private:
218 HRESULT runSetUidToRootHelper(const char *a_pszCommand, ...);
219 ExtPack *findExtPack(const char *a_pszName);
220 void removeExtPack(const char *a_pszName);
221 HRESULT refreshExtPack(const char *a_pszName, bool a_fUnsuableIsError, ExtPack **a_ppExtPack);
222
223private:
224 struct Data;
225 /** Pointer to the private instance. */
226 Data *m;
227};
228
229#endif
230/* vi: set tabstop=4 shiftwidth=4 expandtab: */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette