VirtualBox

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

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

ConsoleImpl: meAttachmentType shouldn't be static

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