VirtualBox

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

Last change on this file since 20523 was 20523, checked in by vboxsync, 15 years ago

build fix

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