VirtualBox

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

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

Main: Live migration coding.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.2 KB
Line 
1/* $Id: ConsoleImpl.h 23669 2009-10-10 03:02:01Z 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 MigrationStateSrc;
37class OUSBDevice;
38class RemoteUSBDevice;
39class SharedFolder;
40class RemoteDisplayInfo;
41class AudioSniffer;
42class ConsoleVRDPServer;
43class VMMDev;
44
45#include <VBox/vrdpapi.h>
46#include <VBox/pdmdrv.h>
47#ifdef VBOX_WITH_GUEST_PROPS
48# include <VBox/HostServices/GuestPropertySvc.h> /* For the property notification callback */
49#endif
50
51struct VUSBIRHCONFIG;
52typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
53
54#include <list>
55
56// defines
57///////////////////////////////////////////////////////////////////////////////
58
59/**
60 * Checks the availability of the underlying VM device driver corresponding
61 * to the COM interface (IKeyboard, IMouse, IDisplay, etc.). When the driver is
62 * not available (NULL), sets error info and returns returns E_ACCESSDENIED.
63 * The translatable error message is defined in null context.
64 *
65 * Intended to used only within Console children (i.e. Keyboard, Mouse,
66 * Display, etc.).
67 *
68 * @param drv driver pointer to check (compare it with NULL)
69 */
70#define CHECK_CONSOLE_DRV(drv) \
71 do { \
72 if (!(drv)) \
73 return setError (E_ACCESSDENIED, tr ("The console is not powered up")); \
74 } while (0)
75
76// Console
77///////////////////////////////////////////////////////////////////////////////
78
79/** IConsole implementation class */
80class ATL_NO_VTABLE Console :
81 public VirtualBoxBaseWithChildrenNEXT,
82 public VirtualBoxSupportErrorInfoImpl<Console, IConsole>,
83 public VirtualBoxSupportTranslation<Console>,
84 VBOX_SCRIPTABLE_IMPL(IConsole)
85{
86 Q_OBJECT
87
88public:
89
90 DECLARE_NOT_AGGREGATABLE(Console)
91
92 DECLARE_PROTECT_FINAL_CONSTRUCT()
93
94 BEGIN_COM_MAP(Console)
95 COM_INTERFACE_ENTRY(ISupportErrorInfo)
96 COM_INTERFACE_ENTRY(IConsole)
97 COM_INTERFACE_ENTRY(IDispatch)
98 END_COM_MAP()
99
100 Console();
101 ~Console();
102
103 HRESULT FinalConstruct();
104 void FinalRelease();
105
106 // public initializers/uninitializers for internal purposes only
107 HRESULT init (IMachine *aMachine, IInternalMachineControl *aControl);
108 void uninit();
109
110 // IConsole properties
111 STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
112 STDMETHOD(COMGETTER(State)) (MachineState_T *aMachineState);
113 STDMETHOD(COMGETTER(Guest)) (IGuest **aGuest);
114 STDMETHOD(COMGETTER(Keyboard)) (IKeyboard **aKeyboard);
115 STDMETHOD(COMGETTER(Mouse)) (IMouse **aMouse);
116 STDMETHOD(COMGETTER(Display)) (IDisplay **aDisplay);
117 STDMETHOD(COMGETTER(Debugger)) (IMachineDebugger **aDebugger);
118 STDMETHOD(COMGETTER(USBDevices)) (ComSafeArrayOut (IUSBDevice *, aUSBDevices));
119 STDMETHOD(COMGETTER(RemoteUSBDevices)) (ComSafeArrayOut (IHostUSBDevice *, aRemoteUSBDevices));
120 STDMETHOD(COMGETTER(RemoteDisplayInfo)) (IRemoteDisplayInfo **aRemoteDisplayInfo);
121 STDMETHOD(COMGETTER(SharedFolders)) (ComSafeArrayOut (ISharedFolder *, aSharedFolders));
122
123 // IConsole methods
124 STDMETHOD(PowerUp) (IProgress **aProgress);
125 STDMETHOD(PowerUpPaused) (IProgress **aProgress);
126 STDMETHOD(PowerDown) (IProgress **aProgress);
127 STDMETHOD(Reset)();
128 STDMETHOD(Pause)();
129 STDMETHOD(Resume)();
130 STDMETHOD(PowerButton)();
131 STDMETHOD(SleepButton)();
132 STDMETHOD(GetPowerButtonHandled)(BOOL *aHandled);
133 STDMETHOD(GetGuestEnteredACPIMode)(BOOL *aEntered);
134 STDMETHOD(SaveState) (IProgress **aProgress);
135 STDMETHOD(AdoptSavedState) (IN_BSTR aSavedStateFile);
136 STDMETHOD(ForgetSavedState)(BOOL aRemove);
137 STDMETHOD(GetDeviceActivity) (DeviceType_T aDeviceType,
138 DeviceActivity_T *aDeviceActivity);
139 STDMETHOD(AttachUSBDevice) (IN_BSTR aId);
140 STDMETHOD(DetachUSBDevice) (IN_BSTR aId, IUSBDevice **aDevice);
141 STDMETHOD(FindUSBDeviceByAddress) (IN_BSTR aAddress, IUSBDevice **aDevice);
142 STDMETHOD(FindUSBDeviceById) (IN_BSTR aId, IUSBDevice **aDevice);
143 STDMETHOD(CreateSharedFolder) (IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable);
144 STDMETHOD(RemoveSharedFolder) (IN_BSTR aName);
145 STDMETHOD(TakeSnapshot) (IN_BSTR aName, IN_BSTR aDescription,
146 IProgress **aProgress);
147 STDMETHOD(DiscardSnapshot) (IN_BSTR aId, IProgress **aProgress);
148 STDMETHOD(DiscardCurrentState) (IProgress **aProgress);
149 STDMETHOD(DiscardCurrentSnapshotAndState) (IProgress **aProgress);
150 STDMETHOD(Migrate)(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, 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 onNetworkAdapterChange (INetworkAdapter *aNetworkAdapter, BOOL changeAdapter);
178 HRESULT onSerialPortChange (ISerialPort *aSerialPort);
179 HRESULT onParallelPortChange (IParallelPort *aParallelPort);
180 HRESULT onStorageControllerChange ();
181 HRESULT onMediumChange(IMediumAttachment *aMediumAttachment);
182 HRESULT onVRDPServerChange();
183 HRESULT onUSBControllerChange();
184 HRESULT onSharedFolderChange (BOOL aGlobal);
185 HRESULT onUSBDeviceAttach (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
186 HRESULT onUSBDeviceDetach (IN_BSTR aId, IVirtualBoxErrorInfo *aError);
187 HRESULT getGuestProperty (IN_BSTR aKey, BSTR *aValue, ULONG64 *aTimestamp, BSTR *aFlags);
188 HRESULT setGuestProperty (IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags);
189 HRESULT enumerateGuestProperties (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues), ComSafeArrayOut(ULONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
190 VMMDev *getVMMDev() { return mVMMDev; }
191 AudioSniffer *getAudioSniffer () { return mAudioSniffer; }
192
193 int VRDPClientLogon (uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
194 void VRDPClientConnect (uint32_t u32ClientId);
195 void VRDPClientDisconnect (uint32_t u32ClientId, uint32_t fu32Intercepted);
196 void VRDPInterceptAudio (uint32_t u32ClientId);
197 void VRDPInterceptUSB (uint32_t u32ClientId, void **ppvIntercept);
198 void VRDPInterceptClipboard (uint32_t u32ClientId);
199
200 void processRemoteUSBDevices (uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevList, uint32_t cbDevList);
201
202 // callback callers (partly; for some events console callbacks are notified
203 // directly from IInternalSessionControl event handlers declared above)
204 void onMousePointerShapeChange(bool fVisible, bool fAlpha,
205 uint32_t xHot, uint32_t yHot,
206 uint32_t width, uint32_t height,
207 void *pShape);
208 void onMouseCapabilityChange (BOOL supportsAbsolute, BOOL needsHostCursor);
209 void onStateChange (MachineState_T aMachineState);
210 void onAdditionsStateChange();
211 void onAdditionsOutdated();
212 void onKeyboardLedsChange (bool fNumLock, bool fCapsLock, bool fScrollLock);
213 void onUSBDeviceStateChange (IUSBDevice *aDevice, bool aAttached,
214 IVirtualBoxErrorInfo *aError);
215 void onRuntimeError (BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage);
216 HRESULT onShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId);
217 void onRemoteDisplayInfoChange();
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 DECLCALLBACK(int) configGuestProperties(void *pvConsole);
434 static int configNetwork(Console *pThis, const char *pszDevice,
435 unsigned uInstance, unsigned uLun,
436 INetworkAdapter *aNetworkAdapter,
437 PCFGMNODE pCfg, PCFGMNODE pLunL0,
438 PCFGMNODE pInst, bool fAttachDetach);
439 static DECLCALLBACK(void) vmstateChangeCallback(PVM aVM, VMSTATE aState,
440 VMSTATE aOldState, void *aUser);
441 static DECLCALLBACK(int) changeDrive (Console *pThis, const char *pszDevice,
442 unsigned uInstance, unsigned uLun,
443 bool fHostDrive, const char *pszPath,
444 const char *pszFormat, bool fPassthrough);
445 const char *controllerTypeToDev(StorageControllerType_T enmCtrlType);
446 HRESULT convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun);
447 HRESULT doMediumChange(IMediumAttachment *aMediumAttachment);
448
449#ifdef VBOX_DYNAMIC_NET_ATTACH
450 HRESULT doNetworkAdapterChange (const char *pszDevice, unsigned uInstance,
451 unsigned uLun, INetworkAdapter *aNetworkAdapter);
452 static DECLCALLBACK(int) changeNetworkAttachment (Console *pThis, const char *pszDevice,
453 unsigned uInstance, unsigned uLun,
454 INetworkAdapter *aNetworkAdapter);
455#endif /* VBOX_DYNAMIC_NET_ATTACH */
456
457#ifdef VBOX_WITH_USB
458 HRESULT attachUSBDevice (IUSBDevice *aHostDevice, ULONG aMaskedIfs);
459 HRESULT detachUSBDevice (USBDeviceList::iterator &aIt);
460
461 static DECLCALLBACK(int) usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid,
462 bool aRemote, const char *aAddress, ULONG aMaskedIfs);
463 static DECLCALLBACK(int) usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, PCRTUUID aUuid);
464#endif
465
466 static DECLCALLBACK(int) fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser);
467
468 static DECLCALLBACK(int) stateProgressCallback(PVM pVM, unsigned uPercent, void *pvUser);
469
470 static DECLCALLBACK(void) setVMErrorCallback(PVM pVM, void *pvUser, int rc, RT_SRC_POS_DECL,
471 const char *pszFormat, va_list args);
472
473 static DECLCALLBACK(void) 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, uint32_t fFlags);
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 uVersion, uint32_t uPass);
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 /** @name Live migration support
517 * @{ */
518 static DECLCALLBACK(int) migrationSrcThreadWrapper(RTTHREAD hThread, void *pvUser);
519 HRESULT migrationSrc(MigrationStateSrc *pState);
520 HRESULT migrationSrcReadACK(MigrationStateSrc *pState, const char *pszNAckMsg = NULL);
521 HRESULT migrationSrcSubmitCommand(MigrationStateSrc *pState, const char *pszCommand);
522 int migrationDst(PVM pVM, IMachine *pMachine, bool fStartPaused, void *pvVMCallbackTask);
523 static DECLCALLBACK(int) migrationDstServeConnection(RTSOCKET Sock, void *pvUser);
524 /** @} */
525
526 bool mSavedStateDataLoaded : 1;
527
528 const ComPtr<IMachine> mMachine;
529 const ComPtr<IInternalMachineControl> mControl;
530
531 const ComPtr <IVRDPServer> mVRDPServer;
532
533 ConsoleVRDPServer * const mConsoleVRDPServer;
534
535 const ComObjPtr<Guest> mGuest;
536 const ComObjPtr<Keyboard> mKeyboard;
537 const ComObjPtr<Mouse> mMouse;
538 const ComObjPtr<Display> mDisplay;
539 const ComObjPtr<MachineDebugger> mDebugger;
540 const ComObjPtr<RemoteDisplayInfo> mRemoteDisplayInfo;
541
542 USBDeviceList mUSBDevices;
543 RemoteUSBDeviceList mRemoteUSBDevices;
544
545 SharedFolderMap mSharedFolders;
546 SharedFolderDataMap mMachineSharedFolders;
547 SharedFolderDataMap mGlobalSharedFolders;
548
549 /** The VM instance handle. */
550 PVM mpVM;
551 /** Holds the number of "readonly" mpVM callers (users) */
552 uint32_t mVMCallers;
553 /** Semaphore posted when the number of mpVM callers drops to zero */
554 RTSEMEVENT mVMZeroCallersSem;
555 /** true when Console has entered the mpVM destruction phase */
556 bool mVMDestroying : 1;
557 /** true when power down is initiated by vmstateChangeCallback (EMT) */
558 bool mVMPoweredOff : 1;
559
560 /** The current network attachment type in the VM.
561 * This doesn't have to match the network attachment type
562 * maintained in the NetworkAdapter. This is needed to
563 * change the network attachment dynamically.
564 */
565 NetworkAttachmentType_T meAttachmentType[SchemaDefs::NetworkAdapterCount];
566
567 VMMDev * const mVMMDev;
568 AudioSniffer * const mAudioSniffer;
569
570 PPDMLED mapFDLeds[2];
571 PPDMLED mapIDELeds[4];
572 PPDMLED mapSATALeds[30];
573 PPDMLED mapSCSILeds[16];
574 PPDMLED mapNetworkLeds[SchemaDefs::NetworkAdapterCount];
575 PPDMLED mapSharedFolderLed;
576 PPDMLED mapUSBLed[2];
577#if !defined(VBOX_WITH_NETFLT) && (defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD))
578 Utf8Str maTAPDeviceName[8];
579 RTFILE maTapFD[8];
580#endif
581
582 bool mVMStateChangeCallbackDisabled;
583
584 /* Local machine state value */
585 MachineState_T mMachineState;
586
587 typedef std::list <ComPtr<IConsoleCallback> > CallbackList;
588 CallbackList mCallbacks;
589
590 struct
591 {
592 /** OnMousePointerShapeChange() cache */
593 struct
594 {
595 bool valid;
596 bool visible;
597 bool alpha;
598 uint32_t xHot;
599 uint32_t yHot;
600 uint32_t width;
601 uint32_t height;
602 BYTE *shape;
603 size_t shapeSize;
604 }
605 mpsc;
606
607 /** OnMouseCapabilityChange() cache */
608 struct
609 {
610 bool valid;
611 BOOL supportsAbsolute;
612 BOOL needsHostCursor;
613 }
614 mcc;
615
616 /** OnKeyboardLedsChange() cache */
617 struct
618 {
619 bool valid;
620 bool numLock;
621 bool capsLock;
622 bool scrollLock;
623 }
624 klc;
625 }
626 mCallbackData;
627
628 friend struct VMTask;
629};
630
631#endif // ____H_CONSOLEIMPL
632/* 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