VirtualBox

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

Last change on this file since 67954 was 65482, checked in by vboxsync, 8 years ago

Main/Console: Add the disk integrity driver into the chain if some specific extra data is present

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