VirtualBox

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

最後變更 在這個檔案從70533是 70533,由 vboxsync 提交於 7 年 前

Audio/VRDE: Implemented audio driver base class for Main audio drivers for dynamically attaching / detaching on runtime.

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