VirtualBox

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

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

Main: coding style: have Main obey the standard VirtualBox coding style rules (no functional changes)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.8 KB
Line 
1/* $Id: ConsoleImpl.h 21878 2009-07-30 12:42:08Z 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);
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 HRESULT attachToBridgedInterface(INetworkAdapter *networkAdapter);
410 HRESULT detachFromBridgedInterface(INetworkAdapter *networkAdapter);
411 HRESULT powerDownHostInterfaces();
412
413 HRESULT setMachineState (MachineState_T aMachineState, bool aUpdateServer = true);
414 HRESULT setMachineStateLocally (MachineState_T aMachineState)
415 {
416 return setMachineState (aMachineState, false /* aUpdateServer */);
417 }
418
419 HRESULT findSharedFolder (CBSTR aName,
420 ComObjPtr<SharedFolder> &aSharedFolder,
421 bool aSetError = false);
422
423 HRESULT fetchSharedFolders (BOOL aGlobal);
424 bool findOtherSharedFolder (IN_BSTR aName,
425 SharedFolderDataMap::const_iterator &aIt);
426
427 HRESULT createSharedFolder (CBSTR aName, SharedFolderData aData);
428 HRESULT removeSharedFolder (CBSTR aName);
429
430 static DECLCALLBACK(int) configConstructor(PVM pVM, void *pvConsole);
431 static DECLCALLBACK(int) configNetwork(Console *pThis, const char *pszDevice,
432 unsigned uInstance, unsigned uLun,
433 INetworkAdapter *aNetworkAdapter,
434 PCFGMNODE pCfg, PCFGMNODE pLunL0,
435 PCFGMNODE pInst, bool attachDetach);
436 static DECLCALLBACK(void) vmstateChangeCallback(PVM aVM, VMSTATE aState,
437 VMSTATE aOldState, void *aUser);
438 HRESULT doDriveChange (const char *pszDevice, unsigned uInstance,
439 unsigned uLun, DriveState_T eState,
440 DriveState_T *peState, const char *pszPath,
441 bool fPassthrough);
442 static DECLCALLBACK(int) changeDrive (Console *pThis, const char *pszDevice,
443 unsigned uInstance, unsigned uLun,
444 DriveState_T eState, DriveState_T *peState,
445 const char *pszPath, bool fPassthrough);
446#ifdef VBOX_DYNAMIC_NET_ATTACH
447 HRESULT doNetworkAdapterChange (const char *pszDevice, unsigned uInstance,
448 unsigned uLun, INetworkAdapter *aNetworkAdapter);
449 static DECLCALLBACK(int) changeNetworkAttachment (Console *pThis, const char *pszDevice,
450 unsigned uInstance, unsigned uLun,
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 int loadStateFileExecInternal (PSSMHANDLE pSSM, uint32_t u32Version);
498
499 static DECLCALLBACK(void) saveStateFileExec (PSSMHANDLE pSSM, void *pvUser);
500 static DECLCALLBACK(int) loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
501
502#ifdef VBOX_WITH_GUEST_PROPS
503 static DECLCALLBACK(int) doGuestPropNotification (void *pvExtension, uint32_t,
504 void *pvParms, uint32_t cbParms);
505 HRESULT doEnumerateGuestProperties (CBSTR aPatterns,
506 ComSafeArrayOut(BSTR, aNames),
507 ComSafeArrayOut(BSTR, aValues),
508 ComSafeArrayOut(ULONG64, aTimestamps),
509 ComSafeArrayOut(BSTR, aFlags));
510
511 bool enabledGuestPropertiesVRDP (void);
512 void updateGuestPropertiesVRDPLogon (uint32_t u32ClientId, const char *pszUser, const char *pszDomain);
513 void updateGuestPropertiesVRDPDisconnect (uint32_t u32ClientId);
514#endif
515
516 bool mSavedStateDataLoaded : 1;
517
518 const ComPtr<IMachine> mMachine;
519 const ComPtr<IInternalMachineControl> mControl;
520
521 const ComPtr<IVRDPServer> mVRDPServer;
522 const ComPtr<IDVDDrive> mDVDDrive;
523 const ComPtr<IFloppyDrive> mFloppyDrive;
524
525 ConsoleVRDPServer * const mConsoleVRDPServer;
526
527 const ComObjPtr<Guest> mGuest;
528 const ComObjPtr<Keyboard> mKeyboard;
529 const ComObjPtr<Mouse> mMouse;
530 const ComObjPtr<Display> mDisplay;
531 const ComObjPtr<MachineDebugger> mDebugger;
532 const ComObjPtr<RemoteDisplayInfo> mRemoteDisplayInfo;
533
534 USBDeviceList mUSBDevices;
535 RemoteUSBDeviceList mRemoteUSBDevices;
536
537 SharedFolderMap mSharedFolders;
538 SharedFolderDataMap mMachineSharedFolders;
539 SharedFolderDataMap mGlobalSharedFolders;
540
541 /** The VM instance handle. */
542 PVM mpVM;
543 /** Holds the number of "readonly" mpVM callers (users) */
544 uint32_t mVMCallers;
545 /** Semaphore posted when the number of mpVM callers drops to zero */
546 RTSEMEVENT mVMZeroCallersSem;
547 /** true when Console has entered the mpVM destruction phase */
548 bool mVMDestroying : 1;
549 /** true when power down is initiated by vmstateChangeCallback (EMT) */
550 bool mVMPoweredOff : 1;
551
552 /** The current DVD drive state in the VM.
553 * This does not have to match the state maintained in the DVD. */
554 DriveState_T meDVDState;
555 /** The current Floppy drive state in the VM.
556 * This does not have to match the state maintained in the Floppy. */
557 DriveState_T meFloppyState;
558
559 /** The current network attachment type/name in the VM.
560 * These don't have to match the network attachment type/name
561 * maintained in the NetworkAdapter. These are needed to
562 * change the network attachment dynamically.
563 */
564 static NetworkAttachmentType_T meAttachmentType[SchemaDefs::NetworkAdapterCount];
565#ifdef VBOX_DYNAMIC_NET_ATTACH
566 static Bstr mHostInterface[SchemaDefs::NetworkAdapterCount];
567 static Bstr mInternalNetwork[SchemaDefs::NetworkAdapterCount];
568 static Bstr mNATNetwork[SchemaDefs::NetworkAdapterCount];
569#endif
570
571 VMMDev * const mVMMDev;
572 AudioSniffer * const mAudioSniffer;
573
574 PPDMLED mapFDLeds[2];
575 PPDMLED mapIDELeds[4];
576 PPDMLED mapSATALeds[30];
577 PPDMLED mapSCSILeds[16];
578 PPDMLED mapNetworkLeds[SchemaDefs::NetworkAdapterCount];
579 PPDMLED mapSharedFolderLed;
580 PPDMLED mapUSBLed[2];
581#if !defined(VBOX_WITH_NETFLT) && defined(RT_OS_LINUX)
582 Utf8Str maTAPDeviceName[8];
583 RTFILE maTapFD[8];
584#endif
585
586 bool mVMStateChangeCallbackDisabled;
587
588 /* Local machine state value */
589 MachineState_T mMachineState;
590
591 typedef std::list <ComPtr<IConsoleCallback> > CallbackList;
592 CallbackList mCallbacks;
593
594 struct
595 {
596 /** OnMousePointerShapeChange() cache */
597 struct
598 {
599 bool valid;
600 bool visible;
601 bool alpha;
602 uint32_t xHot;
603 uint32_t yHot;
604 uint32_t width;
605 uint32_t height;
606 BYTE *shape;
607 size_t shapeSize;
608 }
609 mpsc;
610
611 /** OnMouseCapabilityChange() cache */
612 struct
613 {
614 bool valid;
615 BOOL supportsAbsolute;
616 BOOL needsHostCursor;
617 }
618 mcc;
619
620 /** OnKeyboardLedsChange() cache */
621 struct
622 {
623 bool valid;
624 bool numLock;
625 bool capsLock;
626 bool scrollLock;
627 }
628 klc;
629 }
630 mCallbackData;
631
632 friend struct VMTask;
633};
634
635#endif // ____H_CONSOLEIMPL
636/* 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