VirtualBox

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

Last change on this file since 69237 was 68992, checked in by vboxsync, 7 years ago

Main/Console: Renaming (be more specific what kind of controller type this is).

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