VirtualBox

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

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

Main,Config.kmk,VBoxManage,ExtPacks: Moved the VRDE bits from IVirtualBox to the extension packs; changed ISystemProperties and IVRDEServer to talk about VRDE extension packs instead of VRDE libraries.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.2 KB
Line 
1/* $Id: ExtPackManagerImpl.h 34244 2010-11-22 14:31:02Z 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.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_EXTPACKMANAGERIMPL
19#define ____H_EXTPACKMANAGERIMPL
20
21#include "VirtualBoxBase.h"
22#include <VBox/ExtPack/ExtPack.h>
23#include <iprt/fs.h>
24
25
26/**
27 * An extension pack.
28 *
29 * This
30 */
31class ATL_NO_VTABLE ExtPack :
32 public VirtualBoxBase,
33 VBOX_SCRIPTABLE_IMPL(IExtPack)
34{
35public:
36 /** @name COM and internal init/term/mapping cruft.
37 * @{ */
38 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPack, IExtPack)
39 DECLARE_NOT_AGGREGATABLE(ExtPack)
40 DECLARE_PROTECT_FINAL_CONSTRUCT()
41 BEGIN_COM_MAP(ExtPack)
42 COM_INTERFACE_ENTRY(ISupportErrorInfo)
43 COM_INTERFACE_ENTRY(IExtPack)
44 COM_INTERFACE_ENTRY(IDispatch)
45 END_COM_MAP()
46 DECLARE_EMPTY_CTOR_DTOR(ExtPack)
47
48 HRESULT FinalConstruct();
49 void FinalRelease();
50 HRESULT init(VirtualBox *a_pVirtualBox, const char *a_pszName, const char *a_pszParentDir);
51 void uninit();
52 /** @} */
53
54 /** @name IExtPack interfaces
55 * @{ */
56 STDMETHOD(COMGETTER(Name))(BSTR *a_pbstrName);
57 STDMETHOD(COMGETTER(Description))(BSTR *a_pbstrDescription);
58 STDMETHOD(COMGETTER(Version))(BSTR *a_pbstrVersion);
59 STDMETHOD(COMGETTER(Revision))(ULONG *a_puRevision);
60 STDMETHOD(COMGETTER(VRDEModule))(BSTR *a_pbstrVrdeModule);
61 STDMETHOD(COMGETTER(PlugIns))(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns));
62 STDMETHOD(COMGETTER(Usable))(BOOL *a_pfUsable);
63 STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy);
64 STDMETHOD(QueryObject)(IN_BSTR a_bstrObjectId, IUnknown **a_ppUnknown);
65 /** @} */
66
67 /** @name Internal interfaces used by ExtPackManager.
68 * @{ */
69 void callInstalledHook(IVirtualBox *a_pVirtualBox);
70 HRESULT callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval);
71 void callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox);
72 void callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine);
73 int callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM);
74 int callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM);
75 void callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM);
76 HRESULT checkVrde(void);
77 HRESULT getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary);
78 bool wantsToBeDefaultVrde(void) const;
79 HRESULT refresh(bool *pfCanDelete);
80 /** @} */
81
82protected:
83 /** @name Internal helper methods.
84 * @{ */
85 void probeAndLoad(void);
86 bool findModule(const char *a_pszName, const char *a_pszExt, VBOXEXTPACKMODKIND a_enmKind,
87 Utf8Str *a_ppStrFound, bool *a_pfNative, PRTFSOBJINFO a_pObjInfo) const;
88 static bool objinfoIsEqual(PCRTFSOBJINFO pObjInfo1, PCRTFSOBJINFO pObjInfo2);
89 /** @} */
90
91 /** @name Extension Pack Helpers
92 * @{ */
93 static DECLCALLBACK(int) hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
94 VBOXEXTPACKMODKIND enmKind, char *pszFound, size_t cbFound, bool *pfNative);
95 static DECLCALLBACK(int) hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath);
96 /** @} */
97
98private:
99 struct Data;
100 /** Pointer to the private instance. */
101 Data *m;
102
103 friend class ExtPackManager;
104};
105
106
107/**
108 * Extension pack manager.
109 */
110class ATL_NO_VTABLE ExtPackManager :
111 public VirtualBoxBase,
112 VBOX_SCRIPTABLE_IMPL(IExtPackManager)
113{
114 /** @name COM and internal init/term/mapping cruft.
115 * @{ */
116 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPackManager, IExtPackManager)
117 DECLARE_NOT_AGGREGATABLE(ExtPackManager)
118 DECLARE_PROTECT_FINAL_CONSTRUCT()
119 BEGIN_COM_MAP(ExtPackManager)
120 COM_INTERFACE_ENTRY(ISupportErrorInfo)
121 COM_INTERFACE_ENTRY(IExtPackManager)
122 COM_INTERFACE_ENTRY(IDispatch)
123 END_COM_MAP()
124 DECLARE_EMPTY_CTOR_DTOR(ExtPackManager)
125
126 HRESULT FinalConstruct();
127 void FinalRelease();
128 HRESULT init(VirtualBox *a_pVirtualBox, const char *a_pszDropZonePath, bool a_fCheckDropZone);
129 void uninit();
130 /** @} */
131
132 /** @name IExtPack interfaces
133 * @{ */
134 STDMETHOD(COMGETTER(InstalledExtPacks))(ComSafeArrayOut(IExtPack *, a_paExtPacks));
135 STDMETHOD(Find)(IN_BSTR a_bstrName, IExtPack **a_pExtPack);
136 STDMETHOD(Install)(IN_BSTR a_bstrTarball, BSTR *a_pbstrName);
137 STDMETHOD(Uninstall)(IN_BSTR a_bstrName, BOOL a_fForcedRemoval);
138 STDMETHOD(Cleanup)(void);
139 STDMETHOD(QueryAllPlugInsForFrontend)(IN_BSTR a_bstrFrontend, ComSafeArrayOut(BSTR, a_pabstrPlugInModules));
140 /** @} */
141
142 /** @name Internal interfaces used by other Main classes.
143 * @{ */
144 void processDropZone(void);
145 void callAllVirtualBoxReadyHooks(void);
146 void callAllVmCreatedHooks(IMachine *a_pMachine);
147 int callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM);
148 int callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM);
149 void callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM);
150 HRESULT checkVrdeExtPack(Utf8Str const *a_pstrExtPack);
151 int getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary);
152 HRESULT getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack);
153 /** @} */
154
155private:
156 HRESULT runSetUidToRootHelper(const char *a_pszCommand, ...);
157 ExtPack *findExtPack(const char *a_pszName);
158 void removeExtPack(const char *a_pszName);
159 HRESULT refreshExtPack(const char *a_pszName, bool a_fUnsuableIsError, ExtPack **a_ppExtPack);
160
161private:
162 struct Data;
163 /** Pointer to the private instance. */
164 Data *m;
165};
166
167#endif
168/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

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