VirtualBox

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

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

Main/Console: Fix automatic unpausing a VM which has several disks configured with the same password when all passwords are provided

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 44.5 KB
Line 
1/* $Id: ConsoleImpl.h 54978 2015-03-26 20:49:26Z 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 m_cDisks(0)
599 { }
600
601 ~SecretKey()
602 {
603 RTMemSaferFree(m_pbKey, m_cbKey);
604 m_cRefs = 0;
605 m_pbKey = NULL;
606 m_cbKey = 0;
607 m_fRemoveOnSuspend = false;
608 m_cDisks = 0;
609 }
610
611 /** Reference counter of the key. */
612 volatile uint32_t m_cRefs;
613 /** Key material. */
614 uint8_t *m_pbKey;
615 /** Size of the key in bytes. */
616 size_t m_cbKey;
617 /** Flag whether to remove the key on suspend. */
618 bool m_fRemoveOnSuspend;
619 /** Number of disks using this key. */
620 uint32_t m_cDisks;
621 };
622
623 typedef std::map<Utf8Str, ComObjPtr<SharedFolder> > SharedFolderMap;
624 typedef std::map<Utf8Str, SharedFolderData> SharedFolderDataMap;
625 typedef std::map<Utf8Str, ComPtr<IMediumAttachment> > MediumAttachmentMap;
626 typedef std::list <USBStorageDevice> USBStorageDeviceList;
627 typedef std::map<Utf8Str, SecretKey *> SecretKeyMap;
628
629private:
630
631 typedef std::list <ComObjPtr<OUSBDevice> > USBDeviceList;
632 typedef std::list <ComObjPtr<RemoteUSBDevice> > RemoteUSBDeviceList;
633
634 HRESULT i_addVMCaller(bool aQuiet = false, bool aAllowNullVM = false);
635 void i_releaseVMCaller();
636 HRESULT i_safeVMPtrRetainer(PUVM *a_ppUVM, bool aQuiet);
637 void i_safeVMPtrReleaser(PUVM *a_ppUVM);
638
639 HRESULT i_consoleInitReleaseLog(const ComPtr<IMachine> aMachine);
640
641 HRESULT i_powerUp(IProgress **aProgress, bool aPaused);
642 HRESULT i_powerDown(IProgress *aProgress = NULL);
643
644/* Note: FreeBSD needs this whether netflt is used or not. */
645#if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
646 HRESULT i_attachToTapInterface(INetworkAdapter *networkAdapter);
647 HRESULT i_detachFromTapInterface(INetworkAdapter *networkAdapter);
648#endif
649 HRESULT i_powerDownHostInterfaces();
650
651 HRESULT i_setMachineState(MachineState_T aMachineState, bool aUpdateServer = true);
652 HRESULT i_setMachineStateLocally(MachineState_T aMachineState)
653 {
654 return i_setMachineState(aMachineState, false /* aUpdateServer */);
655 }
656
657 HRESULT i_findSharedFolder(const Utf8Str &strName,
658 ComObjPtr<SharedFolder> &aSharedFolder,
659 bool aSetError = false);
660
661 HRESULT i_fetchSharedFolders(BOOL aGlobal);
662 bool i_findOtherSharedFolder(const Utf8Str &straName,
663 SharedFolderDataMap::const_iterator &aIt);
664
665 HRESULT i_createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData);
666 HRESULT i_removeSharedFolder(const Utf8Str &strName);
667
668 HRESULT i_suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume);
669 void i_resumeAfterConfigChange(PUVM pUVM);
670
671 static DECLCALLBACK(int) i_configConstructor(PUVM pUVM, PVM pVM, void *pvConsole);
672 int i_configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock);
673 int i_configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachine *pMachine);
674 int i_configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine);
675
676 int i_configGraphicsController(PCFGMNODE pDevices,
677 const GraphicsControllerType_T graphicsController,
678 BusAssignmentManager *pBusMgr,
679 const ComPtr<IMachine> &ptrMachine,
680 const ComPtr<IBIOSSettings> &ptrBiosSettings,
681 bool fHMEnabled);
682 int i_configMediumAttachment(const char *pcszDevice,
683 unsigned uInstance,
684 StorageBus_T enmBus,
685 bool fUseHostIOCache,
686 bool fBuiltinIoCache,
687 bool fSetupMerge,
688 unsigned uMergeSource,
689 unsigned uMergeTarget,
690 IMediumAttachment *pMediumAtt,
691 MachineState_T aMachineState,
692 HRESULT *phrc,
693 bool fAttachDetach,
694 bool fForceUnmount,
695 bool fHotplug,
696 PUVM pUVM,
697 DeviceType_T *paLedDevType,
698 PCFGMNODE *ppLunL0);
699 int i_configMedium(PCFGMNODE pLunL0,
700 bool fPassthrough,
701 DeviceType_T enmType,
702 bool fUseHostIOCache,
703 bool fBuiltinIoCache,
704 bool fSetupMerge,
705 unsigned uMergeSource,
706 unsigned uMergeTarget,
707 const char *pcszBwGroup,
708 bool fDiscard,
709 IMedium *pMedium,
710 MachineState_T aMachineState,
711 HRESULT *phrc);
712 int i_configMediumProperties(PCFGMNODE pCur, IMedium *pMedium, bool *pfHostIP, bool *pfEncrypted);
713 static DECLCALLBACK(int) i_reconfigureMediumAttachment(Console *pThis,
714 PUVM pUVM,
715 const char *pcszDevice,
716 unsigned uInstance,
717 StorageBus_T enmBus,
718 bool fUseHostIOCache,
719 bool fBuiltinIoCache,
720 bool fSetupMerge,
721 unsigned uMergeSource,
722 unsigned uMergeTarget,
723 IMediumAttachment *aMediumAtt,
724 MachineState_T aMachineState,
725 HRESULT *phrc);
726 static DECLCALLBACK(int) i_changeRemovableMedium(Console *pThis,
727 PUVM pUVM,
728 const char *pcszDevice,
729 unsigned uInstance,
730 StorageBus_T enmBus,
731 bool fUseHostIOCache,
732 IMediumAttachment *aMediumAtt,
733 bool fForce);
734
735 HRESULT i_attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *BusMgr, PCFGMNODE pDevices);
736 void i_attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds,
737 uint64_t uFirst, uint64_t uLast,
738 Console::MediumAttachmentMap *pmapMediumAttachments,
739 const char *pcszDevice, unsigned uInstance);
740
741 int i_configNetwork(const char *pszDevice, unsigned uInstance, unsigned uLun,
742 INetworkAdapter *aNetworkAdapter, PCFGMNODE pCfg,
743 PCFGMNODE pLunL0, PCFGMNODE pInst,
744 bool fAttachDetach, bool fIgnoreConnectFailure);
745
746 static DECLCALLBACK(int) i_configGuestProperties(void *pvConsole, PUVM pUVM);
747 static DECLCALLBACK(int) i_configGuestControl(void *pvConsole);
748 static DECLCALLBACK(void) i_vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
749 static DECLCALLBACK(int) i_unplugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
750 static DECLCALLBACK(int) i_plugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
751 HRESULT i_doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM);
752 HRESULT i_doCPURemove(ULONG aCpu, PUVM pUVM);
753 HRESULT i_doCPUAdd(ULONG aCpu, PUVM pUVM);
754
755 HRESULT i_doNetworkAdapterChange(PUVM pUVM, const char *pszDevice, unsigned uInstance,
756 unsigned uLun, INetworkAdapter *aNetworkAdapter);
757 static DECLCALLBACK(int) i_changeNetworkAttachment(Console *pThis, PUVM pUVM, const char *pszDevice,
758 unsigned uInstance, unsigned uLun,
759 INetworkAdapter *aNetworkAdapter);
760
761 void i_changeClipboardMode(ClipboardMode_T aClipboardMode);
762 int i_changeDnDMode(DnDMode_T aDnDMode);
763
764#ifdef VBOX_WITH_USB
765 HRESULT i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs, const Utf8Str &aCaptureFilename);
766 HRESULT i_detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice);
767
768 static DECLCALLBACK(int) i_usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid,
769 bool aRemote, const char *aAddress, void *pvRemoteBackend,
770 USHORT aPortVersion, ULONG aMaskedIfs, const char *pszCaptureFilename);
771 static DECLCALLBACK(int) i_usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid);
772#endif
773
774 static DECLCALLBACK(int) i_attachStorageDevice(Console *pThis,
775 PUVM pUVM,
776 const char *pcszDevice,
777 unsigned uInstance,
778 StorageBus_T enmBus,
779 bool fUseHostIOCache,
780 IMediumAttachment *aMediumAtt,
781 bool fSilent);
782 static DECLCALLBACK(int) i_detachStorageDevice(Console *pThis,
783 PUVM pUVM,
784 const char *pcszDevice,
785 unsigned uInstance,
786 StorageBus_T enmBus,
787 IMediumAttachment *aMediumAtt,
788 bool fSilent);
789 HRESULT i_doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
790 HRESULT i_doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
791
792 static DECLCALLBACK(int) i_fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser);
793
794 static DECLCALLBACK(int) i_stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser);
795
796 static DECLCALLBACK(void) i_genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL,
797 const char *pszErrorFmt, va_list va);
798
799 void i_setVMRuntimeErrorCallbackF(uint32_t fFatal, const char *pszErrorId, const char *pszFormat, ...);
800 static DECLCALLBACK(void) i_setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFatal,
801 const char *pszErrorId, const char *pszFormat, va_list va);
802
803 HRESULT i_captureUSBDevices(PUVM pUVM);
804 void i_detachAllUSBDevices(bool aDone);
805
806 static DECLCALLBACK(int) i_powerUpThread(RTTHREAD Thread, void *pvUser);
807 static DECLCALLBACK(int) i_saveStateThread(RTTHREAD Thread, void *pvUser);
808 static DECLCALLBACK(int) i_powerDownThread(RTTHREAD Thread, void *pvUser);
809
810 static DECLCALLBACK(int) i_vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM);
811 static DECLCALLBACK(void) i_vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
812 static DECLCALLBACK(void) i_vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
813 static DECLCALLBACK(void) i_vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM);
814 static DECLCALLBACK(void) i_vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM);
815 static DECLCALLBACK(void) i_vmm2User_NotifyResetTurnedIntoPowerOff(PCVMM2USERMETHODS pThis, PUVM pUVM);
816
817 static DECLCALLBACK(void *) i_drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID);
818 static DECLCALLBACK(void) i_drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
819 static DECLCALLBACK(int) i_drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface, unsigned iLUN);
820 static DECLCALLBACK(void) i_drvStatus_Destruct(PPDMDRVINS pDrvIns);
821 static DECLCALLBACK(int) i_drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
822
823 static DECLCALLBACK(int) i_pdmIfSecKey_KeyRetain(PPDMISECKEY pInterface, const char *pszId, const uint8_t **ppbKey,
824 size_t *pcbKey);
825 static DECLCALLBACK(int) i_pdmIfSecKey_KeyRelease(PPDMISECKEY pInterface, const char *pszId);
826 static DECLCALLBACK(int) i_pdmIfSecKey_PasswordRetain(PPDMISECKEY pInterface, const char *pszId, const char **ppszPassword);
827 static DECLCALLBACK(int) i_pdmIfSecKey_PasswordRelease(PPDMISECKEY pInterface, const char *pszId);
828
829 static DECLCALLBACK(int) i_pdmIfSecKeyHlp_KeyMissingNotify(PPDMISECKEYHLP pInterface);
830
831 int mcAudioRefs;
832 volatile uint32_t mcVRDPClients;
833 uint32_t mu32SingleRDPClientId; /* The id of a connected client in the single connection mode. */
834 volatile bool mcGuestCredentialsProvided;
835
836 static const char *sSSMConsoleUnit;
837 static uint32_t sSSMConsoleVer;
838
839 HRESULT i_loadDataFromSavedState();
840 int i_loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version);
841
842 static DECLCALLBACK(void) i_saveStateFileExec(PSSMHANDLE pSSM, void *pvUser);
843 static DECLCALLBACK(int) i_loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
844
845#ifdef VBOX_WITH_GUEST_PROPS
846 static DECLCALLBACK(int) i_doGuestPropNotification(void *pvExtension, uint32_t, void *pvParms, uint32_t cbParms);
847 HRESULT i_doEnumerateGuestProperties(const Utf8Str &aPatterns,
848 std::vector<Utf8Str> &aNames,
849 std::vector<Utf8Str> &aValues,
850 std::vector<LONG64> &aTimestamps,
851 std::vector<Utf8Str> &aFlags);
852
853 void i_guestPropertiesHandleVMReset(void);
854 bool i_guestPropertiesVRDPEnabled(void);
855 void i_guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain);
856 void i_guestPropertiesVRDPUpdateActiveClient(uint32_t u32ClientId);
857 void i_guestPropertiesVRDPUpdateClientAttach(uint32_t u32ClientId, bool fAttached);
858 void i_guestPropertiesVRDPUpdateNameChange(uint32_t u32ClientId, const char *pszName);
859 void i_guestPropertiesVRDPUpdateIPAddrChange(uint32_t u32ClientId, const char *pszIPAddr);
860 void i_guestPropertiesVRDPUpdateLocationChange(uint32_t u32ClientId, const char *pszLocation);
861 void i_guestPropertiesVRDPUpdateOtherInfoChange(uint32_t u32ClientId, const char *pszOtherInfo);
862 void i_guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId);
863#endif
864
865 bool i_isResetTurnedIntoPowerOff(void);
866
867 /** @name Disk encryption support
868 * @{ */
869 HRESULT i_consoleParseDiskEncryption(const char *psz, const char **ppszEnd);
870 HRESULT i_configureEncryptionForDisk(const Utf8Str &strId, unsigned *pcDisksConfigured);
871 HRESULT i_clearDiskEncryptionKeysOnAllAttachmentsWithKeyId(const Utf8Str &strId);
872 HRESULT i_initSecretKeyIfOnAllAttachments(void);
873 int i_consoleParseKeyValue(const char *psz, const char **ppszEnd,
874 char **ppszKey, char **ppszVal);
875 void i_removeSecretKeysOnSuspend();
876 /** @} */
877
878 /** @name Teleporter support
879 * @{ */
880 static DECLCALLBACK(int) i_teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser);
881 HRESULT i_teleporterSrc(TeleporterStateSrc *pState);
882 HRESULT i_teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg = NULL);
883 HRESULT i_teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck = true);
884 HRESULT i_teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,
885 Progress *pProgress, bool *pfPowerOffOnFailure);
886 static DECLCALLBACK(int) i_teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser);
887 /** @} */
888
889 bool mSavedStateDataLoaded : 1;
890
891 const ComPtr<IMachine> mMachine;
892 const ComPtr<IInternalMachineControl> mControl;
893
894 const ComPtr<IVRDEServer> mVRDEServer;
895
896 ConsoleVRDPServer * const mConsoleVRDPServer;
897 bool mfVRDEChangeInProcess;
898 bool mfVRDEChangePending;
899
900 const ComObjPtr<Guest> mGuest;
901 const ComObjPtr<Keyboard> mKeyboard;
902 const ComObjPtr<Mouse> mMouse;
903 const ComObjPtr<Display> mDisplay;
904 const ComObjPtr<MachineDebugger> mDebugger;
905 const ComObjPtr<VRDEServerInfo> mVRDEServerInfo;
906 /** This can safely be used without holding any locks.
907 * An AutoCaller suffices to prevent it being destroy while in use and
908 * internally there is a lock providing the necessary serialization. */
909 const ComObjPtr<EventSource> mEventSource;
910#ifdef VBOX_WITH_EXTPACK
911 const ComObjPtr<ExtPackManager> mptrExtPackManager;
912#endif
913 const ComObjPtr<EmulatedUSB> mEmulatedUSB;
914
915 USBDeviceList mUSBDevices;
916 RemoteUSBDeviceList mRemoteUSBDevices;
917
918 SharedFolderDataMap m_mapGlobalSharedFolders;
919 SharedFolderDataMap m_mapMachineSharedFolders;
920 SharedFolderMap m_mapSharedFolders; // the console instances
921
922 /** The user mode VM handle. */
923 PUVM mpUVM;
924 /** Holds the number of "readonly" mpUVM callers (users). */
925 uint32_t mVMCallers;
926 /** Semaphore posted when the number of mpUVM callers drops to zero. */
927 RTSEMEVENT mVMZeroCallersSem;
928 /** true when Console has entered the mpUVM destruction phase. */
929 bool mVMDestroying : 1;
930 /** true when power down is initiated by vmstateChangeCallback (EMT). */
931 bool mVMPoweredOff : 1;
932 /** true when vmstateChangeCallback shouldn't initiate a power down. */
933 bool mVMIsAlreadyPoweringOff : 1;
934 /** true if we already showed the snapshot folder size warning. */
935 bool mfSnapshotFolderSizeWarningShown : 1;
936 /** true if we already showed the snapshot folder ext4/xfs bug warning. */
937 bool mfSnapshotFolderExt4WarningShown : 1;
938 /** true if we already listed the disk type of the snapshot folder. */
939 bool mfSnapshotFolderDiskTypeShown : 1;
940 /** true if a USB controller is available (i.e. USB devices can be attached). */
941 bool mfVMHasUsbController : 1;
942 /** true if the VM power off was caused by reset. */
943 bool mfPowerOffCausedByReset : 1;
944
945 /** Pointer to the VMM -> User (that's us) callbacks. */
946 struct MYVMM2USERMETHODS : public VMM2USERMETHODS
947 {
948 Console *pConsole;
949 } *mpVmm2UserMethods;
950
951 /** The current network attachment type in the VM.
952 * This doesn't have to match the network attachment type maintained in the
953 * NetworkAdapter. This is needed to change the network attachment
954 * dynamically.
955 */
956 typedef std::vector<NetworkAttachmentType_T> NetworkAttachmentTypeVector;
957 NetworkAttachmentTypeVector meAttachmentType;
958
959 VMMDev * m_pVMMDev;
960#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
961 AudioVRDE * const mAudioVRDE;
962#else
963 AudioSniffer * const mAudioSniffer;
964#endif
965 Nvram * const mNvram;
966#ifdef VBOX_WITH_USB_CARDREADER
967 UsbCardReader * const mUsbCardReader;
968#endif
969 BusAssignmentManager* mBusMgr;
970
971 enum
972 {
973 iLedFloppy = 0,
974 cLedFloppy = 2,
975 iLedIde = iLedFloppy + cLedFloppy,
976 cLedIde = 4,
977 iLedSata = iLedIde + cLedIde,
978 cLedSata = 30,
979 iLedScsi = iLedSata + cLedSata,
980 cLedScsi = 16,
981 iLedSas = iLedScsi + cLedScsi,
982 cLedSas = 8,
983 iLedUsb = iLedSas + cLedSas,
984 cLedUsb = 8,
985 cLedStorage = cLedFloppy + cLedIde + cLedSata + cLedScsi + cLedSas + cLedUsb
986 };
987 DeviceType_T maStorageDevType[cLedStorage];
988 PPDMLED mapStorageLeds[cLedStorage];
989 PPDMLED mapNetworkLeds[36]; /**< @todo adapt this to the maximum network card count */
990 PPDMLED mapSharedFolderLed;
991 PPDMLED mapUSBLed[2];
992 PPDMLED mapCrOglLed;
993
994 MediumAttachmentMap mapMediumAttachments;
995
996 /** List of attached USB storage devices. */
997 USBStorageDeviceList mUSBStorageDevices;
998
999 /** Map of secret keys used for disk encryption. */
1000 SecretKeyMap m_mapSecretKeys;
1001 /** Number of disks configured for encryption. */
1002 unsigned m_cDisksEncrypted;
1003 /** Number of disks which have the key in the map. */
1004 unsigned m_cDisksPwProvided;
1005
1006 /** Pointer to the key consumer -> provider (that's us) callbacks. */
1007 struct MYPDMISECKEY : public PDMISECKEY
1008 {
1009 Console *pConsole;
1010 } *mpIfSecKey;
1011
1012 /** Pointer to the key helpers -> provider (that's us) callbacks. */
1013 struct MYPDMISECKEYHLP : public PDMISECKEYHLP
1014 {
1015 Console *pConsole;
1016 } *mpIfSecKeyHlp;
1017
1018/* Note: FreeBSD needs this whether netflt is used or not. */
1019#if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
1020 Utf8Str maTAPDeviceName[8];
1021 RTFILE maTapFD[8];
1022#endif
1023
1024 bool mVMStateChangeCallbackDisabled;
1025
1026 bool mfUseHostClipboard;
1027
1028 /** Local machine state value. */
1029 MachineState_T mMachineState;
1030
1031 /** Pointer to the progress object of a live cancelable task.
1032 *
1033 * This is currently only used by Console::Teleport(), but is intended to later
1034 * be used by the live snapshot code path as well. Actions like
1035 * Console::PowerDown, which automatically cancels out the running snapshot /
1036 * teleportation operation, will cancel the teleportation / live snapshot
1037 * operation before starting. */
1038 ComObjPtr<Progress> mptrCancelableProgress;
1039
1040 ComPtr<IEventListener> mVmListener;
1041
1042 friend struct VMTask;
1043};
1044
1045#endif // !____H_CONSOLEIMPL
1046/* vi: set tabstop=4 shiftwidth=4 expandtab: */
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