VirtualBox

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

Last change on this file since 14959 was 14949, checked in by vboxsync, 16 years ago

Appended vim modeline to set tabstop and expand tabs (in the way
suggested by our coding guidelines).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.1 KB
Line 
1/* $Id: ConsoleImpl.h 14949 2008-12-03 15:17:16Z vboxsync $ */
2
3/** @file
4 *
5 * VBox Console COM Class definition
6 */
7
8/*
9 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 */
23
24#ifndef ____H_CONSOLEIMPL
25#define ____H_CONSOLEIMPL
26
27#include "VirtualBoxBase.h"
28#include "ProgressImpl.h"
29
30class Guest;
31class Keyboard;
32class Mouse;
33class Display;
34class MachineDebugger;
35class OUSBDevice;
36class RemoteUSBDevice;
37class SharedFolder;
38class RemoteDisplayInfo;
39class AudioSniffer;
40class ConsoleVRDPServer;
41class VMMDev;
42
43#include <VBox/vrdpapi.h>
44#include <VBox/pdmdrv.h>
45#ifdef VBOX_WITH_GUEST_PROPS
46# include <VBox/HostServices/GuestPropertySvc.h> /* For the property notification callback */
47#endif
48
49struct VUSBIRHCONFIG;
50typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
51
52#include <list>
53
54// defines
55///////////////////////////////////////////////////////////////////////////////
56
57/**
58 * Checks the availability of the underlying VM device driver corresponding
59 * to the COM interface (IKeyboard, IMouse, IDisplay, etc.). When the driver is
60 * not available (NULL), sets error info and returns returns E_ACCESSDENIED.
61 * The translatable error message is defined in null context.
62 *
63 * Intended to used only within Console children (i.e. Keyboard, Mouse,
64 * Display, etc.).
65 *
66 * @param drv driver pointer to check (compare it with NULL)
67 */
68#define CHECK_CONSOLE_DRV(drv) \
69 do { \
70 if (!(drv)) \
71 return setError (E_ACCESSDENIED, tr ("The console is not powered up")); \
72 } while (0)
73
74/** @def VBOX_WITH_UNIXY_TAP_NETWORKING
75 * Unixy style TAP networking. This is defined in the Makefile since it's also
76 * used by NetworkAdapterImpl.h/cpp.
77 */
78#ifdef __DOXYGEN__
79# define VBOX_WITH_UNIXY_TAP_NETWORKING
80#endif
81
82// Console
83///////////////////////////////////////////////////////////////////////////////
84
85/** IConsole implementation class */
86class ATL_NO_VTABLE Console :
87 public VirtualBoxBaseWithChildrenNEXT,
88 public VirtualBoxSupportErrorInfoImpl <Console, IConsole>,
89 public VirtualBoxSupportTranslation <Console>,
90 public IConsole
91{
92 Q_OBJECT
93
94public:
95
96 DECLARE_NOT_AGGREGATABLE(Console)
97
98 DECLARE_PROTECT_FINAL_CONSTRUCT()
99
100 BEGIN_COM_MAP(Console)
101 COM_INTERFACE_ENTRY(ISupportErrorInfo)
102 COM_INTERFACE_ENTRY(IConsole)
103 END_COM_MAP()
104
105 NS_DECL_ISUPPORTS
106
107 Console();
108 ~Console();
109
110 HRESULT FinalConstruct();
111 void FinalRelease();
112
113 // public initializers/uninitializers for internal purposes only
114 HRESULT init (IMachine *aMachine, IInternalMachineControl *aControl);
115 void uninit();
116
117 // IConsole properties
118 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
119 STDMETHOD(COMGETTER(State)) (MachineState_T *aMachineState);
120 STDMETHOD(COMGETTER(Guest)) (IGuest **aGuest);
121 STDMETHOD(COMGETTER(Keyboard)) (IKeyboard **aKeyboard);
122 STDMETHOD(COMGETTER(Mouse)) (IMouse **aMouse);
123 STDMETHOD(COMGETTER(Display)) (IDisplay **aDisplay);
124 STDMETHOD(COMGETTER(Debugger)) (IMachineDebugger **aDebugger);
125 STDMETHOD(COMGETTER(USBDevices)) (IUSBDeviceCollection **aUSBDevices);
126 STDMETHOD(COMGETTER(RemoteUSBDevices)) (IHostUSBDeviceCollection **aRemoteUSBDevices);
127 STDMETHOD(COMGETTER(RemoteDisplayInfo)) (IRemoteDisplayInfo **aRemoteDisplayInfo);
128 STDMETHOD(COMGETTER(SharedFolders)) (ISharedFolderCollection **aSharedFolders);
129
130 // IConsole methods
131 STDMETHOD(PowerUp) (IProgress **aProgress);
132 STDMETHOD(PowerUpPaused) (IProgress **aProgress);
133 STDMETHOD(PowerDown)();
134 STDMETHOD(PowerDownAsync) (IProgress **aProgress);
135 STDMETHOD(Reset)();
136 STDMETHOD(Pause)();
137 STDMETHOD(Resume)();
138 STDMETHOD(PowerButton)();
139 STDMETHOD(SleepButton)();
140 STDMETHOD(GetPowerButtonHandled)(BOOL *aHandled);
141 STDMETHOD(GetGuestEnteredACPIMode)(BOOL *aEntered);
142 STDMETHOD(SaveState) (IProgress **aProgress);
143 STDMETHOD(AdoptSavedState) (INPTR BSTR aSavedStateFile);
144 STDMETHOD(DiscardSavedState)();
145 STDMETHOD(GetDeviceActivity) (DeviceType_T aDeviceType,
146 DeviceActivity_T *aDeviceActivity);
147 STDMETHOD(AttachUSBDevice) (INPTR GUIDPARAM aId);
148 STDMETHOD(DetachUSBDevice) (INPTR GUIDPARAM aId, IUSBDevice **aDevice);
149 STDMETHOD(CreateSharedFolder) (INPTR BSTR aName, INPTR BSTR aHostPath, BOOL aWritable);
150 STDMETHOD(RemoveSharedFolder) (INPTR BSTR aName);
151 STDMETHOD(TakeSnapshot) (INPTR BSTR aName, INPTR BSTR aDescription,
152 IProgress **aProgress);
153 STDMETHOD(DiscardSnapshot) (INPTR GUIDPARAM aId, IProgress **aProgress);
154 STDMETHOD(DiscardCurrentState) (IProgress **aProgress);
155 STDMETHOD(DiscardCurrentSnapshotAndState) (IProgress **aProgress);
156 STDMETHOD(RegisterCallback) (IConsoleCallback *aCallback);
157 STDMETHOD(UnregisterCallback)(IConsoleCallback *aCallback);
158
159 // public methods for internal purposes only
160
161 /*
162 * Note: the following methods do not increase refcount. intended to be
163 * called only by the VM execution thread.
164 */
165
166 Guest *getGuest() const { return mGuest; }
167 Keyboard *getKeyboard() const { return mKeyboard; }
168 Mouse *getMouse() const { return mMouse; }
169 Display *getDisplay() const { return mDisplay; }
170 MachineDebugger *getMachineDebugger() const { return mDebugger; }
171
172 const ComPtr <IMachine> &machine() const { return mMachine; }
173
174 /** Method is called only from ConsoleVRDPServer */
175 IVRDPServer *getVRDPServer() const { return mVRDPServer; }
176
177 ConsoleVRDPServer *consoleVRDPServer() const { return mConsoleVRDPServer; }
178
179 HRESULT updateMachineState (MachineState_T aMachineState);
180
181 // events from IInternalSessionControl
182 HRESULT onDVDDriveChange();
183 HRESULT onFloppyDriveChange();
184 HRESULT onNetworkAdapterChange (INetworkAdapter *aNetworkAdapter);
185 HRESULT onSerialPortChange (ISerialPort *aSerialPort);
186 HRESULT onParallelPortChange (IParallelPort *aParallelPort);
187 HRESULT onVRDPServerChange();
188 HRESULT onUSBControllerChange();
189 HRESULT onSharedFolderChange (BOOL aGlobal);
190 HRESULT onUSBDeviceAttach (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
191 HRESULT onUSBDeviceDetach (INPTR GUIDPARAM aId, IVirtualBoxErrorInfo *aError);
192 HRESULT getGuestProperty (INPTR BSTR aKey, BSTR *aValue, ULONG64 *aTimestamp, BSTR *aFlags);
193 HRESULT setGuestProperty (INPTR BSTR aKey, INPTR BSTR aValue, INPTR BSTR aFlags);
194 HRESULT enumerateGuestProperties (INPTR BSTR aPatterns, ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues), ComSafeArrayOut(ULONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
195 VMMDev *getVMMDev() { return mVMMDev; }
196 AudioSniffer *getAudioSniffer () { return mAudioSniffer; }
197
198 int VRDPClientLogon (uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
199 void VRDPClientConnect (uint32_t u32ClientId);
200 void VRDPClientDisconnect (uint32_t u32ClientId, uint32_t fu32Intercepted);
201 void VRDPInterceptAudio (uint32_t u32ClientId);
202 void VRDPInterceptUSB (uint32_t u32ClientId, void **ppvIntercept);
203 void VRDPInterceptClipboard (uint32_t u32ClientId);
204
205 void processRemoteUSBDevices (uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevList, uint32_t cbDevList);
206
207 // callback callers (partly; for some events console callbacks are notified
208 // directly from IInternalSessionControl event handlers declared above)
209 void onMousePointerShapeChange(bool fVisible, bool fAlpha,
210 uint32_t xHot, uint32_t yHot,
211 uint32_t width, uint32_t height,
212 void *pShape);
213 void onMouseCapabilityChange (BOOL supportsAbsolute, BOOL needsHostCursor);
214 void onStateChange (MachineState_T aMachineState);
215 void onAdditionsStateChange();
216 void onAdditionsOutdated();
217 void onKeyboardLedsChange (bool fNumLock, bool fCapsLock, bool fScrollLock);
218 void onUSBDeviceStateChange (IUSBDevice *aDevice, bool aAttached,
219 IVirtualBoxErrorInfo *aError);
220 void onRuntimeError (BOOL aFatal, INPTR BSTR aErrorID, INPTR BSTR aMessage);
221 HRESULT onShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId);
222
223 static const PDMDRVREG DrvStatusReg;
224
225 void reportAuthLibraryError (const char *filename, int rc)
226 {
227 setError (E_FAIL, tr("Could not load the external authentication library '%s' (%Rrc)"), filename, rc);
228 }
229
230 // for VirtualBoxSupportErrorInfoImpl
231 static const wchar_t *getComponentName() { return L"Console"; }
232
233private:
234
235 /**
236 * Base template for AutoVMCaller and SaveVMPtr. Template arguments
237 * have the same meaning as arguments of Console::addVMCaller().
238 */
239 template <bool taQuiet = false, bool taAllowNullVM = false>
240 class AutoVMCallerBase
241 {
242 public:
243 AutoVMCallerBase (Console *aThat) : mThat (aThat), mRC (S_OK)
244 {
245 Assert (aThat);
246 mRC = aThat->addVMCaller (taQuiet, taAllowNullVM);
247 }
248 ~AutoVMCallerBase()
249 {
250 if (SUCCEEDED (mRC))
251 mThat->releaseVMCaller();
252 }
253 /** Decreases the number of callers before the instance is destroyed. */
254 void release()
255 {
256 AssertReturnVoid (SUCCEEDED (mRC));
257 mThat->releaseVMCaller();
258 mRC = E_FAIL;
259 }
260 /** Restores the number of callers after by #release(). #rc() must be
261 * rechecked to ensure the operation succeeded. */
262 void add()
263 {
264 AssertReturnVoid (!SUCCEEDED (mRC));
265 mRC = mThat->addVMCaller (taQuiet, taAllowNullVM);
266 }
267 /** Returns the result of Console::addVMCaller() */
268 HRESULT rc() const { return mRC; }
269 /** Shortcut to SUCCEEDED (rc()) */
270 bool isOk() const { return SUCCEEDED (mRC); }
271 protected:
272 Console *mThat;
273 HRESULT mRC;
274 private:
275 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoVMCallerBase)
276 DECLARE_CLS_NEW_DELETE_NOOP (AutoVMCallerBase)
277 };
278
279 /**
280 * Helper class that protects sections of code using the mpVM pointer by
281 * automatically calling addVMCaller() on construction and
282 * releaseVMCaller() on destruction. Intended for Console methods dealing
283 * with mpVM. The usage pattern is:
284 * <code>
285 * AutoVMCaller autoVMCaller (this);
286 * CheckComRCReturnRC (autoVMCaller.rc());
287 * ...
288 * VMR3ReqCall (mpVM, ...
289 * </code>
290 *
291 * @note Temporarily locks the argument for writing.
292 *
293 * @sa SafeVMPtr, SafeVMPtrQuiet
294 */
295 typedef AutoVMCallerBase <false, false> AutoVMCaller;
296
297 /**
298 * Same as AutoVMCaller but doesn't set extended error info on failure.
299 *
300 * @note Temporarily locks the argument for writing.
301 */
302 typedef AutoVMCallerBase <true, false> AutoVMCallerQuiet;
303
304 /**
305 * Same as AutoVMCaller but allows a null VM pointer (to trigger an error
306 * instead of assertion).
307 *
308 * @note Temporarily locks the argument for writing.
309 */
310 typedef AutoVMCallerBase <false, true> AutoVMCallerWeak;
311
312 /**
313 * Same as AutoVMCaller but doesn't set extended error info on failure
314 * and allows a null VM pointer (to trigger an error instead of
315 * assertion).
316 *
317 * @note Temporarily locks the argument for writing.
318 */
319 typedef AutoVMCallerBase <true, true> AutoVMCallerQuietWeak;
320
321 /**
322 * Base template for SaveVMPtr and SaveVMPtrQuiet.
323 */
324 template <bool taQuiet = false>
325 class SafeVMPtrBase : public AutoVMCallerBase <taQuiet, true>
326 {
327 typedef AutoVMCallerBase <taQuiet, true> Base;
328 public:
329 SafeVMPtrBase (Console *aThat) : Base (aThat), mpVM (NULL)
330 {
331 if (SUCCEEDED (Base::mRC))
332 mpVM = aThat->mpVM;
333 }
334 /** Smart SaveVMPtr to PVM cast operator */
335 operator PVM() const { return mpVM; }
336 /** Direct PVM access for printf()-like functions */
337 PVM raw() const { return mpVM; }
338 private:
339 PVM mpVM;
340 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (SafeVMPtrBase)
341 DECLARE_CLS_NEW_DELETE_NOOP (SafeVMPtrBase)
342 };
343
344public:
345
346 /**
347 * Helper class that safely manages the Console::mpVM pointer
348 * by calling addVMCaller() on construction and releaseVMCaller() on
349 * destruction. Intended for Console children. The usage pattern is:
350 * <code>
351 * Console::SaveVMPtr pVM (mParent);
352 * CheckComRCReturnRC (pVM.rc());
353 * ...
354 * VMR3ReqCall (pVM, ...
355 * ...
356 * printf ("%p\n", pVM.raw());
357 * </code>
358 *
359 * @note Temporarily locks the argument for writing.
360 *
361 * @sa SafeVMPtrQuiet, AutoVMCaller
362 */
363 typedef SafeVMPtrBase <false> SafeVMPtr;
364
365 /**
366 * A deviation of SaveVMPtr that doesn't set the error info on failure.
367 * Intended for pieces of code that don't need to return the VM access
368 * failure to the caller. The usage pattern is:
369 * <code>
370 * Console::SaveVMPtrQuiet pVM (mParent);
371 * if (pVM.rc())
372 * VMR3ReqCall (pVM, ...
373 * return S_OK;
374 * </code>
375 *
376 * @note Temporarily locks the argument for writing.
377 *
378 * @sa SafeVMPtr, AutoVMCaller
379 */
380 typedef SafeVMPtrBase <true> SafeVMPtrQuiet;
381
382 class SharedFolderData
383 {
384 public:
385 SharedFolderData() {}
386 SharedFolderData(Bstr aHostPath, BOOL aWritable)
387 : mHostPath (aHostPath)
388 , mWritable (aWritable) {}
389 SharedFolderData(const SharedFolderData& aThat)
390 : mHostPath (aThat.mHostPath)
391 , mWritable (aThat.mWritable) {}
392 Bstr mHostPath;
393 BOOL mWritable;
394 };
395 typedef std::map <Bstr, ComObjPtr <SharedFolder> > SharedFolderMap;
396 typedef std::map <Bstr, SharedFolderData> SharedFolderDataMap;
397
398private:
399
400 typedef std::list <ComObjPtr <OUSBDevice> > USBDeviceList;
401 typedef std::list <ComObjPtr <RemoteUSBDevice> > RemoteUSBDeviceList;
402
403 HRESULT addVMCaller (bool aQuiet = false, bool aAllowNullVM = false);
404 void releaseVMCaller();
405
406 HRESULT consoleInitReleaseLog (const ComPtr <IMachine> aMachine);
407
408 HRESULT powerUp (IProgress **aProgress, bool aPaused);
409 HRESULT powerDown (Progress *aProgress = NULL);
410
411 HRESULT callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice,
412 Bstr &tapSetupApplication);
413 HRESULT attachToHostInterface(INetworkAdapter *networkAdapter);
414 HRESULT detachFromHostInterface(INetworkAdapter *networkAdapter);
415 HRESULT powerDownHostInterfaces();
416
417 HRESULT setMachineState (MachineState_T aMachineState, bool aUpdateServer = true);
418 HRESULT setMachineStateLocally (MachineState_T aMachineState)
419 {
420 return setMachineState (aMachineState, false /* aUpdateServer */);
421 }
422
423 HRESULT findSharedFolder (const BSTR aName,
424 ComObjPtr <SharedFolder> &aSharedFolder,
425 bool aSetError = false);
426
427 HRESULT fetchSharedFolders (BOOL aGlobal);
428 bool findOtherSharedFolder (INPTR BSTR aName,
429 SharedFolderDataMap::const_iterator &aIt);
430
431 HRESULT createSharedFolder (INPTR BSTR aName, SharedFolderData aData);
432 HRESULT removeSharedFolder (INPTR BSTR aName);
433
434 static DECLCALLBACK(int) configConstructor(PVM pVM, void *pvConsole);
435 static DECLCALLBACK(void) vmstateChangeCallback(PVM aVM, VMSTATE aState,
436 VMSTATE aOldState, void *aUser);
437 HRESULT doDriveChange (const char *pszDevice, unsigned uInstance,
438 unsigned uLun, DriveState_T eState,
439 DriveState_T *peState, const char *pszPath,
440 bool fPassthrough);
441 static DECLCALLBACK(int) changeDrive (Console *pThis, const char *pszDevice,
442 unsigned uInstance, unsigned uLun,
443 DriveState_T eState, DriveState_T *peState,
444 const char *pszPath, bool fPassthrough);
445
446#ifdef VBOX_WITH_USB
447 HRESULT attachUSBDevice (IUSBDevice *aHostDevice, ULONG aMaskedIfs);
448 HRESULT detachUSBDevice (USBDeviceList::iterator &aIt);
449
450 static DECLCALLBACK(int)
451 usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid,
452 bool aRemote, const char *aAddress, ULONG aMaskedIfs);
453 static DECLCALLBACK(int)
454 usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, PCRTUUID aUuid);
455#endif
456
457 static DECLCALLBACK (int)
458 stateProgressCallback (PVM pVM, unsigned uPercent, void *pvUser);
459
460 static DECLCALLBACK(void)
461 setVMErrorCallback (PVM pVM, void *pvUser, int rc, RT_SRC_POS_DECL,
462 const char *pszFormat, va_list args);
463
464 static DECLCALLBACK(void)
465 setVMRuntimeErrorCallback (PVM pVM, void *pvUser, bool fFatal,
466 const char *pszErrorID,
467 const char *pszFormat, va_list args);
468
469 HRESULT captureUSBDevices (PVM pVM);
470 void detachAllUSBDevices (bool aDone);
471
472 static DECLCALLBACK (int) powerUpThread (RTTHREAD Thread, void *pvUser);
473 static DECLCALLBACK (int) saveStateThread (RTTHREAD Thread, void *pvUser);
474 static DECLCALLBACK (int) powerDownThread (RTTHREAD Thread, void *pvUser);
475
476 static DECLCALLBACK(void *) drvStatus_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
477 static DECLCALLBACK(void) drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
478 static DECLCALLBACK(void) drvStatus_Destruct(PPDMDRVINS pDrvIns);
479 static DECLCALLBACK(int) drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
480
481 int mcAudioRefs;
482 volatile uint32_t mcVRDPClients;
483 uint32_t mu32SingleRDPClientId; /* The id of a connected client in the single connection mode. */
484
485 static const char *sSSMConsoleUnit;
486 static uint32_t sSSMConsoleVer;
487
488 HRESULT loadDataFromSavedState();
489
490 static DECLCALLBACK(void) saveStateFileExec (PSSMHANDLE pSSM, void *pvUser);
491 static DECLCALLBACK(int) loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
492
493#ifdef VBOX_WITH_GUEST_PROPS
494 static DECLCALLBACK(int) doGuestPropNotification (void *pvExtension, uint32_t,
495 void *pvParms, uint32_t cbParms);
496 HRESULT doEnumerateGuestProperties (INPTR BSTR aPatterns,
497 ComSafeArrayOut(BSTR, aNames),
498 ComSafeArrayOut(BSTR, aValues),
499 ComSafeArrayOut(ULONG64, aTimestamps),
500 ComSafeArrayOut(BSTR, aFlags));
501#endif
502
503 bool mSavedStateDataLoaded : 1;
504
505 const ComPtr <IMachine> mMachine;
506 const ComPtr <IInternalMachineControl> mControl;
507
508 const ComPtr <IVRDPServer> mVRDPServer;
509 const ComPtr <IDVDDrive> mDVDDrive;
510 const ComPtr <IFloppyDrive> mFloppyDrive;
511
512 ConsoleVRDPServer * const mConsoleVRDPServer;
513
514 const ComObjPtr <Guest> mGuest;
515 const ComObjPtr <Keyboard> mKeyboard;
516 const ComObjPtr <Mouse> mMouse;
517 const ComObjPtr <Display> mDisplay;
518 const ComObjPtr <MachineDebugger> mDebugger;
519 const ComObjPtr <RemoteDisplayInfo> mRemoteDisplayInfo;
520
521 USBDeviceList mUSBDevices;
522 RemoteUSBDeviceList mRemoteUSBDevices;
523
524 SharedFolderMap mSharedFolders;
525 SharedFolderDataMap mMachineSharedFolders;
526 SharedFolderDataMap mGlobalSharedFolders;
527
528 /** The VM instance handle. */
529 PVM mpVM;
530 /** Holds the number of "readonly" mpVM callers (users) */
531 uint32_t mVMCallers;
532 /** Semaphore posted when the number of mpVM callers drops to zero */
533 RTSEMEVENT mVMZeroCallersSem;
534 /** true when Console has entered the mpVM destruction phase */
535 bool mVMDestroying : 1;
536 /** true when power down is initiated by vmstateChangeCallback (EMT) */
537 bool mVMPoweredOff : 1;
538
539 /** The current DVD drive state in the VM.
540 * This does not have to match the state maintained in the DVD. */
541 DriveState_T meDVDState;
542 /** The current Floppy drive state in the VM.
543 * This does not have to match the state maintained in the Floppy. */
544 DriveState_T meFloppyState;
545
546 VMMDev * const mVMMDev;
547 AudioSniffer * const mAudioSniffer;
548
549 PPDMLED mapFDLeds[2];
550 PPDMLED mapIDELeds[4];
551 PPDMLED mapSATALeds[30];
552 PPDMLED mapNetworkLeds[8];
553 PPDMLED mapSharedFolderLed;
554 PPDMLED mapUSBLed[2];
555#ifdef VBOX_WITH_UNIXY_TAP_NETWORKING
556 Utf8Str maTAPDeviceName[8];
557 RTFILE maTapFD[8];
558#endif
559
560 bool mVMStateChangeCallbackDisabled;
561
562 /* Local machine state value */
563 MachineState_T mMachineState;
564
565 typedef std::list <ComPtr <IConsoleCallback> > CallbackList;
566 CallbackList mCallbacks;
567
568 struct
569 {
570 /** OnMousePointerShapeChange() cache */
571 struct
572 {
573 bool valid;
574 bool visible;
575 bool alpha;
576 uint32_t xHot;
577 uint32_t yHot;
578 uint32_t width;
579 uint32_t height;
580 BYTE *shape;
581 size_t shapeSize;
582 }
583 mpsc;
584
585 /** OnMouseCapabilityChange() cache */
586 struct
587 {
588 bool valid;
589 BOOL supportsAbsolute;
590 BOOL needsHostCursor;
591 }
592 mcc;
593
594 /** OnKeyboardLedsChange() cache */
595 struct
596 {
597 bool valid;
598 bool numLock;
599 bool capsLock;
600 bool scrollLock;
601 }
602 klc;
603 }
604 mCallbackData;
605
606 friend struct VMTask;
607};
608
609#endif // ____H_CONSOLEIMPL
610/* 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