VirtualBox

source: vbox/trunk/src/VBox/Main/include/ConsoleImpl.h@ 54976

Last change on this file since 54976 was 54976, checked in by vboxsync, 10 years ago

Main/Console: Add method to add multiple disk encryption passwords with a single call

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 44.2 KB
Line 
1/* $Id: ConsoleImpl.h 54976 2015-03-26 19:32:11Z vboxsync $ */
2/** @file
3 * VBox Console COM Class definition
4 */
5
6/*
7 * Copyright (C) 2005-2015 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_CONSOLEIMPL
19#define ____H_CONSOLEIMPL
20
21#include "VirtualBoxBase.h"
22#include "VBox/com/array.h"
23#include "EventImpl.h"
24#include "ConsoleWrap.h"
25
26class Guest;
27class Keyboard;
28class Mouse;
29class Display;
30class MachineDebugger;
31class TeleporterStateSrc;
32class OUSBDevice;
33class RemoteUSBDevice;
34class SharedFolder;
35class VRDEServerInfo;
36class EmulatedUSB;
37#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
38class AudioVRDE;
39#else
40class AudioSniffer;
41#endif
42class AudioVRDE;
43class Nvram;
44#ifdef VBOX_WITH_USB_CARDREADER
45class UsbCardReader;
46#endif
47class ConsoleVRDPServer;
48class VMMDev;
49class Progress;
50class BusAssignmentManager;
51COM_STRUCT_OR_CLASS(IEventListener);
52#ifdef VBOX_WITH_EXTPACK
53class ExtPackManager;
54#endif
55class VMMDevMouseInterface;
56class DisplayMouseInterface;
57
58#include <iprt/uuid.h>
59#include <iprt/memsafer.h>
60#include <VBox/RemoteDesktop/VRDE.h>
61#include <VBox/vmm/pdmdrv.h>
62#ifdef VBOX_WITH_GUEST_PROPS
63# include <VBox/HostServices/GuestPropertySvc.h> /* For the property notification callback */
64#endif
65
66#ifdef RT_OS_WINDOWS
67# include "../src-server/win/VBoxComEvents.h"
68#endif
69
70struct VUSBIRHCONFIG;
71typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
72
73#include <list>
74#include <vector>
75
76// defines
77///////////////////////////////////////////////////////////////////////////////
78
79/**
80 * Checks the availability of the underlying VM device driver corresponding
81 * to the COM interface (IKeyboard, IMouse, IDisplay, etc.). When the driver is
82 * not available (NULL), sets error info and returns returns E_ACCESSDENIED.
83 * The translatable error message is defined in null context.
84 *
85 * Intended to used only within Console children (i.e. Keyboard, Mouse,
86 * Display, etc.).
87 *
88 * @param drv driver pointer to check (compare it with NULL)
89 */
90#define CHECK_CONSOLE_DRV(drv) \
91 do { \
92 if (!(drv)) \
93 return setError(E_ACCESSDENIED, tr("The console is not powered up")); \
94 } while (0)
95
96// Console
97///////////////////////////////////////////////////////////////////////////////
98
99class ConsoleMouseInterface
100{
101public:
102 virtual VMMDevMouseInterface *i_getVMMDevMouseInterface(){return NULL;}
103 virtual DisplayMouseInterface *i_getDisplayMouseInterface(){return NULL;}
104 virtual void i_onMouseCapabilityChange(BOOL supportsAbsolute,
105 BOOL supportsRelative,
106 BOOL supportsMT,
107 BOOL needsHostCursor){NOREF(supportsAbsolute); NOREF(supportsRelative); NOREF(supportsMT); NOREF(needsHostCursor);}
108};
109
110/** IConsole implementation class */
111class ATL_NO_VTABLE Console :
112 public ConsoleWrap,
113 public ConsoleMouseInterface
114{
115
116public:
117
118 DECLARE_EMPTY_CTOR_DTOR(Console)
119
120 HRESULT FinalConstruct();
121 void FinalRelease();
122
123 // public initializers/uninitializers for internal purposes only
124 HRESULT init(IMachine *aMachine, IInternalMachineControl *aControl, LockType_T aLockType);
125 void uninit();
126
127
128 // public methods for internal purposes only
129
130 /*
131 * Note: the following methods do not increase refcount. intended to be
132 * called only by the VM execution thread.
133 */
134
135 Guest *i_getGuest() const { return mGuest; }
136 Keyboard *i_getKeyboard() const { return mKeyboard; }
137 Mouse *i_getMouse() const { return mMouse; }
138 Display *i_getDisplay() const { return mDisplay; }
139 MachineDebugger *i_getMachineDebugger() const { return mDebugger; }
140#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
141 AudioVRDE *i_getAudioVRDE() const { return mAudioVRDE; }
142#else
143 AudioSniffer *i_getAudioSniffer() const { return mAudioSniffer; }
144#endif
145
146 const ComPtr<IMachine> &i_machine() const { return mMachine; }
147
148 bool i_useHostClipboard() { return mfUseHostClipboard; }
149
150 /** Method is called only from ConsoleVRDPServer */
151 IVRDEServer *i_getVRDEServer() const { return mVRDEServer; }
152
153 ConsoleVRDPServer *i_consoleVRDPServer() const { return mConsoleVRDPServer; }
154
155 HRESULT i_updateMachineState(MachineState_T aMachineState);
156
157 // events from IInternalSessionControl
158 HRESULT i_onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL changeAdapter);
159 HRESULT i_onSerialPortChange(ISerialPort *aSerialPort);
160 HRESULT i_onParallelPortChange(IParallelPort *aParallelPort);
161 HRESULT i_onStorageControllerChange();
162 HRESULT i_onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
163 HRESULT i_onCPUChange(ULONG aCPU, BOOL aRemove);
164 HRESULT i_onCPUExecutionCapChange(ULONG aExecutionCap);
165 HRESULT i_onClipboardModeChange(ClipboardMode_T aClipboardMode);
166 HRESULT i_onDnDModeChange(DnDMode_T aDnDMode);
167 HRESULT i_onVRDEServerChange(BOOL aRestart);
168 HRESULT i_onVideoCaptureChange();
169 HRESULT i_onUSBControllerChange();
170 HRESULT i_onSharedFolderChange(BOOL aGlobal);
171 HRESULT i_onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs,
172 const Utf8Str &aCaptureFilename);
173 HRESULT i_onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
174 HRESULT i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
175 HRESULT i_onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
176 HRESULT i_onExtraDataChange(IN_BSTR aMachineId, IN_BSTR aKey, IN_BSTR aVal);
177
178 HRESULT i_getGuestProperty(const Utf8Str &aName, Utf8Str *aValue, LONG64 *aTimestamp, Utf8Str *aFlags);
179 HRESULT i_setGuestProperty(const Utf8Str &aName, const Utf8Str &aValue, const Utf8Str &aFlags);
180 HRESULT i_deleteGuestProperty(const Utf8Str &aName);
181 HRESULT i_enumerateGuestProperties(const Utf8Str &aPatterns,
182 std::vector<Utf8Str> &aNames,
183 std::vector<Utf8Str> &aValues,
184 std::vector<LONG64> &aTimestamps,
185 std::vector<Utf8Str> &aFlags);
186 HRESULT i_onlineMergeMedium(IMediumAttachment *aMediumAttachment,
187 ULONG aSourceIdx, ULONG aTargetIdx,
188 IProgress *aProgress);
189 int i_hgcmLoadService(const char *pszServiceLibrary, const char *pszServiceName);
190 VMMDev *i_getVMMDev() { return m_pVMMDev; }
191#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
192 AudioVRDE *i_getAudioVRDE() { return mAudioVRDE; }
193#else
194 AudioSniffer *i_getAudioSniffer() { return mAudioSniffer; }
195#endif
196
197#ifdef VBOX_WITH_EXTPACK
198 ExtPackManager *i_getExtPackManager();
199#endif
200 EventSource *i_getEventSource() { return mEventSource; }
201#ifdef VBOX_WITH_USB_CARDREADER
202 UsbCardReader *i_getUsbCardReader() { return mUsbCardReader; }
203#endif
204
205 int i_VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
206 void i_VRDPClientStatusChange(uint32_t u32ClientId, const char *pszStatus);
207 void i_VRDPClientConnect(uint32_t u32ClientId);
208 void i_VRDPClientDisconnect(uint32_t u32ClientId, uint32_t fu32Intercepted);
209 void i_VRDPInterceptAudio(uint32_t u32ClientId);
210 void i_VRDPInterceptUSB(uint32_t u32ClientId, void **ppvIntercept);
211 void i_VRDPInterceptClipboard(uint32_t u32ClientId);
212
213 void i_processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevList, uint32_t cbDevList, bool fDescExt);
214 void i_reportVmStatistics(ULONG aValidStats, ULONG aCpuUser,
215 ULONG aCpuKernel, ULONG aCpuIdle,
216 ULONG aMemTotal, ULONG aMemFree,
217 ULONG aMemBalloon, ULONG aMemShared,
218 ULONG aMemCache, ULONG aPageTotal,
219 ULONG aAllocVMM, ULONG aFreeVMM,
220 ULONG aBalloonedVMM, ULONG aSharedVMM,
221 ULONG aVmNetRx, ULONG aVmNetTx)
222 {
223 mControl->ReportVmStatistics(aValidStats, aCpuUser, aCpuKernel, aCpuIdle,
224 aMemTotal, aMemFree, aMemBalloon, aMemShared,
225 aMemCache, aPageTotal, aAllocVMM, aFreeVMM,
226 aBalloonedVMM, aSharedVMM, aVmNetRx, aVmNetTx);
227 }
228 void i_enableVMMStatistics(BOOL aEnable);
229
230 HRESULT i_pause(Reason_T aReason);
231 HRESULT i_resume(Reason_T aReason);
232 HRESULT i_saveState(Reason_T aReason, IProgress **aProgress);
233
234 // callback callers (partly; for some events console callbacks are notified
235 // directly from IInternalSessionControl event handlers declared above)
236 void i_onMousePointerShapeChange(bool fVisible, bool fAlpha,
237 uint32_t xHot, uint32_t yHot,
238 uint32_t width, uint32_t height,
239 const uint8_t *pu8Shape,
240 uint32_t cbShape);
241 void i_onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
242 BOOL supportsMT, BOOL needsHostCursor);
243 void i_onStateChange(MachineState_T aMachineState);
244 void i_onAdditionsStateChange();
245 void i_onAdditionsOutdated();
246 void i_onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock);
247 void i_onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached,
248 IVirtualBoxErrorInfo *aError);
249 void i_onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage);
250 HRESULT i_onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId);
251 void i_onVRDEServerInfoChange();
252 HRESULT i_sendACPIMonitorHotPlugEvent();
253
254 static const PDMDRVREG DrvStatusReg;
255
256 static HRESULT i_setErrorStatic(HRESULT aResultCode, const char *pcsz, ...);
257 HRESULT i_setInvalidMachineStateError();
258
259 static const char *i_convertControllerTypeToDev(StorageControllerType_T enmCtrlType);
260 static HRESULT i_convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun);
261 // Called from event listener
262 HRESULT i_onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
263 NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
264 HRESULT i_onNATDnsChanged();
265
266 // Mouse interface
267 VMMDevMouseInterface *i_getVMMDevMouseInterface();
268 DisplayMouseInterface *i_getDisplayMouseInterface();
269
270 EmulatedUSB *i_getEmulatedUSB(void) { return mEmulatedUSB; }
271
272 /**
273 * Sets the disk encryption keys.
274 *
275 * @returns COM status code.
276 * @þaram strCfg The config for the disks.
277 *
278 * @note: One line in the config string contains all required data for one disk.
279 * The format for one disk is some sort of comma separated value using
280 * key=value pairs.
281 * There are two keys defined at the moment:
282 * - uuid: The uuid of the base image the key is for (with or without)
283 * the curly braces.
284 * - dek: The data encryption key in base64 encoding
285 */
286 HRESULT i_setDiskEncryptionKeys(const Utf8Str &strCfg);
287
288private:
289
290 // wraped IConsole properties
291 HRESULT getMachine(ComPtr<IMachine> &aMachine);
292 HRESULT getState(MachineState_T *aState);
293 HRESULT getGuest(ComPtr<IGuest> &aGuest);
294 HRESULT getKeyboard(ComPtr<IKeyboard> &aKeyboard);
295 HRESULT getMouse(ComPtr<IMouse> &aMouse);
296 HRESULT getDisplay(ComPtr<IDisplay> &aDisplay);
297 HRESULT getDebugger(ComPtr<IMachineDebugger> &aDebugger);
298 HRESULT getUSBDevices(std::vector<ComPtr<IUSBDevice> > &aUSBDevices);
299 HRESULT getRemoteUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aRemoteUSBDevices);
300 HRESULT getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders);
301 HRESULT getVRDEServerInfo(ComPtr<IVRDEServerInfo> &aVRDEServerInfo);
302 HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
303 HRESULT getAttachedPCIDevices(std::vector<ComPtr<IPCIDeviceAttachment> > &aAttachedPCIDevices);
304 HRESULT getUseHostClipboard(BOOL *aUseHostClipboard);
305 HRESULT setUseHostClipboard(BOOL aUseHostClipboard);
306 HRESULT getEmulatedUSB(ComPtr<IEmulatedUSB> &aEmulatedUSB);
307
308 // wraped IConsole methods
309 HRESULT powerUp(ComPtr<IProgress> &aProgress);
310 HRESULT powerUpPaused(ComPtr<IProgress> &aProgress);
311 HRESULT powerDown(ComPtr<IProgress> &aProgress);
312 HRESULT reset();
313 HRESULT pause();
314 HRESULT resume();
315 HRESULT powerButton();
316 HRESULT sleepButton();
317 HRESULT getPowerButtonHandled(BOOL *aHandled);
318 HRESULT getGuestEnteredACPIMode(BOOL *aEntered);
319 HRESULT saveState(ComPtr<IProgress> &aProgress);
320 HRESULT adoptSavedState(const com::Utf8Str &aSavedStateFile);
321 HRESULT discardSavedState(BOOL aFRemoveFile);
322 HRESULT getDeviceActivity(const std::vector<DeviceType_T> &aType,
323 std::vector<DeviceActivity_T> &aActivity);
324 HRESULT attachUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename);
325 HRESULT detachUSBDevice(const com::Guid &aId,
326 ComPtr<IUSBDevice> &aDevice);
327 HRESULT findUSBDeviceByAddress(const com::Utf8Str &aName,
328 ComPtr<IUSBDevice> &aDevice);
329 HRESULT findUSBDeviceById(const com::Guid &aId,
330 ComPtr<IUSBDevice> &aDevice);
331 HRESULT createSharedFolder(const com::Utf8Str &aName,
332 const com::Utf8Str &aHostPath,
333 BOOL aWritable,
334 BOOL aAutomount);
335 HRESULT removeSharedFolder(const com::Utf8Str &aName);
336 HRESULT takeSnapshot(const com::Utf8Str &aName,
337 const com::Utf8Str &aDescription,
338 ComPtr<IProgress> &aProgress);
339 HRESULT deleteSnapshot(const com::Guid &aId,
340 ComPtr<IProgress> &aProgress);
341 HRESULT deleteSnapshotAndAllChildren(const com::Guid &aId,
342 ComPtr<IProgress> &aProgress);
343 HRESULT deleteSnapshotRange(const com::Guid &aStartId,
344 const com::Guid &aEndId,
345 ComPtr<IProgress> &aProgress);
346 HRESULT restoreSnapshot(const ComPtr<ISnapshot> &aSnapshot,
347 ComPtr<IProgress> &aProgress);
348 HRESULT teleport(const com::Utf8Str &aHostname,
349 ULONG aTcpport,
350 const com::Utf8Str &aPassword,
351 ULONG aMaxDowntime,
352 ComPtr<IProgress> &aProgress);
353 HRESULT addDiskEncryptionPassword(const com::Utf8Str &aId, const com::Utf8Str &aPassword,
354 BOOL aClearOnSuspend);
355 HRESULT addDiskEncryptionPasswords(const std::vector<com::Utf8Str> &aIds, const std::vector<com::Utf8Str> &aPasswords,
356 BOOL aClearOnSuspend);
357 HRESULT removeDiskEncryptionPassword(const com::Utf8Str &aId);
358 HRESULT clearAllDiskEncryptionPasswords();
359
360 void notifyNatDnsChange(PUVM pUVM, const char *pszDevice, ULONG ulInstanceMax);
361
362 /**
363 * Base template for AutoVMCaller and SafeVMPtr. Template arguments
364 * have the same meaning as arguments of Console::addVMCaller().
365 */
366 template <bool taQuiet = false, bool taAllowNullVM = false>
367 class AutoVMCallerBase
368 {
369 public:
370 AutoVMCallerBase(Console *aThat) : mThat(aThat), mRC(E_FAIL)
371 {
372 Assert(aThat);
373 mRC = aThat->i_addVMCaller(taQuiet, taAllowNullVM);
374 }
375 ~AutoVMCallerBase()
376 {
377 doRelease();
378 }
379 /** Decreases the number of callers before the instance is destroyed. */
380 void releaseCaller()
381 {
382 Assert(SUCCEEDED(mRC));
383 doRelease();
384 }
385 /** Restores the number of callers after by #release(). #rc() must be
386 * rechecked to ensure the operation succeeded. */
387 void addYY()
388 {
389 AssertReturnVoid(!SUCCEEDED(mRC));
390 mRC = mThat->i_addVMCaller(taQuiet, taAllowNullVM);
391 }
392 /** Returns the result of Console::addVMCaller() */
393 HRESULT rc() const { return mRC; }
394 /** Shortcut to SUCCEEDED(rc()) */
395 bool isOk() const { return SUCCEEDED(mRC); }
396 protected:
397 Console *mThat;
398 void doRelease()
399 {
400 if (SUCCEEDED(mRC))
401 {
402 mThat->i_releaseVMCaller();
403 mRC = E_FAIL;
404 }
405 }
406 private:
407 HRESULT mRC; /* Whether the caller was added. */
408 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoVMCallerBase)
409 };
410
411#if 0
412 /**
413 * Helper class that protects sections of code using the mpUVM pointer by
414 * automatically calling addVMCaller() on construction and
415 * releaseVMCaller() on destruction. Intended for Console methods dealing
416 * with mpUVM. The usage pattern is:
417 * <code>
418 * AutoVMCaller autoVMCaller(this);
419 * if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc();
420 * ...
421 * VMR3ReqCall (mpUVM, ...
422 * </code>
423 *
424 * @note Temporarily locks the argument for writing.
425 *
426 * @sa SafeVMPtr, SafeVMPtrQuiet
427 * @obsolete Use SafeVMPtr
428 */
429 typedef AutoVMCallerBase<false, false> AutoVMCaller;
430#endif
431
432 /**
433 * Same as AutoVMCaller but doesn't set extended error info on failure.
434 *
435 * @note Temporarily locks the argument for writing.
436 * @obsolete Use SafeVMPtrQuiet
437 */
438 typedef AutoVMCallerBase<true, false> AutoVMCallerQuiet;
439
440 /**
441 * Same as AutoVMCaller but allows a null VM pointer (to trigger an error
442 * instead of assertion).
443 *
444 * @note Temporarily locks the argument for writing.
445 * @obsolete Use SafeVMPtr
446 */
447 typedef AutoVMCallerBase<false, true> AutoVMCallerWeak;
448
449 /**
450 * Same as AutoVMCaller but doesn't set extended error info on failure
451 * and allows a null VM pointer (to trigger an error instead of
452 * assertion).
453 *
454 * @note Temporarily locks the argument for writing.
455 * @obsolete Use SafeVMPtrQuiet
456 */
457 typedef AutoVMCallerBase<true, true> AutoVMCallerQuietWeak;
458
459 /**
460 * Base template for SafeVMPtr and SafeVMPtrQuiet.
461 */
462 template<bool taQuiet = false>
463 class SafeVMPtrBase : public AutoVMCallerBase<taQuiet, true>
464 {
465 typedef AutoVMCallerBase<taQuiet, true> Base;
466 public:
467 SafeVMPtrBase(Console *aThat) : Base(aThat), mRC(E_FAIL), mpUVM(NULL)
468 {
469 if (Base::isOk())
470 mRC = aThat->i_safeVMPtrRetainer(&mpUVM, taQuiet);
471 }
472 ~SafeVMPtrBase()
473 {
474 doRelease();
475 }
476 /** Direct PUVM access. */
477 PUVM rawUVM() const { return mpUVM; }
478 /** Release the handles. */
479 void release()
480 {
481 Assert(SUCCEEDED(mRC));
482 doRelease();
483 }
484
485 /** The combined result of Console::addVMCaller() and Console::safeVMPtrRetainer */
486 HRESULT rc() const { return Base::isOk()? mRC: Base::rc(); }
487 /** Shortcut to SUCCEEDED(rc()) */
488 bool isOk() const { return SUCCEEDED(mRC) && Base::isOk(); }
489
490 private:
491 void doRelease()
492 {
493 if (SUCCEEDED(mRC))
494 {
495 Base::mThat->i_safeVMPtrReleaser(&mpUVM);
496 mRC = E_FAIL;
497 }
498 Base::doRelease();
499 }
500 HRESULT mRC; /* Whether the VM ptr was retained. */
501 PUVM mpUVM;
502 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(SafeVMPtrBase)
503 };
504
505public:
506
507 /*
508 * Helper class that safely manages the Console::mpUVM pointer
509 * by calling addVMCaller() on construction and releaseVMCaller() on
510 * destruction. Intended for Console children. The usage pattern is:
511 * <code>
512 * Console::SafeVMPtr ptrVM(mParent);
513 * if (!ptrVM.isOk())
514 * return ptrVM.rc();
515 * ...
516 * VMR3ReqCall(ptrVM.rawUVM(), ...
517 * ...
518 * printf("%p\n", ptrVM.rawUVM());
519 * </code>
520 *
521 * @note Temporarily locks the argument for writing.
522 *
523 * @sa SafeVMPtrQuiet, AutoVMCaller
524 */
525 typedef SafeVMPtrBase<false> SafeVMPtr;
526
527 /**
528 * A deviation of SafeVMPtr that doesn't set the error info on failure.
529 * Intended for pieces of code that don't need to return the VM access
530 * failure to the caller. The usage pattern is:
531 * <code>
532 * Console::SafeVMPtrQuiet pVM(mParent);
533 * if (pVM.rc())
534 * VMR3ReqCall(pVM, ...
535 * return S_OK;
536 * </code>
537 *
538 * @note Temporarily locks the argument for writing.
539 *
540 * @sa SafeVMPtr, AutoVMCaller
541 */
542 typedef SafeVMPtrBase<true> SafeVMPtrQuiet;
543
544 class SharedFolderData
545 {
546 public:
547 SharedFolderData()
548 { }
549
550 SharedFolderData(const Utf8Str &aHostPath,
551 bool aWritable,
552 bool aAutoMount)
553 : m_strHostPath(aHostPath),
554 m_fWritable(aWritable),
555 m_fAutoMount(aAutoMount)
556 { }
557
558 // copy constructor
559 SharedFolderData(const SharedFolderData& aThat)
560 : m_strHostPath(aThat.m_strHostPath),
561 m_fWritable(aThat.m_fWritable),
562 m_fAutoMount(aThat.m_fAutoMount)
563 { }
564
565 Utf8Str m_strHostPath;
566 bool m_fWritable;
567 bool m_fAutoMount;
568 };
569
570 /**
571 * Class for managing emulated USB MSDs.
572 */
573 class USBStorageDevice
574 {
575 public:
576 USBStorageDevice()
577 { }
578 /** The UUID associated with the USB device. */
579 RTUUID mUuid;
580 /** Port of the storage device. */
581 LONG iPort;
582 };
583
584 /**
585 * Class for managing cryptographic keys.
586 * @todo: Replace with a keystore implementation once it is ready.
587 */
588 class SecretKey
589 {
590 public:
591 SecretKey() { }
592
593 SecretKey(uint8_t *pbKey, size_t cbKey, bool fRemoveOnSuspend)
594 : m_cRefs(0),
595 m_pbKey(pbKey),
596 m_cbKey(cbKey),
597 m_fRemoveOnSuspend(fRemoveOnSuspend)
598 { }
599
600 ~SecretKey()
601 {
602 RTMemSaferFree(m_pbKey, m_cbKey);
603 m_cRefs = 0;
604 m_pbKey = NULL;
605 m_cbKey = 0;
606 m_fRemoveOnSuspend = false;
607 }
608
609 /** Reference counter of the key. */
610 volatile uint32_t m_cRefs;
611 /** Key material. */
612 uint8_t *m_pbKey;
613 /** Size of the key in bytes. */
614 size_t m_cbKey;
615 /** Flag whether to remove the key on suspend. */
616 bool m_fRemoveOnSuspend;
617 };
618
619 typedef std::map<Utf8Str, ComObjPtr<SharedFolder> > SharedFolderMap;
620 typedef std::map<Utf8Str, SharedFolderData> SharedFolderDataMap;
621 typedef std::map<Utf8Str, ComPtr<IMediumAttachment> > MediumAttachmentMap;
622 typedef std::list <USBStorageDevice> USBStorageDeviceList;
623 typedef std::map<Utf8Str, SecretKey *> SecretKeyMap;
624
625private:
626
627 typedef std::list <ComObjPtr<OUSBDevice> > USBDeviceList;
628 typedef std::list <ComObjPtr<RemoteUSBDevice> > RemoteUSBDeviceList;
629
630 HRESULT i_addVMCaller(bool aQuiet = false, bool aAllowNullVM = false);
631 void i_releaseVMCaller();
632 HRESULT i_safeVMPtrRetainer(PUVM *a_ppUVM, bool aQuiet);
633 void i_safeVMPtrReleaser(PUVM *a_ppUVM);
634
635 HRESULT i_consoleInitReleaseLog(const ComPtr<IMachine> aMachine);
636
637 HRESULT i_powerUp(IProgress **aProgress, bool aPaused);
638 HRESULT i_powerDown(IProgress *aProgress = NULL);
639
640/* Note: FreeBSD needs this whether netflt is used or not. */
641#if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
642 HRESULT i_attachToTapInterface(INetworkAdapter *networkAdapter);
643 HRESULT i_detachFromTapInterface(INetworkAdapter *networkAdapter);
644#endif
645 HRESULT i_powerDownHostInterfaces();
646
647 HRESULT i_setMachineState(MachineState_T aMachineState, bool aUpdateServer = true);
648 HRESULT i_setMachineStateLocally(MachineState_T aMachineState)
649 {
650 return i_setMachineState(aMachineState, false /* aUpdateServer */);
651 }
652
653 HRESULT i_findSharedFolder(const Utf8Str &strName,
654 ComObjPtr<SharedFolder> &aSharedFolder,
655 bool aSetError = false);
656
657 HRESULT i_fetchSharedFolders(BOOL aGlobal);
658 bool i_findOtherSharedFolder(const Utf8Str &straName,
659 SharedFolderDataMap::const_iterator &aIt);
660
661 HRESULT i_createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData);
662 HRESULT i_removeSharedFolder(const Utf8Str &strName);
663
664 HRESULT i_suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume);
665 void i_resumeAfterConfigChange(PUVM pUVM);
666
667 static DECLCALLBACK(int) i_configConstructor(PUVM pUVM, PVM pVM, void *pvConsole);
668 int i_configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock);
669 int i_configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachine *pMachine);
670 int i_configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine);
671
672 int i_configGraphicsController(PCFGMNODE pDevices,
673 const GraphicsControllerType_T graphicsController,
674 BusAssignmentManager *pBusMgr,
675 const ComPtr<IMachine> &ptrMachine,
676 const ComPtr<IBIOSSettings> &ptrBiosSettings,
677 bool fHMEnabled);
678 int i_configMediumAttachment(const char *pcszDevice,
679 unsigned uInstance,
680 StorageBus_T enmBus,
681 bool fUseHostIOCache,
682 bool fBuiltinIoCache,
683 bool fSetupMerge,
684 unsigned uMergeSource,
685 unsigned uMergeTarget,
686 IMediumAttachment *pMediumAtt,
687 MachineState_T aMachineState,
688 HRESULT *phrc,
689 bool fAttachDetach,
690 bool fForceUnmount,
691 bool fHotplug,
692 PUVM pUVM,
693 DeviceType_T *paLedDevType,
694 PCFGMNODE *ppLunL0);
695 int i_configMedium(PCFGMNODE pLunL0,
696 bool fPassthrough,
697 DeviceType_T enmType,
698 bool fUseHostIOCache,
699 bool fBuiltinIoCache,
700 bool fSetupMerge,
701 unsigned uMergeSource,
702 unsigned uMergeTarget,
703 const char *pcszBwGroup,
704 bool fDiscard,
705 IMedium *pMedium,
706 MachineState_T aMachineState,
707 HRESULT *phrc);
708 int i_configMediumProperties(PCFGMNODE pCur, IMedium *pMedium, bool *pfHostIP, bool *pfEncrypted);
709 static DECLCALLBACK(int) i_reconfigureMediumAttachment(Console *pThis,
710 PUVM pUVM,
711 const char *pcszDevice,
712 unsigned uInstance,
713 StorageBus_T enmBus,
714 bool fUseHostIOCache,
715 bool fBuiltinIoCache,
716 bool fSetupMerge,
717 unsigned uMergeSource,
718 unsigned uMergeTarget,
719 IMediumAttachment *aMediumAtt,
720 MachineState_T aMachineState,
721 HRESULT *phrc);
722 static DECLCALLBACK(int) i_changeRemovableMedium(Console *pThis,
723 PUVM pUVM,
724 const char *pcszDevice,
725 unsigned uInstance,
726 StorageBus_T enmBus,
727 bool fUseHostIOCache,
728 IMediumAttachment *aMediumAtt,
729 bool fForce);
730
731 HRESULT i_attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *BusMgr, PCFGMNODE pDevices);
732 void i_attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds,
733 uint64_t uFirst, uint64_t uLast,
734 Console::MediumAttachmentMap *pmapMediumAttachments,
735 const char *pcszDevice, unsigned uInstance);
736
737 int i_configNetwork(const char *pszDevice, unsigned uInstance, unsigned uLun,
738 INetworkAdapter *aNetworkAdapter, PCFGMNODE pCfg,
739 PCFGMNODE pLunL0, PCFGMNODE pInst,
740 bool fAttachDetach, bool fIgnoreConnectFailure);
741
742 static DECLCALLBACK(int) i_configGuestProperties(void *pvConsole, PUVM pUVM);
743 static DECLCALLBACK(int) i_configGuestControl(void *pvConsole);
744 static DECLCALLBACK(void) i_vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
745 static DECLCALLBACK(int) i_unplugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
746 static DECLCALLBACK(int) i_plugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
747 HRESULT i_doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM);
748 HRESULT i_doCPURemove(ULONG aCpu, PUVM pUVM);
749 HRESULT i_doCPUAdd(ULONG aCpu, PUVM pUVM);
750
751 HRESULT i_doNetworkAdapterChange(PUVM pUVM, const char *pszDevice, unsigned uInstance,
752 unsigned uLun, INetworkAdapter *aNetworkAdapter);
753 static DECLCALLBACK(int) i_changeNetworkAttachment(Console *pThis, PUVM pUVM, const char *pszDevice,
754 unsigned uInstance, unsigned uLun,
755 INetworkAdapter *aNetworkAdapter);
756
757 void i_changeClipboardMode(ClipboardMode_T aClipboardMode);
758 int i_changeDnDMode(DnDMode_T aDnDMode);
759
760#ifdef VBOX_WITH_USB
761 HRESULT i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs, const Utf8Str &aCaptureFilename);
762 HRESULT i_detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice);
763
764 static DECLCALLBACK(int) i_usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid,
765 bool aRemote, const char *aAddress, void *pvRemoteBackend,
766 USHORT aPortVersion, ULONG aMaskedIfs, const char *pszCaptureFilename);
767 static DECLCALLBACK(int) i_usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid);
768#endif
769
770 static DECLCALLBACK(int) i_attachStorageDevice(Console *pThis,
771 PUVM pUVM,
772 const char *pcszDevice,
773 unsigned uInstance,
774 StorageBus_T enmBus,
775 bool fUseHostIOCache,
776 IMediumAttachment *aMediumAtt,
777 bool fSilent);
778 static DECLCALLBACK(int) i_detachStorageDevice(Console *pThis,
779 PUVM pUVM,
780 const char *pcszDevice,
781 unsigned uInstance,
782 StorageBus_T enmBus,
783 IMediumAttachment *aMediumAtt,
784 bool fSilent);
785 HRESULT i_doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
786 HRESULT i_doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
787
788 static DECLCALLBACK(int) i_fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser);
789
790 static DECLCALLBACK(int) i_stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser);
791
792 static DECLCALLBACK(void) i_genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL,
793 const char *pszErrorFmt, va_list va);
794
795 void i_setVMRuntimeErrorCallbackF(uint32_t fFatal, const char *pszErrorId, const char *pszFormat, ...);
796 static DECLCALLBACK(void) i_setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFatal,
797 const char *pszErrorId, const char *pszFormat, va_list va);
798
799 HRESULT i_captureUSBDevices(PUVM pUVM);
800 void i_detachAllUSBDevices(bool aDone);
801
802 static DECLCALLBACK(int) i_powerUpThread(RTTHREAD Thread, void *pvUser);
803 static DECLCALLBACK(int) i_saveStateThread(RTTHREAD Thread, void *pvUser);
804 static DECLCALLBACK(int) i_powerDownThread(RTTHREAD Thread, void *pvUser);
805
806 static DECLCALLBACK(int) i_vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM);
807 static DECLCALLBACK(void) i_vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
808 static DECLCALLBACK(void) i_vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
809 static DECLCALLBACK(void) i_vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM);
810 static DECLCALLBACK(void) i_vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM);
811 static DECLCALLBACK(void) i_vmm2User_NotifyResetTurnedIntoPowerOff(PCVMM2USERMETHODS pThis, PUVM pUVM);
812
813 static DECLCALLBACK(void *) i_drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID);
814 static DECLCALLBACK(void) i_drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
815 static DECLCALLBACK(int) i_drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface, unsigned iLUN);
816 static DECLCALLBACK(void) i_drvStatus_Destruct(PPDMDRVINS pDrvIns);
817 static DECLCALLBACK(int) i_drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
818
819 static DECLCALLBACK(int) i_pdmIfSecKey_KeyRetain(PPDMISECKEY pInterface, const char *pszId, const uint8_t **ppbKey,
820 size_t *pcbKey);
821 static DECLCALLBACK(int) i_pdmIfSecKey_KeyRelease(PPDMISECKEY pInterface, const char *pszId);
822 static DECLCALLBACK(int) i_pdmIfSecKey_PasswordRetain(PPDMISECKEY pInterface, const char *pszId, const char **ppszPassword);
823 static DECLCALLBACK(int) i_pdmIfSecKey_PasswordRelease(PPDMISECKEY pInterface, const char *pszId);
824
825 static DECLCALLBACK(int) i_pdmIfSecKeyHlp_KeyMissingNotify(PPDMISECKEYHLP pInterface);
826
827 int mcAudioRefs;
828 volatile uint32_t mcVRDPClients;
829 uint32_t mu32SingleRDPClientId; /* The id of a connected client in the single connection mode. */
830 volatile bool mcGuestCredentialsProvided;
831
832 static const char *sSSMConsoleUnit;
833 static uint32_t sSSMConsoleVer;
834
835 HRESULT i_loadDataFromSavedState();
836 int i_loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version);
837
838 static DECLCALLBACK(void) i_saveStateFileExec(PSSMHANDLE pSSM, void *pvUser);
839 static DECLCALLBACK(int) i_loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
840
841#ifdef VBOX_WITH_GUEST_PROPS
842 static DECLCALLBACK(int) i_doGuestPropNotification(void *pvExtension, uint32_t, void *pvParms, uint32_t cbParms);
843 HRESULT i_doEnumerateGuestProperties(const Utf8Str &aPatterns,
844 std::vector<Utf8Str> &aNames,
845 std::vector<Utf8Str> &aValues,
846 std::vector<LONG64> &aTimestamps,
847 std::vector<Utf8Str> &aFlags);
848
849 void i_guestPropertiesHandleVMReset(void);
850 bool i_guestPropertiesVRDPEnabled(void);
851 void i_guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain);
852 void i_guestPropertiesVRDPUpdateActiveClient(uint32_t u32ClientId);
853 void i_guestPropertiesVRDPUpdateClientAttach(uint32_t u32ClientId, bool fAttached);
854 void i_guestPropertiesVRDPUpdateNameChange(uint32_t u32ClientId, const char *pszName);
855 void i_guestPropertiesVRDPUpdateIPAddrChange(uint32_t u32ClientId, const char *pszIPAddr);
856 void i_guestPropertiesVRDPUpdateLocationChange(uint32_t u32ClientId, const char *pszLocation);
857 void i_guestPropertiesVRDPUpdateOtherInfoChange(uint32_t u32ClientId, const char *pszOtherInfo);
858 void i_guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId);
859#endif
860
861 bool i_isResetTurnedIntoPowerOff(void);
862
863 /** @name Disk encryption support
864 * @{ */
865 HRESULT i_consoleParseDiskEncryption(const char *psz, const char **ppszEnd);
866 HRESULT i_configureEncryptionForDisk(const Utf8Str &strId);
867 HRESULT i_clearDiskEncryptionKeysOnAllAttachmentsWithKeyId(const Utf8Str &strId);
868 HRESULT i_initSecretKeyIfOnAllAttachments(void);
869 int i_consoleParseKeyValue(const char *psz, const char **ppszEnd,
870 char **ppszKey, char **ppszVal);
871 void i_removeSecretKeysOnSuspend();
872 /** @} */
873
874 /** @name Teleporter support
875 * @{ */
876 static DECLCALLBACK(int) i_teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser);
877 HRESULT i_teleporterSrc(TeleporterStateSrc *pState);
878 HRESULT i_teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg = NULL);
879 HRESULT i_teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck = true);
880 HRESULT i_teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,
881 Progress *pProgress, bool *pfPowerOffOnFailure);
882 static DECLCALLBACK(int) i_teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser);
883 /** @} */
884
885 bool mSavedStateDataLoaded : 1;
886
887 const ComPtr<IMachine> mMachine;
888 const ComPtr<IInternalMachineControl> mControl;
889
890 const ComPtr<IVRDEServer> mVRDEServer;
891
892 ConsoleVRDPServer * const mConsoleVRDPServer;
893 bool mfVRDEChangeInProcess;
894 bool mfVRDEChangePending;
895
896 const ComObjPtr<Guest> mGuest;
897 const ComObjPtr<Keyboard> mKeyboard;
898 const ComObjPtr<Mouse> mMouse;
899 const ComObjPtr<Display> mDisplay;
900 const ComObjPtr<MachineDebugger> mDebugger;
901 const ComObjPtr<VRDEServerInfo> mVRDEServerInfo;
902 /** This can safely be used without holding any locks.
903 * An AutoCaller suffices to prevent it being destroy while in use and
904 * internally there is a lock providing the necessary serialization. */
905 const ComObjPtr<EventSource> mEventSource;
906#ifdef VBOX_WITH_EXTPACK
907 const ComObjPtr<ExtPackManager> mptrExtPackManager;
908#endif
909 const ComObjPtr<EmulatedUSB> mEmulatedUSB;
910
911 USBDeviceList mUSBDevices;
912 RemoteUSBDeviceList mRemoteUSBDevices;
913
914 SharedFolderDataMap m_mapGlobalSharedFolders;
915 SharedFolderDataMap m_mapMachineSharedFolders;
916 SharedFolderMap m_mapSharedFolders; // the console instances
917
918 /** The user mode VM handle. */
919 PUVM mpUVM;
920 /** Holds the number of "readonly" mpUVM callers (users). */
921 uint32_t mVMCallers;
922 /** Semaphore posted when the number of mpUVM callers drops to zero. */
923 RTSEMEVENT mVMZeroCallersSem;
924 /** true when Console has entered the mpUVM destruction phase. */
925 bool mVMDestroying : 1;
926 /** true when power down is initiated by vmstateChangeCallback (EMT). */
927 bool mVMPoweredOff : 1;
928 /** true when vmstateChangeCallback shouldn't initiate a power down. */
929 bool mVMIsAlreadyPoweringOff : 1;
930 /** true if we already showed the snapshot folder size warning. */
931 bool mfSnapshotFolderSizeWarningShown : 1;
932 /** true if we already showed the snapshot folder ext4/xfs bug warning. */
933 bool mfSnapshotFolderExt4WarningShown : 1;
934 /** true if we already listed the disk type of the snapshot folder. */
935 bool mfSnapshotFolderDiskTypeShown : 1;
936 /** true if a USB controller is available (i.e. USB devices can be attached). */
937 bool mfVMHasUsbController : 1;
938 /** true if the VM power off was caused by reset. */
939 bool mfPowerOffCausedByReset : 1;
940
941 /** Pointer to the VMM -> User (that's us) callbacks. */
942 struct MYVMM2USERMETHODS : public VMM2USERMETHODS
943 {
944 Console *pConsole;
945 } *mpVmm2UserMethods;
946
947 /** The current network attachment type in the VM.
948 * This doesn't have to match the network attachment type maintained in the
949 * NetworkAdapter. This is needed to change the network attachment
950 * dynamically.
951 */
952 typedef std::vector<NetworkAttachmentType_T> NetworkAttachmentTypeVector;
953 NetworkAttachmentTypeVector meAttachmentType;
954
955 VMMDev * m_pVMMDev;
956#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
957 AudioVRDE * const mAudioVRDE;
958#else
959 AudioSniffer * const mAudioSniffer;
960#endif
961 Nvram * const mNvram;
962#ifdef VBOX_WITH_USB_CARDREADER
963 UsbCardReader * const mUsbCardReader;
964#endif
965 BusAssignmentManager* mBusMgr;
966
967 enum
968 {
969 iLedFloppy = 0,
970 cLedFloppy = 2,
971 iLedIde = iLedFloppy + cLedFloppy,
972 cLedIde = 4,
973 iLedSata = iLedIde + cLedIde,
974 cLedSata = 30,
975 iLedScsi = iLedSata + cLedSata,
976 cLedScsi = 16,
977 iLedSas = iLedScsi + cLedScsi,
978 cLedSas = 8,
979 iLedUsb = iLedSas + cLedSas,
980 cLedUsb = 8,
981 cLedStorage = cLedFloppy + cLedIde + cLedSata + cLedScsi + cLedSas + cLedUsb
982 };
983 DeviceType_T maStorageDevType[cLedStorage];
984 PPDMLED mapStorageLeds[cLedStorage];
985 PPDMLED mapNetworkLeds[36]; /**< @todo adapt this to the maximum network card count */
986 PPDMLED mapSharedFolderLed;
987 PPDMLED mapUSBLed[2];
988 PPDMLED mapCrOglLed;
989
990 MediumAttachmentMap mapMediumAttachments;
991
992 /** List of attached USB storage devices. */
993 USBStorageDeviceList mUSBStorageDevices;
994
995 /** Map of secret keys used for disk encryption. */
996 SecretKeyMap m_mapSecretKeys;
997 /** Number of disks configured for encryption. */
998 unsigned m_cDisksEncrypted;
999
1000 /** Pointer to the key consumer -> provider (that's us) callbacks. */
1001 struct MYPDMISECKEY : public PDMISECKEY
1002 {
1003 Console *pConsole;
1004 } *mpIfSecKey;
1005
1006 /** Pointer to the key helpers -> provider (that's us) callbacks. */
1007 struct MYPDMISECKEYHLP : public PDMISECKEYHLP
1008 {
1009 Console *pConsole;
1010 } *mpIfSecKeyHlp;
1011
1012/* Note: FreeBSD needs this whether netflt is used or not. */
1013#if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
1014 Utf8Str maTAPDeviceName[8];
1015 RTFILE maTapFD[8];
1016#endif
1017
1018 bool mVMStateChangeCallbackDisabled;
1019
1020 bool mfUseHostClipboard;
1021
1022 /** Local machine state value. */
1023 MachineState_T mMachineState;
1024
1025 /** Pointer to the progress object of a live cancelable task.
1026 *
1027 * This is currently only used by Console::Teleport(), but is intended to later
1028 * be used by the live snapshot code path as well. Actions like
1029 * Console::PowerDown, which automatically cancels out the running snapshot /
1030 * teleportation operation, will cancel the teleportation / live snapshot
1031 * operation before starting. */
1032 ComObjPtr<Progress> mptrCancelableProgress;
1033
1034 ComPtr<IEventListener> mVmListener;
1035
1036 friend struct VMTask;
1037};
1038
1039#endif // !____H_CONSOLEIMPL
1040/* 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